1
0
mirror of https://github.com/hsoft/collapseos.git synced 2024-11-17 06:18:06 +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 *** ; *** REQUIREMENTS ***
; stdio ; stdio
; blkdev
; *** DEFINES *** ; *** 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 ; SHELL_EXTRA_CMD_COUNT: Number of extra cmds to be expected after the regular
; ones. See comment in COMMANDS section for details. ; ones. See comment in COMMANDS section for details.
; SHELL_RAMSTART ; SHELL_RAMSTART
@ -397,8 +396,7 @@ shellPeek:
; Load the specified number of bytes (max 0xff) from IO and write them in the ; 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 ; current memory pointer (which doesn't change). This gets chars from
; SHELL_IO_GETC, which can be different from STDIO_GETC. Coupled with the ; blkGetCW.
; "blockdev" part, this allows you to dynamically select your IO source.
; Control is returned to the shell only after all bytes are read. ; Control is returned to the shell only after all bytes are read.
; ;
; Example: load 42 ; Example: load 42
@ -411,7 +409,7 @@ shellLoad:
ld a, (hl) ld a, (hl)
ld b, a ld b, a
ld hl, (SHELL_MEM_PTR) ld hl, (SHELL_MEM_PTR)
.loop: SHELL_IO_GETC .loop: call blkGetCW
jr nz, .ioError jr nz, .ioError
ld (hl), a ld (hl), a
inc hl inc hl
@ -428,8 +426,7 @@ shellLoad:
; Load the specified number of bytes (max 0xff) from the current memory pointer ; 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 ; 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 ; blkPutC.
; "blockdev" part, this allows you to dynamically select your IO source.
; Control is returned to the shell only after all bytes are written. ; Control is returned to the shell only after all bytes are written.
; ;
; Example: save 42 ; Example: save 42
@ -445,7 +442,7 @@ shellSave:
.loop: .loop:
ld a, (hl) ld a, (hl)
inc hl inc hl
SHELL_IO_PUTC call blkPutC
djnz .loop djnz .loop
.end: .end:

View File

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

View File

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

View File

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