mirror of
https://github.com/hsoft/collapseos.git
synced 2024-12-26 04:28:05 +11:00
shell: make arg in peek/poke mandatory
Also, make `0` mean `0x100`.
This commit is contained in:
parent
5e31de0bac
commit
bd2877e012
@ -295,22 +295,17 @@ shellMptr:
|
|||||||
ret
|
ret
|
||||||
|
|
||||||
|
|
||||||
; peek byte where memory pointer points to any display its value. If the
|
; peek the number of bytes specified by argument where memory pointer points to
|
||||||
; optional numerical byte arg is supplied, this number of bytes will be printed
|
; and display their value. If 0 is specified, 0x100 bytes are peeked.
|
||||||
;
|
;
|
||||||
; Example: peek 2 (will print 2 bytes)
|
; Example: peek 2 (will print 2 bytes)
|
||||||
shellPeekCmd:
|
shellPeekCmd:
|
||||||
.db "peek", 0b101, 0, 0
|
.db "peek", 0b001, 0, 0
|
||||||
shellPeek:
|
shellPeek:
|
||||||
push bc
|
push bc
|
||||||
push de
|
|
||||||
push hl
|
push hl
|
||||||
|
|
||||||
ld a, (hl)
|
ld a, (hl)
|
||||||
cp 0
|
|
||||||
jr nz, .arg1isset ; if arg1 is set, no need for a default
|
|
||||||
ld a, 1 ; default for arg1
|
|
||||||
.arg1isset:
|
|
||||||
ld b, a
|
ld b, a
|
||||||
ld hl, (SHELL_MEM_PTR)
|
ld hl, (SHELL_MEM_PTR)
|
||||||
.loop: ld a, (hl)
|
.loop: ld a, (hl)
|
||||||
@ -321,26 +316,19 @@ shellPeek:
|
|||||||
|
|
||||||
.end:
|
.end:
|
||||||
pop hl
|
pop hl
|
||||||
pop de
|
|
||||||
pop bc
|
pop bc
|
||||||
xor a
|
xor a
|
||||||
ret
|
ret
|
||||||
|
|
||||||
; poke byte where memory pointer points and set them to bytes types through
|
; poke specified number of bytes where memory pointer points and set them to
|
||||||
; stdioGetC. If the optional numerical byte arg is supplied, this number of
|
; bytes typed through stdioGetC. Blocks until all bytes have been fetched.
|
||||||
; bytes will be expected from stdioGetC. Blocks until all bytes have been
|
|
||||||
; fetched.
|
|
||||||
shellPokeCmd:
|
shellPokeCmd:
|
||||||
.db "poke", 0b101, 0, 0
|
.db "poke", 0b001, 0, 0
|
||||||
shellPoke:
|
shellPoke:
|
||||||
push bc
|
push bc
|
||||||
push hl
|
push hl
|
||||||
|
|
||||||
ld a, (hl)
|
ld a, (hl)
|
||||||
or a ; cp 0
|
|
||||||
jr nz, .arg1isset ; if arg1 is set, no need for a default
|
|
||||||
ld a, 1 ; default for arg1
|
|
||||||
.arg1isset:
|
|
||||||
ld b, a
|
ld b, a
|
||||||
ld hl, (SHELL_MEM_PTR)
|
ld hl, (SHELL_MEM_PTR)
|
||||||
.loop: call stdioGetC
|
.loop: call stdioGetC
|
||||||
|
Loading…
Reference in New Issue
Block a user