Created
May 10, 2021 22:22
-
-
Save rw-r-r-0644/555177c7d040d0b507a7b5d331bd4525 to your computer and use it in GitHub Desktop.
IOSU logs over lolserial
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.arm.big | |
.open "patches/sections/0x08120000.bin","patches/patched_sections/0x08120000.bin",0x08120000 | |
CODE_SECTION_BASE equ 0x08120000 | |
CODE_SECTION_SIZE equ 0x00015000 | |
CODE_BASE equ (CODE_SECTION_BASE + CODE_SECTION_SIZE) | |
RODATA_SECTION_BASE equ 0x08140000 | |
RODATA_SECTION_SIZE equ 0x00002478 | |
RODATA_BASE equ (RODATA_SECTION_BASE + RODATA_SECTION_SIZE) | |
DATA_SECTION_BASE equ 0x08143000 | |
DATA_SECTION_SIZE equ 0x0000D000 | |
DATA_BASE equ (DATA_SECTION_BASE + DATA_SECTION_SIZE) | |
BSS_SECTION_BASE equ 0x08150000 | |
BSS_SECTION_SIZE equ 0x00061230 | |
BSS_BASE equ (BSS_SECTION_BASE + BSS_SECTION_SIZE) | |
; Output data from SWI syscall 4 | |
.org 0x0812dd68 | |
b svcAB_handler | |
.org CODE_BASE | |
; redirect __sys_write0 to lolserial | |
svcAB_handler: | |
ldmia sp, {r0, r1} | |
cmp r0, #0x4 | |
mov r0, r1 | |
bleq lolserial_print | |
ldmia sp!, {r0-r12, pc}^ | |
LOLSERIAL_WAIT_TICKS equ 200 | |
GP_SENSORBAR equ 0x00000100 | |
GP_SENSORBAR_SHIFT equ 8 | |
lolserial_print: | |
mov r1, #-1 | |
lolserial_lprint: | |
push {r5-r6} | |
add r1, r1, r0 | |
ldr r6, =0x0D800000 | |
ldr r5, [r6, #0x0FC] | |
bic r5, r5, #GP_SENSORBAR | |
str r5, [r6, #0x0FC] | |
ldr r5, [r6, #0x0DC] | |
orr r5, r5, #GP_SENSORBAR | |
str r5, [r6, #0x0DC] | |
ldr r5, [r6, #0x0E4] | |
orr r5, r5, #GP_SENSORBAR | |
str r5, [r6, #0x0E4] | |
ldr r5, [r6, #0x0E0] | |
orr r5, r5, #GP_SENSORBAR | |
str r5, [r6, #0x0E0] | |
lolserial_send_string_loop: | |
cmp r0, r1 | |
ldrneb r5, [r0], #1 | |
cmpne r5, #0 | |
beq lolserial_send_string_end | |
mov r3, #0x200 | |
orr r3, r3, r5, lsl #1 | |
lolserial_send_char_loop: | |
and r4, r3, #1 | |
ldr r5, [r6, #0x0E0] | |
bic r5, r5, #GP_SENSORBAR | |
orr r5, r5, r4, lsl #GP_SENSORBAR_SHIFT | |
str r5, [r6, #0x0E0] | |
ldr r5, [r6, #0x010] | |
adds r4, r5, #LOLSERIAL_WAIT_TICKS | |
bcc timer_wait_loop | |
timer_wait_overflow_loop: | |
ldr r2, [r6, #0x010] | |
cmp r2, r5 | |
bhs timer_wait_overflow_loop | |
timer_wait_loop: | |
ldr r5, [r6, #0x010] | |
cmp r5, r4 | |
blo timer_wait_loop | |
movs r3, r3, lsr #1 | |
bne lolserial_send_char_loop | |
b lolserial_send_string_loop | |
lolserial_send_string_end: | |
pop {r5-r6} | |
bx lr | |
.Close |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment