<< Previous Message Main Index Next Message >>
<< Previous Message in Thread This Month Next Message in Thread >>
Date   : Fri, 16 Dec 2011 08:39:33 +0000
From   : jgh@... (jgh@...)
Subject: 32016 + 32082

Rick Murray wrote:
> jgh wrote:
>> At the BASIC command prompt, the stack is usually at about &FC.
> That's *it*? The entire MOS and such takes only *three* bytes of 
> stack?!?

No, it's "doing nothing", ie something like this:

LDX ?&FF:TSX
\ some more initialisation
LDA #ASC">":JSR OSWRCH  ; Print '>' prompt
LDX #xx:LDY #yy:LDA #zz ; Point to OSWORD control block
                         ; At this point S=&FF or so
JSR OSWORD              ; Request line of input

; within OSWORD 0:
; at this point S=&FD or so
JSR OSRDCH              ; Wait for input character
BCS osw0esc
...etc...

; within OSRDCH
; at this point, S=&FB or so
.loop
LDX &200+input_stream
JSR check_buffer_state

; within check_buffer_state
; at this point, S=&F9 or so

plus, every interupt more stuff gets put on the stack

.irq
STA &FC:PHP:PLA
AND #16:BEQ brkv
JMP (irg1)

.irq1serv
TXA:PHA:TYA:PHA
etc...

>> Early versions of HADFS would gobble up huge amounts of stack space.
> I suppose with such limitations, it is something you need to pay
> particular attention to.

I've just had a quick check with HADFS 5.52 and when accessing a
floppy drive it stacks about 48 bytes! Part of that is stacking
the OSWORD &7F control block as there's no guarrantee what its
return contents are, but I'm surprised so much more is stacked.
I'm currently updating some of the code, I'll see if stack usage
can be rationalised.

JGH
<< Previous Message Main Index Next Message >>
<< Previous Message in Thread This Month Next Message in Thread >>