POINTS.ASM
3D Rotating Cube Assembler source
An improved asm code for 3d graphics
Arno W. Brouwer
POINTS -- Display, shift, rotate and morph points in 3D with color fading.
Thanks go to the authors of XLIB for their Mode X screen routines.
20/08/1993
Well hey, this was a cool little program I found on an FTP site..
Took a small look at it and noticed a few improvements I could make to it.
It is very fast as it is, but now with the improvements it is much faster.
anyhow.. below are the changes I made to this program POINTS.ASM
POINTS.ASM is made by Arno W. Brouwer.
Fixups by Martial Artist / TDT
Remark all your questions, suggestions or contacts to MARTIAL ARTIST
anyhow.. later.. and keep this great source coming out..
Tonight I will make a modex smooth scroll source for everyone cauze it seems
that on comp.sys.ibm.pc.demos everyone wants to..
I would write on comp.sys.ibm.pc.demos but our computer department is too cheap
and I am restricted to post on internet until 2 more years of University..
Oh well have fun..
Oh yeah.. a little info.. for assembling this program I used
tasm /m6 points
tlink points
When I first assembled this I got a few errors from turbo assembler.
Dunno why, because he is obviously using turbo assembler because of IDEAL mode.
but anyhow I had to fix a few things like
label cube ; this doesn't work
label cube byte ; this is the change..
there were 3 labels to be changed..
then there was the
ARG x,y,z:word
had to be changed to
ARG x:word,y:word,z:word
Anyhow.. now it works for me anyways with a simple tasm and tlink so if you
have problems.. you might want to look at the afore mentioned problems.
Martial Artist / TDT
;------------------------------------------------------------------------------
Line 19
p386
use this for the movsx instructions used later on
;------------------------------------------------------------------------------
Line 93-99 is as follows, this is in the data segment
scount = 0
smult = 320
label screenoff word
rept 200
dw smult*scount
scount = scount + 1
endm
This creates a macro, what it does is..
creates an array of 200 words (words defined in label, 200 times with the rept).
It first takes scount which is zero, and then creates a word by multiplying
scount by smult which is 320, then it increments scount and does this 200 times.
This creates 200 words from 0 to 199 all multiplied by 320
example in memory is
screenoff dw 0,320,640,480,...,63680
The reason I used this is to replace 2 mul instructions which took the Y
coordinate and mul'd them by 320.
Instead, we use a lookup table..
take y coordinate in BX.
shl bx,1 ; this multiplies bx by 2.. becuase we are looking up WORDS not bytes
mov si,[screenoff+bx] ; this loads di with the appropriate screen offset.
These mul's are replaced at lines 307 and 749 in the source code
;------------------------------------------------------------------------------
Next thing I replaced are the IDIV instructions.
There were 12 IDIV which divided AX by 256..
instead of
mov cx,256
idiv cx
I replaced them with
movsx dx,ah ; Move ah into dx and extend sign
sar ax,8 ; Shift Arithmetic Right 8 times, this divides by 256
this saves SOOO many clock cycles since there are 12 IDIV's
I replaced these at lines
439, 457, 477, 494, 518, 535, 555, 572, 596, 613, 633, 650 in the source code.
Well that is all I really noticed for now.. just bored and its late..
later
Martial Artist / TDT
(*** download for full code ***)