Page 1 of 1
Run a BAS program from within M/C
Posted: Tue Jun 10, 2014 3:37 pm
by pser1
hello,
it seems I have lost my notes. I am sure I had done this some time ago.
Inside a machine code programm, I have sent the command LOAD"ProgName.BAS" and the disk sytem has loaded it succesfully.
Then the start adress is saved to $19 (usualyy $2401 for PCLEAR4 with disks)
The start+length is stored at $1B, $1D and $1F
Next $68-69 are set to $FFFF (direct mode)
Finally comes this:
JSR $83ED * ensure line links
JMP $841F * start Basic programm
But it doesn't start, despite when typed right on the green screen this works OK (EXEC&H841F always starts the loaded Basic programm)
I am sure that I am forgetting one or more system variables to be initialized, but wich ones?
Any advice will be greatly appreciated!
thanks in advance
regards
pere
Re: Run a BAS program from within M/C
Posted: Tue Jun 10, 2014 5:28 pm
by pser1
hello,
don't know if this is the best way to get it ...
I got a peek to the unassembled DragonDos 1.0 by P.Harvey-Smith
and copied as much instructions as could see there to run the just loaded BAS file.
A bit long, but it works for me ...
Code: Select all
FIN3 LDX #$FFFF
STX <$68
CLR <$F6
LDX <$19
JSR $85EE
LDX <$27
STX <$23
LDX <$1B
STX <$1D
STX <$1F
JSR $8514
JSR $8434
JMP $849F
regards
pere
Re: Run a BAS program from within M/C
Posted: Tue Jun 10, 2014 8:24 pm
by tormod
Is this after loading the program as a raw/ML file? (I do not know exactly what LOAD can do.)
Re: Run a BAS program from within M/C
Posted: Tue Jun 10, 2014 8:49 pm
by pser1
hello Tormod,
this is part of the client I am building to load / run files from my Java VDK server.
It didn't work untill I have copied most of the code from the unassembled DOS1.0 (CmdLoad)
Now I can send the command RUN"LDREAM" and then Java sends back the basic program (LDREAM.BAS") which in turn is started by Dragon
Later one of the lines of the program sends a LOAD"DSKDREAM.BIN" that is served by the Java part, too.
And finally is executed. So, by now it works fine both for BAS and BIN file types.
There is a special case when the filename is not direct, say concatenation of strings and/or variables, for instance:
LOAD A$+"BIN" that by now gives an SN Error
I need to analize it deeper to get the whole string at the client before sending the command to the server ...
Isn't it nice programming?
regards
pere
Re: Run a BAS program from within M/C
Posted: Tue Jun 10, 2014 10:54 pm
by zephyr
pser1 wrote:
Inside a machine code programm, I have sent the command LOAD"ProgName.BAS" and the disk sytem has loaded it succesfully.
Then the start adress is saved to $19 (usualyy $2401 for PCLEAR4 with disks)
The start+length is stored at $1B, $1D and $1F
Next $68-69 are set to $FFFF (direct mode)
Finally comes this:
JSR $83ED * ensure line links
JMP $841F * start Basic programm
But it doesn't start, despite when typed right on the green screen this works OK (EXEC&H841F always starts the loaded Basic programm)
I am sure that I am forgetting one or more system variables to be initialized, but wich ones?
Any advice will be greatly appreciated!
The following method was often used for starting (auto-running) a BASIC program from machine code.
Code: Select all
JSR $841F ; BasVect1 - Sets up various vectors after a BASIC program has loaded.
JSR $83ED ; BasVect2 - Completes init.
JMP $849F ; RUN BASIC - Runs BASIC program in mem.
Re: Run a BAS program from within M/C
Posted: Wed Jun 11, 2014 9:13 am
by pser1
thanks Steve,
this works great too, and the most important it saves some bytes with respect to my best prior version.
regards
pere