1
0
mirror of https://github.com/hsoft/collapseos.git synced 2024-12-25 17:28:06 +11:00

basic: add fnew and fdel commands

This commit is contained in:
Virgil Dupras 2019-11-25 22:49:24 -05:00
parent 817088f794
commit 264e72e0fd
2 changed files with 29 additions and 0 deletions

View File

@ -224,6 +224,11 @@ handle 1 maps to blkid 2.
Once a file is opened, you can use the mapped blkid as you would with any block
device (bseek, getb, putb).
**fnew <blkcnt> <fname>**: Allocates space of "blkcnt" blocks (each block is
0x100 bytes in size) for a new file names "fname". Maximum blkcnt is 0xff.
**fdel <fname>**: Mark file named "fname" as deleted.
**ldbas <fname>**: loads the content of the file specified in the argument
(as an unquoted filename) and replace the current code listing with this
contents. Any line not starting with a number is ignored (not an error).

View File

@ -4,6 +4,7 @@
.equ BFS_FILE_HDL BFS_RAMSTART
.equ BFS_RAMEND @+FS_HANDLE_SIZE
; Lists filenames in currently active FS
basFLS:
ld iy, .iter
jp fsIter
@ -77,6 +78,25 @@ basFOPEN:
push de \ pop ix ; IX now points to the file handle.
jp fsOpen
; Takes one byte block number to allocate as well we one string arg filename
; and allocates a new file in the current fs.
basFNEW:
call rdExpr ; file block count
ret nz
call rdSep ; HL now points to filename
push ix \ pop de
ld a, e
out (42), a
jp fsAlloc
; Deletes filename with specified name
basFDEL:
call fsFindFN
ret nz
; Found! delete
jp fsDel
basPgmHook:
; Cmd to find is in (DE)
ex de, hl
@ -107,4 +127,8 @@ basFSCmds:
.db "ldbas", 0
.dw basFOPEN
.db "fopen", 0
.dw basFNEW
.db "fnew", 0, 0
.dw basFDEL
.db "fdel", 0, 0
.db 0xff, 0xff, 0xff ; end of table