Coder's Guild Mailing List

3D Question

Posted by Computer Consultant on 1998-03-08

Ignore the above, I figured it out. What a pain in the ass that was. I kept debugging and I counted
revolutions until it crashed when doing a X + Y + Z rotatoin from the start, it was 62 revolutions, so
I put a counter in to do a keyboard stop at 62 so I could step to that rotation. Then I went through
it how many times since I have 2 loops, 1 inner and 1 outer. I finally saw that one of the functions was
changed. I kept debuggin until I saw that the CALL [3DB] changed to a CALL[2DB]. Now, I could put some
self modifing code in to fix this (A Hack), but I want to get this program working correctly. So, I kept looping
tring to see the exact moment that it changed, and get to debug that CALL. Finally I got it and I saw the
problem In my LINE drawing function, it loops CX by moving DeltaX or DeltaY in. But, if
DeltaX or DeltaY is 0, then it loops more than 1 time. To fix this, I did a
MOV CX, DeltaX ; And DeltaY
INC CX
TheLoop:
DEC CX
....
TEST CX, CX
JNZ SHORT TheLoop.

As Apposed to before
MOV CX, DeltaX
TheLoop:
....
LOOP SHORT TheLoop

Although it's more code, it don't crash. It brought muy 1,165 byte program to 1,175 byte program.

The Code Before this routines assure that DeltaX/DeltaY is a Positive number
0-Whatever, so it will not be a high number and has been working perfectly since.
You can get a copy at http://www.nauticom.net/www/secret Under DEMOS.
BTW, There is no bounds checking so don't size the object larger than the screen or it will crash.
X, Y, Z to rotate +/- to Scale.


-=-=-=-=-=-=-=-=-=-=-=-
Scrat/_Secret
http://www.nauticom.net/www/secret
-=-=-=-=-=-=-=-=-=-=-=