Hi I'm currently constructing a tasm program to draw some squares on the screen using video memory. My program gets a digit from the user and then constructs 5 squars each side being digit long. My program runs fine getiing the number, calculating the top left hand corner of the 5 squares but I get an error when i try to write to the video memory. The error is : The NTVDM CPU has encountered an illegal instruction cs:0000 ip:3741 OP:ff d9 19 04 00. I run the program from the command prompt in win xp but have also tried using a dos emulator.

I have included the source code and the executable. Can someone please help me!
Posted on 2005-04-14 20:17:50 by bad_programmer
I would suggest you try running your application on dos instead of on windows xp or any dos emulators.
Posted on 2005-04-15 07:50:21 by roticv
I can see that you jump past the end of the program. And you also have the stack parameters reversed in your drawChar1 function.
Posted on 2005-04-15 09:46:11 by Sephiroth3
yeah thanks for the help, fixing the passing of parameters on the stack worked and getting rid of the jump. I have since added some code to create the square but i get the error, i checked the stack this time but i get a similar error to b4. Can someone please tell me why my new sub method doesn't work!
Posted on 2005-04-16 22:36:32 by bad_programmer
Here's an update on progress, I noticed some poeple have downloaded the code but not replied, this may be due to my poorly documented code, so I have updated the documentation in an attempt to clarify exactly what the program is meant to be doing. I have added comments on future additions to the program that if anyone wishes to contribute would be gratly appreciated.
Posted on 2005-04-17 07:13:40 by bad_programmer
well i downloaded it earlier to try debug it :) with debug.exe but couldnt get my self to follow the uncommented and untabbed source
now i just saw that you have attached some commented source but it seems you also made some modification to source so the earlier exe is useless to follow with this source :(

0B31:0000 B83B0B        MOV    AX,0B3B    mov ax,@data 
0B31:0003 8ED8          MOV    DS,AX      mov ds,ax   
0B31:0005 B80300        MOV    AX,0003    mov ax,0003H
0B31:0008 B90100        MOV    CX,0001    int 10H
what happened to the cx instruction
0B31:000B CD10          INT    10

any way while i debugged it earlier i saw it was jumping to some nonexistent code on jmp Ender

0B31:0059 5B            POP    BX          pop bx
0B31:005A EB3C          JMP    0098        jmp ENDer

0B31:0098 0000          ADD    ,AL  <----- it is jumping here so it is bound
0B31:009A 0000          ADD    ,AL        to crash

why not open debug.exe and try tracing through and find where it crashes ??
Posted on 2005-04-17 10:04:27 by bluffer