Seven.FFF wrote: ↑Fri Dec 08, 2017 6:46 pm
Is there a magic way to:
- be in 128K basic
- run a program
- call m/c from the program
- in that machine code, do the m/c equivalent of OUT 32765,17: POKE 23388,17
- Frig the sysvars and stack (somehow) to...
- return to 48K basic, with your program still running, without resetting?
That’s a tall order, brother!
Okay, so let’s doodle a bit:
Code: Select all
ld a,(23388) ;fetch current value
and %11111000 ;clear bits 0–2 (bank #)
or 1 ;select new bank
ld bc,32765 ;our port
di ;condom on
ld (23388),a ;write new value back to sys. var
out (c),a ;and to port
ei ;condom off
ret ;we should be back in BASIC now
This ought to cover everything except
Seven.FFF wrote: ↑Fri Dec 08, 2017 6:46 pm
- return to 48K basic, with your program still running, without resetting?
Then again, I’m not sure why you’d want to do that. If you wanted to prevent further bank switching, you could simply set bit 5, but I presume you’re after something else.
Oh, yeah, and as Mark says, mind the ga— I mean, the stack.