flat assembler
Message board for the users of flat assembler.

Index > DOS > VGA 3D Rotate

Goto page Previous  1, 2, 3
Author
Thread Post new topic Reply to topic
edfed



Joined: 20 Feb 2006
Posts: 4330
Location: Now
edfed 26 Nov 2007, 18:03
problem is that it's not natural computation.
i'm used to compute on fixed memory locations.
i don't like fpu stack
Code:
        mov eax,[gs:edi+00]     ;rotate on y
        mov ebx,[gs:edi+08]     ;x=x*cosy-z*siny
        neg eax             ;z=z*cosy+x*siny
        neg ebx
        mov ecx,eax
        mov edx,ebx
        imul eax,[cos.y]
        imul ebx,[sin.y]
        imul ecx,[sin.y]
        imul edx,[cos.y]
        sub eax,ebx
        add ecx,edx
        sar eax,8                  ;sinus & cosinus are from -255 to 255
        sar ecx,8                  ;instead of -1 to 1
        mov [gs:edi+00],eax
        mov [gs:edi+08],ecx
    

fixed point arythmetic is easier to code
if fpu was like cpu it's ok
fp0,fp1,fp2 etc and use them like eax,ebx,ecx
but it's not the case
why?
intel engineers says that it's better to compute in fpu stack
but in fact it's harder and unlogic.
DJ mauretto, congratulation, you manage the fpu stack very good.
it's not my case.


Last edited by edfed on 26 Nov 2007, 18:24; edited 1 time in total
Post 26 Nov 2007, 18:03
View user's profile Send private message Visit poster's website Reply with quote
DJ Mauretto



Joined: 14 Mar 2007
Posts: 464
Location: Rome,Italy
DJ Mauretto 26 Nov 2007, 18:20
Code:
                                          st        st1    st2     st3                                
FILD Dword [gs:edi+00]                  ;  x 
FCHS                                   ; -x 
FILD Dword[gs:edi+08]              ;  z        -x 
FCHS                                 ; -z        -x 
FLD  ST1                             ; -x        -z      -x 
FLD  ST1                             ; -z        -x      -z     -x 
FIMUL  Dword[sin.y]                   ; -z*siny   -x      -z     -x 
FXCH   ST2                            ; -z        -x   -z*siny   -x 
FIMUL Dword[cos.y]                    ; -z*cosy   -x   -z*siny   -x 
FADD  ST,ST2                                  ;  z        -x   -z*siny   -x 
FIDIV [Value_256]                             ; 
FISTP   Dword [gs:edi+08]             ; -x     -z/siny    -x 


etc...

    


This compute z continue you Wink for x
Note that this code is not optimise,i written now online
is only one example to proceed with FPU stack.
Don't be afraid FPU is nice and very useful for trigonometry
Post 26 Nov 2007, 18:20
View user's profile Send private message Reply with quote
edfed



Joined: 20 Feb 2006
Posts: 4330
Location: Now
edfed 26 Nov 2007, 22:08
if i want to translate my 3Dengine for fpu, then i need to rewrite all the program.
let's go!

after, i'll try with MMX

and after, in SSE

FPS at the top left will show the fpeed for each intruction set.
Post 26 Nov 2007, 22:08
View user's profile Send private message Visit poster's website Reply with quote
LocoDelAssembly
Your code has a bug


Joined: 06 May 2005
Posts: 4624
Location: Argentina
LocoDelAssembly 26 Nov 2007, 23:10
Quote:

after, i'll try with MMX

Don't, it is integer only. You could try with 3DNow which also uses the MMX registers (and these ones actually are stored in the ST registers), but it is AMD-only technology.
Post 26 Nov 2007, 23:10
View user's profile Send private message Reply with quote
edfed



Joined: 20 Feb 2006
Posts: 4330
Location: Now
edfed 27 Nov 2007, 00:07
my best computer only have a SSE1
so i cannot code for floating SIMD
but integral SIMD i can for all my machines with MMX
and for my test computers i don't have FPU.
386dx,486sx,P100MHz,PMMX233MHz,celeron(PII)563MHz,PIIIm800MHz
i don't know what AMD is Wink
it shall work on all machines with maximum performances.


Last edited by edfed on 27 Nov 2007, 01:48; edited 2 times in total
Post 27 Nov 2007, 00:07
View user's profile Send private message Visit poster's website Reply with quote
LocoDelAssembly
Your code has a bug


Joined: 06 May 2005
Posts: 4624
Location: Argentina
LocoDelAssembly 27 Nov 2007, 00:55
Quote:

my best computer only have a SSE1
so i cannot code for floating SIMD


Not sure why you can't code for floating SIMD, but note that SSE1 works with single precision floating point, the same precision that 3DNow has but handling four floats.
Post 27 Nov 2007, 00:55
View user's profile Send private message Reply with quote
edfed



Joined: 20 Feb 2006
Posts: 4330
Location: Now
edfed 27 Nov 2007, 01:38
cpuid is ok, i have SSE
ho, i didn't read with care the developer manual.
effectivelly, SSE operate on scalar floating point values.
up to 16 XMM registers
up to 32 floating point 32bits values!
ok. good!
really good
(it's because i only have my SSE pc since 2 mounths Smile )


Description:
Download
Filename: Whatcpu.asm
Filesize: 1.43 KB
Downloaded: 325 Time(s)

Post 27 Nov 2007, 01:38
View user's profile Send private message Visit poster's website Reply with quote
LocoDelAssembly
Your code has a bug


Joined: 06 May 2005
Posts: 4624
Location: Argentina
LocoDelAssembly 27 Nov 2007, 02:17
Quote:

effectivelly, SSE operate on scalar floating point values.
up to 16 XMM registers

Actually eight (or do you have a 64-bit enabled CPU?), and scalar and packed floating point values. It is still true that you have 32 floating point values since every register can hold four 32-bit values.
Post 27 Nov 2007, 02:17
View user's profile Send private message Reply with quote
rhyno_dagreat



Joined: 31 Jul 2006
Posts: 487
Location: Maryland, Unol Daleithiau
rhyno_dagreat 27 Nov 2007, 03:51
Oh, and btw, for you neophytes to 3D-programming who are reading all of this, some explaination of the math's can be found at http://www.phatcode.net/ under Graphics. Check the 5 tutorials by Rel. They were all written around QB, but it's the understanding of the math behind it that really helps.

Also there's a good FPU tutorial that I read in about a night that is good too. Check under "Assembly" for that.
Wink
Post 27 Nov 2007, 03:51
View user's profile Send private message Reply with quote
edfed



Joined: 20 Feb 2006
Posts: 4330
Location: Now
edfed 27 Nov 2007, 13:14
QB will never die!!!!
what about a fasm QB?QUICK ASM
who is interrested to make a QA compilo with fasm?
there it need the colaboration of everybody
ide is fasmw. for dos.
providing some QB math facilities.
F9 to RUN instead of QB F5!
for me it's ok
QA, if we try to make this, will be ok in a long time.
Post 27 Nov 2007, 13:14
View user's profile Send private message Visit poster's website Reply with quote
rhyno_dagreat



Joined: 31 Jul 2006
Posts: 487
Location: Maryland, Unol Daleithiau
rhyno_dagreat 27 Nov 2007, 20:58
I was thinking about a BASIC compiler for my (our, if you're still willing to work with me) OS project.
Post 27 Nov 2007, 20:58
View user's profile Send private message Reply with quote
edfed



Joined: 20 Feb 2006
Posts: 4330
Location: Now
edfed 27 Nov 2007, 23:52
yes
and with a friend of mine, i want to implement a direct boot java virtual machine.(planed for at least 2009 ... )

in fact this os project is not to be a central os
only a bootable platform to implement what you wish, like a basic compiler with a set of programs, or a java platform, or an asm platform, or a bootable cd or usbpen that can be indifferently exectuted with the os, in an emulator or at boot_time without any os, or simply all of these.
Post 27 Nov 2007, 23:52
View user's profile Send private message Visit poster's website Reply with quote
rhyno_dagreat



Joined: 31 Jul 2006
Posts: 487
Location: Maryland, Unol Daleithiau
rhyno_dagreat 28 Nov 2007, 01:34
I think we should enable an option in it, though, to be able to install it as a central OS. Maybe a CLI command like "osinstall" or something, where it copies from memory to the HDD or such.
Post 28 Nov 2007, 01:34
View user's profile Send private message Reply with quote
Dex4u



Joined: 08 Feb 2005
Posts: 1601
Location: web
Dex4u 28 Nov 2007, 17:13
If you were thinking about a basic interpreter instead of compiler, i would be interested in the project too.
Post 28 Nov 2007, 17:13
View user's profile Send private message Reply with quote
edfed



Joined: 20 Feb 2006
Posts: 4330
Location: Now
edfed 28 Nov 2007, 17:22
sure it's interpreter.
with optional compilation.
and optional asm optimisation.
and all things that don't already exists
Post 28 Nov 2007, 17:22
View user's profile Send private message Visit poster's website Reply with quote
DJ Mauretto



Joined: 14 Mar 2007
Posts: 464
Location: Rome,Italy
DJ Mauretto 28 Nov 2007, 18:12
WOW Very Happy
3D Rotate post became the project of an interpreter, compiler basic,
isn't funny? Very Happy Very Happy
Post 28 Nov 2007, 18:12
View user's profile Send private message Reply with quote
LocoDelAssembly
Your code has a bug


Joined: 06 May 2005
Posts: 4624
Location: Argentina
LocoDelAssembly 28 Nov 2007, 19:06
Yes, I was thinking about splitting the thread. Seems that I have to do several splits instead of just one Sad

Also, there are some posts that are almost on topic, I'm not sure what to do with those.
Post 28 Nov 2007, 19:06
View user's profile Send private message Reply with quote
DJ Mauretto



Joined: 14 Mar 2007
Posts: 464
Location: Rome,Italy
DJ Mauretto 28 Nov 2007, 19:20
Leave things as they are,not put limits to imagination Wink
Post 28 Nov 2007, 19:20
View user's profile Send private message Reply with quote
edfed



Joined: 20 Feb 2006
Posts: 4330
Location: Now
edfed 06 Dec 2007, 14:02
yes, 3d rotate with fpu looks like a command line.
x=x*cosy-z*siny
z=z*cosy+x*siny

x=[offset.x]*cos[angle.y]-[offset.z]*sin[angle.y]
z=[offset.z]*cos[angle.y]+[offset.x]*sin[angle.y]

and finally, something like the exemple of DJ mauretto.

fine.
so it can be linked with that hread about algebra or equivalent
Post 06 Dec 2007, 14:02
View user's profile Send private message Visit poster's website Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  
Goto page Previous  1, 2, 3

< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.