Category : Assembly Language Source Code
Archive   : RHSTDLIB.ZIP
Filename : ISIZE.ASM
assume cs:stdlib
;
; ISize- Returns the number of print positions required by an integer value.
; On Input:
; AX: Integer to get the size of.
;
; On Output:
; AX: Digit count for the integer.
;
public sl_ISize
sl_ISize proc far
cmp ax, 0
jge ISize2
neg ax
call GetUSize
inc ax
ret
;
ISize2: call GetUSize
ret
sl_ISize endp
;
; USize- Same as above, except for unsigned numbers.
;
public sl_USize
sl_USize proc far
call GetUSize
ret
sl_USize endp
;
; GetUSize- Does the actual size comparison.
;
GetUSize proc near
cmp ax, 10
ja GUS1
mov ax, 1
ret
;
GUS1: cmp ax, 100
ja GUS2
mov ax, 2
ret
;
GUS2: cmp ax, 1000
ja GUS3
mov ax, 3
ret
GUS3: cmp ax, 10000
ja GUS4
mov ax, 4
ret
;
GUS4: mov ax, 5
ret
GetUSize endp
;
stdlib ends
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/