I have written a simple numeric output routine for dos. I know its been done before, but i need easy projects to hone my newbie skills. Anyway, Thanks to NaN's suggestion, i have been able to compile and debug it correctly. The problem is that when i run the program (I know it is a com, but why make it an exe? that just takes more space) it give me an illegal operation at
which corresponds to the
mov dx,color
command in the program.
when i trace through the program, this command does not generate an error, so i am mystified. I added lots of comments to my program so it would be easy for anyone who looks at it to understand it.
I would appreciate if someone would take a look at it and tell me what is causing the problem.
Posted on 2001-11-28 17:17:39 by LOLTH
here we go,

i don't know well why, but when you divide a 32bit reg for another 32bit reg pot before the 'div' instruction a xor edx,edx.

Whit these change you program recompiled now works. Take a look.

Posted on 2001-11-29 14:22:04 by Bit7
sorry, i've compiled as EXE but you talked about com...

To compile as com i need to add org 100h before .code starting.

Then your program work in any case.
Posted on 2001-11-29 14:54:25 by Bit7
I figured out why that caused a crash
the div command divides the 64bit number edx:eax by 10 in my program. Since dx was unused, it was filled with some garbage value larger than 10, which made the result of dividing edx:eax by 10 greater than 2^32, causing an overflow of the eax reg and a crash.
Thanks again!
Posted on 2001-11-29 15:47:46 by LOLTH