Some files won't read from disk in assembly.
Posted: Sun Jan 17, 2016 2:38 pm
Am trying to read a file sequentially (in VICE and from SD2IEC). Pretty straightforward:
Some files just give me the default BASIC load address followed by zeroes, others are just being read without problems. All are PRG files. POPEYE.TAP doesn't work, some shell script works, 1.5M of raw data also works, TAP file with header cut out again doesn't. What the flipping heck is causing that mess, please?
Code: Select all
main:
lda #2
ldx #8
tay
jsr $ffba ; SETLFS
lda #@(- txt_file_end txt_file)
ldx #<txt_file
ldy #>txt_file
jsr $ffbd ; CHKIN
jsr $ffc0 ; OPEN
bcs error
ldx #2
jsr $ffc6 ; CHKIN
l: jsr $ffb7
bne done
jsr $ffcf ; CHRIN
bcs error
jmp l
done:
jsr $ffcc ; CLRCHN
lda #2
jmp $ffc3 ; CLOSE
error:
jmp error
txt_file:
"MASTER"
txt_file_end: