TSR - assembly
Posted: Sat Nov 11, 2023 8:15 pm
Hi!
I have a program, that:
- can load another program into memory at $8000
- jump to the start of that program
- that program loads a new program at $8001
- It does a jsr to the start of that program
- that program runs as normal
- when this program ends, it jumps back to the program at $8000
- From there the original program is loaded again in $8001 is started.
So this performs the same as a normal dos shell.
However, I want to do the same for basic programs. I know I can load and run the basic program by chrout the commands on the screen and fill the keyboard buffer with linefeeds. However, when the basic program ends,there is no way to return to the program which executed it.
I'm wondering if this would be possible. A dirty approach would be to edit the basic program in memory, finding all END commands and replace it with a GOTO to a new line with a SYS command to my program which remains in memory.
Can anyone think of a better/good way to point the program counter directly or indirectly to my program which remains in memory?
note: I know that loading my program in $8000 means that if a loaded program is larger than ca 30.000 bytes, my program gets overwritten. That's not a concern right know.
I have a program, that:
- can load another program into memory at $8000
- jump to the start of that program
- that program loads a new program at $8001
- It does a jsr to the start of that program
- that program runs as normal
- when this program ends, it jumps back to the program at $8000
- From there the original program is loaded again in $8001 is started.
So this performs the same as a normal dos shell.
However, I want to do the same for basic programs. I know I can load and run the basic program by chrout the commands on the screen and fill the keyboard buffer with linefeeds. However, when the basic program ends,there is no way to return to the program which executed it.
I'm wondering if this would be possible. A dirty approach would be to edit the basic program in memory, finding all END commands and replace it with a GOTO to a new line with a SYS command to my program which remains in memory.
Can anyone think of a better/good way to point the program counter directly or indirectly to my program which remains in memory?
note: I know that loading my program in $8000 means that if a loaded program is larger than ca 30.000 bytes, my program gets overwritten. That's not a concern right know.