flat assembler
Message board for the users of flat assembler.

Index > Macroinstructions > Pascal like function declarations

Thread Post new topic Reply to topic

Joined: 26 Jan 2021
Posts: 819
Location: Russia
macomics 05 Aug 2021, 17:24
As an alternative to the macros from proc.inc, I tried to create my own. They allow you to describe functions close to the syntax from Pascal. These macros are easily rewritten for 64-bit mode. Just replace the set of registers and the length of the predefined variables.
function <NAME>,<REGS>,<CONF>
    return <STATUS>, <VALUE>
    return <STATUS>, <VALUE>
    return <ERROR>, <RESULT>    

<NAME> - name of function;
<REGS> - any set of integer register (eax, ebx, ecx, edx, ebp, esi, edi, efl, all);
<CONF> - one of function type: stdcall, fastcall, cdecl, register;
<ARGS_LIST>,<VARS_LIST> - function args and local vars accessed from function body(names must start with the character '.');
<CODE> - function code;
<STATUS> - carry flag value: SUCC(CF=0), FAIL(CF=1),SWAP(!CF),DONE(CF not changed);
<VALUE> - return value, or [.Result] can be used to hold return value;
<SEH_CODE> - Structured exception handling code (for Win32);
<ERROR> - SEH return status: BREAK(continue from the point of safe return from the current function), CONTINUE(continue with the command that caused the program to be interrupted), RETRY(continue searching for a suitable SEH function);
<RESULT> - error result.

Description: read comments before using.
Filename: pascal.inc
Filesize: 6.72 KB
Downloaded: 301 Time(s)

Post 05 Aug 2021, 17:24
View user's profile Send private message 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-2023, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.