12 hours ago, kktos said:
Yeah, yeah, I know, one of this stupid idea.
Nevertheless, there's something to it which is appealing.... like having a local ZP and Stack.....
Having a 65C02 which can behave kinda like its big brother, the 65816....
Just a thought....
?
Build the task inside $A000-$BFFF. Do the tasks stack as an X-indexed or Y-indexed stack at $BF00. A pair of zero page vector location (source, target) that the tasks use on zero page. The bank of the next task in the chain at $A000, A, X, Y index state at $A001-$A003, S & T at $A004-$A007, the current RTI address and status at $A008/$A00A.
STA TA : STX TX : STY TY : PLA : STA TFLAG : PLA : STA TLRET : PLA : STA THRET
LDA T : STA TT : LDA T1 : STA TT1 : LDA S : STA TS : LDA S1 : STA TS1
LDA $A000 : STA $00
LDA TS1 : STA S1 : LDA TS : STA S : LDA TT1 : STA T1 : LDA TT : STA T
LDA THRET : PHA : LDA TLRET : PHA : LDA TFLAG : PHA : LDY TY : LDX TX : LDA TA : RTI