Subversion Repositories MB01 Project

Rev

Blame | Last modification | View Log | Download | RSS feed

;; cbm-fs

VIECMAX         .EQU    $1000

mxfils          .EQU    5       ; max # filenames in cmd string
cmdlen          .EQU    96      ; length of command buffer (+ terminator #0)
fntlen          .EQU    97      ; length of canonical file name table 
nbsiz           .EQU    27      ; nambuf text size
dirlen          .EQU    24      ; directory length used
maxfd           .EQU    8       ; max # file descriptors
intfd           .EQU    maxfd+2 ; internal # file descriptors
mxchnls         .EQU    15      ; max # data channels
irdfd           .EQU    maxfd   ; internal fd for read file
iwrfd           .EQU    maxfd+1 ; internal fd for write file

bindx           .EQU    16      ; bam offset index
bamsiz          .EQU    6       ; # bytes/track in bam
numsec          .EQU    40      ; number of logical sectors (blocks)
phisec          .EQU    10      ; number of phisycal sectors / track
dirtrk          .EQU    40      ; system logical track
dirst           .EQU    3       ; starting directory sector
maxtrk          .EQU    81      ; max. logical track + 1
startrk         .EQU    1       ; logical starting track

; max. available blocks's #
maxblks         .EQU    (numsec*(maxtrk-1)-numsec)

dskvern         .EQU    $44     ; disk version number
dosvern         .EQU    $33     ; dos version number
subvern         .EQU    $8D     ; disk sub-version number header ofs. 29 & 30
iobyte          .EQU    $C0     ; default bam i/o byte

MAXDOSDRV       .EQU    4       ; dos drives are 0..3

;deltyp         .EQU    0        ; deleted type
seqtyp          .EQU    1       ; sequential type
prgtyp          .EQU    2       ; program type
usrtyp          .EQU    3       ; user type
reltyp          .EQU    4       ; relative type
partyp          .EQU    5       ; partition type
exetyp          .EQU    6       ; new executable type
typmsk          .EQU    7       ; mask for type bits

; internal use: open function's
rdmode          .EQU    0        ; open read mode
wtmode          .EQU    1       ; open write mode
apmode          .EQU    2       ; open append mode
mdmode          .EQU    3       ; open modify mode
lddir           .EQU    3       ; load directory
seqdir          .EQU    4       ; open dir as seq. file
damode          .EQU    5       ; open direct access type

; error codes
rdtrk           .EQU    20      ; track read error 
badfmt          .EQU    21      ; bad disk format (or unformatted disk)
wrtrk           .EQU    22      ; track write error
rdsec           .EQU    24      ; read error
wrsec           .EQU    25      ; write error
wpon            .EQU    26      ; write protect on
badid           .EQU    29      ; disk id mismatch
badsyn          .EQU    30      ; general syntax
badcmd          .EQU    31      ; invalid command
longln          .EQU    32      ; long line
badfn           .EQU    33      ; invalid filname
nofile          .EQU    34      ; no file given
baddrv          .EQU    35      ; illegal drive number
badchn          .EQU    36      ; illegal channel number
nullln          .EQU    37      ; empty command string
notsam          .EQU    39      ; cannot rename across drives
flock           .EQU    40      ; locked file
fsplt           .EQU    41      ; write file not closed
bnotm           .EQU    42      ; unmatch blocks count
invlnk          .EQU    43      ; invalid file link
badlst          .EQU    44      ; wrong index in last block
filopn          .EQU    60      ; file open
filnop          .EQU    61      ; file not open
flntfd          .EQU    62      ; file not found
flexst          .EQU    63      ; file exists
mistyp          .EQU    64      ; file type mismatch
badts           .EQU    66      ; illegal track or sector
systs           .EQU    67      ; illegal system t or s
wrfil           .EQU    68      ; write only file
rdfil           .EQU    69      ; read only file
nochnl          .EQU    70      ; no channel available
direrr          .EQU    71      ; directory error
dskful          .EQU    72      ; disk full
cbmv2           .EQU    73      ; cbm emulator version
nodriv          .EQU    74      ; drive not ready
opnchn          .EQU    75      ; channel is open
nolinx          .EQU    76      ; no logical index available
fmter           .EQU    77      ; format error
ibmfmt          .EQU    78      ; ibm-formatted disk
syterr          .EQU    79      ; system track read error
dirlnk          .EQU    80      ; corrupted directory link
bamcnt          .EQU    81      ; corrupted bam
badcat          .EQU    82      ; recursive concat
badtlk          .EQU    83      ; invalid talk command
badlsn          .EQU    84      ; invalid listen command

; sezione COMMON -- questo permette di includere il file in piu' file

DPCBMFS: .SECTION page0, ref_only, common
        .ABSOLUTE               ;; inizia sempre da $00
        .ORG    0x00

zpstart         .EQU    $

delsec          .DS     2       ; sector of 1st avail entry
delind          .DS     2       ; index of 1st avail entry
dirsec          .DS     2       ; directory sector of last not empty entry
index           .DS     2       ; index of last not empty entry
track           .DB             ; current track
sector          .DB             ; current sector
dirp            LP              ; long pointer to directory entry
nxtsec          .DB             ; next sector in dir link
type            .DB             ; active file type
mode            .DB             ; active file mode
typflg          .DB             ; match by type flag
patflg          .DB             ; pattern presence flag
f1cnt           .DB             ; file stream 1 count
f2cnt           .DB             ; file stream total count
f1ptr           .DB             ; file stream 1 pointer
f2ptr           .DB             ; file stream 2 pointer
entfnd          .DB             ; dir-entry found flag ($FF = not found)
found           .DB             ; flag found in file stream
tgflg           .DB             ; drive toggle flag
                                ; <7>: search both drives
                                ; <6>: drvnum was toggled

drvnum          .DB             ; current drive

filtbl          .DS     mxfils  ; filename pointer
tmpxxx          .DB             ; extra byte for filtbl/tmp byte
filtrk          .DS     mxfils  ; 1st link/track
filsec          .DS     mxfils  ;    /sector
entsec          .DS     mxfils  ; sector of directory entry
entind          .DS     mxfils  ; index of directory entry
fildrv          .DS     mxfils  ; default flag, drive #
pattyp          .DS     mxfils  ; pattern,replace,closed-flags,type

dpsave          .EQU    $ - zpstart

;----------------------

tlp             LP              ; tmp long pointer
cmdsiz          .DB             ; cmd string size
char            .DB             ; tmp store char
image           .DB             ; file stream image

qfmt            .EQU    cmdsiz  ; quick format flag
idch1           .EQU    char    ; ID format char 1
idch2           .EQU    image   ; ID format char 2
opntm           .EQU    char    ; <7>: open type in parameter
                                ; <6>: open mode in parameter

; virtual iec -----------------------------------------
sa              .DB             ; persistent second addr. virtual iec
viecbuf         .DB             ; virtual iec buffered data
viecsiz         .DW
viecndx         .DW
vieclp          LP
viecfg          .DB             ; virtual iec flag
                                ; <7>: active talk/listen
                                ; <6>: talk (listen if 0)

vcmdix          .DB             ; index to command string
vbufnum         .DB             ; viec buffer #
vcmdsiz         .DB             ; size of virtuasl iec buffer (channel 15)
veof            .DB             ; eof flag

;-----------------------------------------------------
chnl            .DB             ; channel param
cmdnum          .DB             ; command #
bchn            .DB             ; block-op channel
subcmd          .DB             ; blk subcommand # or open type cmd

lsterr          .DB             ; last error

lindx           .DB             ; logical index (internal file descriptor)
linuse          .DB             ; lindx use flags (1=free, 0=busy)
lintab          .DS     mxchnls ; lindx table ($FF = free)
                                ; <7>: write type fd
                                ; <6>: direct access type fd
                                ; <5>: directory load type fd
                                ; <3>: drive
                                ; <2:0> = logical index

drvfg           .DS     2       ; drive flag
                                ; <7>: cbm formatted disk
                                ; <6>: valid format in bit 1,0
                                ; <5>: flag verify in bam iobyte
                                ; <4>: flag write protect on
                                ; <3>: flag new version
                                ;
                                ; <1:0> 00 DD ibm format
                                ;       01 DD cbm format
                                ;       10 HD ibm format
                                ;       11 HD cbm format (not used)

ndbf            .DW             ; # of disk blocks free drive 0
                .DW             ; # of disk blocks free drive 1

sysbuf          .DS     2       ; DMA buffer # of system track cache
trkbuf          .DS     2       ; DMA buffer # of data track cache
wrtbuf          .DS     2       ; DMA buffer # of write buffer cache
dirofs          .DS     2       ; directory cache buffer high pointer (dma)
dirbnk          .DS     2       ; directory cache buffer bank (dma)
trkofs          .DS     2       ; track cache buffer high pointer (dma)
trkbnk          .DS     2       ; track cache buffer bank (dma)
wrtofs          .DS     2       ; write cache pointer
wrtbnk          .DS     2       
tcache          .DS     2       ; current track in cache (0 invalidate cache)
wcache          .DS     2       ; current track in write cache (0 inv. cache)

wbam            .DS     2       ; dirty bam flag

bsize           .DW             ; size of buffer while read/write op
btrf            .DW             ; count of transf. bytes
ntot            .EQU    bsize   ; free block's counter while check file system
bcnt            .EQU    btrf    ; block's count while chech file system

bufp            LP              ; long pointer to read data buffer (cache)
bmpnt           LP              ; bam long pointer
wbuf            LP              ; long pointer to write data buffer

tmp0            .DB             ; temp. byte
wtmp            .DW             ; tmp word

fdst            .DS     maxfd   ; fd status
                                ; <7>: ready
                                ; <6>: eof flag
                                ; <0>: drive
dsec            .DS     maxfd   ; sector of dir entry
dind            .DS     maxfd   ; index of dir entry
ftrk            .DS     maxfd   ; current file track (hi dir ptr for dir list)
fsec            .DS     maxfd   ; current file sector (rdlst for dir list)
fdptr           .DS     maxfd   ; file buffer pointer
fdblk           .DS     maxfd   ; current file block # count
                .DS     maxfd   ; dir. ptr for dir list
fdlst           .DS     maxfd   ; local buffer last byte ptr 
fdix            .DS     maxfd   ; local buffer pointer


wrop            .DB             ; flag write-op
data            .DB             ; buffered byte
rddrv           .DB             ; drive # to read (buffered operation) 
rdidx           .DB             ; pointer to read buffer (buffered operation)
rdlst           .DB             ; pointer to last byte (buffered operation)
rdeof           .DB             ; eof condition (buffered operation)
wrdrv           .DB             ; drive # to write (buffered operation)
wridx           .DB             ; pointer to write buffer (buffered operation)
wsec            .DB             ; last dirty sector in write cache
wfirst          .DB             ; first dirty sector in write cache
wcnt            .DW             ; block's # of write file (buffered operation)

pdrv            .DB             ; used by disk access routines: drive #
pside           .DB             ; side #
psec            .DB             ; start sector #
pcnt            .DB             ; sector(s) count #
pbuf            .DB             ; dma buffer #

dblfd           .DB             ; double index lindx
trap            .DB             ; flag error trap
cmdtrap         .DB             ; no error if command string is empty

        .RELATIVE
        .ENDS

; CBM FS work area
CBMFSW: .SECTION common, ref_only
        .ABSOLUTE
        .ORG    CBMFSW_START

cmdbuf          .DS     cmdlen  ; command buffer
                .DB             ; for terminator '0'
fntab           .DS     fntlen  ; room for one dos filename (80) + one cbm...
                                ; filename (17) or for 5 cbm file names (85)
        
nambuf          .DS     nbsiz   ; directory buffer
nambuf2         .DS     19      ; buffer for store quoted file name

dskser          .LWORD          ; serial in new version
                .LWORD

tos             .DW             ; saved stack pointer
etrk            .DB             ; save track & sector for fmterr function
esec            .DB
dskid1          .DS     2       ; disk id 1
dskid2          .DS     2       ; disk id 2

        .RELATIVE
        .ENDS

CBMVIEC: .SECTION common, ref_only
        .ABSOLUTE
        .ORG    CBMVIEC_START

vixtab          .DS     16
vsiztab         .DS     16
vftab           .DS     16
vopnsa          .DB             ; SA for open command
                .DB
vieccmd         .DS     cmdlen
                .DB


        .RELATIVE
        .ENDS