Category : Assembly Language Source Code
Archive   : ASM-SUBR.ZIP
Filename : HEX8OUT

 
Output of file : HEX8OUT contained in archive : ASM-SUBR.ZIP
;-------------------------hex8out routine begins--------------------------+
; from BLUEBOOK OF ASSEMBLY ROUTINES FOR IBM PC & XT.
; page : 53
;
; NAME HEX8OUT
; ROUTINE FOR Conversion from 8-bit Binary to ASCII Hexidecimal
;
; FUNCTION: This routine accepts a 8-bit binary number in the DL register
; and converts it to ASCII hexidecimal form which is sent to the std input
; device.
;
; INPUT: Upon entry an 8-bit binary number is in DL
; OUTPUT: A string of ASCII digits representing a hexidecimal number is
; sent out through the std output device.
; REGISTERS USED: No registers are modified. DL is used for input.
; SEGMENTS REFERENCED: None
; ROUTINES CALLED: STDOUT
; SPECIAL NOTES: None
;
; ROUTINE TO CONVERT FROM INTERNAL 8-BIT BINARY TO ASCII HEXIDECIMAL.
;
hex8out proc far
;
; a binary number is in DL
;
push cx ; save registers
push ax
;
mov cx,2 ; loop for a count of two
;
hex8out1:
push cx ; save the count
mov cl,4 ; for a count of four
rol dl,cl ; rotate DL 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 hex8out1
;
pop ax ; restore registers
pop cx
ret ; return
;
hex8out endp
;-------------------------hex8out routine ends---------------------------+


  3 Responses to “Category : Assembly Language Source Code
Archive   : ASM-SUBR.ZIP
Filename : HEX8OUT

  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/