.define _platform_switchout
!
-! Verify ABI exact rules but I think we don't need to stack any
-! register state.
+! The ABI requires we preserve BC
!
!
_platform_switchout:
lxi h,0
push h ! Save a 0 argment
+ push b
dad sp
shld U_DATA__U_SP ! Save the sp for a switch in
call map_process_always_di
lhld U_DATA__U_SP
sphl
!
- ! Recover our return code
+ ! Recover our parent frame pointer and return code
!
+ pop b
pop h
lda U_DATA__U_ININTERRUPT
sta _int_disabled
mov h,m
mov l,a
!
- ! We don't have any state to save but the pid
+ ! We don't have any state to save but the pid and framepointer
!
+ push b
push h
lxi h,0
dad sp
!
lxi h,0
shld _runticks
+ !
+ ! Frame pointer
+ !
+ pop b
ret
.define bouncebuffer