Page 1 of 1

Perform RUN manualy from assembler

Posted: Sun Nov 12, 2023 5:57 pm
by unartic
I have a tsr-program which must be able to load a program (assembly or basic). After the assembly of basic program has exited, control must be back to the tsr.

For assembly files it is working. Now I want to do the same for basic files.

My attempt:
- Load the basic file as usual
- jsr to the RUN routine from basic in ROM.

I have a way to find the RUN routine on the fly in ROM so I can alway jsr to the right address. (in current rom bank 4 at $CCC2).

I expected by jsr (or jmp) to the RUN routine to have basic start executing the basic program. Is seems to try that, but I get an error: ?UNDEF/D STATEMENT ERRORIN 531

After that error I get the ready prompt.

If I then type 'RUN' + [ENTER] the manualy loaded basic program works as expected.

So: jumping to the run-routine does not have the same effect as the normal way to start the basic program. Not a large suprpise ofcourse :-)

I've replicated the processor status and registers, but that doesn't help.

My assumption is one of the following:
1. There is a pointer in memory from which the basic program gets executed which is reset by the RUN command if you type it, but not if you jmp to the correct address in memory.
2. I'm just jumping to the wrong routine. I've found it in code4.js on line 117 (https://github.com/commanderx16/x16-rom ... ster/basic).

I hope someone has an idea how to make progress on this and/or point me to the right direction.

note: I know I'm following an unconventional route, but if I get this to work cx16 can be made much more friendly for less experienced users, thus increasing the chance of it's success.

Re: Perform RUN manualy from assembler

Posted: Sun Nov 12, 2023 7:32 pm
by ahenry3068
Try this way viewtopic.php?p=29869#p29869

That should solve the running the program thing. But the only way I know for your TSR to regain control is if it's using an ISR.

Re: Perform RUN manualy from assembler

Posted: Mon Nov 13, 2023 6:35 am
by unartic
Thanks for your input.

Running the basic program without regaining control isn’t a problem :-)

What do you mean about the isr? Does basic use interrupts in some kind of way in de starting or ending proces?