ntr-hb-menu/exception-stub/source/start.s
ApacheThunder fcec9c72d0 Add UI changes...
* Added background graphics for bottom screen console
* Used new font for bottom screen. A stripped down version of the
misaki-gothic used by GodMode9i ->
https://github.com/DS-Homebrew/GodMode9i/tree/master/resources/fonts

* Renamed folders for bootloader and exception stub as I am not setup to
deal with sub-modules at the moment.
2024-03-13 20:25:31 -05:00

110 lines
3.5 KiB
ArmAsm

/*---------------------------------------------------------------------------------
Copyright (C) 2005 - 2017
Dave Murphy (WinterMute)
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any
damages arising from the use of this software.
Permission is granted to anyone to use this software for any
purpose, including commercial applications, and to alter it and
redistribute it freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you
must not claim that you wrote the original software. If you use
this software in a product, an acknowledgment in the product
documentation would be appreciated but is not required.
2. Altered source versions must be plainly marked as such, and
must not be misrepresented as being the original software.
3. This notice may not be removed or altered from any source
distribution.
---------------------------------------------------------------------------------*/
@---------------------------------------------------------------------------------
@ DS processor selection
@---------------------------------------------------------------------------------
.arch armv5te
.cpu arm946e-s
@---------------------------------------------------------------------------------
@---------------------------------------------------------------------------------
.section ".crt0","ax"
.global _start
@---------------------------------------------------------------------------------
.align 4
.arm
@---------------------------------------------------------------------------------
_start:
@---------------------------------------------------------------------------------
push {lr}
ldr r0, =__bss_start__ @ Clear BSS section
ldr r1, =__bss_end__
sub r1, r1, r0
bl ClearMem
ldr r0, =installException
blx r0
pop {lr}
bx lr
.pool
@---------------------------------------------------------------------------------
@ Clear memory to 0x00 if length != 0
@ r0 = Start Address
@ r1 = Length
@---------------------------------------------------------------------------------
ClearMem:
@---------------------------------------------------------------------------------
mov r2, #3 @ Round down to nearest word boundary
add r1, r1, r2 @ Shouldn't be needed
bics r1, r1, r2 @ Clear 2 LSB (and set Z)
bxeq lr @ Quit if copy size is 0
mov r2, #0
ClrLoop:
stmia r0!, {r2}
subs r1, r1, #4
bne ClrLoop
bx lr
@---------------------------------------------------------------------------------
@ Copy memory if length != 0
@ r1 = Source Address
@ r2 = Dest Address
@ r4 = Dest Address + Length
@---------------------------------------------------------------------------------
CopyMemCheck:
@---------------------------------------------------------------------------------
sub r3, r4, r2 @ Is there any data to copy?
@---------------------------------------------------------------------------------
@ Copy memory
@ r1 = Source Address
@ r2 = Dest Address
@ r3 = Length
@---------------------------------------------------------------------------------
CopyMem:
@---------------------------------------------------------------------------------
mov r0, #3 @ These commands are used in cases where
add r3, r3, r0 @ the length is not a multiple of 4,
bics r3, r3, r0 @ even though it should be.
bxeq lr @ Length is zero, so exit
CIDLoop:
ldmia r1!, {r0}
stmia r2!, {r0}
subs r3, r3, #4
bne CIDLoop
bx lr
.align 2