mirror of
https://github.com/hsoft/collapseos.git
synced 2024-11-27 12:08:07 +11:00
shell: rename seek to mptr
going to use `seek` for block devices
This commit is contained in:
parent
c996da8ac8
commit
a5addc989c
@ -20,7 +20,7 @@ increase a number at memory address `0xa100`. First, compile it:
|
|||||||
|
|
||||||
Now, we'll send that code to address `0xa000`:
|
Now, we'll send that code to address `0xa000`:
|
||||||
|
|
||||||
> seek a000
|
> mptr a000
|
||||||
A000
|
A000
|
||||||
> load 8 (resulting binary is 8 bytes long)
|
> load 8 (resulting binary is 8 bytes long)
|
||||||
|
|
||||||
@ -41,17 +41,17 @@ transfer was successful with:
|
|||||||
Good! Now, we can try to run it. Before we run it, let's peek at the value at
|
Good! Now, we can try to run it. Before we run it, let's peek at the value at
|
||||||
`0xa100` (being RAM, it's random):
|
`0xa100` (being RAM, it's random):
|
||||||
|
|
||||||
> seek a100
|
> mptr a100
|
||||||
A100
|
A100
|
||||||
> peek
|
> peek
|
||||||
61
|
61
|
||||||
|
|
||||||
So, we'll expect this to become `62` after we run the code. Let's go:
|
So, we'll expect this to become `62` after we run the code. Let's go:
|
||||||
|
|
||||||
> seek a000
|
> mptr a000
|
||||||
A000
|
A000
|
||||||
> call 00 0000
|
> call 00 0000
|
||||||
> seek a100
|
> mptr a100
|
||||||
A100
|
A100
|
||||||
> peek
|
> peek
|
||||||
62
|
62
|
||||||
|
14
doc/shell.md
14
doc/shell.md
@ -17,7 +17,7 @@ numerical arguments have to be typed in hexadecimal form, without prefix or
|
|||||||
suffix. Lowercase is fine. Single digit is fine for byte (not word) arguments
|
suffix. Lowercase is fine. Single digit is fine for byte (not word) arguments
|
||||||
smaller than `0x10`. Example calls:
|
smaller than `0x10`. Example calls:
|
||||||
|
|
||||||
seek 01ff
|
mptr 01ff
|
||||||
peek 4
|
peek 4
|
||||||
load 1f
|
load 1f
|
||||||
call 00 0123
|
call 00 0123
|
||||||
@ -33,14 +33,14 @@ table describes those codes:
|
|||||||
| `02` | Badly formatted arguments |
|
| `02` | Badly formatted arguments |
|
||||||
| `03` | Out of bounds |
|
| `03` | Out of bounds |
|
||||||
|
|
||||||
## seek
|
## mptr
|
||||||
|
|
||||||
The shell has a global memory pointer (let's call it `memptr`) that is used by
|
The shell has a global memory pointer (let's call it `memptr`) that is used by
|
||||||
other commands. This pointer is 2 bytes long and starts at `0x0000`. To move
|
other commands. This pointer is 2 bytes long and starts at `0x0000`. To move
|
||||||
it, you use the seek command with the new pointer position. The command
|
it, you use the mptr command with the new pointer position. The command
|
||||||
prints out the new `memptr` (just to confirm that it has run). Example:
|
prints out the new `memptr` (just to confirm that it has run). Example:
|
||||||
|
|
||||||
> seek 42ff
|
> mptr 42ff
|
||||||
42FF
|
42FF
|
||||||
|
|
||||||
## peek
|
## peek
|
||||||
@ -49,7 +49,7 @@ Read memory targeted by `memptr` and prints its contents in hexadecimal form.
|
|||||||
This command takes one byte argument (optional, default to 1), the number of
|
This command takes one byte argument (optional, default to 1), the number of
|
||||||
bytes we want to read. Example:
|
bytes we want to read. Example:
|
||||||
|
|
||||||
> seek 0040
|
> mptr 0040
|
||||||
0040
|
0040
|
||||||
> peek 2
|
> peek 2
|
||||||
ED56
|
ED56
|
||||||
@ -83,11 +83,11 @@ return if you don't want to break your system.
|
|||||||
The following example works in the case where you've made yourself a jump table
|
The following example works in the case where you've made yourself a jump table
|
||||||
in your glue code a `jp printstr` at `0x0004`:
|
in your glue code a `jp printstr` at `0x0004`:
|
||||||
|
|
||||||
> seek a000
|
> mptr a000
|
||||||
A000
|
A000
|
||||||
> load 6
|
> load 6
|
||||||
Hello\0 (you can send a null char through a terminal with CTRL+@)
|
Hello\0 (you can send a null char through a terminal with CTRL+@)
|
||||||
> seek 0004
|
> mptr 0004
|
||||||
0004
|
0004
|
||||||
> call 00 a000
|
> call 00 a000
|
||||||
Hello>
|
Hello>
|
||||||
|
@ -42,7 +42,7 @@ SHELL_BUFSIZE .equ 0x20
|
|||||||
|
|
||||||
; *** VARIABLES ***
|
; *** VARIABLES ***
|
||||||
; Memory address that the shell is currently "pointing at" for peek, load, call
|
; Memory address that the shell is currently "pointing at" for peek, load, call
|
||||||
; operations. Set with seek.
|
; operations. Set with mptr.
|
||||||
SHELL_MEM_PTR .equ SHELL_RAMSTART
|
SHELL_MEM_PTR .equ SHELL_RAMSTART
|
||||||
; Used to store formatted hex values just before printing it.
|
; Used to store formatted hex values just before printing it.
|
||||||
SHELL_HEX_FMT .equ SHELL_MEM_PTR+2
|
SHELL_HEX_FMT .equ SHELL_MEM_PTR+2
|
||||||
@ -330,10 +330,10 @@ shellParseArgs:
|
|||||||
;
|
;
|
||||||
|
|
||||||
; Set memory pointer to the specified address (word).
|
; Set memory pointer to the specified address (word).
|
||||||
; Example: seek 01fe
|
; Example: mptr 01fe
|
||||||
shellSeekCmd:
|
shellMptrCmd:
|
||||||
.db "seek", 0b011, 0b001, 0
|
.db "mptr", 0b011, 0b001, 0
|
||||||
shellSeek:
|
shellMptr:
|
||||||
push de
|
push de
|
||||||
push hl
|
push hl
|
||||||
|
|
||||||
@ -468,5 +468,5 @@ shellCall:
|
|||||||
; This table is at the very end of the file on purpose. The idea is to be able
|
; This table is at the very end of the file on purpose. The idea is to be able
|
||||||
; to graft extra commands easily after an include in the glue file.
|
; to graft extra commands easily after an include in the glue file.
|
||||||
shellCmdTbl:
|
shellCmdTbl:
|
||||||
.dw shellSeekCmd, shellPeekCmd, shellLoadCmd, shellCallCmd
|
.dw shellMptrCmd, shellPeekCmd, shellLoadCmd, shellCallCmd
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user