programmers resources
  http://www.intel-assembler.it/  (c)2017 intel-assembler.it   info@intel-assembler.it
 
Search :  
Lingua Italiana    English Language   
Index
 
just an empty assembly space
just an arrow Intel Platform
just an arrow Article & Guides
just an arrow Download Software


23/01/2009 Featured Article: How to remove Buzus Virus (permalink)




:::3277492:::
Bottone Scambio Directory Pubblicitaonline.it
Home Page | Articles & Guides | Download | Intel Platform | Contacts

Google
 


Bookmark and Share
Download 
Tell a friend



3D Rotating Cube Assembler source

An improved asm code for 3d graphics

(by 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.

This article is online from 3078 days and has been seen 9718 times




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 ***)



Top
Download 
Tell a friend
Bookmark and Share



Similar Articles

2D/3D Rotation asm demos
Source code for 2D and 3D rotation
(by Ash [NLB/BD])

3D Texture Mapping theory and asm code
a mid-length text about texture logic and coding
(by Sean Barrett)

4K 3D Asm Demo
4096 byte 3D assembler graphical demo
(by Jari Kyt÷joki)

Basic Introduction to 3D Programming
A short doc about howto plot in 3D
(by Synergist)

Math.inc: General 3D math functions
A library with many math functions for 3d graphics
(by John McCarthy)

Perspective Transforms
A two page document with the perspective formulas
(by Andre Yew)

REFRACTION 4k intro
Assembler graphic demo, 3D chessboard
(by G.O.D.)

Star Field
3D Assembly star field
(by VLA)

Three Dimensional Rotations For Computer Graphics
A short document on 3D rotation
(by VLA)

Three Dimensional Shading In Computer Graphics
A brief intro on 3d shading theory
(by VLA)

VGA Trainer Program
A course for graphic programming in Pascal/ASM
(by Grant Smith Denthor of ASPHYXIA)

VGOPHONG Phong lighting and specular highlights
Theory, practice of phong lightnin and shade model
(by TimJ/Vertigo)

X-Sharp 3-D animation package v22
3D ball demo with zoom, share and move
(by Michael Abrash)

Zed3D programming guide
A compact reference for 3d computer graphics
(by SÚbastien Loisel)

 Tags: 3d


webmaster jes
writers rguru, tech-g, aiguru, drAx

site optimized for IE/Firefox/Chrome with 1024x768 resolution

Valid HTML 4.01 Transitional


ALL TRADEMARKS ® ARE PROPERTY OF LEGITTIMATE OWNERS.
© ALL RIGHTS RESERVED.

hosting&web - www.accademia3.it

grossocactus
find rguru on
http://www.twitter.com/sicurezza3/
... send an email ...
Your name

Destination email

Message

captcha! Code