home *** CD-ROM | disk | FTP | other *** search
- ;
- ; *** Listing 9-24 ***
- ;
- ; Performs binary-to-ASCII conversion of a byte value
- ; by using AAM.
- ;
- jmp Skip
- ;
- ResultString db 3 dup (?)
- ResultStringEnd label byte
- db 0 ;a zero to mark the string end
- ;
- Skip:
- BYTE_VALUE=0
- call ZTimerOn
- rept 100
- std ;make STOSB decrement DI
- mov ax,ds
- mov es,ax ;for STOSB
- mov bl,'0' ;used for converting to ASCII
- mov di,offset ResultStringEnd-1
- mov al,BYTE_VALUE
- aam ;put least significant decimal
- ; digit of BYTE_VALUE in AL,
- ; other digits in AH
- add al,bl ;make it an ASCII digit
- stosb ;save least significant digit
- mov al,ah
- aam ;put middle decimal digit in AL
- add al,bl ;make it an ASCII digit
- stosb ;save middle digit
- ;most significant decimal
- ; digit is in AH
- add ah,bl ;make it an ASCII digit
- mov [di],ah ;save most significant digit
- BYTE_VALUE=BYTE_VALUE+1
- endm
- call ZTimerOff