It is, that's why I need to create a push & pop function by hand :) since I'm working in C
Printable View
when you using asm with c you do __asm{
or can you use push directly with it ?
Z80 assembler stack operations.
Unfortunately it is abit more complicated as the registers are paired
so you push two 8 bit ints to store two paired 8 bit registers.
Also it is 'upside down' the 'top' of the stack is high and as you push stuff
onto it it is stored at lower memory locations.
Code:
PUSH B PUSH BC C5 (SP-2) <- C; (SP-1) <- B; SP <- SP - 2
PUSH D PUSH DE D5 (SP-2) <- E; (SP-1) <- D; SP <- SP - 2
PUSH H PUSH HL E5 (SP-2) <- L; (SP-1) <- H; SP <- SP - 2
PUSH PSW PUSH AF F5 (SP-2) <- Flags; (SP-1) <- A; SP <- SP - 2
--- PUSH IX DDE5 (SP-2) <- IXl; (SP-1) <- IXh; SP <- SP - 2
--- PUSH IY FDE5 (SP-2) <- IYl; (SP-1) <- IYh; SP <- SP - 2
POP B POP BC C1 B <- (SP+1); C <- (SP); SP <- SP + 2
POP D POP DE D1 D <- (SP+1); E <- (SP); SP <- SP + 2
POP H POP HL E1 H <- (SP+1); L <- (SP); SP <- SP + 2
POP PSW POP AF F1 A <- (SP+1); Flags <- (SP); SP <- SP + 2
It is, but it's been part of C since Turbo C/C++ 1.01, that I know of.