mirror of
https://github.com/bobbimanners/Applecorn.git
synced 2024-11-05 02:08:07 +00:00
Added support for *FREE (prints blks used atm)
This commit is contained in:
parent
95e106e757
commit
f5a8a65e96
BIN
applecorn.po
BIN
applecorn.po
Binary file not shown.
@ -344,7 +344,7 @@ FSCHND
|
||||
|
||||
FSCDRIVE JMP DRIVE
|
||||
|
||||
FSCFREE
|
||||
FSCFREE JMP FREE
|
||||
|
||||
FSCACCESS
|
||||
|
||||
@ -615,6 +615,35 @@ CHDIRRET
|
||||
BRK
|
||||
:EXIT RTS
|
||||
|
||||
* Handle *FREE command
|
||||
FREE LDA (OSLPTR),Y ; First char
|
||||
CMP #$3A ; Colon
|
||||
BNE :ERR
|
||||
JSR PARSLPTR ; Copy arg->MOSFILE
|
||||
CMP #$03 ; Check 3 char arg
|
||||
BEQ :HASPARM
|
||||
:ERR BRK
|
||||
DB $DC
|
||||
ASC 'Syntax: FREE :sd (eg: DRIVE :61)'
|
||||
BRK
|
||||
:HASPARM >>> XF2MAIN,DRVINFO
|
||||
|
||||
FREERET
|
||||
>>> ENTAUX
|
||||
JSR CHKERROR
|
||||
CMP #$00
|
||||
BEQ :NOERR
|
||||
BRK
|
||||
DB $CE ; Bad directory
|
||||
ASC 'Bad dir'
|
||||
BRK
|
||||
:NOERR LDX AUXBLK ; Blocks used
|
||||
LDY AUXBLK+1
|
||||
JSR PRDECXY ; Print in decimal
|
||||
JSR FORCENL
|
||||
RTS
|
||||
|
||||
|
||||
* Parse filename pointed to by XY
|
||||
* Write filename to MOSFILE in main memory
|
||||
* Returns length in A
|
||||
|
@ -74,30 +74,6 @@ BEEP PHA
|
||||
PLA
|
||||
RTS
|
||||
|
||||
** Delay approx 1/100 sec
|
||||
*************************
|
||||
** Enter at DELAY with CS to test keyboard
|
||||
** Enter at CENTI to ignore keyboard
|
||||
**
|
||||
*CENTI CLC ; Don't test keyboard
|
||||
*DELAY PHX ; 3cy
|
||||
* PHY ; 3cy
|
||||
* LDY #10 ; 2cy 10 * 1/1000s
|
||||
**------------------------------------------------
|
||||
*:L1 LDX #$48 ; 2cy $48 gives about 1/1000s
|
||||
*:L2 BCC :L3 ; 2cy/3cy Don't test kbd
|
||||
* LDA $C000 ; 4cy
|
||||
* BMI :L5 ; 2cy keypress, exit early
|
||||
*:L3 DEX ; 2cy
|
||||
* BNE :L2 ; 3cy/2cy -> 72*(2+2+4+2+2+3)-1
|
||||
** ; = 1079 -> 0.00105s
|
||||
**------------------------------------------------
|
||||
*:L4 DEY ; 2cy
|
||||
* BNE :L1 ; 3cy/2cy
|
||||
*:L5 PLY ; 4cy
|
||||
* PLX ; 4cy
|
||||
* RTS ; 6cy
|
||||
|
||||
* Print string pointed to by X,Y to the screen
|
||||
OUTSTR TXA
|
||||
|
||||
@ -146,6 +122,49 @@ PRNIB CMP #$0A
|
||||
:S1 ADC #'0' ; < $0A
|
||||
JMP OSWRCH
|
||||
|
||||
* Print 16 bit value in XY in decimal
|
||||
* beebwiki.mdfs.net/Number_output_in_6502_machine_code
|
||||
PRDECXY STX :NUM+0
|
||||
STY :NUM+1
|
||||
LDA #' '
|
||||
STA :PAD
|
||||
:PRDEC16 LDY #$08 ; Five digits
|
||||
:LP1 LDX #$FF
|
||||
SEC
|
||||
:LP2 LDA :NUM+0
|
||||
SBC :TENS+0,Y
|
||||
STA :NUM+0
|
||||
LDA :NUM+1
|
||||
SBC :TENS+1,Y
|
||||
STA :NUM+1
|
||||
INX
|
||||
BCS :LP2
|
||||
LDA :NUM+0
|
||||
ADC :TENS+0,Y
|
||||
STA :NUM+0
|
||||
LDA :NUM+1
|
||||
ADC :TENS+1,Y
|
||||
STA :NUM+1
|
||||
TXA
|
||||
BNE :DIGIT
|
||||
LDA :PAD
|
||||
BNE :PRINT
|
||||
BEQ :NEXT
|
||||
:DIGIT LDX #'0'
|
||||
STX :PAD
|
||||
ORA #'0'
|
||||
:PRINT JSR OSWRCH
|
||||
:NEXT DEY
|
||||
DEY
|
||||
BPL :LP1
|
||||
RTS
|
||||
:PAD DB $00
|
||||
:NUM DW $0000
|
||||
:TENS DW 1
|
||||
DW 10
|
||||
DW 100
|
||||
DW 1000
|
||||
DW 10000
|
||||
|
||||
* GSINIT - Initialise for GSTRANS string parsing
|
||||
************************************************
|
||||
@ -445,7 +464,3 @@ MOSVEND
|
||||
AUXBLK ASC '**ENDOFCODE**'
|
||||
DS $200-13
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
57
mainmem.s
57
mainmem.s
@ -143,7 +143,6 @@ RESET TSX
|
||||
|
||||
* Copy 512 bytes from BLKBUF to AUXBLK in aux LC
|
||||
COPYAUXBLK
|
||||
SEI
|
||||
>>> ALTZP ; Alt ZP & Alt LC on
|
||||
|
||||
LDY #$00
|
||||
@ -167,7 +166,6 @@ COPYAUXBLK
|
||||
BRA :L2
|
||||
|
||||
:S2 >>> MAINZP ; Alt ZP off, ROM back in
|
||||
CLI
|
||||
RTS
|
||||
|
||||
* TO DO: All OSFILE calls combined and dispatch in here
|
||||
@ -194,21 +192,8 @@ DELFILE >>> ENTMAIN
|
||||
BCC :DELETED
|
||||
PLX ; Drop object
|
||||
JSR CHKNOTFND
|
||||
* CMP #$44 ; Path not found
|
||||
* BEQ :NOTFND
|
||||
* CMP #$45 ; Volume dir not found
|
||||
* BEQ :NOTFND
|
||||
* CMP #$46 ; File not found
|
||||
* BNE :EXIT
|
||||
*:NOTFND LDA #$00 ; 'Not found'
|
||||
* BRA :EXIT
|
||||
PHA
|
||||
:DELETED PLA ; Get object back
|
||||
* LDA #$02 ; Prepare A=2, it was a dir
|
||||
* LDX GINFOPL+7 ; Storage type
|
||||
* CPX #$0D
|
||||
* BEQ :EXIT ; It was a directory
|
||||
* LDA #$01 ; A=1, it was a file
|
||||
:EXIT >>> XF2AUX,OSFILERET
|
||||
|
||||
DESTROY LDA #<MOSFILE ; Attempt to destroy file
|
||||
@ -565,9 +550,7 @@ LOADFILE >>> ENTMAIN
|
||||
STA GINFOPL+1
|
||||
LDA #>MOSFILE
|
||||
STA GINFOPL+2
|
||||
JSR MLI ; Call GET_FILE_INFO
|
||||
DB GINFOCMD
|
||||
DW GINFOPL
|
||||
JSR GETINFO ; GET_FILE_INFO
|
||||
BCS :READERR
|
||||
LDA GINFOPL+5 ; Aux type LSB
|
||||
STA FBLOAD+0
|
||||
@ -614,9 +597,7 @@ EXISTS LDA #<MOSFILE
|
||||
STA GINFOPL+1
|
||||
LDA #>MOSFILE
|
||||
STA GINFOPL+2
|
||||
JSR MLI ; GET_FILE_INFO
|
||||
DB GINFOCMD
|
||||
DW GINFOPL
|
||||
JSR GETINFO ; GET_FILE_INFO
|
||||
BCS :NOEXIST
|
||||
LDA GINFOPL+7 ; Storage type
|
||||
CMP #$0D
|
||||
@ -808,9 +789,7 @@ UPDFB LDA #<MOSFILE
|
||||
LDA #>MOSFILE
|
||||
STA OPENPL+2
|
||||
STA GINFOPL+2
|
||||
JSR MLI ; Call GET_FILE_INFO
|
||||
DB GINFOCMD
|
||||
DW GINFOPL
|
||||
JSR GETINFO ; Call GET_FILE_INFO
|
||||
BCC :UPDFB1
|
||||
JMP CHKNOTFND
|
||||
|
||||
@ -1038,6 +1017,34 @@ SETPFX >>> ENTMAIN
|
||||
:ERR LDA #$40 ; Invalid pathname syn
|
||||
BRA :EXIT
|
||||
|
||||
* Obtain info on blocks used/total blocks
|
||||
DRVINFO >>> ENTMAIN
|
||||
JSR PREPATH
|
||||
BCS :ERR
|
||||
LDA #<MOSFILE
|
||||
STA GINFOPL+1
|
||||
LDA #>MOSFILE
|
||||
STA GINFOPL+2
|
||||
JSR GETINFO ; GET_FILE_INFO
|
||||
BCS :EXIT
|
||||
PHA
|
||||
>>> ALTZP ; Alt ZP & Alt LC on
|
||||
LDA GINFOPL+8 ; Blcks used LSB
|
||||
STA AUXBLK
|
||||
LDA GINFOPL+9 ; Blks used MSB
|
||||
STA AUXBLK+1
|
||||
>>> MAINZP ; ALt ZP off, ROM back in
|
||||
PLA
|
||||
:EXIT >>> XF2AUX,FREERET
|
||||
:ERR LDA #$40 ; Invalid pathname syn
|
||||
BRA :EXIT
|
||||
|
||||
* Geyt file info
|
||||
GETINFO JSR MLI
|
||||
DB GINFOCMD
|
||||
DW GINFOPL
|
||||
RTS
|
||||
|
||||
* Create disk file
|
||||
CRTFILE JSR MLI
|
||||
DB CREATCMD
|
||||
@ -1381,5 +1388,3 @@ QUITPL HEX 04 ; Number of parameters
|
||||
MFTEMP DS 65 ; Temp copy of MOSFILE
|
||||
PREFIX DS 65 ; Buffer for ProDOS prefix
|
||||
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user