flat assembler
Message board for the users of flat assembler.
Index
> Macroinstructions > use proc macro without OS |
| Author |
|
|
bitRAKE 21 Mar 2026, 19:30
You left out what tool you're actually using.
stdcall is the general macro to call functions. invoke is engineered for indirect calls specifically (typically external). Code: macro invoke?: proc*,args& stdcall [proc],args end macro |
|||
|
|
Byte 21 Mar 2026, 20:47
bitRAKE wrote: You left out what tool you're actually using. Sorry. I use FASM for DOS. What prevents me from using invoke to call my own functions like I did in MASM? I can't understand why the error is in the unspecified operand size? |
|||
|
|
revolution 21 Mar 2026, 21:03
invoke is an indirect call.
stdcall is a direct call. Code: call [my_proc] ; indirect call call the_proc ; direct call my_proc dd the_proc the_proc: ret |
|||
|
|
bitRAKE 21 Mar 2026, 21:06
The unspecified operand size error is because the call instruction has many forms.
FASM didn't aim for parity with MASM. Of course, it's possible to write your own invoke - I don't use it myself. The way you're using it is little more than an extended CALL instruction. _________________ ¯\(°_o)/¯ AI may [not] have aided with the above reply. |
|||
|
|
revolution 21 Mar 2026, 21:13
Rewriting _OutMsg EQU _OutMsgIn12h can make invoke work
Code: _OutMsg dd _OutMsgIn12h |
|||
|
|
Byte 21 Mar 2026, 21:35
Thank you very much everyone for your answers!
This advice solved my issue. revolution wrote: Rewriting _OutMsg EQU _OutMsgIn12h can make invoke work Using invoke avoids errors when working with variables on the stack. And using proc structures the code better than simply jumping to a label. MASM is a good assembler. Unfortunately, it is not very suitable for writing OS-independent code (unless it is 16-bit code). I will study FASM. P . S . Another question: can FASM create a listing file? Last edited by Byte on 21 Mar 2026, 21:40; edited 1 time in total |
|||
|
|
revolution 21 Mar 2026, 21:39
stdcall is a less wasteful option, that provides all the same protections from errors as invoke.
Code: stdcall _OutMsgIn12h, txtToOut, eax |
|||
|
|
Byte 21 Mar 2026, 21:42
revolution wrote: stdcall is a less wasteful option, that provides all the same protections from errors as invoke. Thank you, I will let you know. |
|||
|
|
revolution 21 Mar 2026, 21:44
Byte wrote: P . S . Another question: can FASM create a listing file? |
|||
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2026, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.