home *** CD-ROM | disk | FTP | other *** search
Text File | 1992-11-05 | 3.7 KB | 119 lines | [04] ASCII Text (0x0000) |
- ;=======================================
- ;DIRECTORY NAVIGATOR
- ;
- ;=================================================
- ;
- ;GETFILES: TRAVERSE THE BUFFER AND STORE THE FILENAMES
- ;
- NUMFILES DFB $00 ;NUMBER OF FILES IN DIRECTORY
- NTRYLEN DFB $00 ;LENGTH OF EACH FILE ENTRY
- FPERBLK DFB $00 ;NUMBER OF FILES PER BLOCK
- BLKPAGE DFB $00 ;PAGE WE ARE ON NOW
- FILSREAD DFB $00 ;NUMBER OF FILES WE READ IN CURRENT BLOCK
- FILEEND DW $00 ;LAST BYTE OF OUR FILE BUFFER
- ;
- GETFILES LDA #<DIRBUFR ;SET PAGE=$20
- STA BLKPAGE
- LDA #$00 ;SET UP ZP POINTER INTO THAT PAGE
- STA TEMP
- LDA BLKPAGE
- STA TEMP+1
- LDA #>FILBUFR ;SET UP ZP POINTER INTO OUR FILE AREA
- STA FPTR
- LDA #<FILBUFR
- STA FPTR+1
- ;
- LDY #$23 ;GET BYTE WITH OFFSET $23 INTO NTRYLEN
- LDA (TEMP),Y
- STA NTRYLEN
- LDY #$24 ;ETC WITH OTHER VALUES
- LDA (TEMP),Y
- STA FPERBLK
- STA FILSREAD
- LDA #$00 ;WE WILL COUNT NUMBER OF FILES
- STA NUMFILES
- DEC FILSREAD ;ONE FILE READ SO FAR (FOR DIR ENTRY)
- ;
- CLC
- LDA TEMP
- ADC NTRYLEN ;GO TO NEXT FILE ENTRY (+27 BYTES)
- STA TEMP
- LDA TEMP+1
- ADC #$00
- STA TEMP+1
- ;
- DOBLOCK INC TEMP ;ADJUST BY 4 BYTES FOR POINTERS AT BEGIN OF BLK
- INC TEMP
- INC TEMP
- INC TEMP
- ;
- NEXTFIL LDY #$00 ;GET THE STORAGE TYPE
- LDA (TEMP),Y
- AND #$F0
- BEQ DONTSTOR ;IF FILE IS DELETED, DON'T STORE IT
- ;
- LDA LOCKFILT
- BEQ STORFILE ;IF WE AREN'T FILTERING LOCKED FILES, CONTINUE
- ;
- LDY #$1E
- LDA (TEMP),Y
- AND #$C2 ;LOOK FOR WRITE, DESTROY, RENAME ACCESS
- BNE DONTSTOR ;IF FILTERING AND UNLOCKED, DONT STORE IT
- ;
- STORFILE INC NUMFILES
- JSR FORMDATA ;SEE SUBROUTINE IN NEXT SEGMENT TO FORMAT DATA
- ;
- DONTSTOR DEC FILSREAD ;ONE MORE FILE WAS READ
- LDA FILSREAD
- BEQ DONEBLK
- ;
- CLC
- LDA TEMP
- ADC NTRYLEN ;GO TO NEXT FILE ENTRY (+27 BYTES)
- STA TEMP
- LDA TEMP+1
- ADC #$00
- STA TEMP+1
- CLV
- BVC NEXTFIL
- ;=========================
- DONEBLK LDA FPERBLK ;RESET COUNT OF FILES IN BLOCK
- STA FILSREAD
- LDA #$00 ;SET UP ZP POINTER INTO BLOCK PAGE
- STA TEMP
- LDA BLKPAGE
- STA TEMP+1
- LDY #$02 ;IF FWD POINTER NON-ZERO, DO NEXT BLOCK
- LDA (TEMP),Y
- BNE NEXTBLK
- INY
- LDA (TEMP),Y
- BNE NEXTBLK
- LDA #$00 ;PUT FINAL ZERO ON OUR PARM AREA
- JSR STORBYTE
- LDA FPTR ;SAVE END OF FILE AREA
- STA FILEEND
- LDA FPTR+1
- STA FILEEND+1
- RTS ;DONE WITH DIRECTORY
- ;
- NEXTBLK INC BLKPAGE
- INC BLKPAGE
- LDA BLKPAGE
- STA TEMP+1 ;GO TO NEXT DIR PAGE
- LDA #$00
- STA TEMP
- JMP DOBLOCK
- ;
- ; SUBROUTINE TO STORE ONE BYTE IN FILE AREA AND INC PTR TO NEXT BYTE
- STORBYTE STY YSAVE
- LDY #$00
- STA (FPTR),Y
- INC FPTR
- BNE STORBYT0
- INC FPTR+1
- STORBYT0 LDY YSAVE
- RTS
- ;
- CHN DIR.SC2
-