Hi everyone
I would like to know how I can display a numerical value in this small program.
.model small
.stack 64
.data
.code
xyz PROC NEAR
mov AX, @DATA
mov DS, AX
mov AX ,5
mov BX, 3
call SUM
; un probleme ici
MOV AH,09h
MOV DX,AX
INT 21h
mov ah, 4ch
int 21h
xyz endp
SUM PROC NEAR
ADD AX,BX
RET
SUM endp
end
Thanks in advanceĀ :U
you have a 16-bit binary value
you need to convert that to an ASCII numeric string for display (presumably decimal)
the code depends on whether you want to display signed values (-32768 to 32767) or unsigned (0 to 65535)
lazy method - you could display it in ASCII hexidecimal format and let the reader decide how to interpret it :P
Thank you for your answer :U
Where can I find the appropriate syntax ?
I looked up for it in the web but I did not find anything standard to do that.
there are routines if you search the forum
i have one called ling long kai fang in another thread, but that is 32-bit and it will display huge integers - kind of overkill
let me know whether you want a signed or unsigned routine
Let's start with a routine for unsigned, so I can understand it :P
Thank You
ok - give me about 15 minutes - then it's nap-time :bg
Ok no problem take your time. :U
Thanks
give this a try - i did not test it :P
I will .. Thanks ! :U
I added a line to wait a key press from the keyboard and I get the value but also with a write fault. :P
Thanks !
:bg
just add this before you terminate
mov ah,0
int 16h
I already added the first one before terminating the program.
Does the second one fix the bug ?
i don't understand the write fault ???
anyways - here is the modified program...
yes when the program asks for a key to be pressed the message appear
you'll have to show me the error message - the program runs fine, here
i am using xp pro sp2
your last prog works fine :U about the error I received this message
write fault error writing device AUX
abort, retry, fail?
the AUX device is an alias for the COM1 serial port
you must have the debugger switched in or something
some debuggers may use the AUX device for output
that is a no-no on win2000 or higher OS's without ring 0 privileges
maybe it is a setting in the debugger - not sure
I am using MASM 16bits under windows xp sp3 and cpu intel E8400.
well - something is trying to send output to the COM port
Thank you for you help :U :thumbu