mirror of
https://github.com/hsoft/collapseos.git
synced 2024-11-23 20:08:05 +11:00
Code consolidation
This commit is contained in:
parent
ce49fc15d0
commit
af13b0bd00
@ -127,6 +127,18 @@ printcrlf:
|
|||||||
SHELL_PUTC
|
SHELL_PUTC
|
||||||
ret
|
ret
|
||||||
|
|
||||||
|
; Print the hex char in A
|
||||||
|
printHex:
|
||||||
|
push af
|
||||||
|
push hl
|
||||||
|
ld hl, SHELL_HEX_FMT
|
||||||
|
call fmtHexPair
|
||||||
|
ld a, 2
|
||||||
|
call printnstr
|
||||||
|
pop hl
|
||||||
|
pop af
|
||||||
|
ret
|
||||||
|
|
||||||
; Parse command (null terminated) at HL and calls it
|
; Parse command (null terminated) at HL and calls it
|
||||||
shellParse:
|
shellParse:
|
||||||
push af
|
push af
|
||||||
@ -204,11 +216,7 @@ shellPrintErr:
|
|||||||
|
|
||||||
ld hl, .str
|
ld hl, .str
|
||||||
call printstr
|
call printstr
|
||||||
|
call printHex
|
||||||
ld hl, SHELL_HEX_FMT
|
|
||||||
call fmtHexPair
|
|
||||||
ld a, 2
|
|
||||||
call printnstr
|
|
||||||
call printcrlf
|
call printcrlf
|
||||||
|
|
||||||
pop hl
|
pop hl
|
||||||
@ -334,31 +342,23 @@ shellParseArgs:
|
|||||||
shellMptrCmd:
|
shellMptrCmd:
|
||||||
.db "mptr", 0b011, 0b001, 0
|
.db "mptr", 0b011, 0b001, 0
|
||||||
shellMptr:
|
shellMptr:
|
||||||
push de
|
|
||||||
push hl
|
push hl
|
||||||
|
|
||||||
; z80 is little endian. in a "ld hl, (nn)" op, L is loaded from the
|
; reminder: z80 is little-endian
|
||||||
; first byte, H is loaded from the second.
|
|
||||||
ld a, (hl)
|
ld a, (hl)
|
||||||
ld (SHELL_MEM_PTR+1), a
|
ld (SHELL_MEM_PTR+1), a
|
||||||
inc hl
|
inc hl
|
||||||
ld a, (hl)
|
ld a, (hl)
|
||||||
ld (SHELL_MEM_PTR), a
|
ld (SHELL_MEM_PTR), a
|
||||||
|
|
||||||
ld de, (SHELL_MEM_PTR)
|
ld hl, (SHELL_MEM_PTR)
|
||||||
ld hl, SHELL_HEX_FMT
|
ld a, h
|
||||||
ld a, d
|
call printHex
|
||||||
call fmtHexPair
|
ld a, l
|
||||||
ld a, 2
|
call printHex
|
||||||
call printnstr
|
|
||||||
ld a, e
|
|
||||||
call fmtHexPair
|
|
||||||
ld a, 2
|
|
||||||
call printnstr
|
|
||||||
call printcrlf
|
call printcrlf
|
||||||
|
|
||||||
pop hl
|
pop hl
|
||||||
pop de
|
|
||||||
xor a
|
xor a
|
||||||
ret
|
ret
|
||||||
|
|
||||||
@ -382,12 +382,7 @@ shellPeek:
|
|||||||
ld b, a
|
ld b, a
|
||||||
ld hl, (SHELL_MEM_PTR)
|
ld hl, (SHELL_MEM_PTR)
|
||||||
.loop: ld a, (hl)
|
.loop: ld a, (hl)
|
||||||
ex hl, de
|
call printHex
|
||||||
ld hl, SHELL_HEX_FMT
|
|
||||||
call fmtHexPair
|
|
||||||
ld a, 2
|
|
||||||
call printnstr
|
|
||||||
ex hl, de
|
|
||||||
inc hl
|
inc hl
|
||||||
djnz .loop
|
djnz .loop
|
||||||
call printcrlf
|
call printcrlf
|
||||||
|
Loading…
Reference in New Issue
Block a user