MSX-DOS TPA Question

Pagina 2/2
1 |

Van Grauw

Ascended (10699)

afbeelding van Grauw

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.)

Van ericb59

Paragon (1098)

afbeelding van ericb59

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;
}

Van Pencioner

Scribe (1542)

afbeelding van Pencioner

20-12-2018, 22:24

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

Pagina 2/2
1 |