Skip to content

Commit

Permalink
sh: Add heap command
Browse files Browse the repository at this point in the history
  • Loading branch information
ry755 committed May 27, 2024
1 parent 716d0bc commit 9a46d8d
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 1 deletion.
6 changes: 6 additions & 0 deletions applications/sh/commands/commands.asm
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,11 @@ shell_parse_command:
call compare_string
ifz jmp shell_getreg_command

; heap
mov r1, shell_heap_command_string
call compare_string
ifz jmp shell_heap_command

; help
mov r1, shell_help_command_string
call compare_string
Expand Down Expand Up @@ -210,6 +215,7 @@ shell_invalid_command_string: data.str "invalid command or FXF binary" data.8 10
#include "commands/echo.asm"
#include "commands/exit.asm"
#include "commands/head.asm"
#include "commands/heap.asm"
#include "commands/help.asm"
#include "commands/if.asm"
#include "commands/math.asm"
Expand Down
2 changes: 1 addition & 1 deletion applications/sh/commands/echo.asm
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
; clear command
; echo command

shell_echo_command_string: data.strz "echo"
shell_echoregd_command_string: data.strz "echoregd"
Expand Down
21 changes: 21 additions & 0 deletions applications/sh/commands/heap.asm
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
; heap command

shell_heap_command_string: data.strz "heap"

shell_heap_command:
call heap_usage
push r0
call print_decimal_to_terminal
mov r0, shell_heap_command_bytes_string
call print_str_to_terminal

pop r0
div r0, 1024
call print_decimal_to_terminal
mov r0, shell_heap_command_kib_string
call print_str_to_terminal

ret

shell_heap_command_bytes_string: data.str " bytes" data.8 10 data.8 0
shell_heap_command_kib_string: data.str " KiB" data.8 10 data.8 0

0 comments on commit 9a46d8d

Please sign in to comment.