flat assembler
Message board for the users of flat assembler.
![]() |
Author |
|
Fanael 19 Sep 2009, 08:01
Code: foo = sth Use equ: Code: Frequency equ rbp+8*0 StartTime equ rbp+8*1 ;and so on |
|||
![]() |
|
roxaz 19 Sep 2009, 08:02
how about using struct?
Code: include '%fasminc%\win64a.inc' struct Structure Frequency dq ? StartTime dq ? EndTime dq ? LocVar dq ? ends section '.text' code readable executable start: push rbp sub rsp,8*4 mov rbp,rsp invoke QueryPerformanceFrequency, [rbp+Structure.Frequency] invoke QueryPerformanceCounter, [rbp+Structure.StartTime] add rsp,8*4 pop rbp ret |
|||
![]() |
|
LocoDelAssembly 19 Sep 2009, 16:33
Or this:
Code: start: virtual at rbp - .locals_size .Frequency dq ? .StartTime dq ? .EndTime dq ? .LocVar dq ? .locals_size = ($ - $$ + 7) and -8 end virtual push rbp mov rbp, rsp sub rsp, .locals_size invoke QueryPerformanceFrequency, addr .Frequency invoke QueryPerformanceCounter, addr .StartTime mov rsp, rbp pop rbp ret [edit]Replaced code with one using rbp in a more "canonical" way. [edit2]Parameters modified to the correct ones.[/edit2] Last edited by LocoDelAssembly on 19 Sep 2009, 16:54; edited 2 times in total |
|||
![]() |
|
tthsqe 19 Sep 2009, 16:35
thanks, I didn't know about equ.
But, the code generated for the invoke should be: Code: sub rsp,8*2 lea rcx,[Frequency] call [QueryPerformanceFrequency] add rsp,8*2 and I haven't been able to get inoke to do this |
|||
![]() |
|
LocoDelAssembly 19 Sep 2009, 16:40
What do you get instead?
|
|||
![]() |
|
tthsqe 19 Sep 2009, 16:51
revolution,
that code has the same problem in that it generates mov rcx,[rbp+8] When calling QueryPF, rcx should be a pointer to the stack location: sub rsp,8*2 lea rcx,[rbp+8*n] call [QueryPerformanceFrequency] add rsp,8*2 |
|||
![]() |
|
LocoDelAssembly 19 Sep 2009, 16:55
Well, I guess you are talking to me actually
![]() Yes sorry, I used the wrong parameters, I edited my code again, check it if it now works. |
|||
![]() |
|
tthsqe 19 Sep 2009, 16:56
I though
invoke QueryPF, addr Frequency would do it, but this doesn't assemble. maybe a bug in the invoke macro? |
|||
![]() |
|
tthsqe 19 Sep 2009, 17:01
Sorry! LocoDelAssembly,
With your edited code, on the first invoke line I get a Error: invalid operand insruction: inc addr .Frequency source: timingtest.asm[28] proc64,inc [5] proc64.inc [41] using FASM 1.68 |
|||
![]() |
|
LocoDelAssembly 19 Sep 2009, 17:33
Oh, I'm using FASM 1.69.04. "addr" is present in PROC64.INC (in the case of 32-bit programming "addr" is located in win32{a|w}x.inc instead of PROC32.INC).
However, I see that FASM 1.68 also has "addr" defined in PROC64.INC. Perhaps you are not using the very latest version? (last update: 24 Aug 2009 14:13:10 UTC) |
|||
![]() |
|
tthsqe 19 Sep 2009, 19:30
I got the new version, and it assembled it correctly.
|
|||
![]() |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.