diff --git a/applecorn.po b/applecorn.po index c2b0fae..e59bf7d 100644 Binary files a/applecorn.po and b/applecorn.po differ diff --git a/applecorn.s b/applecorn.s index a8de2bd..19aff2e 100644 --- a/applecorn.s +++ b/applecorn.s @@ -186,3 +186,5 @@ MAINZP MAC + + diff --git a/auxmem.bytwrd.s b/auxmem.bytwrd.s index 02883e0..5765d02 100644 --- a/auxmem.bytwrd.s +++ b/auxmem.bytwrd.s @@ -541,3 +541,5 @@ OSBM2 ASC ').' + + diff --git a/auxmem.chario.s b/auxmem.chario.s index cfd1618..adc4fa7 100644 --- a/auxmem.chario.s +++ b/auxmem.chario.s @@ -445,3 +445,5 @@ KBDDONE RTS + + diff --git a/auxmem.hostfs.s b/auxmem.hostfs.s index 5ca07d7..8532711 100644 --- a/auxmem.hostfs.s +++ b/auxmem.hostfs.s @@ -901,3 +901,5 @@ ERROR2E DW $C800 + + diff --git a/auxmem.init.s b/auxmem.init.s index 8af4403..6e2106f 100644 --- a/auxmem.init.s +++ b/auxmem.init.s @@ -158,3 +158,5 @@ HELLO ASC 'Applecorn MOS 2021-09-06 snapshot' + + diff --git a/auxmem.misc.s b/auxmem.misc.s index 2de4571..409dbd8 100644 --- a/auxmem.misc.s +++ b/auxmem.misc.s @@ -472,3 +472,5 @@ AUXBLK ASC '**ENDOFCODE**' + + diff --git a/auxmem.mosequ.s b/auxmem.mosequ.s index a683d7c..3568f85 100644 --- a/auxmem.mosequ.s +++ b/auxmem.mosequ.s @@ -74,3 +74,5 @@ OSFILECB EQU $2EE ; OSFILE control block + + diff --git a/auxmem.oscli.s b/auxmem.oscli.s index 35e1a6f..2760413 100644 --- a/auxmem.oscli.s +++ b/auxmem.oscli.s @@ -574,3 +574,5 @@ ECHO3 PHP + + diff --git a/auxmem.vdu.s b/auxmem.vdu.s index d3b98d0..8e2e4b2 100644 --- a/auxmem.vdu.s +++ b/auxmem.vdu.s @@ -503,3 +503,5 @@ BYTEA0 LDY #79 ; Read VDU variable $09,$0A + + diff --git a/extract b/extract index e124611..7c6567c 100755 --- a/extract +++ b/extract @@ -1,10 +1,10 @@ #!/bin/sh -for file in APPLECORN AUXMEM.BYTWRD AUXMEM.CHARIO AUXMEM.HOSTFS AUXMEM.INIT AUXMEM.MISC AUXMEM.MOSEQU AUXMEM.OSCLI AUXMEM.VDU MAINMEM.FSEQU MAINMEM.INIT MAINMEM.LDR MAINMEM.LISTS MAINMEM.MENU MAINMEM.MISC MAINMEM.PATH MAINMEM.SVC; do +for file in APPLECORN AUXMEM.BYTWRD AUXMEM.CHARIO AUXMEM.HOSTFS AUXMEM.INIT AUXMEM.MISC AUXMEM.MOSEQU AUXMEM.OSCLI AUXMEM.VDU MAINMEM.FSEQU MAINMEM.INIT MAINMEM.LDR MAINMEM.LISTS MAINMEM.MENU MAINMEM.MISC MAINMEM.PATH MAINMEM.SVC MAINMEM.WILD; do cadius extractfile applecorn.po /APPLECORN/${file}.S . rm _FileInformation.txt cadius clearhighbit ${file}.S\#040000 cadius indentfile ${file}.S\#040000 - FNAME=`echo ${file}.s | tr [:upper:] [:lower:]` + FNAME=`echo ${file}.S | tr [:upper:] [:lower:]` mv -v ${file}.S\#040000 $FNAME done git diff diff --git a/mainmem.fsequ.s b/mainmem.fsequ.s index d3635bd..507aa3d 100644 --- a/mainmem.fsequ.s +++ b/mainmem.fsequ.s @@ -50,3 +50,5 @@ GEOFCMD EQU $D1 + + diff --git a/mainmem.init.s b/mainmem.init.s index 7c2d6d0..f620c17 100644 --- a/mainmem.init.s +++ b/mainmem.init.s @@ -96,3 +96,5 @@ RESET TSX + + diff --git a/mainmem.ldr.s b/mainmem.ldr.s index 4701e23..2fbdc09 100644 --- a/mainmem.ldr.s +++ b/mainmem.ldr.s @@ -125,3 +125,5 @@ CANTOPEN ASC "Unable to open ROM file" + + diff --git a/mainmem.lists.s b/mainmem.lists.s index 1a3ce34..5f24725 100644 --- a/mainmem.lists.s +++ b/mainmem.lists.s @@ -100,3 +100,5 @@ QUITPL HEX 04 ; Number of parameters + + diff --git a/mainmem.menu.s b/mainmem.menu.s index 5591ea9..ffaa375 100644 --- a/mainmem.menu.s +++ b/mainmem.menu.s @@ -131,3 +131,5 @@ ROM8 STR "USERROM2.ROM" + + diff --git a/mainmem.misc.s b/mainmem.misc.s index a54c7b6..33cb744 100644 --- a/mainmem.misc.s +++ b/mainmem.misc.s @@ -149,3 +149,5 @@ FILEREFS DB $00,$00,$00,$00 + + diff --git a/mainmem.path.s b/mainmem.path.s index 33dac84..d26ece7 100644 --- a/mainmem.path.s +++ b/mainmem.path.s @@ -276,3 +276,5 @@ PREFIX DS 65 ; Buffer for ProDOS prefix + + diff --git a/mainmem.svc.s b/mainmem.svc.s index 7436663..efb36cc 100644 --- a/mainmem.svc.s +++ b/mainmem.svc.s @@ -801,3 +801,5 @@ MAINRDEXIT >>> XF2AUX,NULLRTS ; Back to an RTS + + diff --git a/mainmem.wild.s b/mainmem.wild.s index c534b02..4cf79be 100644 --- a/mainmem.wild.s +++ b/mainmem.wild.s @@ -9,197 +9,197 @@ * append the segment as it is. Uses MFTEMP to build up the path. * Returns with carry set if wildcard match fails, clear otherwise WILDCARD - STZ :LAST - LDX #$00 ; Start with first char - STX MFTEMP ; Clear MFTEMP (len=0) - PHX -:L1 PLX - JSR SEGMENT ; Extract segment of pathname - BCC :NOTLST - DEC :LAST -:NOTLST PHX - LDA SEGBUF ; Length of segment - BNE :S1 ; Check for zero length segments - LDA :LAST ; If not the last segment ... - BEQ :L1 ; ... go again -:S1 JSR HASWILD ; See if it has '*'/'#'/'?' - BCS :WILD ; It does - JSR APPSEG ; Not wild: Append SEGBUF to MFTEMP - BRA :NEXT -:WILD LDX #MFTEMP ; in the directory path MFTEMP - JSR SRCHDIR - BCS :NOMATCH ; Wildcard did not match anything - JSR APPSEG ; Append modified SEGBUF to MFTEMP -:NEXT LDA :LAST - BEQ :L1 - PLX - JSR TMPtoMF ; Copy the path we built to MOSFILE - CLC - RTS -:NOMATCH PLX - SEC - RTS -:LAST DB $00 ; Flag for last segment + STZ :LAST + LDX #$00 ; Start with first char + STX MFTEMP ; Clear MFTEMP (len=0) + PHX +:L1 PLX + JSR SEGMENT ; Extract segment of pathname + BCC :NOTLST + DEC :LAST +:NOTLST PHX + LDA SEGBUF ; Length of segment + BNE :S1 ; Check for zero length segments + LDA :LAST ; If not the last segment ... + BEQ :L1 ; ... go again +:S1 JSR HASWILD ; See if it has '*'/'#'/'?' + BCS :WILD ; It does + JSR APPSEG ; Not wild: Append SEGBUF to MFTEMP + BRA :NEXT +:WILD LDX #MFTEMP ; in the directory path MFTEMP + JSR SRCHDIR + BCS :NOMATCH ; Wildcard did not match anything + JSR APPSEG ; Append modified SEGBUF to MFTEMP +:NEXT LDA :LAST + BEQ :L1 + PLX + JSR TMPtoMF ; Copy the path we built to MOSFILE + CLC + RTS +:NOMATCH PLX + SEC + RTS +:LAST DB $00 ; Flag for last segment * Copy a segment of the path into SEGBUF * PREPATH makes all paths absolute, so always begins with '/' * On entry: X contains index of first char in MOSFILE to process * Set carry if no more segments, clear otherwise -SEGMENT LDY #$00 -:L1 CPX MOSFILE ; See if we are done - BEQ :NOMORE - LDA MOSFILE+1,X - CMP #'/' - BEQ :DONE - STA SEGBUF+1,Y - INX - INY - BRA :L1 -:DONE STY SEGBUF ; Record the length - LDA #$00 - STA SEGBUF+1,Y ; Null terminate for MATCH - INX ; Skip the slash - CLC ; Not the last one - RTS -:NOMORE STY SEGBUF ; Record the length - LDA #$00 - STA SEGBUF+1,Y ; Null terminate for MATCH - SEC ; Last segment - RTS +SEGMENT LDY #$00 +:L1 CPX MOSFILE ; See if we are done + BEQ :NOMORE + LDA MOSFILE+1,X + CMP #'/' + BEQ :DONE + STA SEGBUF+1,Y + INX + INY + BRA :L1 +:DONE STY SEGBUF ; Record the length + LDA #$00 + STA SEGBUF+1,Y ; Null terminate for MATCH + INX ; Skip the slash + CLC ; Not the last one + RTS +:NOMORE STY SEGBUF ; Record the length + LDA #$00 + STA SEGBUF+1,Y ; Null terminate for MATCH + SEC ; Last segment + RTS * See if SEGBUF contains any of '*', '#', '?' * Set carry if wild, clear otherwise -HASWILD LDX #$00 -:L1 CPX SEGBUF ; At end? - BEQ :NOTWILD - LDA SEGBUF+1,X - CMP #'*' - BEQ :WILD - CMP #'#' - BEQ :WILD - CMP #'?' - BEQ :WILD - INX - BRA :L1 -:NOTWILD CLC - RTS -:WILD SEC - RTS +HASWILD LDX #$00 +:L1 CPX SEGBUF ; At end? + BEQ :NOTWILD + LDA SEGBUF+1,X + CMP #'*' + BEQ :WILD + CMP #'#' + BEQ :WILD + CMP #'?' + BEQ :WILD + INX + BRA :L1 +:NOTWILD CLC + RTS +:WILD SEC + RTS * Append SEGBUF to MFTEMP -APPSEG LDY MFTEMP ; Dest idx = length - LDA #'/' ; Add a '/' separator - STA MFTEMP+1,Y - INY - LDX #$00 ; Source idx -:L1 CPX SEGBUF ; At end? - BEQ :DONE - LDA SEGBUF+1,X - STA MFTEMP+1,Y - INX - INY - BRA :L1 -:DONE STY MFTEMP ; Update length - RTS +APPSEG LDY MFTEMP ; Dest idx = length + LDA #'/' ; Add a '/' separator + STA MFTEMP+1,Y + INY + LDX #$00 ; Source idx +:L1 CPX SEGBUF ; At end? + BEQ :DONE + LDA SEGBUF+1,X + STA MFTEMP+1,Y + INX + INY + BRA :L1 +:DONE STY MFTEMP ; Update length + RTS * Read directory, apply wildcard match * Inputs: directory name in XY (Pascal string) * If there is a match, replaces SEGBUF with the first match and CLC * If no match, or any other error, returns with carry set -SRCHDIR STX OPENPL+1 - STY OPENPL+2 - JSR OPENFILE - BCS :NODIR - LDA OPENPL+5 ; File ref num - STA READPL+1 -:L1 JSR RDFILE ; Read->BLKBUF - BCC :S1 - CMP #$4C ; EOF - BEQ :EOF - BRA :BADDIR -:S1 JSR SRCHBLK ; Handle one block - BCS :MATCH - BRA :L1 -:MATCH CLC - PHP - BRA :CLOSE +SRCHDIR STX OPENPL+1 + STY OPENPL+2 + JSR OPENFILE + BCS :NODIR + LDA OPENPL+5 ; File ref num + STA READPL+1 +:L1 JSR RDFILE ; Read->BLKBUF + BCC :S1 + CMP #$4C ; EOF + BEQ :EOF + BRA :BADDIR +:S1 JSR SRCHBLK ; Handle one block + BCS :MATCH + BRA :L1 +:MATCH CLC + PHP + BRA :CLOSE :BADDIR -:EOF SEC - PHP -:CLOSE LDA OPENPL+5 - STA CLSPL+1 - JSR CLSFILE - PLP - RTS -:NODIR SEC - RTS +:EOF SEC + PHP +:CLOSE LDA OPENPL+5 + STA CLSPL+1 + JSR CLSFILE + PLP + RTS +:NODIR SEC + RTS * Apply wildcard match to a directory block * Directory block is in BLKBUF * On exit: set carry if match, clear carry otherwise -SRCHBLK LDA BLKBUF+4 ; Obtain storage type - AND #$E0 ; Mask 3 MSBs - CMP #$E0 - BNE :NOTKEY - LDX #$01 ; Skip dir name - BRA :L1 -:NOTKEY LDX #$00 -:L1 PHX - JSR MATCHENT - PLX - BCS :MATCH - INX - CPX #13 ; Number of dirents in block - BNE :L1 - CLC ; Fell off end, no match -:MATCH RTS +SRCHBLK LDA BLKBUF+4 ; Obtain storage type + AND #$E0 ; Mask 3 MSBs + CMP #$E0 + BNE :NOTKEY + LDX #$01 ; Skip dir name + BRA :L1 +:NOTKEY LDX #$00 +:L1 PHX + JSR MATCHENT + PLX + BCS :MATCH + INX + CPX #13 ; Number of dirents in block + BNE :L1 + CLC ; Fell off end, no match +:MATCH RTS * Apply wildcard match to a directory entry * On entry: X = dirent index in BLKBUF * On exit: set carry if match, clear carry otherwise -MATCHENT LDA #BLKBUF+4 - STA A1H -:L1 CPX #$00 - BEQ :S1 - CLC - LDA #$27 ; Size of dirent - ADC A1L - STA A1L - LDA #$00 - ADC A1H - STA A1H - DEX - BRA :L1 -:S1 LDY #$00 - LDA (A1L),Y ; Length byte - BEQ :NOMATCH ; Inactive entry - INC A1L ; Inc ptr, skip length byte - BNE :S2 - INC A1H -:S2 JSR MATCH ; Try wildcard match - BCC :NOMATCH - LDA A1L ; Decrement ptr again - BNE :S3 - DEC A1H -:S3 DEC A1L - LDY #$00 ; If matches, copy matching filename - LDA (A1L),Y ; Length of filename - AND #$0F ; Mask out other ProDOS stuff - STA SEGBUF - TAY -:L2 CPY #$00 - BEQ :MATCH - LDA (A1L),Y - STA SEGBUF,Y - DEY - BRA :L2 -:MATCH SEC - RTS -:NOMATCH CLC - RTS +MATCHENT LDA #BLKBUF+4 + STA A1H +:L1 CPX #$00 + BEQ :S1 + CLC + LDA #$27 ; Size of dirent + ADC A1L + STA A1L + LDA #$00 + ADC A1H + STA A1H + DEX + BRA :L1 +:S1 LDY #$00 + LDA (A1L),Y ; Length byte + BEQ :NOMATCH ; Inactive entry + INC A1L ; Inc ptr, skip length byte + BNE :S2 + INC A1H +:S2 JSR MATCH ; Try wildcard match + BCC :NOMATCH + LDA A1L ; Decrement ptr again + BNE :S3 + DEC A1H +:S3 DEC A1L + LDY #$00 ; If matches, copy matching filename + LDA (A1L),Y ; Length of filename + AND #$0F ; Mask out other ProDOS stuff + STA SEGBUF + TAY +:L2 CPY #$00 + BEQ :MATCH + LDA (A1L),Y + STA SEGBUF,Y + DEY + BRA :L2 +:MATCH SEC + RTS +:NOMATCH CLC + RTS * From: http://6502.org/source/strings/patmatch.htm * Input: A NUL-terminated, <255-length pattern at address PATTERN. @@ -207,48 +207,45 @@ MATCHENT LDA #= 15 - ; TODO: No overflow check +SEGBUF DS 65 ; For storing path segments (Pascal str)