1
0
mirror of https://github.com/hsoft/collapseos.git synced 2024-11-24 00:08:06 +11:00

recipes/trs80: add CFS support

This commit is contained in:
Virgil Dupras 2020-02-22 20:06:59 -05:00
parent ec6df3087d
commit 2860a10f71
2 changed files with 45 additions and 3 deletions

View File

@ -214,6 +214,11 @@ In addition to this, there is a `flush` command to ensure that dirty buffers are
synced to disk. Make sure you run this after a write operation or before synced to disk. Make sure you run this after a write operation or before
swapping disks. swapping disks.
On top of that, there's CFS support builtin. To enable a FS, type `fson` while
the active block device is properly placed (you can initialize a new FS by
writing `CFS\0\0\0\0` to the disk). If it doesn't error out, commands like
`fls` and `fnew` will work. Don't forget to flush when you're finished :)
There is also a custom `recv` command that does the same "ping pong" as in There is also a custom `recv` command that does the same "ping pong" as in
`recv.asm`, but once. It puts the result in `A`. This can be useful to send down `recv.asm`, but once. It puts the result in `A`. This can be useful to send down
a raw CFS: you just need a while loop that repeatedly call `recv:putb a`. a raw CFS: you just need a while loop that repeatedly call `recv:putb a`.

View File

@ -2,6 +2,8 @@
.equ RAMEND 0xcfff .equ RAMEND 0xcfff
; Address of the *CL driver. Same as in recv.asm ; Address of the *CL driver. Same as in recv.asm
.equ COM_DRV_ADDR 0x0238 .equ COM_DRV_ADDR 0x0238
; in sync with user.h. Last BAS_RAMEND: 0x5705
.equ USER_CODE 0x5800
; Free memory in TRSDOS starts at 0x3000 ; Free memory in TRSDOS starts at 0x3000
.org 0x3000 .org 0x3000
@ -9,6 +11,7 @@
.inc "err.h" .inc "err.h"
.inc "blkdev.h" .inc "blkdev.h"
.inc "fs.h"
.inc "ascii.h" .inc "ascii.h"
.inc "core.asm" .inc "core.asm"
.inc "str.asm" .inc "str.asm"
@ -19,16 +22,22 @@
.inc "trs80/floppy.asm" .inc "trs80/floppy.asm"
.equ BLOCKDEV_RAMSTART FLOPPY_RAMEND .equ BLOCKDEV_RAMSTART FLOPPY_RAMEND
.equ BLOCKDEV_COUNT 1 .equ BLOCKDEV_COUNT 3
.inc "blockdev.asm" .inc "blockdev.asm"
; List of devices ; List of devices
.dw floppyGetB, floppyPutB .dw floppyGetB, floppyPutB
.dw blk1GetB, blk1PutB
.dw blk2GetB, blk2PutB
.equ STDIO_RAMSTART BLOCKDEV_RAMEND .equ STDIO_RAMSTART BLOCKDEV_RAMEND
.equ STDIO_GETC trs80GetC .equ STDIO_GETC trs80GetC
.equ STDIO_PUTC trs80PutC .equ STDIO_PUTC trs80PutC
.inc "stdio.asm" .inc "stdio.asm"
.equ FS_RAMSTART STDIO_RAMEND
.equ FS_HANDLE_COUNT 2
.inc "fs.asm"
; The TRS-80 generates a double line feed if we give it both CR and LF. ; The TRS-80 generates a double line feed if we give it both CR and LF.
.equ printcrlf printcr .equ printcrlf printcr
@ -36,7 +45,7 @@
; RAM space used in different routines for short term processing. ; RAM space used in different routines for short term processing.
.equ SCRATCHPAD_SIZE STDIO_BUFSIZE .equ SCRATCHPAD_SIZE STDIO_BUFSIZE
.equ SCRATCHPAD STDIO_RAMEND .equ SCRATCHPAD FS_RAMEND
.inc "lib/util.asm" .inc "lib/util.asm"
.inc "lib/ari.asm" .inc "lib/ari.asm"
.inc "lib/parse.asm" .inc "lib/parse.asm"
@ -50,14 +59,19 @@
.inc "basic/var.asm" .inc "basic/var.asm"
.equ BUF_RAMSTART VAR_RAMEND .equ BUF_RAMSTART VAR_RAMEND
.inc "basic/buf.asm" .inc "basic/buf.asm"
.equ BFS_RAMSTART BUF_RAMEND
.inc "basic/fs.asm"
.inc "basic/blk.asm" .inc "basic/blk.asm"
.inc "basic/floppy.asm" .inc "basic/floppy.asm"
.equ BAS_RAMSTART BUF_RAMEND .equ BAS_RAMSTART BFS_RAMEND
.inc "basic/main.asm" .inc "basic/main.asm"
.out BAS_RAMEND
init: init:
ld sp, RAMEND ld sp, RAMEND
call floppyInit call floppyInit
call fsInit
call basInit call basInit
ld hl, basFindCmdExtra ld hl, basFindCmdExtra
ld (BAS_FINDHOOK), hl ld (BAS_FINDHOOK), hl
@ -124,6 +138,9 @@ basFindCmdExtra:
ld hl, basBLKCmds ld hl, basBLKCmds
call basFindCmd call basFindCmd
ret z ret z
ld hl, basFSCmds
call basFindCmd
ret z
ld hl, .cmds ld hl, .cmds
jp basFindCmd jp basFindCmd
@ -132,4 +149,24 @@ basFindCmdExtra:
.dw recvCmd .dw recvCmd
.db 0xff ; end of table .db 0xff ; end of table
; *** blkdev 1: file handle 0 ***
blk1GetB:
ld ix, FS_HANDLES
jp fsGetB
blk1PutB:
ld ix, FS_HANDLES
jp fsPutB
; *** blkdev 2: file handle 1 ***
blk2GetB:
ld ix, FS_HANDLES+FS_HANDLE_SIZE
jp fsGetB
blk2PutB:
ld ix, FS_HANDLES+FS_HANDLE_SIZE
jp fsPutB
RAMSTART: RAMSTART: