diff --git a/fox32rom.def b/fox32rom.def index 8454e10..43b5754 100644 --- a/fox32rom.def +++ b/fox32rom.def @@ -58,8 +58,9 @@ write_sector: jmp [0xF0045004] ; memory copy/compare jump table copy_memory_bytes: jmp [0xF0046000] copy_memory_words: jmp [0xF0046004] -compare_memory_bytes: jmp [0xF0046008] -compare_memory_words: jmp [0xF004600C] +copy_string: jmp [0xF0046008] +compare_memory_bytes: jmp [0xF004600C] +compare_memory_words: jmp [0xF0046010] ; event types const EVENT_TYPE_MOUSE_CLICK: 0x00000000 diff --git a/main.asm b/main.asm index c327389..4a216c3 100644 --- a/main.asm +++ b/main.asm @@ -155,6 +155,7 @@ get_rom_version: #include "overlay.asm" #include "panic.asm" #include "ryfs.asm" + #include "string.asm" #include "vsync.asm" @@ -227,6 +228,7 @@ get_rom_version: org.pad 0xF0046000 data.32 copy_memory_bytes data.32 copy_memory_words + data.32 copy_string data.32 compare_memory_bytes data.32 compare_memory_words diff --git a/string.asm b/string.asm new file mode 100644 index 0000000..bef50a2 --- /dev/null +++ b/string.asm @@ -0,0 +1,24 @@ +; copy string from source pointer to destination pointer +; if the source and destination overlap, the behavior is undefined +; inputs: +; r0: pointer to source +; r1: pointer to destinaton +; outputs: +; none +copy_string: + push r0 + push r1 + push r2 + +copy_string_loop: + mov.8 r2, [r0] + mov.8 [r1], r2 + inc r0 + inc r1 + cmp.8 r2, 0 + ifnz jmp copy_string_loop + + pop r2 + pop r1 + pop r0 + ret