PDA

View Full Version : Assembly help


Medieval Bob
2004-06-27, 11:38 AM
You know assembly? ICQ, AIM, or PM me. I need help with a fairly simple problem with my homework.

Demosthenes
2004-06-27, 11:40 AM
Why don't you just post the problem?

Medieval Bob
2004-06-27, 12:24 PM
Okay, need help again.

;include main 32-bit header
include irvine32.inc

.data
;program data
input byte 20 dup (?)

.code
;program code
main proc
mov edx, offset input ;sets edx to the beginning of input

getnums:
call readhex
cmp eax, 99h ;this checks for an exit flag
je continue ;exits if flag is given
mov [edx], al
add edx, 1
cmp edx, offset input + 28 ;checks for the 28th number (total in example)
jc getnums ;loop if not finished

continue:
mov ecx, edx ;makes a copy of edx to know when to stop
mov edx, offset input ;sets edx back to the beginning of input

printnum:
mov eax, [edx]
call writehex


;exit the program
exit
main endp
end main


My call to writehex works, but I need to print out the values entered. As it is, if I enter A, it loops, then I enter 99 to get out of the loop, I have a problem.

The register, eax, is 0000000A. So, when I call writehex, it writes 0000000A. I just need it to print A. How do I do that?

Medieval Bob
2004-06-27, 12:55 PM
*bump* Read above post.