monitor: Add load
command
This commit is contained in:
parent
5729ff6c71
commit
67e448abd3
|
@ -24,6 +24,11 @@ monitor_shell_parse_command:
|
|||
call compare_string
|
||||
ifz jmp monitor_shell_list_command
|
||||
|
||||
; load
|
||||
mov r1, monitor_shell_load_command_string
|
||||
call compare_string
|
||||
ifz jmp monitor_shell_load_command
|
||||
|
||||
; set.8
|
||||
mov r1, monitor_shell_set8_command_string
|
||||
call compare_string
|
||||
|
@ -53,4 +58,5 @@ monitor_shell_invalid_command_string: data.str "invalid command" data.8 10 data.
|
|||
#include "monitor/commands/help.asm"
|
||||
#include "monitor/commands/jump.asm"
|
||||
#include "monitor/commands/list.asm"
|
||||
#include "monitor/commands/load.asm"
|
||||
#include "monitor/commands/set.asm"
|
||||
|
|
|
@ -15,5 +15,6 @@ monitor_shell_help_text:
|
|||
data.str "help | display this help text" data.8 10
|
||||
data.str "jump | jump to address $0" data.8 10
|
||||
data.str "list | list memory contents starting at address $0" data.8 10
|
||||
data.str "load | load disk $0's sector $1 to buffer at address $2 of size $3 sectors" data.8 10
|
||||
data.str "set.SZ | set [$0] to $1; equivalent to `mov.SZ [$0], $1`" data.8 10
|
||||
data.8 0
|
||||
|
|
49
monitor/commands/load.asm
Normal file
49
monitor/commands/load.asm
Normal file
|
@ -0,0 +1,49 @@
|
|||
; jump command
|
||||
|
||||
monitor_shell_load_command_string: data.strz "load"
|
||||
|
||||
monitor_shell_load_command:
|
||||
call monitor_shell_parse_arguments
|
||||
|
||||
; r0: pointer to disk id string
|
||||
; r1: pointer to source sector number string
|
||||
; r2: pointer to destination address string
|
||||
; r3: pointer to number of sectors string
|
||||
|
||||
push r3
|
||||
push r2
|
||||
push r1
|
||||
mov r1, 16
|
||||
call string_to_int
|
||||
mov r10, r0
|
||||
pop r0
|
||||
mov r1, 16
|
||||
call string_to_int
|
||||
mov r11, r0
|
||||
pop r0
|
||||
mov r1, 16
|
||||
call string_to_int
|
||||
mov r12, r0
|
||||
pop r0
|
||||
mov r1, 16
|
||||
call string_to_int
|
||||
mov r13, r0
|
||||
|
||||
; r10: disk id
|
||||
; r11: source sector number
|
||||
; r12: destination address
|
||||
; r13: number of sectors
|
||||
|
||||
mov r31, r13
|
||||
cmp r31, 0
|
||||
ifz ret
|
||||
mov r0, r11
|
||||
mov r1, r10
|
||||
mov r2, r12
|
||||
monitor_shell_load_command_loop:
|
||||
call read_sector
|
||||
inc r0
|
||||
add r2, 512
|
||||
loop monitor_shell_load_command_loop
|
||||
|
||||
ret
|
Loading…
Reference in New Issue
Block a user