This is my code....
CODE
;;;;;%include "NASMENV\lib\io.mac"
.STACK 100H
.DATA
char_prompt db "Please input a character: ",0
out_msg1 db "The ASCII code of ' ",0
out_msg2 db "' in hex is ",0
query_msg db "Do you want to quit (Y/N): ",0
; translation table: 4-bit binary to hex
hex-table db "012345789ABCDEF", 0
.CODE
.STARTUP
read_char:
PutStr char_prompt; request a char. input
GetCh AL
PutStr out_msg1
PutCh AL
PutStr out_msg2
mov AH,AL ; save input character in AH
mov EBX, hex_table; EBX = translation table
shr AL,4 ; move upper 4 bits to lower half
xlatb ; replace AL with hex digit
PutCh AL ; write the first hex digit
mov AL,AH ; restore input character to AL
and AL,0FH ; mask off upper 4 bits
xlatb
PutCh AL ; write the second hex digit
nwln
PutStr query_msg; query user whether to terminate
GetCh AL ; read response
cmp AL, 'Y' ; if response is not 'Y'
jne read_char; read another character
done:
.EXIT
.STACK 100H
.DATA
char_prompt db "Please input a character: ",0
out_msg1 db "The ASCII code of ' ",0
out_msg2 db "' in hex is ",0
query_msg db "Do you want to quit (Y/N): ",0
; translation table: 4-bit binary to hex
hex-table db "012345789ABCDEF", 0
.CODE
.STARTUP
read_char:
PutStr char_prompt; request a char. input
GetCh AL
PutStr out_msg1
PutCh AL
PutStr out_msg2
mov AH,AL ; save input character in AH
mov EBX, hex_table; EBX = translation table
shr AL,4 ; move upper 4 bits to lower half
xlatb ; replace AL with hex digit
PutCh AL ; write the first hex digit
mov AL,AH ; restore input character to AL
and AL,0FH ; mask off upper 4 bits
xlatb
PutCh AL ; write the second hex digit
nwln
PutStr query_msg; query user whether to terminate
GetCh AL ; read response
cmp AL, 'Y' ; if response is not 'Y'
jne read_char; read another character
done:
.EXIT
When I attempt to make...I get the below.... PLEASE HELP! This is driving me bonkers!
QUOTE
J:\NASMENV\ASM\Hex2Char>make
MAKE Version 5.2 Copyright © 1987, 2000 Borland
/NASMENV/NASM/nasm-0.98.39/nasm -o hex2char.obj -f obj -l hex2char.lst -
P /NASMENV/lib/io.mac hex2char.asm
J:\NASMENV\lib\io.mac:7: warning: redefining multi-line macro `.STACK'
J:\NASMENV\lib\io.mac:15: warning: redefining multi-line macro `.DATA'
J:\NASMENV\lib\io.mac:21: warning: redefining multi-line macro `.UDATA'
J:\NASMENV\lib\io.mac:27: warning: redefining multi-line macro `.CODE'
J:\NASMENV\lib\io.mac:35: warning: redefining multi-line macro `.STARTUP'
J:\NASMENV\lib\io.mac:49: warning: redefining multi-line macro `.EXIT'
J:\NASMENV\lib\io.mac:57: warning: redefining multi-line macro `nwln'
J:\NASMENV\lib\io.mac:64: warning: redefining multi-line macro `PutCh'
J:\NASMENV\lib\io.mac:74: warning: redefining multi-line macro `PutStr'
J:\NASMENV\lib\io.mac:84: warning: redefining multi-line macro `GetStr'
J:\NASMENV\lib\io.mac:99: warning: redefining multi-line macro `GetCh'
J:\NASMENV\lib\io.mac:120: warning: redefining multi-line macro `PutInt'
J:\NASMENV\lib\io.mac:130: warning: redefining multi-line macro `GetInt'
J:\NASMENV\lib\io.mac:143: warning: redefining multi-line macro `PutLInt'
J:\NASMENV\lib\io.mac:152: warning: redefining multi-line macro `GetLInt'
hex2char.asm:18: error: parser: instruction expected
** error 1 ** deleting hex2char.obj
MAKE Version 5.2 Copyright © 1987, 2000 Borland
/NASMENV/NASM/nasm-0.98.39/nasm -o hex2char.obj -f obj -l hex2char.lst -
P /NASMENV/lib/io.mac hex2char.asm
J:\NASMENV\lib\io.mac:7: warning: redefining multi-line macro `.STACK'
J:\NASMENV\lib\io.mac:15: warning: redefining multi-line macro `.DATA'
J:\NASMENV\lib\io.mac:21: warning: redefining multi-line macro `.UDATA'
J:\NASMENV\lib\io.mac:27: warning: redefining multi-line macro `.CODE'
J:\NASMENV\lib\io.mac:35: warning: redefining multi-line macro `.STARTUP'
J:\NASMENV\lib\io.mac:49: warning: redefining multi-line macro `.EXIT'
J:\NASMENV\lib\io.mac:57: warning: redefining multi-line macro `nwln'
J:\NASMENV\lib\io.mac:64: warning: redefining multi-line macro `PutCh'
J:\NASMENV\lib\io.mac:74: warning: redefining multi-line macro `PutStr'
J:\NASMENV\lib\io.mac:84: warning: redefining multi-line macro `GetStr'
J:\NASMENV\lib\io.mac:99: warning: redefining multi-line macro `GetCh'
J:\NASMENV\lib\io.mac:120: warning: redefining multi-line macro `PutInt'
J:\NASMENV\lib\io.mac:130: warning: redefining multi-line macro `GetInt'
J:\NASMENV\lib\io.mac:143: warning: redefining multi-line macro `PutLInt'
J:\NASMENV\lib\io.mac:152: warning: redefining multi-line macro `GetLInt'
hex2char.asm:18: error: parser: instruction expected
** error 1 ** deleting hex2char.obj


