|
Post by Leif Bloomquist on Jul 11, 2006 14:06:13 GMT -5
How do you read and write SEQ files in machine language? I've read through the various kernal routine descriptions, but it's still not clear to me how to put it all together.
Basically I just want to be able to write a chunk of memory to a file, and read it back in later.
|
|
|
Post by Robin Harbron on Jul 11, 2006 20:46:19 GMT -5
How do you read and write SEQ files in machine language? I've read through the various kernal routine descriptions, but it's still not clear to me how to put it all together. Basically I just want to be able to write a chunk of memory to a file, and read it back in later. This sounds better suited to a PRG file. Any particular reason it has to be SEQ? The Fridge has what you need, I think: ffd2.com/fridge/io/diskio.sLet us know if you need anything clarified. Loading and saving are very similar - most of the setup is the same.
|
|
|
Post by Leif Bloomquist on Nov 1, 2006 16:04:36 GMT -5
Yeah, a PRG is more suitable. I have a mental image of PRGs being the executables and SEQs being your prefs etc, but I guess the C64 never did it that way.
Thanks for the example code, I now have it working after stripping out the extraneous stuff. One thing that confused me was that it uses LDA $BA which is correct, except that VICE uses drive 0 by default, not 8...so I kept getting a "disk error"!
|
|
|
Post by Nomen Nescio on Nov 4, 2006 22:54:52 GMT -5
This code snippet is from my character set editor (I use xa65 assembler): LOAD = $ffd5 ; KERNAL load SAVE = $ffd8 ; KERNAL save SETLFS = $ffba ; KERNAL set up a logical file SETNAM = $ffbd ; KERNAL set file name ZPWORD0 = $00FB ; a free word in zero page [...]
chraddr .word WRKFNT1 ; start address of font being edited. chraend .word WKF1END ; end address of font being edited.
iodev .byt 8 ; I/O device # (disk drive) fileno .byt 2 ; Logical file number namelen .byt 11 ; # of characters in filename filenam .byt "CHARSET.CHR" ; filename text
[...]
;-[ Load Character Set ]------------------------------------------------------ lodchrs .( ldx iodev ; device # lda fileno ; logical file number ldy #0 ; 0 = ignore load address of file, we'll specify jsr SETLFS
lda namelen ; set filename ldx #<filenam ldy #>filenam jsr SETNAM lda #0 ; 0 = load, 1 = verify ldx chraddr ; load address ldy chraddr+1 jsr LOAD ; KERNAL load routine lchdone rts .)
;-[ Save Character Set ]------------------------------------------------------ savchrs .(
ldx iodev ; device # lda fileno ; logical file number ldy #0 ; ??? should this be $FF for no secondary? Need to Check KERNAL! jsr SETLFS
lda namelen ; set filename ldx #<filenam ldy #>filenam jsr SETNAM lda chraddr ; save start address sta ZPWORD0 lda chraddr+1 sta ZPWORD0+1 ldx chraend ; end address ldy chraend+1 lda #ZPWORD0 ; where start address ptr is jsr SAVE ; KERNAL save routine schdone rts .)
This saves and loads PRG files, but if you want them to be SEQ you can append a ",S" to the filename and the 1541 will make SEQ files (but the first two bytes of the file will still contain a load address.) If you don't want that, I'm sure I could write some example code to do real opening/reading/writing to SEQ files for you.
|
|
|
Post by mrloadstar on Mar 6, 2007 11:21:03 GMT -5
LDA $BA BNE OK LDA #$08 STA $BA OK <your routine here> Good fix! Nothing is more perturbing than a program that lives only on drive 8! Dave
|
|