Category : Files from Magazines
Archive   : CGAZV4N2.ZIP
Filename : GETSP.ASM
Output of file : GETSP.ASM contained in archive : CGAZV4N2.ZIP
;
; getsp.asm - returns current value of SP in AX. Note that
; this value is *not* adjusted for the bytes that
; were pushed onto the stack by the call to getsp.
; This introduces such a small error that it's
; not worth the extra code.
;
; Author: John Rex
; Assembler: MASM
; Memory models: any may be used. Tell the assembler which is
; needed by defining mem_s, mem_c, mem_m, mem_l, or mem_h
;
; Usage: unsigned getsp();
;
; ************************************************************
tell1 MACRO message
if1
%out message
endif
endm
ifdef mem_s ;small model?
mem_Small equ 1
.model small
tell1
else
mem_Small equ 0
endif
ifdef mem_c ;compact model?
mem_Compact equ 1
.model compact
tell1
else
mem_Compact equ 0
endif
ifdef mem_m ;medium model?
mem_Medium equ 1
.model medium
tell1
else
mem_Medium equ 0
endif
ifdef mem_h ;Huge model?
mem_l equ 1 ;looks like large model
endif
ifdef mem_l ;Large model?
mem_Large equ 1
.model large
ifndef mem_h
tell1
else
tell1
endif
else
mem_Large equ 0
endif
; now check model
mem_Model = mem_Small + mem_Compact + mem_Medium + mem_Large
if mem_Model ne 1
.err ; no good!
tell1
endif
; After all of the above, the code is rather anti-climactic
.code
public _getsp
_getsp proc
mov ax,sp
ret
_getsp endp
end
Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!
This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.
But one thing that puzzles me is the “mtswslnkmcjklsdlsbdmMICROSOFT” string. There is an article about it here. It is definitely worth a read: http://www.os2museum.com/wp/mtswslnk/