1
0
mirror of https://github.com/hsoft/collapseos.git synced 2025-04-11 07:58:16 +10:00

print value of memory pointer when no arguments are given

This commit is contained in:
Valentin Lenhart 2019-10-09 22:05:29 +02:00
parent 83b314c450
commit 23be234762

View File

@ -220,13 +220,19 @@ shellPrintErr:
; directive *just* after your '.inc "shell.asm"'. Voila! ; directive *just* after your '.inc "shell.asm"'. Voila!
; ;
; Set memory pointer to the specified address (word). ; Set memory pointer to the specified address (word) ors print the current value.
; Example: mptr 01fe ; Example: mptr 01fe
shellMptrCmd: shellMptrCmd:
.db "mptr", 0b011, 0b001, 0 .db "mptr", 0b111, 0b001, 0
shellMptr: shellMptr:
push hl push hl
ld a, (hl)
inc hl
and (hl)
dec hl
jr z, .print
; reminder: z80 is little-endian ; reminder: z80 is little-endian
ld a, (hl) ld a, (hl)
ld (SHELL_MEM_PTR+1), a ld (SHELL_MEM_PTR+1), a
@ -234,6 +240,7 @@ shellMptr:
ld a, (hl) ld a, (hl)
ld (SHELL_MEM_PTR), a ld (SHELL_MEM_PTR), a
.print:
ld hl, (SHELL_MEM_PTR) ld hl, (SHELL_MEM_PTR)
ld a, h ld a, h
call printHex call printHex