| UMBC CMSC 211 |
.model small
.stack 100h
.data
HexDigit DB '0123456789ABCDEF' ;
Mybyte DB 27h ;
.code
main PROC
include pcmac.inc
_begin
mov bx, OFFSET HexDigit ; Point to the table
mov al, mybyte ;
mov cl, 4 ;
shr al, cl ; do the high bits first
xlat ; Get the ASCII value for this number
_PutCh al ;
mov al, mybyte ;
and al, 0Fh ; do the low bits next
xlat ; Get the ASCII value for this number
_PutCh al ;
_PutCh 10, 13
_exit
main ENDP
END main
We can use a similiar approch to solve a number of problems. If you have to deal with a character set from IBM called EBCDIC, you can use the an array to hold the equivalent characters, where the EBCDIC value is the index into the array, giving you the ASCII character.
We can have an array of ASCII characters, where we change all of the lowercase characters to be uppercase, and then we can convert the lowercase to uppercase.
All of those examples will allow us to exploit the xlat instruction.