LOAD "someprog",8
RUN
Preferably the routine would do a ,8 or a ,8,1 (binary). Im thinking
it would be easier to use built in Kernal routines if possible.
Once again I will declare that I'm not as familiar with CBM as I could be,
but, it makes sense to me that you need to be in the BASIC Interpreter in
order to run a BASIC program, which would take you out of your ML program.
Therefore, IMO, it wouldn't be possible to do what you are asking.
Also, I've never seen it done. Usually ML programs are run from within a
BASIC program, then RTI brings you back to BASIC. I might be wrong about
the RTI command. It could be RTS.
Bill Garber
Yes use the Kernal load routine to load the program, but remember to
set the end of program pointers so the variables don't destroy the
program after its running. Then call the basic run routine. I will
leave it to you to find these addresses in the programmers reference
guide.
I remember 'hacking' some programs that show (at least) one
"Cracker-intro" and almost every intro code ended with these lines
JSR $A659
JMP $A7AE
Another trick I remember is the UNNEW code for C64:
POKE 2050,1:SYS42291:POKE45,PEEK(34):POKE46,PEEK(35):CLR
Hope this helps...
--
Jouni Nordlund
> Once again I will declare that I'm not as familiar with CBM as I could be,
> but, it makes sense to me that you need to be in the BASIC Interpreter in
> order to run a BASIC program, which would take you out of your ML program.
Not at all, since BASIC itself is written in ML, you can call and use any of
the BASIC routines from within ML. I don't know the C64 addresses, but for
the VIC 20 you simply do:
JMP $C7AE
to start the current BASIC program. You might even be able to call RUN
directly ($C871).
Although it's probably more prudent to do:
JSR $C659 ; CLR
JSR $c533 ; Relinks BASIC Program from and to any address...
JMP $C7AE ; RUN
You're right though, getting back *into* your ML program would be tricky -
probably require the BASIC program to do a SYS. It would be interesting to
to do a JSR $C7AE and see if what happens when the program ends.
-Leif
I have some code that downloads a program via tftp, then checks
whether the first 2 bytes are $801 (i.e. the BASIC load address) and
if it is, jumps into BASIC via this:
jsr $e453 ;set BASIC vectors
jsr $e3bf ;initialize BASIC
jsr $a86e
jsr $a533 ; re-bind BASIC lines
ldx $22 ;load end-of-BASIC pointer (lo byte)
ldy $23 ;load end-of-BASIC pointer (hi byte)
stx $2d ;save end-of-BASIC pointer (lo byte)
sty $2e ;save end-of-BASIC pointer (hi byte)
jsr $a659 ; CLR (reset variables)
jmp $a7ae ; jump to BASIC interpreter loop
I seem to remember a fair bit of trial and error based on suggestions
I'd found via google (and old postings to this group) so I don't claim
to fully understand everything going on there but this particular
incantation is what works for me. This code resides in an 'autostart'
cartridge image, meaning BASIC has not been initialised prior to
execution of the above.
Regards
Jonno
I haven't programmed this stuff in years but it is certainly do-able. Use
the Kernal routines. As I recall you have to adjust the end of program
pointers afterwards (else all the variable declarations in the BASIC program
will overwrite the program itself). To run the BASIC code after will require
a jump to the interpreter. Some other stuff probably needs to be done to set
the current line, etc. If you trace the code for doing a "LOAD/RUN" it
should have most of it.
Steve