This commit is contained in:
Irmen de Jong 2020-09-22 23:22:20 +02:00
parent 6f78a32e64
commit 8c63d7cf5b

View File

@ -12,28 +12,29 @@ main {
ldx #<dirname ldx #<dirname
ldy #>dirname ldy #>dirname
jsr c64.SETNAM jsr c64.SETNAM
lda #$08 lda #1
sta $BA ; device #8 ldx #8
lda #$60 ldy #0
sta $B9 ; secondary chn jsr c64.SETLFS
jsr $F3D5 ; open for serial bus devices ; SETLFS + OPEN? jsr c64.OPEN ; OPEN 1,8,0
jsr $F219 ; set input device ldx #1
jsr c64.CHKIN ; define input channel
ldy #$04 ldy #$04
labl1 jsr c64.ACPTR ; input byte on serial bus labl1 jsr c64.CHRIN ; input byte on serial bus
dey dey
bne labl1 ; get rid of Y bytes bne labl1 ; get rid of Y bytes
lda $C6 ; key pressed? lda $C6 ; key pressed?
ora $90 ; or EOF? ora $90 ; or EOF?
bne labl2 ; if yes exit bne labl2 ; if yes exit
jsr c64.ACPTR ; now get the size of the file jsr c64.CHRIN ; now get the size of the file
pha pha
jsr c64.ACPTR jsr c64.CHRIN
tay tay
pla pla
jsr txt.print_uw jsr txt.print_uw
lda #32 lda #32
jsr c64.CHROUT jsr c64.CHROUT
labl3 jsr c64.ACPTR ; now the filename labl3 jsr c64.CHRIN ; now the filename
jsr c64.CHROUT ; put a character to screen jsr c64.CHROUT ; put a character to screen
cmp #0 cmp #0
bne labl3 ; while not 0 encountered bne labl3 ; while not 0 encountered
@ -41,7 +42,8 @@ labl3 jsr c64.ACPTR ; now the filename
jsr c64.CHROUT ; put a CR , end line jsr c64.CHROUT ; put a CR , end line
ldy #$02 ; set 2 bytes to skip ldy #$02 ; set 2 bytes to skip
bne labl1 ; repeat bne labl1 ; repeat
labl2 jsr $F642 ; close serial bus device labl2 lda #1
jsr c64.CLOSE ; close serial bus device
jsr c64.CLRCHN ; restore I/O devices to default jsr c64.CLRCHN ; restore I/O devices to default
rts rts