The crt0.s file for the z80 port (version #8471 used here) contains this section:
;; Stack at the top of memory.
According to Zilog's documentation, the data from a push command (or call, etc...) is stored at SP-1 (high byte) and SP-2 (low byte). This means that a push will store at 0xfffe and 0xfffd, wasting the byte at address 0xffff.
Whilst this is safe and causes no problems, and based on the assumption that the stack pointer wraps around at 0 and 0xffff, it may be worth looking into whether the stack should be started at 0x0000, meaning the first push/call will store at addresses 0xfffe and 0xffff.
Log in to post a comment.