ack/mach/i80/libem/faddrn.h
David Given 79a38ecc08 Instead of using parameterised rsts for stack access, add a huge swathe of
automatically built helper tools. Star Trek goes up from 40243 to 40779 bytes,
but should be a lot faster.
2019-02-13 22:45:22 +01:00

31 lines
529 B
C

.sect .text
.sect .rom
.sect .data
.sect .bss
.sect .text
! Fetches the word at negative stack offset OFFSET into de.
#define PASTE(a, b) a ## b
#define LABEL(prefix, offset) PASTE(prefix, offset)
.define LABEL(.faddrn, OFFSET)
LABEL(.faddrn, OFFSET):
#if OFFSET == 0
mov l, c
mov h, b
#elif OFFSET == 1
mov l, c
mov h, b
dcx h
#elif OFFSET == 2
mov l, c
mov h, b
dcx h
dcx h
#else
lxi h, -OFFSET
dad b
#endif
ret