MSX-DOS TPA Question

Page 2/2
1 |

By Grauw

Ascended (8192)

Grauw's picture

20-12-2018, 09:36

If the aforementioned check passes, you can also write a magic value word x bytes below the stack (say 100H), and on program termination check if it hasn't changed. That way you will get an early warning if your stack grows large.

(By the way, for C maybe 100H is too little an amount, since it uses the stack so much. Would have to try it and see.)

By ericb59

Paladin (846)

ericb59's picture

20-12-2018, 21:45

Is this supposed to give me the current adress of the Stack ?

unsigned int ReadSP(void)
{
__asm

  ld   HL,#0
  add  HL,SP 

__endasm;
}

By Pencioner

Paladin (906)

Pencioner's picture

20-12-2018, 22:24

SDCC seems to handle int return from functions via HL - so yes, with SDCC compiler it should work fine

Page 2/2
1 |