1
0
mirror of https://github.com/hsoft/collapseos.git synced 2024-12-24 14:38:05 +11:00

shell: de-macro-ize

This commit is contained in:
Virgil Dupras 2019-05-17 08:21:37 -04:00
parent 56760b5aba
commit 45b8e84e2a
4 changed files with 5 additions and 14 deletions

View File

@ -15,10 +15,9 @@
; *** REQUIREMENTS ***
; stdio
; blkdev
; *** DEFINES ***
; SHELL_IO_GETC: Macro that calls a GetC routine for I/O ("load" cmd)
; SHELL_IO_PUTC: Macro that calls a PutC routine for I/O ("save" cmd)
; SHELL_EXTRA_CMD_COUNT: Number of extra cmds to be expected after the regular
; ones. See comment in COMMANDS section for details.
; SHELL_RAMSTART
@ -397,8 +396,7 @@ shellPeek:
; Load the specified number of bytes (max 0xff) from IO and write them in the
; current memory pointer (which doesn't change). This gets chars from
; SHELL_IO_GETC, which can be different from STDIO_GETC. Coupled with the
; "blockdev" part, this allows you to dynamically select your IO source.
; blkGetCW.
; Control is returned to the shell only after all bytes are read.
;
; Example: load 42
@ -411,7 +409,7 @@ shellLoad:
ld a, (hl)
ld b, a
ld hl, (SHELL_MEM_PTR)
.loop: SHELL_IO_GETC
.loop: call blkGetCW
jr nz, .ioError
ld (hl), a
inc hl
@ -428,8 +426,7 @@ shellLoad:
; Load the specified number of bytes (max 0xff) from the current memory pointer
; and write them to I/O. Memory pointer doesn't move. This puts chars to
; SHELL_IO_PUTC, which can be different from STDIO_PUTC. Coupled with the
; "blockdev" part, this allows you to dynamically select your IO source.
; blkPutC.
; Control is returned to the shell only after all bytes are written.
;
; Example: save 42
@ -445,7 +442,7 @@ shellSave:
.loop:
ld a, (hl)
inc hl
SHELL_IO_PUTC
call blkPutC
djnz .loop
.end:

View File

@ -25,8 +25,6 @@ STDIO_RAMSTART .equ BLOCKDEV_RAMEND
#include "stdio.asm"
SHELL_RAMSTART .equ STDIO_RAMEND
.define SHELL_IO_GETC call aciaGetC
.define SHELL_IO_PUTC call aciaPutC
SHELL_EXTRA_CMD_COUNT .equ 0
#include "shell.asm"

View File

@ -40,8 +40,6 @@ STDIO_RAMSTART .equ BLOCKDEV_RAMEND
#include "stdio.asm"
SHELL_RAMSTART .equ STDIO_RAMEND
.define SHELL_IO_GETC call blkGetCW
.define SHELL_IO_PUTC call blkPutC
SHELL_EXTRA_CMD_COUNT .equ 3
#include "shell.asm"
.dw sdcInitializeCmd, blkBselCmd, blkSeekCmd

View File

@ -30,8 +30,6 @@ STDIO_RAMSTART .equ BLOCKDEV_RAMEND
#include "fs_cmds.asm"
SHELL_RAMSTART .equ FS_RAMEND
.define SHELL_IO_GETC call blkGetC
.define SHELL_IO_PUTC call blkPutC
SHELL_EXTRA_CMD_COUNT .equ 7
#include "shell.asm"
.dw blkBselCmd, blkSeekCmd, fsOnCmd, flsCmd, fnewCmd, fdelCmd, fopnCmd