modified: include/cdecl16.inc

This commit is contained in:
2025-09-11 14:01:30 -04:00
parent fca8a5d573
commit 8e6c823a00

View File

@@ -42,6 +42,7 @@
; __CDECL16_PROC_ARGS nargs ; __CDECL16_PROC_ARGS nargs
; Creates %$arg1 .. %$argN as [bp+4], [bp+6], ... ; Creates %$arg1 .. %$argN as [bp+4], [bp+6], ...
; for use inside of function bodies ; for use inside of function bodies
; BUG: still needs to be tested
%ifnmacro __CDECL16_PROC_ARGS %ifnmacro __CDECL16_PROC_ARGS
%macro __CDECL16_PROC_ARGS 1 %macro __CDECL16_PROC_ARGS 1
%push __CDECL16_PROC_ARGS %push __CDECL16_PROC_ARGS
@@ -78,6 +79,7 @@
; __CDECL16_CALL_ARGS_SIZED func, size1[, size2 ...] ; sizes in BYTES ; __CDECL16_CALL_ARGS_SIZED func, size1[, size2 ...] ; sizes in BYTES
; if you *need* to pass dword sized args in 16-bit mode, use this to properly ; if you *need* to pass dword sized args in 16-bit mode, use this to properly
; count the stack frame to restore later! ; count the stack frame to restore later!
; BUG: still needs to be tested
%ifnmacro __CDECL16_CALL_ARGS_SIZED %ifnmacro __CDECL16_CALL_ARGS_SIZED
%macro __CDECL16_CALL_ARGS_SIZED 2-* %macro __CDECL16_CALL_ARGS_SIZED 2-*
%push __CDECL16_CALL_ARGS_SIZED %push __CDECL16_CALL_ARGS_SIZED
@@ -124,13 +126,21 @@
%endmacro %endmacro
%endif %endif
;
; Only setup the minimum stack frame
; unlike the above, everything is caller save
;
%ifnmacro __FASTCALL16_ENTRY %ifnmacro __FASTCALL16_ENTRY
%macro __FASTCALL16_ENTRY 0 %macro __FASTCALL16_ENTRY 0-1
push bp push bp
mov bp, sp mov bp, sp
%if %0 = 1
sub sp, %1 ; reserve locals only when needed
%endif
%endmacro %endmacro
%endif %endif
; restore minimum stack frame, all regs are caller save
%ifnmacro __FASTCALL16_EXIT %ifnmacro __FASTCALL16_EXIT
%macro __FASTCALL16_EXIT 0 %macro __FASTCALL16_EXIT 0
mov sp, bp mov sp, bp