ReC98/th04/main
nmlgc 0dcd0b8136 [Maintenance] Reimplement TASM's ARG directive for `MOV BX, SP` functions
`cPtrSize` is simply the wrong constant for calculating parameter
offsets on the stack, because it corresponds to the memory model's
default distance, not the function's distance. Luckily, ARG has a
RETURNS clause, and if you declare all parameters in there, ARG won't
emit that pesky and unnecessary `ENTER 0, 0` instruction. Big discovery
right there!
Sadly, ARG is unusable for ZUN's silly functions that keep the base
pointer in BX. TASM declares the resulting equates as `[BP+offset]`,
and it's apparently impossible to only get `offset` out of such an
equate later.

So, rather than staying with numbers, let's reimplement ARG for these
functions instead. This way, we can even abstract away the stack clear
size for the `RET` instructions.
It's a bit rough around the edges though, forcing you to explicitly
specify the function distance, and to pass the parameters in reverse
order compared to the C declaration (thankfully, all of these use the
PASCAL calling convention). It also doesn't work with more complex
types yet. But certainly better than numbers.

Part of P0134, funded by [Anonymous].
2021-02-20 23:50:00 +01:00
..
boss [Maintenance] Declare CDG blitting functions in C land 2020-09-21 15:00:01 +02:00
bullet [Maintenance] Consistently express angle literals in signed hex format 2020-10-02 14:48:54 +02:00
enemy [Maintenance] Rename all old *_X and *_Y constants to *_LEFT and *_TOP 2020-08-28 15:14:22 +02:00
hud [Maintenance] Copy <dos.h>'s 16-bit x86 Real Mode declarations to a new file 2021-02-20 23:49:45 +01:00
item [Position independence] [th01/th02/th04/th05] False positives: Score values 2020-09-17 22:23:26 +02:00
midboss [Maintenance] Move all features exclusive to MAIN.EXE to a main/ subdirectory 2020-04-15 20:58:01 +02:00
player [Maintenance] Reimplement TASM's ARG directive for `MOV BX, SP` functions 2021-02-20 23:50:00 +01:00
pointnum [Maintenance] Rename all old *_X and *_Y constants to *_LEFT and *_TOP 2020-08-28 15:14:22 +02:00
stage [Maintenance] [th02/th04/th05] Declare more stage and player symbols in C land 2020-05-04 00:03:17 +02:00
bullets_gather_inv.asm [Reverse-engineering] [th04/th05] Gather circle structure 2020-04-03 17:41:04 +02:00
circles.asm [Maintenance] [th04/th05] Declare circles in C land 2020-08-28 15:14:21 +02:00
circles.cpp [Maintenance] [th04/th05] Declare circles in C land 2020-08-28 15:14:21 +02:00
circles.hpp [Maintenance] [th04/th05] Declare circles in C land 2020-08-28 15:14:21 +02:00
circles[bss].asm [Maintenance] [th04/th05] Declare circles in C land 2020-08-28 15:14:21 +02:00
circles_color[bss].asm [Maintenance] Move all features exclusive to MAIN.EXE to a main/ subdirectory 2020-04-15 20:58:01 +02:00
demo.h [Maintenance] Move all features exclusive to MAIN.EXE to a main/ subdirectory 2020-04-15 20:58:01 +02:00
drawp.hpp [Decompilation] [th05] Line sets: Rendering 2020-08-19 20:10:08 +02:00
drawpoint[bss].asm [Decompilation] [th05] Line sets: Rendering 2020-08-19 20:10:08 +02:00
ems.h [Maintenance] Move all features exclusive to MAIN.EXE to a main/ subdirectory 2020-04-15 20:58:01 +02:00
ems[bss].asm [Maintenance] Move all features exclusive to MAIN.EXE to a main/ subdirectory 2020-04-15 20:58:01 +02:00
frames.h [Maintenance] Proofread all comments in C land 2020-06-21 22:14:08 +02:00
frames[bss].asm [Maintenance] Move all features exclusive to MAIN.EXE to a main/ subdirectory 2020-04-15 20:58:01 +02:00
frames[data].asm [Maintenance] Move all features exclusive to MAIN.EXE to a main/ subdirectory 2020-04-15 20:58:01 +02:00
gather.hpp [Reverse-engineering] [th04/th05] 3-stack gather circles 2020-04-03 17:45:28 +02:00
gather[bss].asm [Reverse-engineering] [th04/th05] Gather circle structure 2020-04-03 17:41:04 +02:00
gather_add.asm [Reverse-engineering] [th04/th05] 3-stack gather circles 2020-04-03 17:45:28 +02:00
gather_point_render.asm [Reverse-engineering] [th04/th05] Gather point rendering 2020-04-03 17:32:51 +02:00
gather_render.asm [Maintenance] Rename all old *_X and *_Y constants to *_LEFT and *_TOP 2020-08-28 15:14:22 +02:00
homing.hpp [Maintenance] Declare the "no valid point" constant (-999) in a single place 2020-08-19 19:32:37 +02:00
homing_target[bss].asm [Maintenance] Declare the "no valid point" constant (-999) in a single place 2020-08-19 19:32:37 +02:00
null.asm [Maintenance] [th04/th05] Declare null callbacks in a single place in C land 2020-05-04 16:14:18 +02:00
null.hpp [Maintenance] [th04/th05] Declare null callbacks in a single place in C land 2020-05-04 16:14:18 +02:00
pause.asm [Maintenance] Move all features exclusive to MAIN.EXE to a main/ subdirectory 2020-04-15 20:58:01 +02:00
pause.h [Maintenance] Move all features exclusive to MAIN.EXE to a main/ subdirectory 2020-04-15 20:58:01 +02:00
pause[data].asm [Maintenance] Move all features exclusive to MAIN.EXE to a main/ subdirectory 2020-04-15 20:58:01 +02:00
phase.h [Maintenance] Move all features exclusive to MAIN.EXE to a main/ subdirectory 2020-04-15 20:58:01 +02:00
phase.inc [Maintenance] Move all features exclusive to MAIN.EXE to a main/ subdirectory 2020-04-15 20:58:01 +02:00
play[bss].asm [Maintenance] [th02/th04/th05] Declare more stage and player symbols in C land 2020-05-04 00:03:17 +02:00
playfld.h [Reverse-engineering] [th04/th05] Clearing the playfield's text RAM area 2020-05-03 23:25:59 +02:00
playperf.asm [Maintenance] Reimplement TASM's ARG directive for `MOV BX, SP` functions 2021-02-20 23:50:00 +01:00
playperf.hpp [Maintenance] [th02/th04/th05] Declare more stage and player symbols in C land 2020-05-04 00:03:17 +02:00
rank.hpp [Maintenance] Only use the `far` keyword to declare intent 2021-02-20 15:47:30 +01:00
score[bss].asm [Maintenance] [th04/th05] Assemble 16-bit .ASM files case-sensitively 2020-05-03 23:56:08 +02:00
scroll.hpp [Maintenance] Declare distinct types for screen, VRAM, and TRAM coordinates 2020-08-28 14:53:30 +02:00
scroll[bss].asm [Maintenance] [th04/th05] Declare scrolling variables and functions in C land 2020-05-04 00:03:51 +02:00
scroll_y_1.asm [Maintenance] Reimplement TASM's ARG directive for `MOV BX, SP` functions 2021-02-20 23:50:00 +01:00
scroll_y_3.asm [Maintenance] Reimplement TASM's ARG directive for `MOV BX, SP` functions 2021-02-20 23:50:00 +01:00
select_for_rank.asm [Maintenance] Move all features exclusive to MAIN.EXE to a main/ subdirectory 2020-04-15 20:58:01 +02:00
spark_render.asm [Maintenance] Declare distinct types for screen, VRAM, and TRAM coordinates 2020-08-28 14:53:30 +02:00
sparks.asm [Maintenance] Rename all old *_X and *_Y constants to *_LEFT and *_TOP 2020-08-28 15:14:22 +02:00
sparks[bss].asm [Maintenance] Move all features exclusive to MAIN.EXE to a main/ subdirectory 2020-04-15 20:58:01 +02:00
sparks_add.asm [Maintenance] Declare distinct types for screen, VRAM, and TRAM coordinates 2020-08-28 14:53:30 +02:00
sparks_add[bss].asm [Maintenance] Move all features exclusive to MAIN.EXE to a main/ subdirectory 2020-04-15 20:58:01 +02:00
tile.hpp [Maintenance] master.hpp transition: Gaiji functions 2021-01-30 18:46:21 +01:00
tile.inc [Reverse-engineering] [th04/th05] Stage tiles: Initial ring buffer filling 2020-08-28 15:28:26 +02:00
tile_section[data].asm [Reverse-engineering] [th04/th05] Stage tiles: Initial ring buffer filling 2020-08-28 15:28:26 +02:00
tiles[bss].asm [Decompilation] [th04/th05] Declare stage tile data and functions in C land 2020-05-03 23:52:30 +02:00
tiles_fill_initial.asm [Reverse-engineering] [th04/th05] Stage tiles: Initial ring buffer filling 2020-08-28 15:28:26 +02:00
tiles_invalidate.asm [Maintenance] Reimplement TASM's ARG directive for `MOV BX, SP` functions 2021-02-20 23:50:00 +01:00
tiles_invalidate[bss].asm [Maintenance] [th04/th05] Declare scrolling variables and functions in C land 2020-05-04 00:03:51 +02:00
tiles_invalidate_all.asm [Decompilation] [th04/th05] Declare stage tile data and functions in C land 2020-05-03 23:52:30 +02:00
tiles_redraw.asm [Maintenance] Rename all old *_X and *_Y constants to *_LEFT and *_TOP 2020-08-28 15:14:22 +02:00
tiles_render_all.asm [Maintenance] Rename all old *_X and *_Y constants to *_LEFT and *_TOP 2020-08-28 15:14:22 +02:00