flat assembler
Message board for the users of flat assembler.
Index
> Macroinstructions > locals...endl macro |
| Author |
|
|
AsmGuru62 27 Apr 2026, 19:26
I believe that proc/endp/stdcall are for 32-bit code, so I wonder why FASM for DOS compiles it.
Should be an error, stating that registers like EBP cannot be used with 'use16' directive. Maybe PROC32.INC can be modified to support stdcall procedures for DOS? Any macro masters out there? |
|||
|
|
Byte 27 Apr 2026, 20:12
AsmGuru62 wrote: I believe that proc/endp/stdcall are for 32-bit code, so I wonder why FASM for DOS compiles it. The fact is that when I compile 32-bit "pure" code, this macro also works incorrectly. But for this I use fasm for DOS. |
|||
|
|
revolution 27 Apr 2026, 22:18
1. One problem with the code is that call (inside stdcall) pushes a 16-bit address so the computation of the offset for r is off by 2. The proc macro assumes a call will push a 32-bit address.
2. Second: pi is uninitialised, locals (defined in proc32) only defines lowercase versions of data definitions so DW is not special, only dw will initialise the constant. Using all-caps DW is why the code also fails in 32-bit settings. I would suggest to make a dedicated proc16 macro set to handle 16-bit code correctly. AsmGuru62 wrote: Should be an error, stating that registers like EBP cannot be used with 'use16' directive. |
|||
|
|
Byte 28 Apr 2026, 20:14
revolution wrote:
Thanks, replacing 'DD' with 'dd' fixed the situation with 32-bit code. Macros are cool, of course. But if the compiler core supported stdcall (cdecl etc) and local variables, it would be much cooler. |
|||
|
|
revolution 29 Apr 2026, 00:20
Byte wrote: Macros are cool, of course. But if the compiler core supported stdcall (cdecl etc) and local variables, it would be much cooler. |
|||
|
|
Byte 29 Apr 2026, 17:13
I disagree a little. Calling a routine depends not so much on the OS as on the calling convention. This or that OS only adheres to a certain convention. And that only applies to system calls. In addition, each OS requires its own compiler assembly. There is no universal code. But the compiler can support all known calling conventions.
|
|||
|
|
macomics 29 Apr 2026, 20:34
Byte wrote: But the compiler can support all known calling conventions. To solve such routine tasks, a preprocessor/macro language has been added to the assembler. This way you can create the macro instructions you need and work in any system and with any ABI. |
|||
|
|
revolution 30 Apr 2026, 00:35
Byte wrote: Calling a routine depends not so much on the OS as on the calling convention. Plus: ABIs get updated, renewed, re-invented, extended, etc. Some ABIs are extremely complex, especially when dealing with mixed integer and floating point values (e.g. SYSV, FASTCALL) The source code would need to signal the type of each value to correctly format all the call inputs. It gets untidy very quickly. The assembler code to handle all the different calling conventions becomes larger than the base assembler itself. |
|||
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2026, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.