Login
Back to forumReply to this topicGo to last reply

Posted By

Luca
on 2014-04-16
10:06:47
 [SOLVED] SEQ files saver

This code should save a determined $80 long SEQ file and should work, in pure theory, but it does not Why?
Any hint will be appreciated happy

data_end   = data+$80

LDA #data & 255
STA $02
LDA #data >> 8
STA $03
;
LDA #filename_end-filename
LDX #filename & 255
LDY #filename >> 8
JSR $ffbd ; call setnam
LDA #$02 ; file number 2
LDX $ae ; last used device number
BNE *+4
LDX #$08 ; default to device 8
LDY #$02 ; secondary address 2
JSR $ffba ; call setlfs
JSR $ffc0 ; call open
BCS oerror ; error by open

LDX #$02 ; file number 2
JSR $ffc9 ; call chkout
LDY #$00
wloop JSR $ffb7 ; call readst (check for error)
BNE werror ; error by write
LDA ($02),y ; get byte from memory
JSR $ffd2 ; call chrout
INC $02
BNE *+4
INC $03
LDA $02
CMP #data_end & 255
LDA $03
SBC #data_end >> 8
BCC wloop ; next byte
file_close
LDA #$02 ; file number 2
JSR $ffc3 ; call close
JSR $ffcc ; call clrchn
RTS
oerror
; here write something related to open
JMP file_close ; even if open failed, the file has to be closed
werror
; here write something related to write
JMP file_close

filename
db "filefile,s,w"
filename_end


Posted By

gerliczer
on 2014-04-16
11:40:37
 Re: SEQ files saver

Hi Luca,

After a quick googling MIRKOSOFT had the exact same question back in the summer of 2011 here: http://www.commodore128.org/index.php?topic=3988.0.

Posted By

Luca
on 2014-04-16
14:45:00
 Re: SEQ files saver

Thank you gerliczer, he did it for the C128 and did the mistake to involve some serial bus kernal stuff, but in the very last post he did what I've done...with no success for me
Dunno why, I did what I've to do but then I receive an error when opening the file with JSR $FFC0.

Missed to point out, of course I casted a SEI + STA $FF3E before running the code.

Solved at last, leaving this thread to posterity usage: the filename format display charset cmapped at $40, not $00! Hence, the filename must be included as CAPS:
        db "FILENAME,S,W"




Back to topReply to this topic


Copyright © Plus/4 World Team, 2001-2024