Moving a .PRG for saving?
Posted: Wed Nov 22, 2017 11:41 am
This is going to be a strange question, but something I need to do.
I have hardware that can take a .PRG file (saved from internet), and write it to memory location A000-BFFF in a real VIC-20.
This is normally the expansion ROM location where a cartridge image would live.
What I want to do is with few lines of directly typed basic code, peek & poke it back to it's normal location.
From there, I can just SAVE "Program",8,1 to put it on disk.
Is it just a matter of peeking at the first two bytes here to get the original location of the file?...
If that assumption is correct, would this then move the file back to its proper location?...
Not sure if I also have to POKE some other address to tell basic where the code lives now?
I also don't care that each program will be 8K in length.
Thanks,
Brad
I have hardware that can take a .PRG file (saved from internet), and write it to memory location A000-BFFF in a real VIC-20.
This is normally the expansion ROM location where a cartridge image would live.
What I want to do is with few lines of directly typed basic code, peek & poke it back to it's normal location.
From there, I can just SAVE "Program",8,1 to put it on disk.
Is it just a matter of peeking at the first two bytes here to get the original location of the file?...
Code: Select all
NEWADR = PEEK(40960) + PEEK(40961) * 256
Code: Select all
OLDADR = 40962
FOR X = NEWADR TO NEWADR + 8191 : POKE X , PEEK(OLDADR) : OLDADR = ALDADR + 1 : NEXT
I also don't care that each program will be 8K in length.
Thanks,
Brad