Reading disk directory to screen

Basic and Machine Language

Moderator: Moderators

tlr
Vic 20 Nerd
Posts: 567
Joined: Mon Oct 04, 2004 10:53 am

Post by tlr »

Jeff-20 wrote:I wasn't very clear because I'm not sure exactly of what I want. I think I wanted a simple wedge that I could put in a convenient spot like 673 - 767.
There you go: dir673.zip

Code: Select all

;**************************************************************************
;*
;* FILE  dir673.asm
;* Written by Daniel Kahlin
;*
;* DESCRIPTION
;*   Perform disk directory.
;*
;*   LOAD"DIR673",8,1
;*   SYS673
;*
;******
        processor 6502
        org     $02a1

;**************************************************************************
;*
;* NAME  dir
;*
;* DESCRIPTION
;*   Perform disk directory listing.
;*
;******
dir:
        lda     #1
        ldx     $ba
        ldy     #0
        jsr     $ffba
;       lda     #1      ;NAMELEN=1
        ldx     #<dirname
        ldy     #>dirname
        jsr     $ffbd
        jsr     $ffc0
        ldx     #1
        jsr     $ffc6
        
; skip load addr
        jsr     $ffcf
        jsr     $ffcf

d_lp1:
; check for RUN/STOP
        jsr     $ffe1
        beq     d_ex1
        
; skip link
        jsr     $ffcf
        jsr     $ffcf

        lda     $90             ; check status
        bne     d_ex1           ; EOF or error, exit

        lda     #13
        jsr     $ffd2

; line no
        jsr     $ffcf
        tax
        jsr     $ffcf
        jsr     $ddcd

; line contents
        lda     #" "
        jsr     $ffd2
d_lp2:
        jsr     $ffcf
        beq     d_lp1
        jsr     $ffd2
        lda     $90             ; check for errors
        beq     d_lp2           ; none, loop to next line

d_ex1:
        jsr     $ffcc
        lda     #1
        jmp     $ffc3
;       rts
dirname:
        dc.b    "$"
        echo    .

; eof
Post Reply