Category : Assembly Language Source Code
Archive   : MATHASM.ZIP
Filename : ASC16.ASM

 
Output of file : ASC16.ASM contained in archive : MATHASM.ZIP
ASC16 PROC NEAR
;***************************************************************
; Converts a 16-bit signed integer to ASCII
; SI offset to integer; DI to last byte of
; ASCII location. BX returns offset to first
; character (sign) of ASCII value
;***************************************************************
PUSH SI
SUB AX,AX ;clear AX
OR AX,[SI] ;get binary integer
; check sign
MOV SI," " ;assume sign positive
JNS ASC16A
MOV SI,"-" ;save negative sign
NEG AX ;and make integer positive
; convert to ASCII decimal
ASC16A: MOV BX,DI ;initial offset in BX
MOV CX,10 ;decimal 10 in CX
ASC16B: SUB DX,DX ;clear DX
DIV CX ;divide by 10

ADD DX,48 ;convert remainder to ASCII
MOV [BX],DL ;save it
DEC BX ;point to next position
OR AX,AX ;if quotient is not zero
JNZ ASC16B ;do it again
; set sign
MOV AX,SI ;sign in AL
MOV [BX],AL ;save it
;
POP SI
RET
ASC16 ENDP

  3 Responses to “Category : Assembly Language Source Code
Archive   : MATHASM.ZIP
Filename : ASC16.ASM

  1. Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!

  2. This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.

  3. 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/