flat assembler
Message board for the users of flat assembler.
Index
> Windows > Multiple .ASM files |
Author |
|
revolution 09 Nov 2008, 08:28
I think you are talking about including one file from another. This is known as the "include" directive.
Code: include "somefile.inc" |
|||
09 Nov 2008, 08:28 |
|
roland 09 Nov 2008, 08:31
so its ok to put whole procedures in the includes? ah ok thanks
|
|||
09 Nov 2008, 08:31 |
|
revolution 09 Nov 2008, 08:33
Sure, just put anything in there, it is as though you have copy-pasted the whole file into that position within the main source. You can even include files from the included file to any desired depth.
|
|||
09 Nov 2008, 08:33 |
|
roland 09 Nov 2008, 08:42
thanks. is there a way to put sections in .inc files?
|
|||
09 Nov 2008, 08:42 |
|
baldr 09 Nov 2008, 09:27
roland,
Definitely is. Just don't expect fasm to combine them… |
|||
09 Nov 2008, 09:27 |
|
roland 10 Nov 2008, 02:53
Thanks so much for the info and quick replies! just one more question im not sure you can do this but, can you close a window without ending a program? eg if you wanted to open a new window in your program can you close the old one without ending the program? thanks!
|
|||
10 Nov 2008, 02:53 |
|
revolution 10 Nov 2008, 03:00
roland wrote: Thanks so much for the info and quick replies! just one more question im not sure you can do this but, can you close a window without ending a program? eg if you wanted to open a new window in your program can you close the old one without ending the program? thanks! |
|||
10 Nov 2008, 03:00 |
|
roland 10 Nov 2008, 08:08
i was just thinking of going from windowed screen to full screen by pressing f1. when i press f1 i create a new window which is either full screen or windowed but i need to destroy the old window at the same time.
|
|||
10 Nov 2008, 08:08 |
|
bitshifter 10 Nov 2008, 09:48
There is no need to trash the window just to change its style.
First hide it via ShowWindow(hwnd,SW_HIDE) Then set new styles via SetWindowLong(...) Then update and show it via SetWindowPos(...) |
|||
10 Nov 2008, 09:48 |
|
roland 11 Nov 2008, 05:50
AH! thats how you do it! thanks!
|
|||
11 Nov 2008, 05:50 |
|
roland 12 Nov 2008, 00:50
can i have just one more question?
I want to set a D3D9 line using a procedure so I can change the line position when i want. Code: struct Vertex x dd ? y dd ? z dd ? colour dd ? ends proc SetLine x1, y1, colour1, x2, y2, colour2 lineList Vertex [x1],[y1], 0.0, [colour1] Vertex [x2],[y2], 0.0, [colour2] ret endp then I Set it using: Code: invoke SetLine, 0, 0, $ff0000, 100, 100, $00ff00 ;Set the line at 0, 0 to 100,100, first point red and second is green. then i just draw it. its just that this comes up with errors Error: invalid argument Linelist.x dd[..arg?2fN] -what ever that means??? |
|||
12 Nov 2008, 00:50 |
|
revolution 12 Nov 2008, 01:13
You need to show us the lineList macro, the error is occurring somewhere in there.
BTW: You shouldn't use invoke to call SetLine, use stdcall. |
|||
12 Nov 2008, 01:13 |
|
roland 12 Nov 2008, 03:32
lineList is an array from the struct Vertex.
But when i try to declare linelist inside a procedure it doesn't work. And i can't declare it twice. So in the Struct Vertex, there is X, Y, Z and Colour. Is there a way to move a number into the x, y, z and colour like in c++? eg mov lineList.x, [number] i tried this but it doesnt work. Is there any FASM tutorials that someone can point me to? |
|||
12 Nov 2008, 03:32 |
|
revolution 12 Nov 2008, 04:29
It is confusing the way you have coded it. It is not normal to put data variables into a procedure without a local directive. What did you think would be executed as the first instruction within the SetLine procedure?
|
|||
12 Nov 2008, 04:29 |
|
revolution 12 Nov 2008, 05:08
roland: What is it that you are trying to achieve? If we had some idea of what you want to do then perhaps someone can suggest the proper method to do it.
|
|||
12 Nov 2008, 05:08 |
|
roland 12 Nov 2008, 05:54
i want to make an easy procedure to set where to put a line, so i can change the lines position and colour quickly and easily. heres the code, hope it helps. sorry for being confusing before.
heres how i set up and draw the line Code: proc DrawLineInit D3DCALL pd3dDevice, CreateVertexBuffer, sizeof.Vertex * 2, 0, CustomFVF, D3DPOOL_DEFAULT, LineVB, NULL cmp eax, D3D_OK jne Error mov [pVertices], NULL D3DCALL LineVB, Lock, 0, sizeof.Vertex * 2, pVertices, 0 cmp eax, D3D_OK jne Error cinvoke memcpy, [pVertices], lineList, sizeof.Vertex * 2 D3DCALL LineVB, Unlock ret endp proc DrawLine D3DCALL pd3dDevice, SetStreamSource, 0, [LineVB], 0, sizeof.Vertex D3DCALL pd3dDevice, DrawPrimitive, D3DPT_LINELIST, 0, 1 ret endp heres how I want to set the lines position and colour, but its not working Code: proc SetLine x1, y1, colour1, x2, y2, colour2 lineList Vertex [x1],[y1], 0.0,1.0, [colour1] Vertex [x2],[y2], 0.0,1.0, [colour2] ret endp and heres my D3DRender procedure where i do the drawing Look at: stdcall SetLine, 0, 0, $ff0000, 100, 200, $00ff00 call DrawLine Code: proc Draw D3DCALL pd3dDevice, Clear, 0, NULL, D3DCLEAR_TARGET or D3DCLEAR_ZBUFFER, $000000, 1.0, 0 D3DCALL pd3dDevice, BeginScene ;Render geometry here... stdcall SetLine, 0, 0, $ff0000, 100, 200, $00ff00 call DrawLine D3DCALL pd3dDevice, EndScene D3DCALL pd3dDevice, Present, NULL, NULL, NULL, NULL return endp |
|||
12 Nov 2008, 05:54 |
|
revolution 12 Nov 2008, 06:21
You should declare lineList in your data section. Putting it in the code section is not a good idea.
Code: ;somewhere in your data section lineList Vertex rb sizeof.Vertex ;somewhere in your code section proc SetLine x1, y1, colour1, x2, y2, colour2 ;the first vertex mov eax,[x1] mov [sizeof.Vertex*0+lineList.x],eax mov eax,[y1] mov [sizeof.Vertex*0+lineList.y],eax mov eax,dword 0.0 mov [sizeof.Vertex*0+lineList.z],eax mov eax,[colour1] mov [sizeof.Vertex*0+lineList.colour],eax ;the second vertex mov eax,[x2] mov [sizeof.Vertex*1+lineList.x],eax mov eax,[y2] mov [sizeof.Vertex*1+lineList.y],eax mov eax,dword 0.0 mov [sizeof.Vertex*1+lineList.z],eax mov eax,[colour2] mov [sizeof.Vertex*1+lineList.colour],eax ret endp |
|||
12 Nov 2008, 06:21 |
|
roland 12 Nov 2008, 07:57
WOW! Thanks revolution!!!
Code: lineList Vertex rb sizeof.Vertex ; could you explain to me what this does? i get the rest though, cool! also, are there any tutorials anywhere that cover arrays? |
|||
12 Nov 2008, 07:57 |
|
revolution 12 Nov 2008, 08:11
rb is reserve bytes. Read the fasm manual for description.
|
|||
12 Nov 2008, 08:11 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.