If the second OPEN and the line with JSR CHKOUT are commented out, the JSR CHRIN will result in loading the first byte of the inputfile into A.
But, when the second OPEN is executed, JSR CHRIN does not read a byte from the inputfile.
I can't figure out why.
;Open file for INPUT lda #5 ldx #8 ldy #2 jsr SETLFS lda #(end_filename-filename) ldx #<filename ldy #>filename jsr SETNAM jsr OPEN LDX #5 jsr CHKIN ;Open file for OUTPUT lda #6 ldx #8 ldy #6 jsr SETLFS lda #(end_filenamedest-filenamedest) ldx #<filenamedest ldy #>filenamedest jsr SETNAM jsr OPEN LDX #1 JSR CHKOUT JSR CHRIN