Is it possible to 'load' a file by sending the command to channel 15You can read PRG files just like they were SEQ files:
and reading the output? (by this I mean directories as well as files)
OPEN 15,8,15:OPEN x,8,y,"file,p,r" and then all the usual stuff
involved in reading sequential files. The directory is easiest
read block-by-block (track 18). Both methods are well described
elsewhere, like the 1541 manual.
Find the beginning of the file and read block-by-block. Throw away
the n-1 first blocks. Actually you only have to parse the pointer
to the next block. Maybe the disk command B-R will work if you only
want to read a few bytes?
I'm not too sure whether ASC(b$) is returning the actual value of
the byte or doing some sort of odd translation
Actually wanting to read the whole file 16K at a time,
I think the only case you have to watch out for is when you get
empty string, i.e. GET#1,b$ : IF b$="" THEN b$=CHR$(0)
Hihi
It's been a while since I've written on a real C64, if someone could
answer these I'd appreciate it...
Firstly in Basic, when saving a file, how do you overwrite a file that already exists? I seem to get a flashing red light and nothing saved
when I try...
When I start basic, it reports 38911 bytes free, does that mean there
are other areas of memory I can use for machine code without affecting
the basic program in memory, if so, where are they?
How do I load/save an area of memory from Basic? (like SAVE "somedata"
CODE 49152,8192 or whatever on the spectrum)
In assembler, how do I read from Basic variables? as in, if I called a routine with say PA=1 PB=2 PC$="FOO" how would I read those? I realise
I could just poke (at least the numbers) to the relevent place but
that doesn't seem like a great solution...
The screen display seems to be from 1024 onwards, where are the
attributes stored?
Thanks :)
--
Enzo
have a hunt for the "programmers reference guide". that will tell you loads.
there will be an online version somewhere - I just got the vic20 one
Firstly in Basic, when saving a file, how do you overwrite a file that >already exists? I seem to get a flashing red light and nothing saved
when I try...
When I start basic, it reports 38911 bytes free, does that mean there
are other areas of memory I can use for machine code without affecting
the basic program in memory, if so, where are they?
How do I load/save an area of memory from Basic? (like SAVE "somedata"
CODE 49152,8192 or whatever on the spectrum)
In assembler, how do I read from Basic variables? as in, if I called a >routine with say PA=1 PB=2 PC$="FOO" how would I read those? I realise
I could just poke (at least the numbers) to the relevent place but
that doesn't seem like a great solution...
The screen display seems to be from 1024 onwards, where are the
attributes stored?
Hihi
It's been a while since I've written on a real C64, if someone could
answer these I'd appreciate it...
Firstly in Basic, when saving a file, how do you overwrite a file that already exists? I seem to get a flashing red light and nothing saved
when I try...
When I start basic, it reports 38911 bytes free, does that mean there
are other areas of memory I can use for machine code without affecting
the basic program in memory, if so, where are they?
How do I load/save an area of memory from Basic? (like SAVE "somedata"
CODE 49152,8192 or whatever on the spectrum)
The screen display seems to be from 1024 onwards, where are the
attributes stored?
There is a Save-and-Replace command, but I wouldn't use it (at least one >demonstrated bug exists).
Instead, scratch first, save second:
SAVE "@0:FILENAME",8 is the trick, though a bit buggy. Make sure you have >free disk space for TWO copies of your program.
Following will delete old version before saving the new one:
OPEN 1,8,15,"S0:FILENAME":CLOSE1:SAVE"FILENAME",8
Following will delete old version before saving the new one:
OPEN 1,8,15,"S0:FILENAME":CLOSE1:SAVE"FILENAME",8
You're building nearly the same bug into this little commandline. You shouldn't scratch the old file *before* you are sure you've properly
written the new file...
have a hunt for the "programmers reference guide". that will tell you loads.
there will be an online version somewhere - I just got the vic20 one
I used to put the commands on lines 1, 2, 3, 4 as REM statements in reverse >order (line 4 being the write command. You'll find out why if you try it >without reversing it), list 1-4, remove the rems one at a time and have
a... half manual, half automated system of replacing files.. feeling pretty >confident I was covered.
In assembler, how do I read from Basic variables? as in, if I called a >>routine with say PA=1 PB=2 PC$="FOO" how would I read those? I realise
I could just poke (at least the numbers) to the relevent place but
that doesn't seem like a great solution...
It would be easier to pass the variables instead. Here is an idiom I use >frequently:
jsr $aefd ; check and throw away comma
jsr $ad9e ; BASIC prmeval
jsr $b7f7 ; convert to int, store in $14-$15
So, if you were to assemble this to 49152, and did sys49152,w+3 the result
of w+3 would be stored in integer 16-bit form with low byte at $14 and
high byte at $15.
Sysop: | Gate Keeper |
---|---|
Location: | Shelby, NC |
Users: | 764 |
Nodes: | 20 (0 / 20) |
Uptime: | 40:35:11 |
Calls: | 11,275 |
Calls today: | 1 |
Files: | 5,288 |
D/L today: |
81 files (10,064K bytes) |
Messages: | 521,283 |