Category : Assembly Language Source Code
Archive   : ASM_SUBR.ZIP
Filename : HEX16OUT

 
Output of file : HEX16OUT contained in archive : ASM_SUBR.ZIP
;-------------------------hex16out routine begins--------------------------+
; from BLUEBOOK OF ASSEMBLY ROUTINES FOR IBM PC & XT.
; page : 55
;
; NAME HEX16OUT
; ROUTINE FOR Conversion from 16-bit Binary to ASCII Hexidecimal
;
; FUNCTION: This routine accepts a 16-bit binary number in the DX register
; and converts it to ASCII hexidecimal form which is sent to the std input
; device.
;
; INPUT: Upon entry an 16-bit binary number is in DX
; OUTPUT: A string of ASCII digits representing a hexidecimal number is
; sent out through the std output device.
; REGISTERS USED: No registers are modified. DX is used for input.
; SEGMENTS REFERENCED: None
; ROUTINES CALLED: STDOUT
; SPECIAL NOTES: None
;
; ROUTINE TO CONVERT FROM INTERNAL 16-BIT BINARY TO ASCII HEXIDECIMAL.
;
hex16out proc far
;
; a binary number is in DX
;
push cx ; save registers
push ax
;
mov cx,4 ; loop for a count of four
;
hex16out1:
push cx ; save the count
mov cl,4 ; for a count of four
rol dx,cl ; rotate DX left
;
mov al,dl ; move into AL
and al,00Fh ; just digit
daa ; add 6 if A - F
add al,0F0h ; bump a carry if A - F
adc al,040h ; here is the ASCII
call stdout ; send it
;
pop cx
loop hex16out1
;
pop ax ; restore registers
pop cx
ret ; return
;
hex16out endp
;-------------------------hex16out routine ends---------------------------+


  3 Responses to “Category : Assembly Language Source Code
Archive   : ASM_SUBR.ZIP
Filename : HEX16OUT

  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/