!to"p4dir.prg",cbm
;---------------------------------------------------------
; Directory Loader for Commodore C16 and Plus/4
;
; (/) 23.3.2017
;---------------------------------------------------------
FNLEN = $00A8 ; Length of current file name
LA = $00AC ; Current logical fiie number
SA = $00AD ; Current secondary address
FA = $00AE ; Current device number
FNADR = $00AF ; Pointer: current file name
STATUS= $90 ; Status Byte
;---------------------------------------------------------
*= $1000
!byte $00,$0b,$10,$0a,$00,$9e,$34,$31,$30,$39,$00,$00,$00
*=$100d
lda #"$" ; filename $
sta $d0 ; save
lda #$d0 ; adress lo byte
sta FNADR
lda #$00 ; high byte
sta FNADR+1
lda #$01 ; length
sta FNLEN
lda #$08 ; drive id
sta FA
lda #$60 ; sec. address
sta SA
jsr $ffc0 ; file open
lda FA
jsr $ffb4 ; talk
lda SA
jsr $ff96 ; send SA after talk
lda #$00
sta STATUS
ldy #$03
-- sty $d0
jsr $ffa5 ; byte from floppy
sta $d1
ldy STATUS
bne ++ ; check status byte
jsr $ffa5 ; get byte
ldy STATUS
bne ++ ; check status byte
ldy $d0
dey
bne --
ldx $d1
jsr $a45f ; 16bit number output
lda #$20 ; space
jsr $ffd2 ; type space
- jsr $ffa5 ; get next byte
ldx STATUS ; status
bne ++
tax ; test byte
beq + ; zero ? go to cr
jsr $ffd2 ; else type again
jmp - ; get next
+ lda #$0d ; cr
jsr $ffd2 ; type
ldy #$02 ; 2 byte block-counter
bne -- ; next line
++ jsr $ffc3 ; close
rtsLetzte Änderung: 2019-01-03 11:15:18