fox32rom/monitor/commands/commands.asm

56 lines
1.8 KiB
NASM
Raw Permalink Normal View History

2022-04-26 06:46:47 +02:00
; command parser
monitor_shell_parse_command:
mov r0, MONITOR_SHELL_TEXT_BUF_BOTTOM
2023-12-23 05:16:57 +01:00
; loop over the table of commands
mov r2, monitor_shell_command_table
monitor_shell_parse_command_loop:
mov r1, [r2]
2022-04-26 06:46:47 +02:00
call compare_string
2023-12-23 05:16:57 +01:00
; if the string matches, jump to the corresponding address in the table
ifz jmp [r2+4]
; otherwise, move to the next entry
add r2, 8
; if the entry is zero, then we have reached the end of the table
cmp [r2], 0
ifnz jmp monitor_shell_parse_command_loop
2022-05-02 03:03:04 +02:00
; invalid command
mov r0, monitor_shell_invalid_command_string
call print_string_to_monitor
call redraw_monitor_console
2022-04-26 06:46:47 +02:00
ret
2023-12-23 05:16:57 +01:00
monitor_shell_command_table:
data.32 monitor_shell_exit_command_string
data.32 monitor_shell_exit_command
data.32 monitor_shell_help_command_string
data.32 monitor_shell_help_command
data.32 monitor_shell_jump_command_string
data.32 monitor_shell_jump_command
data.32 monitor_shell_list_command_string
data.32 monitor_shell_list_command
data.32 monitor_shell_load_command_string
data.32 monitor_shell_load_command
data.32 monitor_shell_reg_command_string
data.32 monitor_shell_reg_command
data.32 monitor_shell_set8_command_string
data.32 monitor_shell_set8_command
data.32 monitor_shell_set16_command_string
data.32 monitor_shell_set16_command
data.32 monitor_shell_set32_command_string
data.32 monitor_shell_set32_command
data.32 0 data.32 0
monitor_shell_invalid_command_string: data.str "invalid command" data.8 10 data.8 0
2022-04-26 06:46:47 +02:00
; all commands
#include "monitor/commands/exit.asm"
#include "monitor/commands/help.asm"
2022-05-13 00:10:24 +02:00
#include "monitor/commands/jump.asm"
#include "monitor/commands/list.asm"
2023-03-31 02:36:48 +02:00
#include "monitor/commands/load.asm"
#include "monitor/commands/reg.asm"
2022-05-02 03:03:04 +02:00
#include "monitor/commands/set.asm"