File-Selector for very long directories (Source) ....
Suche
Index
FAQ
Kontakt
Zurück

File-Selector for very long directories



Ein File-Selector Source für sehr lange Diretories. Dieses Programm funktioniert nur mit echten Laufwerken oder einer 100%igen Emulation !


; --------- basic 4 zeropage    ------------------------------------------

			CURCOL		= $c6	; cursor column (0-39 / 0-79)
			CUROW		= $d8	; cursor row (0-24)
                        CR			= $0D	; CARRIAGE RETURN
			DN			= $d4	; device number
			FNADR		= $da	; ptr $da,$db to filename
			FNLEN		= $d1	; filename's length
			LF			= $d2	; logical file number
			LVFLAG		= $9d	; LOAD/VERIFY flag
			SA			= $d3	; secondary address
			STATUS		= $96	; status ST
			CHRGET		= $70	; subroutine: get next byte of BASIC text
			CHRGOT		= $76	; entry to get same byte of text again
			TXTPTR		= $77	; $77/$78 pointer to next CHRGET byte

			MEMUSS		= $fd	; $7d/$fe tape load temps

; --------- basic 4 subroutines ------------------------------------------


                        SETCUR          = $e067 ; set cursor (ofs col:$c6, row:$d8)
			SCROUT		= $e202	; output A to screen
			ACPTR		= $f1c0	; input IEEE -> A
			CHKIN		= $ffc6	; stdin from logical file # in X
			CIOUT		= $f19e	; output A -> IEEE
			CKOUT		= $ffc9	; stdout to logical file # in X
			CLOSE		= $f2e0	; close file
			CLRCH		= $ffcc	; reset stdio to defaults
			LISTN		= $f0d5	; send LISTEN
			LOAD		= $f408	; LOAD
			LOADOP		= $f356	; LOAD without pointer change
			OPEN		= $f563	; open file
			OPENI		= $f4a5	; open file on IEEE device
			SCNT		= $f2c1	; prepare SETT for logical file A
			SECND		= $f143	; send secondary address A
			SETT		= $f2cd	; set LF,DN,SA from table
			TALK		= $f0d2	; send TALK
			TWAIT		= $f92b	;
			UNLSN		= $f1b9	; send UNLISTEN
			UNTLK		= $f1ae	; send UNTALK
			READY		= $b3ff	; basic warm start
			CLRSCR		= $e015	; clear screen
			INTOUT		= $cf83	; write integer 0-65535 X=LSB,A=MSB
			CRLF		= $d534	; move cursor to next line

; --------- kernel subroutines ------------------------------------------

			BASIN		= $ffcf ; read char from input channel -> A
			BSOUT		= $ffd2	; Write A to stdout
			GETIN		= $ffe4	; read char from keyboard buffer -> A

;----------------------------------------------------------------------------
firstline    = $0a
lastline     = $0b
s_lo         = $fb
s_hi         = $fc
linelenght   = $fe
get          = $ffe4


!to "dir.prg",cbm
*=$1000


;----------------------------------------------------------------------------
; DIRECTORY
;----------------------------------------------------------------------------



               jsr CLRSCR
               jsr build_title
               lda #$01
               sta FNLEN
               lda #$08
               sta DN
               lda #$00
               sta menuline
               sta menupage
               sta lines
               sta STATUS
               sta $da                 ; FNADR = $da; ptr $da,$db to filename
               lda #$12
               sta $db
               lda #$60                ;DATA SA 0
               sta SA
               jsr OPENI               ; open file
               jsr TALK
               lda SA
               jsr SECND
               lda #$03
               sta CUROW
               jsr SETCUR
               ldy #3



list_blocks:
-              sty FNLEN
               jsr ACPTR
               sta MEMUSS              ; store blocks LSB
               ldy STATUS
               bne +
               jsr ACPTR
               sta MEMUSS + 1          ; store blocks MSB
               ldy STATUS
               bne +
               ldy FNLEN
               dey
               bne -
               ldx MEMUSS
               lda MEMUSS + 1
               jsr INTOUT              ; write #blocks to screen
               lda #' '


listing:
               jsr SCROUT
getbyte:       jsr ACPTR               ; read byte from IEEE
               ldx STATUS
+              bne stoplisting
               cmp #0
               beq newline
               jsr SCROUT              ; write filename and type
               bne getbyte             ; then continue
newline:       lda #CR
               jsr SCROUT
               inc ofset
               inc lines
               lda lines
               cmp #$14
               beq nextpage
               jsr GETIN
               cmp #27
               beq stoplisting
               ldy #$02
-              bne list_blocks
nextpage:
               jsr GETIN
               cmp #'S'
               beq lightbar
               cmp #27
               beq stoplisting
               cmp #$20
               bne nextpage
               jsr CLRSCR
               lda #$00
               sta lines
               jsr build_title
               lda #$03
               sta CUROW
               jsr SETCUR
               ldy #$02
               bne -

stoplisting:   jsr $f72f               ; close file with $E0, unlisten
               jsr CRLF
               pla
               pla
               jmp READY               ; BASIC warm start

build_title:
               ldy #00
-              lda title,y
               sta $8000,y
               iny
               cpy #$50
               bne -
               rts

; lightbar setup

lightbar:

               lda #$80                ; ofs first line
               sta s_hi
               lda #$f0
               sta s_lo
               lda #$1d                ; lenght of the line
               sta linelenght
               lda #$00                ; first line (+ofs)
               sta firstline
               lda lines
               sta lastline
               dec lastline



; build inverted highlighting at second line
;

              jsr j0


; move by keyboard

main:
               jsr get
               cmp #27                 ; esc-key
               beq +
               cmp #$11                ; cursor down
               beq move_down
               cmp #$91                ; cursor up
               beq move_up
               jmp main

+              ldy #$00
-              lda (s_lo),y
               and #%01111111
               sta (s_lo),y
               iny
               cpy linelenght
               bne -
               lda #00
               sta menuline
               jmp nextpage
; move-routines
move_down:
               lda menuline
               cmp lastline
               bne +
               jmp main
+              inc menuline
               clc
               ldy #$00
-              lda (s_lo),y
               and #%01111111
               sta (s_lo),y
               iny
               bcc +
               inc s_hi
+              cpy linelenght
               bne -
               lda s_lo
               clc
               adc #$50
               sta s_lo
               bcc j0
               inc s_hi
j0:            clc
               ldy #$00
-              lda (s_lo),y
               ora #%10000000
               sta (s_lo),y
               iny
               bcc +
               inc s_hi
+              cpy linelenght
               bne -
               jmp main
move_up:
               lda menuline
               cmp firstline
               bne +
               jmp main
+              dec menuline
               clc
               ldy #$00
-              lda (s_lo),y
               and #%01111111
               sta (s_lo),y
               iny
               bcc +
               inc s_hi
+              cpy linelenght
               bne -
               lda s_lo
               sec
               sbc #$50
               sta s_lo
               bcs +
               dec s_hi
+              bne j0
               jmp main




*=$1200
!TX "$"
lines: !by $00
menuline    !by $00
ofset !by $00
title:   !scr"*** cbm 8000 tiny directory explorer ***                                        "

 

Letzte Änderung: 2019-01-04 09:54:18
  Rubrik:  CBM PET
Rubriken-Übersicht
 9 Besucher online 

Valid XHTML 1.0 Transitional Valid CSS!