flat assembler
Message board for the users of flat assembler.

Index > Windows > d3d9 includes

Author
Thread Post new topic Reply to topic
aaro



Joined: 21 Jun 2003
Posts: 107
Location: hel.fi
aaro 31 Oct 2003, 17:03
Sample:
Code:
include '%include%\d3d9.inc''

section '.data' data readable writeable
   OBJECT D3D, IDirect3D9

section '.text' code readable executable
   invoke Direct3DCreate9, D3D_SDK_VERSION
   mov [pD3D], eax
   D3D GetAdapterCount
    


Last edited by aaro on 01 Nov 2003, 14:24; edited 1 time in total
Post 31 Oct 2003, 17:03
View user's profile Send private message Reply with quote
Madis731



Joined: 25 Sep 2003
Posts: 2139
Location: Estonia
Madis731 31 Oct 2003, 17:58
Some wierd things happen if you try to compile the code in fASM
even with great modifications I couldn't get it to work
I think you know what I mean;)
Post 31 Oct 2003, 17:58
View user's profile Send private message Visit poster's website Yahoo Messenger MSN Messenger Reply with quote
aaro



Joined: 21 Jun 2003
Posts: 107
Location: hel.fi
aaro 01 Nov 2003, 10:30
That was just to show you how to use the includes.
I will post working example when i have time to finish one.
Post 01 Nov 2003, 10:30
View user's profile Send private message Reply with quote
aaro



Joined: 21 Jun 2003
Posts: 107
Location: hel.fi
aaro 01 Nov 2003, 14:24
Deleted attachment because there's bugs in files and/or fasm.
http://board.flatassembler.net/topic.php?t=481
I will post files again if i get them working.
Sorry.
Post 01 Nov 2003, 14:24
View user's profile Send private message Reply with quote
aaro



Joined: 21 Jun 2003
Posts: 107
Location: hel.fi
aaro 04 Nov 2003, 21:58
There's d3d9 includes and little example how to use them.


Description: Uploaded new version of includes now those should be bug free.
Download
Filename: testd3d9.zip
Filesize: 16.56 KB
Downloaded: 713 Time(s)

Post 04 Nov 2003, 21:58
View user's profile Send private message Reply with quote
Madis731



Joined: 25 Sep 2003
Posts: 2139
Location: Estonia
Madis731 19 Nov 2003, 22:25
I have been messing around with your include file for a while. I am most thankful to you. I cleared the screen, put some vertices on it and soon I could see dots and lines and triangles. I even made a rainbow Wink... quite simple I think.
But the whole thing is still, now I would like to have some action Very Happy
I tried to convert some C++ and VBasic apps to fASM, but as I tried it, I started losing pointers, getting illegal operations and other things...strange is that when I try to change my vertices (I managed to get their pointer) they just won't change, but the next round they will be the same:| I think that vertices are copied from another location, but why and what is that location.
Maybe I have missed something, but would it help if I'd rather give the application untransformed and unlit vertices. Because maybe DirectX and Windows have somekind of memory protection!? Confused
What do these EXACTLY do with the computer=> Lock() Unlock() D3DXMatrixRotationY() SetTransform() by this I mean how does RAM act before and after these functions are used...
Thank you in advance,
Madis
Post 19 Nov 2003, 22:25
View user's profile Send private message Visit poster's website Yahoo Messenger MSN Messenger Reply with quote
aaro



Joined: 21 Jun 2003
Posts: 107
Location: hel.fi
aaro 21 Nov 2003, 00:18
i'm very happy that someone is using my includes, hope i can help. First of all you should download dx sdk: http://www.microsoft.com/downloads/details.aspx?FamilyID=1d97f320-9dfd-4e7a-b947-3a037ccf84af&displaylang=en
Quote:

strange is that when I try to change my vertices (I managed to get their pointer) they just won't change, but the next round they will be the same:| I think that vertices are copied from another location, but why and what is that location.

At TestD3D8.asm line 112 there's code how to copy new vertices to the vertex buffer:
Code:
 lea eax, [.pVertices] ; EAX = Address of an local variable to get pointer to VB data
        D3DVB Lock, 0, sizeof.vertices, eax, 0 ; Lock VB, returns pointer to data in .pVertices(eax points to that location)
        .if eax,ne,D3D_OK ; Error checking
          xor eax, eax ; Error checking
               return ; Error checking
     .endif ; Error checking
     invoke RtlMoveMemory, [.pVertices], vertices, sizeof.vertices ; Copy new vertices
   D3DVB Unlock ; Unlock VB, copies data from .pVertices to VB(i think)
    

You really shouldn't use the RtlMoveMemory, you should write the routine your self(faster) use rep movsd or make loop and copy data in there(faster than rep movsd on modern CPUs if i remember correctly)
Quote:

What do these EXACTLY do with the computer=> Lock() Unlock() D3DXMatrixRotationY() SetTransform() by this I mean how does RAM act before and after these functions are used...

Lock copies data to location where you can change it and returns pointer to it. Unlock copies data you changed back so vidcard can use it, after Unlock you CAN'T use pointer returned with Lock. You need allways call Lock and get new pointer when you wan't to change data. D3DXMatrixRotationY, straight from the sdk: "Builds a matrix that rotates around the y-axis." but you can't use it in your code if you haven't translated d3dx9 header files in the sdk because these are not included in my zip. If you translate those please post them here so anyone can use them. SetTransform sets new transform matrix(read about matrices in sdk and/or use google to find info on them), first parameter is what matrix you want to change(world, projection, view or texture), second is the new matrix.

I'm little bit drunk so sorry if there's typos/mistakes in my answer and i'm not very good at dx so that's another reason why there might be some mistakes.

Edit: If you can't find the bug your self, please post your source so i can take a look at it.
Post 21 Nov 2003, 00:18
View user's profile Send private message Reply with quote
Madis731



Joined: 25 Sep 2003
Posts: 2139
Location: Estonia
Madis731 22 Nov 2003, 13:50
Nice to observe again the intelligence of Finnish people:) In my opinion you can code ANYTHING. And now - DirectX9 in assembler, good work
I could write in Finnish too, but other people won't understand, so....

I have the SDK, but I sort-of copy-pasted it into the assembler, after little modifications I got it compiled, but no reasonable result.
The problem is that I can do BASIC and I can do C++, but when it comes to assembler, then I'm totally new to this. As soon as I started to change the sample provided, I got stuck, so no luck for me right now Sad
I will try the latter example and do my magic. See if I can get it to work, but I don't think that I dare to write my own routines. I would have to do ("katseeksitusmeetod" in Estonian), like just writing numbers and seeing what happens. This would ofcourse crash my computer few times and finally start working with bugs Rolling Eyes
Wish me luck, now I will start coding...Smile
Post 22 Nov 2003, 13:50
View user's profile Send private message Visit poster's website Yahoo Messenger MSN Messenger Reply with quote
aaro



Joined: 21 Jun 2003
Posts: 107
Location: hel.fi
aaro 22 Nov 2003, 16:22
Quote:

Wish me luck, now I will start coding...

Good luck and thanks for your kind words. If you get stuck just post your source here or pm me and i'll try to help.
Post 22 Nov 2003, 16:22
View user's profile Send private message Reply with quote
mike.dld



Joined: 03 Oct 2003
Posts: 235
Location: Belarus, Minsk
mike.dld 27 Aug 2004, 22:18
It's an old topic but...
aaro, could you please post any newer version of that example (with includes) for the latest FASM versions. I tried to modify the existing one but failed (Windows gaves me an error then trying to start app Sad)
Post 27 Aug 2004, 22:18
View user's profile Send private message Visit poster's website ICQ Number Reply with quote
proveren



Joined: 24 Jul 2004
Posts: 68
Location: Bulgaria
proveren 28 Aug 2004, 07:16
DirectX9 is hard to compile even in C++ using DevCPP. There are things that the ms cpp compiler hides, the includes are also complex and there are some utility functions, defines, macros that are a pain in the translate in fasm.

So - go with OpenGL, no abstract objects, pointers, only simple functions and constants quite easy to fasm*.
_____________________________________________

*fasm - (v.) 1. to translate to and assemble using FASM.
2. (slang) to make professinally clean and fast code.
Post 28 Aug 2004, 07:16
View user's profile Send private message Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid 28 Aug 2004, 09:50
i think those header are overcomplicated like everything from M$, but it is possible to make them simple, you don't need all those stupid defines and macros, just something like privaloc's COMCALL macro and equates.
Post 28 Aug 2004, 09:50
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
proveren



Joined: 24 Jul 2004
Posts: 68
Location: Bulgaria
proveren 28 Aug 2004, 10:01
Yes, the COMCALL and INTERFACE are very good and by the way I would like to say to all directx asm coders to either use the ddraw.inc that comes with fasmw package or when they are making custom directX includes to stick to that standard. I have seen too many DXCALLS, DDRAWINOVOKES, DDSURFACE4INVOKES, and whatnot. There really should be a standart in order to make DirectX accessible to the most asm coders without difficulty.
Post 28 Aug 2004, 10:01
View user's profile Send private message Reply with quote
slav



Joined: 21 Apr 2004
Posts: 5
Location: Spain
slav 28 Aug 2004, 12:50
If you understand how COM works, it's quite easy to translate DX9 headers to fasm without those confusing macros. I've do it a few months ago, it's not as perfect as it could be (i did it for my own use) but i will post them with a working example so you can see it's almost as easy as OpenGL.
Post 28 Aug 2004, 12:50
View user's profile Send private message Reply with quote
slav



Joined: 21 Apr 2004
Posts: 5
Location: Spain
slav 29 Aug 2004, 15:20
Just for my eyes... i will have to spend a few hours more on them to make them more handy. I "only" took me one morning to translate the D3D9 C includes...


Description:
Download
Filename: d3d9.zip
Filesize: 15.17 KB
Downloaded: 599 Time(s)

Post 29 Aug 2004, 15:20
View user's profile Send private message Reply with quote
mike.dld



Joined: 03 Oct 2003
Posts: 235
Location: Belarus, Minsk
mike.dld 21 Sep 2004, 10:01
Another one request. Could anyone please write a simple (?) program using DD & D3D demonstrating rotating cube made up from 6 separate planes of different colors and some semitransparent text written. This would be a good example for me.
Post 21 Sep 2004, 10:01
View user's profile Send private message Visit poster's website ICQ Number Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


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