Loading and saving to disk in MS Basic

Skip to first unread message

Neil Andretti

Nov 21, 2022, 4:09:30 PM11/21/22
to PAL 6502 computer
Hi group.
I've patched MS Basic KB 9 to use the 1541 loading routines. and I rearanged the zeropage usage of the loading and saving routines to not collide with Basics 0page use. Now loading and saving in MS Basic works with the 1541.

What do you need?
Use the 1541 wiring from Dave McMurtrie
Burn the 1541 routines to a ROM to location $A000.
Load the special patched Basic (from Disk, filename 01) and start at loco $3D64

To load type
LOAD (name from 01-FF)
to save type
SAVE (name from 01-FF)

just WOW.


Neil Andretti

Nov 22, 2022, 3:06:36 AM11/22/22
to PAL 6502 computer
Sorry, things are not as nice as I thought: LOAD and SAVE do never use any parameter, they just save the FileID $FE....
and loading is always $FF, which is the wildcard for the next program....


GN Liu

Nov 23, 2022, 9:20:32 AM11/23/22
to PAL 6502 computer
keep patching?

D Hassler

Nov 23, 2022, 12:04:20 PM11/23/22
to PAL 6502 computer
This is very cool!  :^)  One way to set the file ID number inside KB9, before a SAVE, is to POKE 10052,xxx in immediate mode, where xxx is any decimal number 1-255.  This will overwrite the file ID preset of $FE in KB9...at least on my copy of BASIC, which I got from Jim McC.  To LOAD that specific ID, POKE 10135,xxx.  I just tested on a file saved to cassette with ID $7F (POKEed 127 dec.), verified with Butterfield's DIRECTORY program, then reloaded and it skipped over two other programs and LOADed the proper one.

I guess that this only works if your patched version calls the 1541 routine after KB9 sets up its file ID and jumps out.  On my copy of BASIC, that's $27A3 and $275C for LOAD and SAVE, respectively.

See ya, Dave

Neil Andretti

Nov 24, 2022, 2:33:32 AM11/24/22
to PAL 6502 computer
Dave, you're brilliant. 

I just have to search adress of the lda #$fe sta $17F9 thing and I have it ;)   ... in my compiled version it's $2659 (save byte name) and $26AC (load byte name)
So POKE 9817,xxx and POKE 9900,xxx does the Job.

Liu: Yes, I need to keep analyzing the Basic code, find out how to grab the additional program name after LOAD and SAVE, convert the two ascii letters to one byte and save it in $17F9.... phew ...  ;)

Thanks group.... I'm gonna try it tomorrow on my free day. If it works you will get a new video  :D

Reply all
Reply to author
0 new messages