NTR_Launcher/ndsbootloader/source/biosCalls.s
ApacheThunder de31f9cb2b 1.3 Refactor
* Added DSOnei kernel to included nds files for Stage2 menu.
* Added N-Card rom dump to included nds files for Stage2 menu.
* Added CycloDS, and DSTWo bootloader dumps to included nds files for
Stage2 menu.
* DSTwo now boots correctly from cart launcher.
* R4 SDHC Gold and other similar DEMON time bomb DSTTi clones now boot
correctly from cart launcher.
* Added back option for enabling/disabling TWL ram.
* Added fixes to allow DS only carts to run with TWL ram enabled.
* Initial modcrypt code added for TWL carts. Currently works in
emulation however TWL carts will fail to boot on hardware (when twl
mode, ram, etc is enabled).
* If TWL mode and ram is enabled, cart loader will now load the DSi
extended binaries into ram. Currently however they will only boot in
emulation. Have not resolved why it's not working on hardware yet.
* Stage2 menu now allowed to load dsi extended binaries of SRLs if TWL
mode and TWL ram is enabled. Booting rom dumps as a method of booting
into TWL carts is confirmed working. At least for System Flaw it does.
:D
* Despite the improvents Acekard 2i still appears to require using the
stage2 menu to boot into.
* Fixes that allowed Demon timebomb carts to boot from cart
launcher/autoboot may allow other non working carts to work. Further
testing needed.
2024-11-27 21:50:32 -06:00

234 lines
7.7 KiB
ArmAsm

/*---------------------------------------------------------------------------------
Copyright (C) 2005
Michael Noland (joat)
Jason Rogers (dovoto)
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.
---------------------------------------------------------------------------------*/
#include <nds/asminc.h>
.text
.align 4
.thumb
@---------------------------------------------------------------------------------
BEGIN_ASM_FUNC swiDelay
@---------------------------------------------------------------------------------
swi 0x03
bx lr
@---------------------------------------------------------------------------------
BEGIN_ASM_FUNC swiSleep
@---------------------------------------------------------------------------------
swi 0x07
bx lr
@---------------------------------------------------------------------------------
BEGIN_ASM_FUNC swiChangeSoundBias
@---------------------------------------------------------------------------------
swi 0x08
bx lr
@---------------------------------------------------------------------------------
BEGIN_ASM_FUNC swiDivide
@---------------------------------------------------------------------------------
swi 0x09
bx lr
@---------------------------------------------------------------------------------
BEGIN_ASM_FUNC swiRemainder
@---------------------------------------------------------------------------------
swi 0x09
mov r0, r1
bx lr
@---------------------------------------------------------------------------------
BEGIN_ASM_FUNC swiDivMod
@---------------------------------------------------------------------------------
push {r2, r3}
swi 0x09
pop {r2, r3}
str r0, [r2]
str r1, [r3]
bx lr
@---------------------------------------------------------------------------------
BEGIN_ASM_FUNC swiCopy
@---------------------------------------------------------------------------------
swi 0x0B
bx lr
@---------------------------------------------------------------------------------
BEGIN_ASM_FUNC swiFastCopy
@---------------------------------------------------------------------------------
swi 0x0C
bx lr
@---------------------------------------------------------------------------------
BEGIN_ASM_FUNC swiSqrt
@---------------------------------------------------------------------------------
swi 0x0D
bx lr
@---------------------------------------------------------------------------------
BEGIN_ASM_FUNC swiCRC16
@---------------------------------------------------------------------------------
swi 0x0E
bx lr
@---------------------------------------------------------------------------------
BEGIN_ASM_FUNC swiIsDebugger
@---------------------------------------------------------------------------------
swi 0x0F
bx lr
@---------------------------------------------------------------------------------
BEGIN_ASM_FUNC swiUnpackBits
@---------------------------------------------------------------------------------
swi 0x10
bx lr
@---------------------------------------------------------------------------------
BEGIN_ASM_FUNC swiDecompressLZSSWram
@---------------------------------------------------------------------------------
swi 0x11
bx lr
@---------------------------------------------------------------------------------
BEGIN_ASM_FUNC swiDecompressLZSSVramNTR
@---------------------------------------------------------------------------------
swi 0x12
bx lr
@---------------------------------------------------------------------------------
BEGIN_ASM_FUNC swiDecompressLZSSVramTWL
@---------------------------------------------------------------------------------
swi 0x02
bx lr
@---------------------------------------------------------------------------------
BEGIN_ASM_FUNC swiDecompressHuffman
@---------------------------------------------------------------------------------
swi 0x13
bx lr
@---------------------------------------------------------------------------------
BEGIN_ASM_FUNC swiDecompressRLEWram
@---------------------------------------------------------------------------------
swi 0x14
bx lr
@---------------------------------------------------------------------------------
BEGIN_ASM_FUNC swiDecompressRLEVram
@---------------------------------------------------------------------------------
swi 0x15
bx lr
@---------------------------------------------------------------------------------
@ ARM7 only bios calls
@---------------------------------------------------------------------------------
#ifdef ARM7
@---------------------------------------------------------------------------------
BEGIN_ASM_FUNC swiHalt
@---------------------------------------------------------------------------------
swi 0x06
bx lr
@---------------------------------------------------------------------------------
BEGIN_ASM_FUNC swiGetSineTable
@---------------------------------------------------------------------------------
swi 0x1A
bx lr
@---------------------------------------------------------------------------------
BEGIN_ASM_FUNC swiGetPitchTable
@---------------------------------------------------------------------------------
swi 0x1B
bx lr
@---------------------------------------------------------------------------------
BEGIN_ASM_FUNC swiGetVolumeTable
@---------------------------------------------------------------------------------
swi 0x1C
bx lr
@ ARM7 function, but no real point in exposing it, at least not
@ without adding a way to get the 3 arguments back into C
@ .global swiGetFptrs
@ .thumb_func
@swiGetFptrs:
@ swi 0x1D
@ bx lr
@---------------------------------------------------------------------------------
BEGIN_ASM_FUNC swiSwitchToGBAMode
@---------------------------------------------------------------------------------
mov r0, #0x40
swi 0x1F
@ does not return, of course
@---------------------------------------------------------------------------------
BEGIN_ASM_FUNC swiSetHaltCR
@---------------------------------------------------------------------------------
mov r2, r0
swi 0x1F
bx lr
#endif // ARM7
@---------------------------------------------------------------------------------
@ ARM9 only bios calls
@---------------------------------------------------------------------------------
#ifdef ARM9
@---------------------------------------------------------------------------------
BEGIN_ASM_FUNC swiWaitForIRQ
@---------------------------------------------------------------------------------
swi 0x06
bx lr
@---------------------------------------------------------------------------------
BEGIN_ASM_FUNC swiDecodeDelta8
@---------------------------------------------------------------------------------
swi 0x16
bx lr
@---------------------------------------------------------------------------------
BEGIN_ASM_FUNC swiDecodeDelta16
@---------------------------------------------------------------------------------
swi 0x18
bx lr
@---------------------------------------------------------------------------------
BEGIN_ASM_FUNC swiSetHaltCR
@---------------------------------------------------------------------------------
swi 0x1F
bx lr
#endif // ARM9