summaryrefslogtreecommitdiffstats
path: root/c/src/lib/libbsp/arm/nds/libnds/source
diff options
context:
space:
mode:
Diffstat (limited to 'c/src/lib/libbsp/arm/nds/libnds/source')
-rw-r--r--c/src/lib/libbsp/arm/nds/libnds/source/arm7/audio.c25
-rw-r--r--c/src/lib/libbsp/arm/nds/libnds/source/arm7/clock.c279
-rw-r--r--c/src/lib/libbsp/arm/nds/libnds/source/arm7/microphone.c113
-rw-r--r--c/src/lib/libbsp/arm/nds/libnds/source/arm7/spi.c75
-rw-r--r--c/src/lib/libbsp/arm/nds/libnds/source/arm7/touch.c371
-rw-r--r--c/src/lib/libbsp/arm/nds/libnds/source/arm7/userSettings.c69
-rw-r--r--c/src/lib/libbsp/arm/nds/libnds/source/arm9/COS.S75
-rw-r--r--c/src/lib/libbsp/arm/nds/libnds/source/arm9/SIN.S75
-rw-r--r--c/src/lib/libbsp/arm/nds/libnds/source/arm9/TAN.S75
-rw-r--r--c/src/lib/libbsp/arm/nds/libnds/source/arm9/boxtest.c97
-rw-r--r--c/src/lib/libbsp/arm/nds/libnds/source/arm9/console.c456
-rw-r--r--c/src/lib/libbsp/arm/nds/libnds/source/arm9/dcache.S92
-rw-r--r--c/src/lib/libbsp/arm/nds/libnds/source/arm9/default_font.S523
-rw-r--r--c/src/lib/libbsp/arm/nds/libnds/source/arm9/exceptionHandler.S109
-rw-r--r--c/src/lib/libbsp/arm/nds/libnds/source/arm9/exceptions.c34
-rw-r--r--c/src/lib/libbsp/arm/nds/libnds/source/arm9/gurumeditation.c270
-rw-r--r--c/src/lib/libbsp/arm/nds/libnds/source/arm9/icache.S55
-rw-r--r--c/src/lib/libbsp/arm/nds/libnds/source/arm9/image.c132
-rw-r--r--c/src/lib/libbsp/arm/nds/libnds/source/arm9/initSystem.c94
-rw-r--r--c/src/lib/libbsp/arm/nds/libnds/source/arm9/keys.c97
-rw-r--r--c/src/lib/libbsp/arm/nds/libnds/source/arm9/ndsmotion.c488
-rw-r--r--c/src/lib/libbsp/arm/nds/libnds/source/arm9/pcx.c85
-rw-r--r--c/src/lib/libbsp/arm/nds/libnds/source/arm9/rumble.c73
-rw-r--r--c/src/lib/libbsp/arm/nds/libnds/source/arm9/sound.c72
-rw-r--r--c/src/lib/libbsp/arm/nds/libnds/source/arm9/system.c31
-rw-r--r--c/src/lib/libbsp/arm/nds/libnds/source/arm9/touch.c46
-rw-r--r--c/src/lib/libbsp/arm/nds/libnds/source/arm9/video.c122
-rw-r--r--c/src/lib/libbsp/arm/nds/libnds/source/arm9/videoGL.c424
-rw-r--r--c/src/lib/libbsp/arm/nds/libnds/source/common/biosCalls.S333
-rw-r--r--c/src/lib/libbsp/arm/nds/libnds/source/common/card.c393
-rw-r--r--c/src/lib/libbsp/arm/nds/libnds/source/common/gbfs.c202
-rw-r--r--c/src/lib/libbsp/arm/nds/libnds/source/common/interruptDispatcher.S117
-rw-r--r--c/src/lib/libbsp/arm/nds/libnds/source/common/interrupts.c145
33 files changed, 0 insertions, 5647 deletions
diff --git a/c/src/lib/libbsp/arm/nds/libnds/source/arm7/audio.c b/c/src/lib/libbsp/arm/nds/libnds/source/arm7/audio.c
deleted file mode 100644
index 7fc380f9ef..0000000000
--- a/c/src/lib/libbsp/arm/nds/libnds/source/arm7/audio.c
+++ /dev/null
@@ -1,25 +0,0 @@
-/*---------------------------------------------------------------------------------
-
- Copyright (C) 2005
- 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/arm7/audio.h"
diff --git a/c/src/lib/libbsp/arm/nds/libnds/source/arm7/clock.c b/c/src/lib/libbsp/arm/nds/libnds/source/arm7/clock.c
deleted file mode 100644
index bd75197d6b..0000000000
--- a/c/src/lib/libbsp/arm/nds/libnds/source/arm7/clock.c
+++ /dev/null
@@ -1,279 +0,0 @@
-/*---------------------------------------------------------------------------------
- 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/bios.h"
-#include "nds/arm7/clock.h"
-#include "nds/interrupts.h"
-#include "nds/ipc.h"
-
-#include <time.h>
-
-/*
- * forward declaration to avoid warning
- */
-void syncRTC(void);
-
-// Delay (in swiDelay units) for each bit transfer
-#define RTC_DELAY 48
-
-// Pin defines on RTC_CR
-#define CS_0 (1<<6)
-#define CS_1 ((1<<6) | (1<<2))
-#define SCK_0 (1<<5)
-#define SCK_1 ((1<<5) | (1<<1))
-#define SIO_0 (1<<4)
-#define SIO_1 ((1<<4) | (1<<0))
-#define SIO_out (1<<4)
-#define SIO_in (1)
-
-//---------------------------------------------------------------------------------
-void BCDToInteger(uint8 * data, uint32 length) {
-//---------------------------------------------------------------------------------
- u32 i;
- for (i = 0; i < length; i++) {
- data[i] = (data[i] & 0xF) + ((data[i] & 0xF0)>>4)*10;
- }
-}
-
-
-//---------------------------------------------------------------------------------
-void integerToBCD(uint8 * data, uint32 length) {
-//---------------------------------------------------------------------------------
- u32 i;
- for (i = 0; i < length; i++) {
- int high, low;
- swiDivMod(data[i], 10, &high, &low);
- data[i] = (high<<4) | low;
- }
-}
-
-//---------------------------------------------------------------------------------
-void rtcTransaction(uint8 * command, uint32 commandLength, uint8 * result, uint32 resultLength) {
-//---------------------------------------------------------------------------------
- uint32 bit;
- uint8 data;
-
- // Raise CS
- RTC_CR8 = CS_0 | SCK_1 | SIO_1;
- swiDelay(RTC_DELAY);
- RTC_CR8 = CS_1 | SCK_1 | SIO_1;
- swiDelay(RTC_DELAY);
-
- // Write command byte (high bit first)
- data = *command++;
-
- for (bit = 0; bit < 8; bit++) {
- RTC_CR8 = CS_1 | SCK_0 | SIO_out | (data>>7);
- swiDelay(RTC_DELAY);
-
- RTC_CR8 = CS_1 | SCK_1 | SIO_out | (data>>7);
- swiDelay(RTC_DELAY);
-
- data = data << 1;
- }
- // Write parameter bytes (low bit first)
- for ( ; commandLength > 1; commandLength--) {
- data = *command++;
-
- for (bit = 0; bit < 8; bit++) {
- RTC_CR8 = CS_1 | SCK_0 | SIO_out | (data & 1);
- swiDelay(RTC_DELAY);
-
- RTC_CR8 = CS_1 | SCK_1 | SIO_out | (data & 1);
- swiDelay(RTC_DELAY);
-
- data = data >> 1;
- }
- }
-
- // Read result bytes (low bit first)
- for ( ; resultLength > 0; resultLength--) {
- data = 0;
-
- for (bit = 0; bit < 8; bit++) {
- RTC_CR8 = CS_1 | SCK_0;
- swiDelay(RTC_DELAY);
-
- RTC_CR8 = CS_1 | SCK_1;
- swiDelay(RTC_DELAY);
-
- if (RTC_CR8 & SIO_in) data |= (1 << bit);
- }
- *result++ = data;
- }
-
- // Finish up by dropping CS low
- RTC_CR8 = CS_0 | SCK_1;
- swiDelay(RTC_DELAY);
-}
-
-
-//---------------------------------------------------------------------------------
-void rtcReset(void) {
-//---------------------------------------------------------------------------------
- uint8 status;
- uint8 command[2];
-
- // Read the first status register
- command[0] = READ_STATUS_REG1;
- rtcTransaction(command, 1, &status, 1);
-
- // Reset the RTC if needed
- if (status & (STATUS_POC | STATUS_BLD)) {
- command[0] = WRITE_STATUS_REG1;
- command[1] = status | STATUS_RESET;
- rtcTransaction(command, 2, 0, 0);
- }
-}
-
-
-//---------------------------------------------------------------------------------
-void rtcGetTimeAndDate(uint8 * time) {
-//---------------------------------------------------------------------------------
- uint8 command, status;
-
- command = READ_TIME_AND_DATE;
- rtcTransaction(&command, 1, time, 7);
-
- command = READ_STATUS_REG1;
- rtcTransaction(&command, 1, &status, 1);
-
- if ( status & STATUS_24HRS ) {
- time[4] &= 0x3f;
- } else {
-
- }
- BCDToInteger(time,7);
-}
-
-//---------------------------------------------------------------------------------
-void rtcSetTimeAndDate(uint8 * time) {
-//---------------------------------------------------------------------------------
- uint8 command[8 + 1];
-
- int i;
- for ( i=0; i< 8; i++ ) {
- command[i+1] = time[i];
- }
- command[0] = WRITE_TIME_AND_DATE;
- // fixme: range checking on the data we tell it
- rtcTransaction(command, 8, 0, 0);
-}
-
-//---------------------------------------------------------------------------------
-void rtcGetTime(uint8 * time) {
-//---------------------------------------------------------------------------------
- uint8 command, status;
-
- command = READ_TIME;
- rtcTransaction(&command, 1, time, 3);
-
- command = READ_STATUS_REG1;
- rtcTransaction(&command, 1, &status, 1);
- if ( status & STATUS_24HRS ) {
- time[0] &= 0x3f;
- } else {
-
- }
- BCDToInteger(time,3);
-
-}
-
-//---------------------------------------------------------------------------------
-void rtcSetTime(uint8 * time) {
-//---------------------------------------------------------------------------------
- uint8 command[4];
-
- int i;
- for ( i=0; i< 3; i++ ) {
- command[i+1] = time[i];
- }
- command[0] = WRITE_TIME;
- // fixme: range checking on the data we tell it
- rtcTransaction(command, 4, 0, 0);
-}
-
-//---------------------------------------------------------------------------------
-void syncRTC(void) {
-//---------------------------------------------------------------------------------
- if (++IPC->time.rtc.seconds == 60 ) {
- IPC->time.rtc.seconds = 0;
- if (++IPC->time.rtc.minutes == 60) {
- IPC->time.rtc.minutes = 0;
- if (++IPC->time.rtc.hours == 24) {
- rtcGetTimeAndDate((uint8 *)&(IPC->time.rtc.year));
- }
- }
- }
-
- IPC->unixTime++;
-}
-
-//---------------------------------------------------------------------------------
-void initClockIRQ() {
-//---------------------------------------------------------------------------------
-
- REG_RCNT = 0x8100;
- irqSet(IRQ_NETWORK, syncRTC);
- // Reset the clock if needed
- rtcReset();
-
- uint8 command[4];
- command[0] = READ_STATUS_REG2;
- rtcTransaction(command, 1, &command[1], 1);
-
- command[0] = WRITE_STATUS_REG2;
- command[1] = 0x41;
- rtcTransaction(command, 2, 0, 0);
-
- command[0] = WRITE_INT_REG1;
- command[1] = 0x01;
- rtcTransaction(command, 2, 0, 0);
-
- command[0] = WRITE_INT_REG2;
- command[1] = 0x00;
- command[2] = 0x21;
- command[3] = 0x35;
- rtcTransaction(command, 4, 0, 0);
-
- // Read all time settings on first start
- rtcGetTimeAndDate((uint8 *)&(IPC->time.rtc.year));
-
-
- struct tm currentTime;
-
- currentTime.tm_sec = IPC->time.rtc.seconds;
- currentTime.tm_min = IPC->time.rtc.minutes;
- currentTime.tm_hour = IPC->time.rtc.hours;
-
- currentTime.tm_mday = IPC->time.rtc.day;
- currentTime.tm_mon = IPC->time.rtc.month - 1;
- currentTime.tm_year = IPC->time.rtc.year + 100;
-
- currentTime.tm_isdst = -1;
-
- IPC->unixTime = mktime(&currentTime);
-}
-
diff --git a/c/src/lib/libbsp/arm/nds/libnds/source/arm7/microphone.c b/c/src/lib/libbsp/arm/nds/libnds/source/arm7/microphone.c
deleted file mode 100644
index bec98fdc22..0000000000
--- a/c/src/lib/libbsp/arm/nds/libnds/source/arm7/microphone.c
+++ /dev/null
@@ -1,113 +0,0 @@
-/*---------------------------------------------------------------------------------
- Microphone control for the ARM7
-
- Copyright (C) 2005
- Michael Noland (joat)
- Jason Rogers (dovoto)
- Dave Murphy (WinterMute)
- Chris Double (doublec)
-
- 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/arm7/audio.h>
-#include <nds/timers.h>
-
-//---------------------------------------------------------------------------------
-// Turn on the Microphone Amp. Code based on neimod's example.
-//---------------------------------------------------------------------------------
-void PM_SetAmp(u8 control) {
-//---------------------------------------------------------------------------------
- SerialWaitBusy();
- REG_SPICNT = SPI_ENABLE | SPI_DEVICE_POWER | SPI_BAUD_1MHz | SPI_CONTINUOUS;
- REG_SPIDATA = PM_AMP_OFFSET;
-
- SerialWaitBusy();
-
- REG_SPICNT = SPI_ENABLE | SPI_DEVICE_POWER | SPI_BAUD_1MHz;
- REG_SPIDATA = control;
-}
-
-//---------------------------------------------------------------------------------
-// Read a byte from the microphone. Code based on neimod's example.
-//---------------------------------------------------------------------------------
-u8 MIC_ReadData() {
-//---------------------------------------------------------------------------------
- u16 result, result2;
-
- SerialWaitBusy();
-
- REG_SPICNT = SPI_ENABLE | SPI_DEVICE_MICROPHONE | SPI_BAUD_2MHz | SPI_CONTINUOUS;
- REG_SPIDATA = 0xEC; // Touchscreen command format for AUX
-
- SerialWaitBusy();
-
- REG_SPIDATA = 0x00;
-
- SerialWaitBusy();
-
- result = REG_SPIDATA;
- REG_SPICNT = SPI_ENABLE | SPI_DEVICE_TOUCH | SPI_BAUD_2MHz;
- REG_SPIDATA = 0x00;
-
- SerialWaitBusy();
-
- result2 = REG_SPIDATA;
-
- return (((result & 0x7F) << 1) | ((result2>>7)&1));
-}
-
-static u8* microphone_buffer = 0;
-static int microphone_buffer_length = 0;
-static int current_length = 0;
-
-
-//---------------------------------------------------------------------------------
-void StartRecording(u8* buffer, int length) {
-//---------------------------------------------------------------------------------
- microphone_buffer = buffer;
- microphone_buffer_length = length;
- current_length = 0;
-
- MIC_On();
-
- // Setup a 16kHz timer
- TIMER0_DATA = 0xF7CF;
- TIMER0_CR = TIMER_ENABLE | TIMER_DIV_1 | TIMER_IRQ_REQ;
-}
-
-//---------------------------------------------------------------------------------
-int StopRecording() {
-//---------------------------------------------------------------------------------
- TIMER0_CR &= ~TIMER_ENABLE;
- MIC_Off();
- microphone_buffer = 0;
- return current_length;
-}
-
-//---------------------------------------------------------------------------------
-void ProcessMicrophoneTimerIRQ() {
-//---------------------------------------------------------------------------------
- if(microphone_buffer && microphone_buffer_length > 0) {
- // Read data from the microphone. Data from the Mic is unsigned, flipping
- // the highest bit makes it signed.
- *microphone_buffer++ = MIC_ReadData() ^ 0x80;
- --microphone_buffer_length;
- current_length++;
- }
-}
diff --git a/c/src/lib/libbsp/arm/nds/libnds/source/arm7/spi.c b/c/src/lib/libbsp/arm/nds/libnds/source/arm7/spi.c
deleted file mode 100644
index f7f9a312cf..0000000000
--- a/c/src/lib/libbsp/arm/nds/libnds/source/arm7/spi.c
+++ /dev/null
@@ -1,75 +0,0 @@
-/*---------------------------------------------------------------------------------
-
- Copyright (C) 2005
- Michael Noland (joat)
-
- 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/arm7/serial.h>
-
-
-//---------------------------------------------------------------------------------
-int writePowerManagement(int reg, int command) {
-//---------------------------------------------------------------------------------
- // Write the register / access mode (bit 7 sets access mode)
- while (REG_SPICNT & SPI_BUSY);
- REG_SPICNT = SPI_ENABLE | SPI_BAUD_1MHZ | SPI_BYTE_MODE | SPI_CONTINUOUS | SPI_DEVICE_POWER;
- REG_SPIDATA = reg;
-
- // Write the command / start a read
- while (REG_SPICNT & SPI_BUSY);
- REG_SPICNT = SPI_ENABLE | SPI_BAUD_1MHZ | SPI_BYTE_MODE | SPI_DEVICE_POWER;
- REG_SPIDATA = command;
-
- // Read the result
- while (REG_SPICNT & SPI_BUSY);
- return REG_SPIDATA & 0xFF;
-}
-
-
-//---------------------------------------------------------------------------------
-void readFirmware(uint32 address, void * destination, uint32 size) {
-//---------------------------------------------------------------------------------
- uint8 * buffer = (uint8 *)destination;
-
- // Read command
- while (REG_SPICNT & SPI_BUSY);
- REG_SPICNT = SPI_ENABLE | SPI_BYTE_MODE | SPI_CONTINUOUS | SPI_DEVICE_FIRMWARE;
- REG_SPIDATA = FIRMWARE_READ;
- while (REG_SPICNT & SPI_BUSY);
-
- // Set the address
- REG_SPIDATA = (address>>16) & 0xFF;
- while (REG_SPICNT & SPI_BUSY);
- REG_SPIDATA = (address>>8) & 0xFF;
- while (REG_SPICNT & SPI_BUSY);
- REG_SPIDATA = (address>>0) & 0xFF;
- while (REG_SPICNT & SPI_BUSY);
-
- // Read the data
- while (size--) {
- REG_SPIDATA = 0;
- while (REG_SPICNT & SPI_BUSY);
- *buffer++ = (REG_SPIDATA & 0xFF);
- }
-
- REG_SPICNT = 0;
-}
-
diff --git a/c/src/lib/libbsp/arm/nds/libnds/source/arm7/touch.c b/c/src/lib/libbsp/arm/nds/libnds/source/arm7/touch.c
deleted file mode 100644
index 65de47ef6b..0000000000
--- a/c/src/lib/libbsp/arm/nds/libnds/source/arm7/touch.c
+++ /dev/null
@@ -1,371 +0,0 @@
-/*---------------------------------------------------------------------------------
- Touch screen control for the ARM7
-
- 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/jtypes.h>
-#include <nds/system.h>
-#include <nds/arm7/touch.h>
-#include <nds/interrupts.h>
-
-#include <stdlib.h>
-
-static u8 last_time_touched = 0;
-
-static u8 range_counter_1 = 0;
-static u8 range_counter_2 = 0;
-static u8 range = 20;
-static u8 min_range = 20;
-
-//---------------------------------------------------------------------------------
-static u8 CheckStylus(void){
-//---------------------------------------------------------------------------------
-
- SerialWaitBusy();
-
- REG_SPICNT = SPI_ENABLE | SPI_BAUD_2MHz | SPI_DEVICE_TOUCH | SPI_CONTINUOUS; //0x8A01;
- REG_SPIDATA = TSC_MEASURE_TEMP1;
-
- SerialWaitBusy();
-
- REG_SPIDATA = 0;
-
- SerialWaitBusy();
-
- REG_SPICNT = SPI_ENABLE | SPI_BAUD_2MHz | SPI_DEVICE_TOUCH;// 0x8201;
- REG_SPIDATA = 0;
-
- SerialWaitBusy();
-
- if(last_time_touched == 1){
- if( !(REG_KEYXY & 0x40) )
- return 1;
- else{
- REG_SPICNT = SPI_ENABLE | SPI_BAUD_2MHz | SPI_DEVICE_TOUCH | SPI_CONTINUOUS;
- REG_SPIDATA = TSC_MEASURE_TEMP1;
-
- SerialWaitBusy();
-
- REG_SPIDATA = 0;
-
- SerialWaitBusy();
-
- REG_SPICNT = SPI_ENABLE | SPI_BAUD_2MHz | SPI_DEVICE_TOUCH;
- REG_SPIDATA = 0;
-
- SerialWaitBusy();
-
- return !(REG_KEYXY & 0x40) ? 2 : 0;
- }
- }else{
- return !(REG_KEYXY & 0x40) ? 1 : 0;
- }
-}
-
-//---------------------------------------------------------------------------------
-uint16 touchRead(uint32 command) {
-//---------------------------------------------------------------------------------
- uint16 result, result2;
-
- uint32 oldIME = REG_IME;
-
- REG_IME = 0;
-
- SerialWaitBusy();
-
- // Write the command and wait for it to complete
- REG_SPICNT = SPI_ENABLE | SPI_BAUD_2MHz | SPI_DEVICE_TOUCH | SPI_CONTINUOUS; //0x8A01;
- REG_SPIDATA = command;
- SerialWaitBusy();
-
- // Write the second command and clock in part of the data
- REG_SPIDATA = 0;
- SerialWaitBusy();
- result = REG_SPIDATA;
-
- // Clock in the rest of the data (last transfer)
- REG_SPICNT = SPI_ENABLE | 0x201;
- REG_SPIDATA = 0;
- SerialWaitBusy();
-
- result2 = REG_SPIDATA >>3;
-
- REG_IME = oldIME;
-
- // Return the result
- return ((result & 0x7F) << 5) | result2;
-}
-
-
-//---------------------------------------------------------------------------------
-uint32 touchReadTemperature(int * t1, int * t2) {
-//---------------------------------------------------------------------------------
- *t1 = touchRead(TSC_MEASURE_TEMP1);
- *t2 = touchRead(TSC_MEASURE_TEMP2);
- return 8490 * (*t2 - *t1) - 273*4096;
-}
-
-
-static bool touchInit = false;
-static s32 xscale, yscale;
-static s32 xoffset, yoffset;
-
-//---------------------------------------------------------------------------------
-static int16 readTouchValue(uint32 command, int16 *dist_max, u8 *err){
-//---------------------------------------------------------------------------------
- int16 values[5];
- int32 aux1, aux2, aux3, dist, dist2, result = 0;
- u8 i, j, k;
-
- *err = 1;
-
- SerialWaitBusy();
-
- REG_SPICNT = SPI_ENABLE | SPI_BAUD_2MHz | SPI_DEVICE_TOUCH | SPI_CONTINUOUS;
- REG_SPIDATA = command;
-
- SerialWaitBusy();
-
- for(i=0; i<5; i++){
- REG_SPIDATA = 0;
- SerialWaitBusy();
-
- aux1 = REG_SPIDATA;
- aux1 = aux1 & 0xFF;
- aux1 = aux1 << 16;
- aux1 = aux1 >> 8;
-
- values[4-i] = aux1;
-
- REG_SPIDATA = command;
- SerialWaitBusy();
-
- aux1 = REG_SPIDATA;
- aux1 = aux1 & 0xFF;
- aux1 = aux1 << 16;
-
- aux1 = values[4-i] | (aux1 >> 16);
- values[4-i] = ((aux1 & 0x7FF8) >> 3);
- }
-
- REG_SPICNT = SPI_ENABLE | SPI_BAUD_2MHz | SPI_DEVICE_TOUCH;
- REG_SPIDATA = 0;
- SerialWaitBusy();
-
- dist = 0;
- for(i=0; i<4; i++){
- aux1 = values[i];
-
- for(j=i+1; j<5; j++){
- aux2 = values[j];
- aux2 = abs(aux1 - aux2);
- if(aux2>dist) dist = aux2;
- }
- }
-
- *dist_max = dist;
-
- for(i=0; i<3; i++){
- aux1 = values[i];
-
- for(j=i+1; j<4; j++){
- aux2 = values[j];
- dist = abs(aux1 - aux2);
-
- if( dist <= range ){
- for(k=j+1; k<5; k++){
- aux3 = values[k];
- dist2 = abs(aux1 - aux3);
-
- if( dist2 <= range ){
- result = aux2 + (aux1 << 1);
- result = result + aux3;
- result = result >> 2;
- result = result & (~7);
-
- *err = 0;
-
- break;
- }
- }
- }
- }
- }
-
- if((*err) == 1){
- result = values[0] + values[4];
- result = result >> 1;
- result = result & (~7);
- }
-
- return (result & 0xFFF);
-}
-
-//---------------------------------------------------------------------------------
-static void UpdateRange(uint8 *this_range, int16 last_dist_max, u8 data_error, u8 tsc_touched){
-//---------------------------------------------------------------------------------
- //range_counter_1 = counter_0x380A98C
- //range_counter_2 = counter_0x380A990
- //Initial values:
- // range = 20
- // min_range = 20
-
- if(tsc_touched != 0){
- if( data_error == 0){
- range_counter_2 = 0;
-
- if( last_dist_max >= ((*this_range) >> 1)){
- range_counter_1 = 0;
- }else{
- range_counter_1++;
-
- if(range_counter_1 >= 4){
- range_counter_1 = 0;
-
- if((*this_range) > min_range){
- (*this_range)--;
- range_counter_2 = 3;
- }
- }
- }
- }else{
- range_counter_1 = 0;
- range_counter_2++;
-
- if(range_counter_2 >= 4){
-
- range_counter_2 = 0;
-
- if((*this_range) < 35){ //0x23 = 35
- *this_range = (*this_range) + 1;
- }
- }
- }
- }else{
- range_counter_2 = 0;
- range_counter_1 = 0;
- }
-}
-
-//---------------------------------------------------------------------------------
-// reading pixel position:
-//---------------------------------------------------------------------------------
-touchPosition touchReadXY() {
-//---------------------------------------------------------------------------------
-
- int16 dist_max_y, dist_max_x, dist_max;
- u8 error, error_where, first_check, i;
-
- touchPosition touchPos = { 0, 0, 0, 0, 0, 0 };
-
- if ( !touchInit ) {
-
- xscale = ((PersonalData->calX2px - PersonalData->calX1px) << 19) / ((PersonalData->calX2) - (PersonalData->calX1));
- yscale = ((PersonalData->calY2px - PersonalData->calY1px) << 19) / ((PersonalData->calY2) - (PersonalData->calY1));
-
- xoffset = ((PersonalData->calX1 + PersonalData->calX2) * xscale - ((PersonalData->calX1px + PersonalData->calX2px) << 19) ) / 2;
- yoffset = ((PersonalData->calY1 + PersonalData->calY2) * yscale - ((PersonalData->calY1px + PersonalData->calY2px) << 19) ) / 2;
- touchInit = true;
- }
-
- uint32 oldIME = REG_IME;
-
- REG_IME = 0;
-
- first_check = CheckStylus();
- if(first_check != 0){
- error_where = 0;
-
- touchPos.z1 = readTouchValue(TSC_MEASURE_Z1 | 1, &dist_max, &error);
- touchPos.z2 = readTouchValue(TSC_MEASURE_Z2 | 1, &dist_max, &error);
-
- touchPos.x = readTouchValue(TSC_MEASURE_X | 1, &dist_max_x, &error);
- if(error==1) error_where += 1;
-
- touchPos.y = readTouchValue(TSC_MEASURE_Y | 1, &dist_max_y, &error);
- if(error==1) error_where += 2;
-
- REG_SPICNT = SPI_ENABLE | SPI_BAUD_2MHz | SPI_DEVICE_TOUCH | SPI_CONTINUOUS;
- for(i=0; i<12; i++){
- REG_SPIDATA = 0;
-
- SerialWaitBusy();
- }
-
- REG_SPICNT = SPI_ENABLE | SPI_BAUD_2MHz | SPI_DEVICE_TOUCH;
- REG_SPIDATA = 0;
-
- SerialWaitBusy();
-
- if(first_check == 2) error_where = 3;
-
- switch( CheckStylus() ){
- case 0:
- last_time_touched = 0;
- break;
- case 1:
- last_time_touched = 1;
-
- if(dist_max_x > dist_max_y)
- dist_max = dist_max_x;
- else
- dist_max = dist_max_y;
-
- break;
- case 2:
- last_time_touched = 0;
- error_where = 3;
-
- break;
- }
-
- s16 px = ( touchPos.x * xscale - xoffset + xscale/2 ) >>19;
- s16 py = ( touchPos.y * yscale - yoffset + yscale/2 ) >>19;
-
- if ( px < 0) px = 0;
- if ( py < 0) py = 0;
- if ( px > (SCREEN_WIDTH -1)) px = SCREEN_WIDTH -1;
- if ( py > (SCREEN_HEIGHT -1)) py = SCREEN_HEIGHT -1;
-
- touchPos.px = px;
- touchPos.py = py;
-
-
- }else{
- error_where = 3;
- touchPos.x = 0;
- touchPos.y = 0;
- last_time_touched = 0;
- }
-
- UpdateRange(&range, dist_max, error_where, last_time_touched);
-
- REG_IME = oldIME;
-
-
- return touchPos;
-
-}
-
diff --git a/c/src/lib/libbsp/arm/nds/libnds/source/arm7/userSettings.c b/c/src/lib/libbsp/arm/nds/libnds/source/arm7/userSettings.c
deleted file mode 100644
index ef2a09e2b3..0000000000
--- a/c/src/lib/libbsp/arm/nds/libnds/source/arm7/userSettings.c
+++ /dev/null
@@ -1,69 +0,0 @@
-/*---------------------------------------------------------------------------------
- Copyright (C) 2005
- 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/arm7/serial.h>
-#include <nds/system.h>
-#include <string.h>
-
-//---------------------------------------------------------------------------------
-void readUserSettings() {
-//---------------------------------------------------------------------------------
-
- PERSONAL_DATA slot1;
- PERSONAL_DATA slot2;
-
- short slot1count, slot2count;
- short slot1CRC, slot2CRC;
-
- uint32 userSettingsBase;
- readFirmware( 0x20, &userSettingsBase,2);
-
- uint32 slot1Address = userSettingsBase * 8;
- uint32 slot2Address = userSettingsBase * 8 + 0x100;
-
- readFirmware( slot1Address , &slot1, sizeof(PERSONAL_DATA));
- readFirmware( slot2Address , &slot2, sizeof(PERSONAL_DATA));
- readFirmware( slot1Address + 0x70, &slot1count, 2);
- readFirmware( slot2Address + 0x70, &slot2count, 2);
- readFirmware( slot1Address + 0x72, &slot1CRC, 2);
- readFirmware( slot2Address + 0x72, &slot2CRC, 2);
-
- // default to slot 1 user Settings
- void *currentSettings = &slot1;
-
- short calc1CRC = swiCRC16( 0xffff, &slot1, sizeof(PERSONAL_DATA));
- short calc2CRC = swiCRC16( 0xffff, &slot2, sizeof(PERSONAL_DATA));
-
- // bail out if neither slot is valid
- if ( calc1CRC != slot1CRC && calc2CRC != slot2CRC) return;
-
- // if both slots are valid pick the most recent
- if ( calc1CRC == slot1CRC && calc2CRC == slot2CRC ) {
- currentSettings = (slot2count == (( slot2count + 1 ) & 0x7f) ? &slot2 : &slot1);
- } else {
- if ( calc2CRC == slot2CRC )
- currentSettings = &slot2;
- }
- memcpy ( PersonalData, currentSettings, sizeof(PERSONAL_DATA));
-
-}
diff --git a/c/src/lib/libbsp/arm/nds/libnds/source/arm9/COS.S b/c/src/lib/libbsp/arm/nds/libnds/source/arm9/COS.S
deleted file mode 100644
index 405e9f74a6..0000000000
--- a/c/src/lib/libbsp/arm/nds/libnds/source/arm9/COS.S
+++ /dev/null
@@ -1,75 +0,0 @@
-/* Generated by BIN2S - please don't edit directly */
- .section .rodata
- .balign 4
- .global COS_bin_size
-COS_bin_size: .int 1024
- .global COS_bin
-COS_bin:
- .byte 0, 16,255, 15,254, 15,253, 15,251, 15,248, 15,244, 15,240, 15
- .byte 236, 15,231, 15,225, 15,218, 15,211, 15,203, 15,195, 15,186, 15
- .byte 177, 15,167, 15,156, 15,145, 15,133, 15,120, 15,107, 15, 93, 15
- .byte 79, 15, 64, 15, 49, 15, 33, 15, 16, 15,255, 14,237, 14,219, 14
- .byte 200, 14,180, 14,160, 14,139, 14,118, 14, 96, 14, 74, 14, 51, 14
- .byte 28, 14, 4, 14,235, 13,210, 13,185, 13,159, 13,132, 13,105, 13
- .byte 77, 13, 49, 13, 20, 13,247, 12,217, 12,187, 12,157, 12,125, 12
- .byte 94, 12, 62, 12, 29, 12,252, 11,218, 11,184, 11,150, 11,115, 11
- .byte 80, 11, 44, 11, 8, 11,227, 10,190, 10,153, 10,115, 10, 77, 10
- .byte 38, 10,255, 9,215, 9,176, 9,135, 9, 95, 9, 54, 9, 13, 9
- .byte 227, 8,185, 8,143, 8,100, 8, 57, 8, 14, 8,226, 7,183, 7
- .byte 138, 7, 94, 7, 49, 7, 4, 7,215, 6,169, 6,123, 6, 77, 6
- .byte 31, 6,240, 5,194, 5,147, 5, 99, 5, 52, 5, 4, 5,213, 4
- .byte 165, 4,116, 4, 68, 4, 19, 4,227, 3,178, 3,129, 3, 80, 3
- .byte 31, 3,237, 2,188, 2,138, 2, 89, 2, 39, 2,245, 1,195, 1
- .byte 145, 1, 95, 1, 45, 1,251, 0,200, 0,150, 0,100, 0, 50, 0
- .byte 0, 0,206,255,156,255,106,255, 56,255, 5,255,211,254,161,254
- .byte 111,254, 61,254, 11,254,217,253,167,253,118,253, 68,253, 19,253
- .byte 225,252,176,252,127,252, 78,252, 29,252,237,251,188,251,140,251
- .byte 91,251, 43,251,252,250,204,250,157,250,109,250, 62,250, 16,250
- .byte 225,249,179,249,133,249, 87,249, 41,249,252,248,207,248,162,248
- .byte 118,248, 73,248, 30,248,242,247,199,247,156,247,113,247, 71,247
- .byte 29,247,243,246,202,246,161,246,121,246, 80,246, 41,246, 1,246
- .byte 218,245,179,245,141,245,103,245, 66,245, 29,245,248,244,212,244
- .byte 176,244,141,244,106,244, 72,244, 38,244, 4,244,227,243,194,243
- .byte 162,243,131,243, 99,243, 69,243, 39,243, 9,243,236,242,207,242
- .byte 179,242,151,242,124,242, 97,242, 71,242, 46,242, 21,242,252,241
- .byte 228,241,205,241,182,241,160,241,138,241,117,241, 96,241, 76,241
- .byte 56,241, 37,241, 19,241, 1,241,240,240,223,240,207,240,192,240
- .byte 177,240,163,240,149,240,136,240,123,240,111,240,100,240, 89,240
- .byte 79,240, 70,240, 61,240, 53,240, 45,240, 38,240, 31,240, 25,240
- .byte 20,240, 16,240, 12,240, 8,240, 5,240, 3,240, 2,240, 1,240
- .byte 0,240, 1,240, 2,240, 3,240, 5,240, 8,240, 12,240, 16,240
- .byte 20,240, 25,240, 31,240, 38,240, 45,240, 53,240, 61,240, 70,240
- .byte 79,240, 89,240,100,240,111,240,123,240,136,240,149,240,163,240
- .byte 177,240,192,240,207,240,223,240,240,240, 1,241, 19,241, 37,241
- .byte 56,241, 76,241, 96,241,117,241,138,241,160,241,182,241,205,241
- .byte 228,241,252,241, 21,242, 46,242, 71,242, 97,242,124,242,151,242
- .byte 179,242,207,242,236,242, 9,243, 39,243, 69,243, 99,243,131,243
- .byte 162,243,194,243,227,243, 4,244, 38,244, 72,244,106,244,141,244
- .byte 176,244,212,244,248,244, 29,245, 66,245,103,245,141,245,179,245
- .byte 218,245, 1,246, 41,246, 80,246,121,246,161,246,202,246,243,246
- .byte 29,247, 71,247,113,247,156,247,199,247,242,247, 30,248, 73,248
- .byte 118,248,162,248,207,248,252,248, 41,249, 87,249,133,249,179,249
- .byte 225,249, 16,250, 62,250,109,250,157,250,204,250,252,250, 43,251
- .byte 91,251,140,251,188,251,237,251, 29,252, 78,252,127,252,176,252
- .byte 225,252, 19,253, 68,253,118,253,167,253,217,253, 11,254, 61,254
- .byte 111,254,161,254,211,254, 5,255, 56,255,106,255,156,255,206,255
- .byte 0, 0, 50, 0,100, 0,150, 0,200, 0,251, 0, 45, 1, 95, 1
- .byte 145, 1,195, 1,245, 1, 39, 2, 89, 2,138, 2,188, 2,237, 2
- .byte 31, 3, 80, 3,129, 3,178, 3,227, 3, 19, 4, 68, 4,116, 4
- .byte 165, 4,213, 4, 4, 5, 52, 5, 99, 5,147, 5,194, 5,240, 5
- .byte 31, 6, 77, 6,123, 6,169, 6,215, 6, 4, 7, 49, 7, 94, 7
- .byte 138, 7,183, 7,226, 7, 14, 8, 57, 8,100, 8,143, 8,185, 8
- .byte 227, 8, 13, 9, 54, 9, 95, 9,135, 9,176, 9,215, 9,255, 9
- .byte 38, 10, 77, 10,115, 10,153, 10,190, 10,227, 10, 8, 11, 44, 11
- .byte 80, 11,115, 11,150, 11,184, 11,218, 11,252, 11, 29, 12, 62, 12
- .byte 94, 12,125, 12,157, 12,187, 12,217, 12,247, 12, 20, 13, 49, 13
- .byte 77, 13,105, 13,132, 13,159, 13,185, 13,210, 13,235, 13, 4, 14
- .byte 28, 14, 51, 14, 74, 14, 96, 14,118, 14,139, 14,160, 14,180, 14
- .byte 200, 14,219, 14,237, 14,255, 14, 16, 15, 33, 15, 49, 15, 64, 15
- .byte 79, 15, 93, 15,107, 15,120, 15,133, 15,145, 15,156, 15,167, 15
- .byte 177, 15,186, 15,195, 15,203, 15,211, 15,218, 15,225, 15,231, 15
- .byte 236, 15,240, 15,244, 15,248, 15,251, 15,253, 15,254, 15,255, 15
-
- .global COS_bin_end
-COS_bin_end:
-
diff --git a/c/src/lib/libbsp/arm/nds/libnds/source/arm9/SIN.S b/c/src/lib/libbsp/arm/nds/libnds/source/arm9/SIN.S
deleted file mode 100644
index 7a9723b39b..0000000000
--- a/c/src/lib/libbsp/arm/nds/libnds/source/arm9/SIN.S
+++ /dev/null
@@ -1,75 +0,0 @@
-/* Generated by BIN2S - please don't edit directly */
- .section .rodata
- .balign 4
- .global SIN_bin_size
-SIN_bin_size: .int 1024
- .global SIN_bin
-SIN_bin:
- .byte 0, 0, 50, 0,100, 0,150, 0,200, 0,251, 0, 45, 1, 95, 1
- .byte 145, 1,195, 1,245, 1, 39, 2, 89, 2,138, 2,188, 2,237, 2
- .byte 31, 3, 80, 3,129, 3,178, 3,227, 3, 19, 4, 68, 4,116, 4
- .byte 165, 4,213, 4, 4, 5, 52, 5, 99, 5,147, 5,194, 5,240, 5
- .byte 31, 6, 77, 6,123, 6,169, 6,215, 6, 4, 7, 49, 7, 94, 7
- .byte 138, 7,183, 7,226, 7, 14, 8, 57, 8,100, 8,143, 8,185, 8
- .byte 227, 8, 13, 9, 54, 9, 95, 9,135, 9,176, 9,215, 9,255, 9
- .byte 38, 10, 77, 10,115, 10,153, 10,190, 10,227, 10, 8, 11, 44, 11
- .byte 80, 11,115, 11,150, 11,184, 11,218, 11,252, 11, 29, 12, 62, 12
- .byte 94, 12,125, 12,157, 12,187, 12,217, 12,247, 12, 20, 13, 49, 13
- .byte 77, 13,105, 13,132, 13,159, 13,185, 13,210, 13,235, 13, 4, 14
- .byte 28, 14, 51, 14, 74, 14, 96, 14,118, 14,139, 14,160, 14,180, 14
- .byte 200, 14,219, 14,237, 14,255, 14, 16, 15, 33, 15, 49, 15, 64, 15
- .byte 79, 15, 93, 15,107, 15,120, 15,133, 15,145, 15,156, 15,167, 15
- .byte 177, 15,186, 15,195, 15,203, 15,211, 15,218, 15,225, 15,231, 15
- .byte 236, 15,240, 15,244, 15,248, 15,251, 15,253, 15,254, 15,255, 15
- .byte 0, 16,255, 15,254, 15,253, 15,251, 15,248, 15,244, 15,240, 15
- .byte 236, 15,231, 15,225, 15,218, 15,211, 15,203, 15,195, 15,186, 15
- .byte 177, 15,167, 15,156, 15,145, 15,133, 15,120, 15,107, 15, 93, 15
- .byte 79, 15, 64, 15, 49, 15, 33, 15, 16, 15,255, 14,237, 14,219, 14
- .byte 200, 14,180, 14,160, 14,139, 14,118, 14, 96, 14, 74, 14, 51, 14
- .byte 28, 14, 4, 14,235, 13,210, 13,185, 13,159, 13,132, 13,105, 13
- .byte 77, 13, 49, 13, 20, 13,247, 12,217, 12,187, 12,157, 12,125, 12
- .byte 94, 12, 62, 12, 29, 12,252, 11,218, 11,184, 11,150, 11,115, 11
- .byte 80, 11, 44, 11, 8, 11,227, 10,190, 10,153, 10,115, 10, 77, 10
- .byte 38, 10,255, 9,215, 9,176, 9,135, 9, 95, 9, 54, 9, 13, 9
- .byte 227, 8,185, 8,143, 8,100, 8, 57, 8, 14, 8,226, 7,183, 7
- .byte 138, 7, 94, 7, 49, 7, 4, 7,215, 6,169, 6,123, 6, 77, 6
- .byte 31, 6,240, 5,194, 5,147, 5, 99, 5, 52, 5, 4, 5,213, 4
- .byte 165, 4,116, 4, 68, 4, 19, 4,227, 3,178, 3,129, 3, 80, 3
- .byte 31, 3,237, 2,188, 2,138, 2, 89, 2, 39, 2,245, 1,195, 1
- .byte 145, 1, 95, 1, 45, 1,251, 0,200, 0,150, 0,100, 0, 50, 0
- .byte 0, 0,206,255,156,255,106,255, 56,255, 5,255,211,254,161,254
- .byte 111,254, 61,254, 11,254,217,253,167,253,118,253, 68,253, 19,253
- .byte 225,252,176,252,127,252, 78,252, 29,252,237,251,188,251,140,251
- .byte 91,251, 43,251,252,250,204,250,157,250,109,250, 62,250, 16,250
- .byte 225,249,179,249,133,249, 87,249, 41,249,252,248,207,248,162,248
- .byte 118,248, 73,248, 30,248,242,247,199,247,156,247,113,247, 71,247
- .byte 29,247,243,246,202,246,161,246,121,246, 80,246, 41,246, 1,246
- .byte 218,245,179,245,141,245,103,245, 66,245, 29,245,248,244,212,244
- .byte 176,244,141,244,106,244, 72,244, 38,244, 4,244,227,243,194,243
- .byte 162,243,131,243, 99,243, 69,243, 39,243, 9,243,236,242,207,242
- .byte 179,242,151,242,124,242, 97,242, 71,242, 46,242, 21,242,252,241
- .byte 228,241,205,241,182,241,160,241,138,241,117,241, 96,241, 76,241
- .byte 56,241, 37,241, 19,241, 1,241,240,240,223,240,207,240,192,240
- .byte 177,240,163,240,149,240,136,240,123,240,111,240,100,240, 89,240
- .byte 79,240, 70,240, 61,240, 53,240, 45,240, 38,240, 31,240, 25,240
- .byte 20,240, 16,240, 12,240, 8,240, 5,240, 3,240, 2,240, 1,240
- .byte 0,240, 1,240, 2,240, 3,240, 5,240, 8,240, 12,240, 16,240
- .byte 20,240, 25,240, 31,240, 38,240, 45,240, 53,240, 61,240, 70,240
- .byte 79,240, 89,240,100,240,111,240,123,240,136,240,149,240,163,240
- .byte 177,240,192,240,207,240,223,240,240,240, 1,241, 19,241, 37,241
- .byte 56,241, 76,241, 96,241,117,241,138,241,160,241,182,241,205,241
- .byte 228,241,252,241, 21,242, 46,242, 71,242, 97,242,124,242,151,242
- .byte 179,242,207,242,236,242, 9,243, 39,243, 69,243, 99,243,131,243
- .byte 162,243,194,243,227,243, 4,244, 38,244, 72,244,106,244,141,244
- .byte 176,244,212,244,248,244, 29,245, 66,245,103,245,141,245,179,245
- .byte 218,245, 1,246, 41,246, 80,246,121,246,161,246,202,246,243,246
- .byte 29,247, 71,247,113,247,156,247,199,247,242,247, 30,248, 73,248
- .byte 118,248,162,248,207,248,252,248, 41,249, 87,249,133,249,179,249
- .byte 225,249, 16,250, 62,250,109,250,157,250,204,250,252,250, 43,251
- .byte 91,251,140,251,188,251,237,251, 29,252, 78,252,127,252,176,252
- .byte 225,252, 19,253, 68,253,118,253,167,253,217,253, 11,254, 61,254
- .byte 111,254,161,254,211,254, 5,255, 56,255,106,255,156,255,206,255
-
- .global SIN_bin_end
-SIN_bin_end:
-
diff --git a/c/src/lib/libbsp/arm/nds/libnds/source/arm9/TAN.S b/c/src/lib/libbsp/arm/nds/libnds/source/arm9/TAN.S
deleted file mode 100644
index c30a88de43..0000000000
--- a/c/src/lib/libbsp/arm/nds/libnds/source/arm9/TAN.S
+++ /dev/null
@@ -1,75 +0,0 @@
-/* Generated by BIN2S - please don't edit directly */
- .section .rodata
- .balign 4
- .global TAN_bin_size
-TAN_bin_size: .int 1024
- .global TAN_bin
-TAN_bin:
- .byte 0, 0, 50, 0,100, 0,150, 0,201, 0,251, 0, 46, 1, 96, 1
- .byte 147, 1,198, 1,249, 1, 44, 2, 95, 2,147, 2,198, 2,250, 2
- .byte 46, 3, 99, 3,151, 3,204, 3, 1, 4, 55, 4,109, 4,163, 4
- .byte 218, 4, 17, 5, 73, 5,129, 5,185, 5,242, 5, 44, 6,102, 6
- .byte 160, 6,219, 6, 23, 7, 84, 7,145, 7,207, 7, 13, 8, 77, 8
- .byte 141, 8,206, 8, 16, 9, 83, 9,151, 9,219, 9, 33, 10,104, 10
- .byte 176, 10,250, 10, 68, 11,144, 11,221, 11, 44, 12,124, 12,206, 12
- .byte 33, 13,118, 13,205, 13, 37, 14,128, 14,220, 14, 59, 15,156, 15
- .byte 255, 15,101, 16,206, 16, 57, 17,167, 17, 24, 18,140, 18, 3, 19
- .byte 126, 19,253, 19,128, 20, 7, 21,146, 21, 34, 22,183, 22, 82, 23
- .byte 242, 23,152, 24, 68, 25,247, 25,177, 26,115, 27, 62, 28, 17, 29
- .byte 239, 29,214, 30,201, 31,200, 32,212, 33,238, 34, 24, 36, 83, 37
- .byte 160, 38, 2, 40,122, 41, 11, 43,183, 44,130, 46,110, 48,129, 50
- .byte 190, 52, 44, 55,209, 57,180, 60,224, 63, 95, 67, 64, 71,147, 75
- .byte 111, 80,239, 85, 53, 92,112, 99,220,107,206,117,185,129, 70,144
- .byte 115,162,204,185,232,216,110, 4,175, 69,103,178,196,139,187, 23
- .byte 80,248, 69,232, 60,116,153, 77, 81,186,146,251, 24, 39, 52, 70
- .byte 141, 93,186,111, 71,126, 50,138, 36,148,144,156,203,163, 17,170
- .byte 145,175,109,180,192,184,161,188, 32,192, 76,195, 47,198,212,200
- .byte 66,203,127,205,146,207,126,209, 73,211,245,212,134,214,254,215
- .byte 96,217,173,218,232,219, 18,221, 44,222, 56,223, 55,224, 42,225
- .byte 17,226,239,226,194,227,141,228, 79,229, 9,230,188,230,104,231
- .byte 14,232,174,232, 73,233,222,233,110,234,249,234,128,235, 3,236
- .byte 130,236,253,236,116,237,232,237, 89,238,199,238, 50,239,155,239
- .byte 0,240,100,240,197,240, 36,241,128,241,219,241, 51,242,138,242
- .byte 223,242, 50,243,132,243,212,243, 35,244,112,244,188,244, 6,245
- .byte 80,245,152,245,223,245, 37,246,105,246,173,246,240,246, 50,247
- .byte 115,247,179,247,243,247, 49,248,111,248,172,248,233,248, 37,249
- .byte 96,249,154,249,212,249, 14,250, 71,250,127,250,183,250,239,250
- .byte 38,251, 93,251,147,251,201,251,255,251, 52,252,105,252,157,252
- .byte 210,252, 6,253, 58,253,109,253,161,253,212,253, 7,254, 58,254
- .byte 109,254,160,254,210,254, 5,255, 55,255,106,255,156,255,206,255
- .byte 0, 0, 50, 0,100, 0,150, 0,201, 0,251, 0, 46, 1, 96, 1
- .byte 147, 1,198, 1,249, 1, 44, 2, 95, 2,147, 2,198, 2,250, 2
- .byte 46, 3, 99, 3,151, 3,204, 3, 1, 4, 55, 4,109, 4,163, 4
- .byte 218, 4, 17, 5, 73, 5,129, 5,185, 5,242, 5, 44, 6,102, 6
- .byte 160, 6,219, 6, 23, 7, 84, 7,145, 7,207, 7, 13, 8, 77, 8
- .byte 141, 8,206, 8, 16, 9, 83, 9,151, 9,219, 9, 33, 10,104, 10
- .byte 176, 10,250, 10, 68, 11,144, 11,221, 11, 44, 12,124, 12,206, 12
- .byte 33, 13,118, 13,205, 13, 37, 14,128, 14,220, 14, 59, 15,156, 15
- .byte 255, 15,101, 16,206, 16, 57, 17,167, 17, 24, 18,140, 18, 3, 19
- .byte 126, 19,253, 19,128, 20, 7, 21,146, 21, 34, 22,183, 22, 82, 23
- .byte 242, 23,152, 24, 68, 25,247, 25,177, 26,115, 27, 62, 28, 17, 29
- .byte 239, 29,214, 30,201, 31,200, 32,212, 33,238, 34, 24, 36, 83, 37
- .byte 160, 38, 2, 40,122, 41, 11, 43,183, 44,130, 46,110, 48,129, 50
- .byte 190, 52, 44, 55,209, 57,180, 60,224, 63, 95, 67, 64, 71,147, 75
- .byte 111, 80,239, 85, 53, 92,112, 99,220,107,206,117,185,129, 70,144
- .byte 115,162,204,185,232,216,110, 4,175, 69,103,178,196,139,187, 23
- .byte 196,128, 69,232, 60,116,153, 77, 81,186,146,251, 24, 39, 52, 70
- .byte 141, 93,186,111, 71,126, 50,138, 36,148,144,156,203,163, 17,170
- .byte 145,175,109,180,192,184,161,188, 32,192, 76,195, 47,198,212,200
- .byte 66,203,127,205,146,207,126,209, 73,211,245,212,134,214,254,215
- .byte 96,217,173,218,232,219, 18,221, 44,222, 56,223, 55,224, 42,225
- .byte 17,226,239,226,194,227,141,228, 79,229, 9,230,188,230,104,231
- .byte 14,232,174,232, 73,233,222,233,110,234,249,234,128,235, 3,236
- .byte 130,236,253,236,116,237,232,237, 89,238,199,238, 50,239,155,239
- .byte 0,240,100,240,197,240, 36,241,128,241,219,241, 51,242,138,242
- .byte 223,242, 50,243,132,243,212,243, 35,244,112,244,188,244, 6,245
- .byte 80,245,152,245,223,245, 37,246,105,246,173,246,240,246, 50,247
- .byte 115,247,179,247,243,247, 49,248,111,248,172,248,233,248, 37,249
- .byte 96,249,154,249,212,249, 14,250, 71,250,127,250,183,250,239,250
- .byte 38,251, 93,251,147,251,201,251,255,251, 52,252,105,252,157,252
- .byte 210,252, 6,253, 58,253,109,253,161,253,212,253, 7,254, 58,254
- .byte 109,254,160,254,210,254, 5,255, 55,255,106,255,156,255,206,255
-
- .global TAN_bin_end
-TAN_bin_end:
-
diff --git a/c/src/lib/libbsp/arm/nds/libnds/source/arm9/boxtest.c b/c/src/lib/libbsp/arm/nds/libnds/source/arm9/boxtest.c
deleted file mode 100644
index 8335635c33..0000000000
--- a/c/src/lib/libbsp/arm/nds/libnds/source/arm9/boxtest.c
+++ /dev/null
@@ -1,97 +0,0 @@
-/*---------------------------------------------------------------------------------
- BoxTest.c -- Code for performing hardware box test against viewing frustrum
-
- 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/arm9/video.h>
-#include <nds/arm9/videoGL.h>
-
-/*
- * Prototypes
- *
- * NOTE: This code appears to be externally available test code.
- */
-void BoxTest_Asynch(v16 x, v16 y, v16 z, v16 width, v16 height, v16 depth);
-int BoxTestf(float x, float y, float z, float width, float height, float depth);
-void BoxTestf_Asynch(float x, float y, float z, float width, float height, float depth);
-int BoxTestResult(void);
-int BoxTest(v16 x, v16 y, v16 z, v16 width, v16 height, v16 depth);
-
-//---------------------------------------------------------------------------------
-void BoxTest_Asynch(v16 x, v16 y, v16 z, v16 width, v16 height, v16 depth)
-//---------------------------------------------------------------------------------
-{
- glPolyFmt(BIT(12) | BIT(13));
- glBegin(GL_TRIANGLES);
- glEnd();
-
- GFX_BOX_TEST = VERTEX_PACK(x, y);
- GFX_BOX_TEST = VERTEX_PACK(z, width);
- GFX_BOX_TEST = VERTEX_PACK(height, depth);
-}
-
-//---------------------------------------------------------------------------------
-void BoxTestf_Asynch(float x, float y, float z, float width, float height, float depth)
-//---------------------------------------------------------------------------------
-{
- BoxTest_Asynch(floattov16(x), floattov16(y), floattov16(z),
- floattov16(width), floattov16(height), floattov16(depth));
-}
-
-//---------------------------------------------------------------------------------
-int BoxTestResult(void)
-//---------------------------------------------------------------------------------
-{
- while(GFX_STATUS & BIT(0));
-
- return (GFX_STATUS & BIT(1));
-}
-
-//---------------------------------------------------------------------------------
-int BoxTest(v16 x, v16 y, v16 z, v16 width, v16 height, v16 depth)
-//---------------------------------------------------------------------------------
-{
- glPolyFmt(BIT(12) | BIT(13));
- glBegin(GL_TRIANGLES);
- glEnd();
-
- GFX_BOX_TEST = VERTEX_PACK(x, y);
- GFX_BOX_TEST = VERTEX_PACK(z, width);
- GFX_BOX_TEST = VERTEX_PACK(height, depth);
-
- while(GFX_STATUS & BIT(0));
-
- return (GFX_STATUS & BIT(1));
-}
-
-//---------------------------------------------------------------------------------
-int BoxTestf(float x, float y, float z, float width, float height, float depth)
-//---------------------------------------------------------------------------------
-{
- return BoxTest(floattov16(x), floattov16(y), floattov16(z),
- floattov16(width), floattov16(height), floattov16(depth));
-}
diff --git a/c/src/lib/libbsp/arm/nds/libnds/source/arm9/console.c b/c/src/lib/libbsp/arm/nds/libnds/source/arm9/console.c
deleted file mode 100644
index 23adf4c0c2..0000000000
--- a/c/src/lib/libbsp/arm/nds/libnds/source/arm9/console.c
+++ /dev/null
@@ -1,456 +0,0 @@
-/*---------------------------------------------------------------------------------
- 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/jtypes.h>
-#include <nds/memory.h>
-#include <nds/arm9/console.h>
-#include <nds/arm9/video.h>
-#include <nds/arm9/background.h>
-#include <default_font_bin.h>
-
-#include <stdio.h>
-#include <stdarg.h>
-#include <sys/iosupport.h>
-
-// global console variables
-
-#define CONSOLE_WIDTH 32
-#define CONSOLE_HEIGHT 24
-#define TAB_SIZE 3
-
-// map to print to
-static u16* fontMap;
-
-// location of cursor
-static int row, col;
-static int savedX, savedY;
-
-// font may not start on a character base boundry
-static u16 fontOffset;
-
-// the first character in the set (0 if you have a full set)
-static u16 fontStart;
-
-// the 16-color palette to use
-bool fontBold = false;
-static u16 fontPal;
-
-static int consoleInitialised = 0;
-
-void consolePrintChar(char c);
-
-
-//---------------------------------------------------------------------------------
-static void consoleCls(char mode) {
-//---------------------------------------------------------------------------------
-
- int i = 0;
- int colTemp,rowTemp;
-
- switch (mode)
- {
- case '0':
- {
- colTemp = col;
- rowTemp = row;
-
- while(i++ < ((CONSOLE_HEIGHT * CONSOLE_WIDTH) - (rowTemp * CONSOLE_WIDTH + colTemp))) consolePrintChar(' ');
-
- col = colTemp;
- row = rowTemp;
- break;
- }
- case '1':
- {
- colTemp = col;
- rowTemp = row;
-
- row = 0;
- col = 0;
-
- while (i++ < (rowTemp * CONSOLE_WIDTH + colTemp)) consolePrintChar(' ');
-
- col = colTemp;
- row = rowTemp;
- break;
- }
- case '2':
- {
- row = 0;
- col = 0;
-
- while(i++ < CONSOLE_HEIGHT * CONSOLE_WIDTH) consolePrintChar(' ');
-
- row = 0;
- col = 0;
- break;
- }
- }
-}
-//---------------------------------------------------------------------------------
-static void consoleClearLine(char mode) {
-//---------------------------------------------------------------------------------
-
- int i = 0;
- int colTemp;
-
- switch (mode)
- {
- case '0':
- {
- colTemp = col;
-
- while(i++ < (CONSOLE_WIDTH - colTemp)) {
- consolePrintChar(' ');
- }
-
- col = colTemp;
-
- break;
- }
- case '1':
- {
- colTemp = col;
-
- col = 0;
-
- while(i++ < ((CONSOLE_WIDTH - colTemp)-2)) {
- consolePrintChar(' ');
- }
-
- col = colTemp;
-
- break;
- }
- case '2':
- {
- colTemp = col;
-
- col = 0;
-
- while(i++ < CONSOLE_WIDTH) {
- consolePrintChar(' ');
- }
-
- col = colTemp;
-
- break;
- }
- default:
- {
- colTemp = col;
-
- while(i++ < (CONSOLE_WIDTH - colTemp)) {
- consolePrintChar(' ');
- }
-
- col = colTemp;
-
- break;
- }
- }
-}
-//---------------------------------------------------------------------------------
-static int con_write(struct _reent *r,int fd,const char *ptr,int len) {
-//---------------------------------------------------------------------------------
-
- if (!consoleInitialised) return -1;
-
- char chr;
-
- int i, count = 0;
- char *tmp = (char*)ptr;
-
- if(!tmp || len<=0) return -1;
-
- i = 0;
- while(*tmp!='\0' && i<len) {
-
- chr = *(tmp++);
- i++; count++;
-
- if ( chr == 0x1b && *tmp == '[' ) {
- bool escaping = true;
- char *escapeseq = tmp;
- int escapelen = 0;
-
- do {
- chr = *(tmp++);
- i++; count++; escapelen++;
- int parameter;
-
- switch (chr) {
- /////////////////////////////////////////
- // Cursor directional movement
- /////////////////////////////////////////
- case 'A':
- siscanf(escapeseq,"[%dA", &parameter);
- row = (row - parameter) < 0 ? 0 : row - parameter;
- escaping = false;
- break;
- case 'B':
- siscanf(escapeseq,"[%dB", &parameter);
- row = (row + parameter) > CONSOLE_HEIGHT - 1 ? CONSOLE_HEIGHT - 1 : row + parameter;
- escaping = false;
- break;
- case 'C':
- siscanf(escapeseq,"[%dC", &parameter);
- col = (col + parameter) > CONSOLE_WIDTH - 1 ? CONSOLE_WIDTH - 1 : col + parameter;
- escaping = false;
- break;
- case 'D':
- siscanf(escapeseq,"[%dC", &parameter);
- col = (col - parameter) < 0 ? 0 : col - parameter;
- escaping = false;
- break;
- /////////////////////////////////////////
- // Cursor position movement
- /////////////////////////////////////////
- case 'H':
- case 'f':
- siscanf(escapeseq,"[%d;%df", &row, &col);
- escaping = false;
- break;
- /////////////////////////////////////////
- // Screen clear
- /////////////////////////////////////////
- case 'J':
- consoleCls(escapeseq[escapelen-2]);
- escaping = false;
- break;
- /////////////////////////////////////////
- // Line clear
- /////////////////////////////////////////
- case 'K':
- consoleClearLine(escapeseq[escapelen-2]);
- escaping = false;
- break;
- /////////////////////////////////////////
- // Save cursor position
- /////////////////////////////////////////
- case 's':
- savedX = col;
- savedY = row;
- escaping = false;
- break;
- /////////////////////////////////////////
- // Load cursor position
- /////////////////////////////////////////
- case 'u':
- col = savedX;
- row = savedY;
- escaping = false;
- break;
- }
- } while (escaping);
- continue;
- }
-
- consolePrintChar(chr);
- }
-
- return count;
-}
-
-const devoptab_t dotab_stdout = {
- "con",
- NULL,
- NULL,
- con_write,
- NULL,
- NULL,
- NULL
-};
-
-
-/*---------------------------------------------------------------------------------
- consoleInit
- param:
- font: 16 color font
- charBase: the location the font data will be loaded to
- numCharacters: count of characters in the font
- charStart: The ascii number of the first character in the font set
- if you have a full set this will be zero
- map: pointer to the map you will be printing to.
- pal: specifies the 16 color palette to use, if > 15 it will change all non-zero
- entries in the font to use palette index 255
----------------------------------------------------------------------------------*/
-void consoleInit( u16* font, u16* charBase,
- u16 numCharacters, u8 charStart,
- u16* map, u8 pal, u8 bitDepth) {
-//---------------------------------------------------------------------------------
- int i;
-
- row = col = 0;
-
- fontStart = charStart;
-
- fontOffset = 0;
-
- fontMap = map;
-
- if(bitDepth == 16)
- {
- if(pal < 16)
- {
- fontPal = pal << 12;
-
- for (i = 0; i < numCharacters * 16; i++)
- charBase[i] = font[i];
- }
- else
- {
- fontPal = 15 << 12;
-
- for (i = 0; i < numCharacters * 16; i++)
- {
- u16 temp = 0;
-
- if(font[i] & 0xF)
- temp |= 0xF;
- if(font[i] & 0xF0)
- temp |= 0xF0;
- if(font[i] & 0xF00)
- temp |= 0xF00;
- if(font[i] & 0xF000)
- temp |= 0xF000;
-
- charBase[i] = temp;
- }
- }
- }//end if bitdepth
- else
- {
- fontPal = 0;
- for(i = 0; i < numCharacters * 16; i++)
- {
- u32 temp = 0;
-
- if(font[i] & 0xF)
- temp = 255;
- if(font[i] & 0xF0)
- temp |= 255 << 8;
- if(font[i] & 0xF00)
- temp |= 255 << 16;
- if(font[i] & 0xF000)
- temp |= 255 << 24;
-
- ((u32*)charBase)[i] = temp;
-
- }
- }
-
- devoptab_list[STD_OUT] = &dotab_stdout;
- devoptab_list[STD_ERR] = &dotab_stdout;
- setvbuf(stderr, NULL , _IONBF, 0);
- setvbuf(stdout, NULL , _IONBF, 0);
- consoleCls('2');
- consoleInitialised = 1;
-
-}
-
-//---------------------------------------------------------------------------------
-// Places the console in a default mode using bg0 of the sub display, and vram c for
-// font and map..this is provided for rapid prototyping and nothing more
-void consoleDemoInit(void) {
-//---------------------------------------------------------------------------------
- videoSetModeSub(MODE_0_2D | DISPLAY_BG0_ACTIVE); //sub bg 0 will be used to print text
- vramSetBankC(VRAM_C_SUB_BG);
-
- SUB_BG0_CR = BG_MAP_BASE(31);
-
- BG_PALETTE_SUB[255] = RGB15(31,31,31); //by default font will be rendered with color 255
-
- //consoleInit() is a lot more flexible but this gets you up and running quick
- consoleInitDefault((u16*)SCREEN_BASE_BLOCK_SUB(31), (u16*)CHAR_BASE_BLOCK_SUB(0), 16);
-}
-
-//---------------------------------------------------------------------------------
-void consoleInitDefault(u16* map, u16* charBase, u8 bitDepth) {
-//---------------------------------------------------------------------------------
- consoleInit((u16*)default_font_bin, charBase, 256, 0, map, CONSOLE_USE_COLOR255, bitDepth);
-}
-
-//void consoleInitColorDefault(u16* map, u16* charBase) {
-// consoleInit((u16*)default_font_bin, charBase, 256, 0, map, CONSOLE_USE_COLOR255, bitDepth);
-//}
-
-//---------------------------------------------------------------------------------
-static void newRow(void) {
-//---------------------------------------------------------------------------------
- int i;
- row++;
- if(row >= CONSOLE_HEIGHT) {
- row--;
-
- for(i = CONSOLE_WIDTH; i < CONSOLE_HEIGHT * CONSOLE_WIDTH; i++) fontMap[i - CONSOLE_WIDTH] = fontMap[i];
-
- for(i = 0; i < CONSOLE_WIDTH; i++) fontMap[i + (CONSOLE_HEIGHT-1)*CONSOLE_WIDTH] = fontPal | (u16)(' ' + fontOffset - fontStart);
-
- }
-}
-
-
-//---------------------------------------------------------------------------------
-void consolePrintChar(char c) {
-//---------------------------------------------------------------------------------
-
- if(col >= CONSOLE_WIDTH) {
- col = 0;
-
- newRow();
- }
-
- switch(c) {
- /*
- The only special characters we will handle are tab (\t), carriage return (\r) & line feed (\n).
- Carriage return & line feed will function the same: go to next line and put cursor at the beginning.
- For everything else, use VT sequences.
-
- Reason: VT sequences are more specific to the task of cursor placement.
- The special escape sequences \b \f & \v are archaic and non-portable.
- */
- case 9:
- col += TAB_SIZE;
- break;
- case 10:
- case 13:
- newRow();
- col = 0;
- break;
- default:
- fontMap[col + row * CONSOLE_WIDTH] = fontPal | (u16)(c + fontOffset - fontStart);
- ++col;
- break;
- }
-}
-
-//---------------------------------------------------------------------------------
-void consoleClear(void) {
-//---------------------------------------------------------------------------------
- iprintf("\x1b[2J");
-}
-
-
diff --git a/c/src/lib/libbsp/arm/nds/libnds/source/arm9/dcache.S b/c/src/lib/libbsp/arm/nds/libnds/source/arm9/dcache.S
deleted file mode 100644
index 85f409b2be..0000000000
--- a/c/src/lib/libbsp/arm/nds/libnds/source/arm9/dcache.S
+++ /dev/null
@@ -1,92 +0,0 @@
-/*---------------------------------------------------------------------------------
- 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.
-
----------------------------------------------------------------------------------*/
-#define ICACHE_SIZE 0x2000
-#define DCACHE_SIZE 0x1000
-#define CACHE_LINE_SIZE 32
-//---------------------------------------------------------------------------------
- .arm
-//---------------------------------------------------------------------------------
- .global DC_FlushAll
-//---------------------------------------------------------------------------------
-DC_FlushAll:
-/*---------------------------------------------------------------------------------
- Clean and invalidate entire data cache
----------------------------------------------------------------------------------*/
- mov r1, #0
-outer_loop:
- mov r0, #0
-inner_loop:
- orr r2, r1, r0 @ generate segment and line address
- mcr p15, 0, r2, c7, c14, 2 @ clean and flush the line
- add r0, r0, #CACHE_LINE_SIZE
- cmp r0, #DCACHE_SIZE/4
- bne inner_loop
- add r1, r1, #0x40000000
- cmp r1, #0
- bne outer_loop
- bx lr
-
-//---------------------------------------------------------------------------------
- .global DC_FlushRange
-//---------------------------------------------------------------------------------
-DC_FlushRange:
-/*---------------------------------------------------------------------------------
- Clean and invalidate a range
----------------------------------------------------------------------------------*/
- add r1, r1, r0
- bic r0, r0, #(CACHE_LINE_SIZE - 1)
-.flush:
- mcr p15, 0, r0, c7, c14, 1 @ clean and flush address
- add r0, r0, #CACHE_LINE_SIZE
- cmp r0, r1
- blt .flush
- bx lr
-
-//---------------------------------------------------------------------------------
- .global DC_InvalidateAll
-//---------------------------------------------------------------------------------
-DC_InvalidateAll:
-/*---------------------------------------------------------------------------------
- Clean and invalidate entire data cache
----------------------------------------------------------------------------------*/
- mov r0, #0
- mcr p15, 0, r0, c7, c6, 0
- bx lr
-
-//---------------------------------------------------------------------------------
- .global DC_InvalidateRange
-//---------------------------------------------------------------------------------
-DC_InvalidateRange:
-/*---------------------------------------------------------------------------------
- Invalidate a range
----------------------------------------------------------------------------------*/
- add r1, r1, r0
- bic r0, r0, #CACHE_LINE_SIZE - 1
-.invalidate:
- mcr p15, 0, r0, c7, c6, 1
- add r0, r0, #CACHE_LINE_SIZE
- cmp r0, r1
- blt .invalidate
- bx lr
diff --git a/c/src/lib/libbsp/arm/nds/libnds/source/arm9/default_font.S b/c/src/lib/libbsp/arm/nds/libnds/source/arm9/default_font.S
deleted file mode 100644
index 743677700e..0000000000
--- a/c/src/lib/libbsp/arm/nds/libnds/source/arm9/default_font.S
+++ /dev/null
@@ -1,523 +0,0 @@
-/* Generated by BIN2S - please don't edit directly */
- .section .rodata
- .balign 4
- .global default_font_bin_size
-default_font_bin_size: .int 8192
- .global default_font_bin
-default_font_bin:
- .byte 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
- .byte 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
- .byte 16, 17, 17, 1, 1, 0, 0, 16, 1, 1, 16, 16, 1, 0, 0, 16
- .byte 1, 17, 17, 16, 1, 16, 1, 16, 1, 0, 0, 16, 16, 17, 17, 1
- .byte 16, 17, 17, 1, 17, 17, 17, 17, 17, 16, 1, 17, 17, 17, 17, 17
- .byte 17, 0, 0, 17, 17, 1, 16, 17, 17, 17, 17, 17, 16, 17, 17, 1
- .byte 16, 1, 17, 0, 17, 17, 17, 1, 17, 17, 17, 1, 17, 17, 17, 1
- .byte 16, 17, 17, 0, 0, 17, 1, 0, 0, 16, 0, 0, 0, 0, 0, 0
- .byte 0, 16, 0, 0, 0, 17, 1, 0, 16, 17, 17, 0, 17, 17, 17, 1
- .byte 16, 17, 17, 0, 0, 17, 1, 0, 0, 16, 0, 0, 0, 0, 0, 0
- .byte 0, 17, 17, 0, 0, 17, 17, 0, 0, 16, 1, 0, 17, 17, 17, 17
- .byte 17, 1, 16, 17, 0, 16, 1, 0, 0, 17, 17, 0, 0, 0, 0, 0
- .byte 0, 16, 0, 0, 0, 17, 1, 0, 16, 17, 17, 0, 17, 17, 17, 1
- .byte 17, 1, 17, 1, 0, 16, 0, 0, 0, 17, 1, 0, 0, 0, 0, 0
- .byte 0, 0, 0, 0, 0, 0, 0, 0, 0, 16, 1, 0, 0, 17, 17, 0
- .byte 0, 17, 17, 0, 0, 16, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0
- .byte 17, 17, 17, 17, 17, 17, 17, 17, 17, 1, 16, 17, 17, 0, 0, 17
- .byte 17, 0, 0, 17, 17, 1, 16, 17, 17, 17, 17, 17, 17, 17, 17, 17
- .byte 0, 0, 0, 0, 0, 17, 17, 0, 16, 1, 16, 1, 16, 0, 0, 1
- .byte 16, 0, 0, 1, 16, 1, 16, 1, 0, 17, 17, 0, 0, 0, 0, 0
- .byte 17, 17, 17, 17, 17, 0, 0, 17, 1, 16, 1, 16, 1, 17, 17, 16
- .byte 1, 17, 17, 16, 1, 16, 1, 16, 17, 0, 0, 17, 17, 17, 17, 17
- .byte 0, 0, 17, 17, 0, 0, 16, 17, 0, 0, 17, 17, 16, 17, 17, 16
- .byte 17, 0, 17, 0, 17, 0, 17, 0, 17, 0, 17, 0, 16, 17, 1, 0
- .byte 0, 17, 17, 0, 16, 1, 16, 1, 16, 1, 16, 1, 16, 1, 16, 1
- .byte 0, 17, 17, 0, 0, 16, 1, 0, 16, 17, 17, 1, 0, 16, 1, 0
- .byte 0, 0, 1, 0, 0, 0, 17, 0, 0, 0, 1, 1, 0, 0, 1, 1
- .byte 0, 0, 1, 0, 16, 17, 1, 0, 17, 17, 0, 0, 0, 0, 0, 0
- .byte 0, 16, 1, 0, 0, 16, 16, 0, 0, 16, 1, 1, 0, 16, 16, 1
- .byte 16, 17, 0, 1, 17, 1, 0, 1, 0, 0, 17, 1, 0, 16, 17, 0
- .byte 0, 16, 0, 0, 16, 16, 16, 0, 0, 17, 1, 0, 17, 1, 17, 1
- .byte 0, 17, 1, 0, 16, 16, 16, 0, 0, 16, 0, 0, 0, 0, 0, 0
- .byte 1, 0, 0, 0, 17, 1, 0, 0, 17, 17, 1, 0, 17, 17, 17, 1
- .byte 17, 17, 1, 0, 17, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0
- .byte 0, 0, 0, 1, 0, 0, 17, 1, 0, 17, 17, 1, 17, 17, 17, 1
- .byte 0, 17, 17, 1, 0, 0, 17, 1, 0, 0, 0, 1, 0, 0, 0, 0
- .byte 0, 16, 1, 0, 0, 17, 17, 0, 16, 16, 1, 1, 0, 16, 1, 0
- .byte 16, 16, 1, 1, 0, 17, 17, 0, 0, 16, 1, 0, 0, 0, 0, 0
- .byte 16, 1, 16, 1, 16, 1, 16, 1, 16, 1, 16, 1, 16, 1, 16, 1
- .byte 16, 1, 16, 1, 0, 0, 0, 0, 16, 1, 16, 1, 0, 0, 0, 0
- .byte 16, 17, 17, 17, 17, 16, 1, 17, 17, 16, 1, 17, 17, 16, 1, 17
- .byte 16, 17, 1, 17, 0, 16, 1, 17, 0, 16, 1, 17, 0, 0, 0, 0
- .byte 0, 16, 17, 0, 0, 1, 0, 1, 0, 17, 1, 0, 16, 0, 16, 0
- .byte 16, 0, 16, 0, 0, 17, 1, 0, 1, 0, 1, 0, 16, 17, 0, 0
- .byte 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
- .byte 16, 17, 17, 1, 16, 17, 17, 1, 16, 17, 17, 1, 0, 0, 0, 0
- .byte 0, 16, 1, 0, 0, 17, 17, 0, 16, 16, 1, 1, 0, 16, 1, 0
- .byte 16, 16, 1, 1, 0, 17, 17, 0, 0, 16, 1, 0, 16, 17, 17, 1
- .byte 0, 16, 1, 0, 0, 17, 17, 0, 16, 16, 1, 1, 0, 16, 1, 0
- .byte 0, 16, 1, 0, 0, 16, 1, 0, 0, 16, 1, 0, 0, 0, 0, 0
- .byte 0, 16, 1, 0, 0, 16, 1, 0, 0, 16, 1, 0, 0, 16, 1, 0
- .byte 16, 16, 1, 1, 0, 17, 17, 0, 0, 16, 1, 0, 0, 0, 0, 0
- .byte 0, 0, 0, 0, 0, 16, 1, 0, 0, 0, 17, 0, 17, 17, 17, 1
- .byte 0, 0, 17, 0, 0, 16, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0
- .byte 0, 0, 0, 0, 0, 17, 0, 0, 16, 1, 0, 0, 17, 17, 17, 1
- .byte 16, 1, 0, 0, 0, 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
- .byte 0, 0, 0, 0, 0, 0, 0, 0, 17, 0, 0, 0, 17, 0, 0, 0
- .byte 17, 0, 0, 0, 17, 17, 17, 1, 0, 0, 0, 0, 0, 0, 0, 0
- .byte 0, 0, 0, 0, 0, 1, 16, 0, 16, 0, 0, 1, 17, 17, 17, 17
- .byte 16, 0, 0, 1, 0, 1, 16, 0, 0, 0, 0, 0, 0, 0, 0, 0
- .byte 0, 0, 0, 0, 0, 16, 0, 0, 0, 17, 1, 0, 16, 17, 17, 0
- .byte 17, 17, 17, 1, 17, 17, 17, 1, 0, 0, 0, 0, 0, 0, 0, 0
- .byte 0, 0, 0, 0, 17, 17, 17, 1, 17, 17, 17, 1, 16, 17, 17, 0
- .byte 0, 17, 1, 0, 0, 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
- .byte 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
- .byte 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
- .byte 0, 16, 1, 0, 0, 17, 17, 0, 0, 17, 17, 0, 0, 16, 1, 0
- .byte 0, 16, 1, 0, 0, 0, 0, 0, 0, 16, 1, 0, 0, 0, 0, 0
- .byte 16, 1, 17, 0, 0, 1, 16, 0, 0, 1, 16, 0, 0, 0, 0, 0
- .byte 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
- .byte 16, 1, 17, 0, 16, 1, 17, 0, 17, 17, 17, 1, 16, 1, 17, 0
- .byte 17, 17, 17, 1, 16, 1, 17, 0, 16, 1, 17, 0, 0, 0, 0, 0
- .byte 0, 16, 0, 0, 16, 17, 17, 0, 17, 16, 0, 0, 16, 17, 17, 0
- .byte 0, 16, 16, 1, 17, 17, 17, 0, 0, 16, 0, 0, 0, 0, 0, 0
- .byte 0, 0, 0, 0, 16, 1, 16, 1, 1, 1, 17, 0, 17, 16, 1, 0
- .byte 0, 17, 16, 1, 16, 1, 1, 1, 17, 0, 17, 0, 0, 0, 0, 0
- .byte 0, 17, 1, 0, 16, 0, 17, 0, 0, 17, 1, 0, 16, 17, 1, 0
- .byte 17, 0, 17, 1, 17, 0, 17, 0, 16, 17, 1, 1, 0, 0, 0, 0
- .byte 0, 17, 0, 0, 0, 16, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0
- .byte 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
- .byte 0, 16, 1, 0, 0, 17, 0, 0, 16, 1, 0, 0, 16, 1, 0, 0
- .byte 16, 1, 0, 0, 0, 17, 0, 0, 0, 16, 1, 0, 0, 0, 0, 0
- .byte 16, 1, 0, 0, 0, 17, 0, 0, 0, 16, 1, 0, 0, 16, 1, 0
- .byte 0, 16, 1, 0, 0, 17, 0, 0, 16, 1, 0, 0, 0, 0, 0, 0
- .byte 0, 0, 0, 0, 16, 1, 16, 1, 0, 17, 17, 0, 17, 17, 17, 17
- .byte 0, 17, 17, 0, 16, 1, 16, 1, 0, 0, 0, 0, 0, 0, 0, 0
- .byte 0, 0, 0, 0, 0, 17, 0, 0, 0, 17, 0, 0, 17, 17, 17, 0
- .byte 0, 17, 0, 0, 0, 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
- .byte 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
- .byte 0, 0, 0, 0, 0, 17, 0, 0, 0, 16, 0, 0, 0, 1, 0, 0
- .byte 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 17, 17, 17, 0
- .byte 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
- .byte 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
- .byte 0, 0, 0, 0, 0, 0, 0, 0, 0, 17, 0, 0, 0, 0, 0, 0
- .byte 0, 0, 0, 1, 0, 0, 16, 1, 0, 0, 17, 0, 0, 16, 1, 0
- .byte 0, 17, 0, 0, 16, 1, 0, 0, 17, 0, 0, 0, 0, 0, 0, 0
- .byte 16, 17, 17, 0, 17, 0, 17, 1, 17, 16, 17, 1, 17, 17, 16, 1
- .byte 17, 1, 16, 1, 17, 1, 16, 1, 16, 17, 17, 0, 0, 0, 0, 0
- .byte 0, 16, 1, 0, 0, 17, 1, 0, 16, 17, 1, 0, 0, 16, 1, 0
- .byte 0, 16, 1, 0, 0, 16, 1, 0, 16, 17, 17, 1, 0, 0, 0, 0
- .byte 16, 17, 17, 0, 17, 0, 16, 1, 0, 0, 16, 1, 0, 16, 17, 0
- .byte 16, 17, 0, 0, 17, 0, 16, 1, 17, 17, 17, 1, 0, 0, 0, 0
- .byte 16, 17, 17, 0, 17, 0, 16, 1, 0, 0, 16, 1, 0, 17, 17, 0
- .byte 0, 0, 16, 1, 17, 0, 16, 1, 16, 17, 17, 0, 0, 0, 0, 0
- .byte 0, 16, 17, 0, 0, 17, 17, 0, 16, 1, 17, 0, 17, 0, 17, 0
- .byte 17, 17, 17, 1, 0, 0, 17, 0, 0, 16, 17, 1, 0, 0, 0, 0
- .byte 17, 17, 17, 1, 17, 0, 0, 0, 17, 17, 17, 0, 0, 0, 16, 1
- .byte 0, 0, 16, 1, 17, 0, 16, 1, 16, 17, 17, 0, 0, 0, 0, 0
- .byte 16, 17, 17, 0, 17, 0, 16, 1, 17, 0, 0, 0, 17, 17, 17, 0
- .byte 17, 0, 16, 1, 17, 0, 16, 1, 16, 17, 17, 0, 0, 0, 0, 0
- .byte 17, 17, 17, 1, 17, 0, 16, 1, 0, 0, 17, 0, 0, 16, 1, 0
- .byte 0, 17, 0, 0, 0, 17, 0, 0, 0, 17, 0, 0, 0, 0, 0, 0
- .byte 16, 17, 17, 0, 17, 0, 16, 1, 17, 0, 16, 1, 16, 17, 17, 0
- .byte 17, 0, 16, 1, 17, 0, 16, 1, 16, 17, 17, 0, 0, 0, 0, 0
- .byte 16, 17, 17, 0, 17, 0, 16, 1, 17, 0, 16, 1, 16, 17, 17, 1
- .byte 0, 0, 16, 1, 17, 0, 16, 1, 16, 17, 17, 0, 0, 0, 0, 0
- .byte 0, 0, 0, 0, 0, 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
- .byte 0, 0, 0, 0, 0, 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
- .byte 0, 0, 0, 0, 0, 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
- .byte 0, 0, 0, 0, 0, 17, 0, 0, 0, 16, 0, 0, 0, 1, 0, 0
- .byte 0, 0, 17, 0, 0, 16, 1, 0, 0, 17, 0, 0, 16, 1, 0, 0
- .byte 0, 17, 0, 0, 0, 16, 1, 0, 0, 0, 17, 0, 0, 0, 0, 0
- .byte 0, 0, 0, 0, 0, 0, 0, 0, 16, 17, 17, 1, 0, 0, 0, 0
- .byte 0, 0, 0, 0, 16, 17, 17, 1, 0, 0, 0, 0, 0, 0, 0, 0
- .byte 16, 1, 0, 0, 0, 17, 0, 0, 0, 16, 1, 0, 0, 0, 17, 0
- .byte 0, 16, 1, 0, 0, 17, 0, 0, 16, 1, 0, 0, 0, 0, 0, 0
- .byte 16, 17, 1, 0, 17, 0, 17, 0, 0, 0, 17, 0, 0, 16, 1, 0
- .byte 0, 17, 0, 0, 0, 0, 0, 0, 0, 17, 0, 0, 0, 0, 0, 0
- .byte 16, 17, 17, 0, 1, 0, 0, 1, 1, 16, 17, 1, 1, 1, 16, 1
- .byte 1, 16, 17, 1, 1, 0, 0, 0, 16, 17, 17, 0, 0, 0, 0, 0
- .byte 16, 17, 17, 0, 17, 0, 16, 1, 17, 0, 16, 1, 17, 17, 17, 1
- .byte 17, 0, 16, 1, 17, 0, 16, 1, 17, 0, 16, 1, 0, 0, 0, 0
- .byte 17, 17, 17, 0, 16, 1, 16, 1, 16, 1, 16, 1, 16, 17, 17, 0
- .byte 16, 1, 16, 1, 16, 1, 16, 1, 17, 17, 17, 0, 0, 0, 0, 0
- .byte 16, 17, 17, 0, 17, 0, 16, 1, 17, 0, 0, 0, 17, 0, 0, 0
- .byte 17, 0, 0, 0, 17, 0, 16, 1, 16, 17, 17, 0, 0, 0, 0, 0
- .byte 17, 17, 17, 0, 16, 1, 16, 1, 16, 1, 16, 1, 16, 1, 16, 1
- .byte 16, 1, 16, 1, 16, 1, 16, 1, 17, 17, 17, 0, 0, 0, 0, 0
- .byte 17, 17, 17, 1, 16, 1, 0, 1, 16, 1, 1, 0, 16, 17, 1, 0
- .byte 16, 1, 1, 0, 16, 1, 0, 1, 17, 17, 17, 1, 0, 0, 0, 0
- .byte 17, 17, 17, 1, 16, 1, 0, 1, 16, 1, 1, 0, 16, 17, 1, 0
- .byte 16, 1, 1, 0, 16, 1, 0, 0, 17, 17, 0, 0, 0, 0, 0, 0
- .byte 16, 17, 17, 0, 17, 0, 16, 1, 17, 0, 16, 1, 17, 0, 0, 0
- .byte 17, 0, 17, 1, 17, 0, 16, 1, 16, 17, 17, 1, 0, 0, 0, 0
- .byte 17, 0, 16, 1, 17, 0, 16, 1, 17, 0, 16, 1, 17, 17, 17, 1
- .byte 17, 0, 16, 1, 17, 0, 16, 1, 17, 0, 16, 1, 0, 0, 0, 0
- .byte 0, 17, 17, 0, 0, 16, 1, 0, 0, 16, 1, 0, 0, 16, 1, 0
- .byte 0, 16, 1, 0, 0, 16, 1, 0, 0, 17, 17, 0, 0, 0, 0, 0
- .byte 0, 16, 17, 1, 0, 0, 17, 0, 0, 0, 17, 0, 0, 0, 17, 0
- .byte 17, 0, 17, 0, 17, 0, 17, 0, 16, 17, 1, 0, 0, 0, 0, 0
- .byte 17, 1, 16, 1, 16, 1, 16, 1, 16, 1, 17, 0, 16, 17, 1, 0
- .byte 16, 1, 17, 0, 16, 1, 16, 1, 17, 1, 16, 1, 0, 0, 0, 0
- .byte 17, 17, 0, 0, 16, 1, 0, 0, 16, 1, 0, 0, 16, 1, 0, 0
- .byte 16, 1, 0, 1, 16, 1, 16, 1, 17, 17, 17, 1, 0, 0, 0, 0
- .byte 1, 0, 0, 1, 17, 0, 16, 1, 17, 1, 17, 1, 17, 17, 17, 1
- .byte 17, 16, 16, 1, 17, 0, 16, 1, 17, 0, 16, 1, 0, 0, 0, 0
- .byte 17, 0, 16, 1, 17, 1, 16, 1, 17, 17, 16, 1, 17, 16, 17, 1
- .byte 17, 0, 17, 1, 17, 0, 16, 1, 17, 0, 16, 1, 0, 0, 0, 0
- .byte 16, 17, 17, 0, 17, 0, 16, 1, 17, 0, 16, 1, 17, 0, 16, 1
- .byte 17, 0, 16, 1, 17, 0, 16, 1, 16, 17, 17, 0, 0, 0, 0, 0
- .byte 17, 17, 17, 0, 16, 1, 16, 1, 16, 1, 16, 1, 16, 17, 17, 0
- .byte 16, 1, 0, 0, 16, 1, 0, 0, 17, 17, 0, 0, 0, 0, 0, 0
- .byte 16, 17, 17, 0, 17, 0, 16, 1, 17, 0, 16, 1, 17, 0, 16, 1
- .byte 17, 16, 16, 1, 17, 16, 17, 1, 16, 17, 17, 0, 0, 0, 16, 1
- .byte 17, 17, 17, 0, 16, 1, 16, 1, 16, 1, 16, 1, 16, 17, 17, 0
- .byte 16, 1, 16, 1, 16, 1, 16, 1, 17, 1, 16, 1, 0, 0, 0, 0
- .byte 16, 17, 17, 0, 17, 0, 16, 1, 17, 0, 0, 0, 16, 17, 17, 0
- .byte 0, 0, 16, 1, 17, 0, 16, 1, 16, 17, 17, 0, 0, 0, 0, 0
- .byte 16, 17, 17, 1, 16, 16, 1, 1, 16, 16, 1, 1, 0, 16, 1, 0
- .byte 0, 16, 1, 0, 0, 16, 1, 0, 0, 17, 17, 0, 0, 0, 0, 0
- .byte 17, 0, 16, 1, 17, 0, 16, 1, 17, 0, 16, 1, 17, 0, 16, 1
- .byte 17, 0, 16, 1, 17, 0, 16, 1, 16, 17, 17, 0, 0, 0, 0, 0
- .byte 17, 0, 16, 1, 17, 0, 16, 1, 17, 0, 16, 1, 17, 0, 16, 1
- .byte 16, 1, 17, 0, 0, 17, 1, 0, 0, 16, 0, 0, 0, 0, 0, 0
- .byte 17, 0, 16, 1, 17, 0, 16, 1, 17, 16, 16, 1, 17, 17, 17, 1
- .byte 17, 1, 17, 1, 17, 0, 16, 1, 1, 0, 0, 1, 0, 0, 0, 0
- .byte 17, 0, 16, 1, 16, 1, 17, 0, 0, 17, 1, 0, 0, 17, 1, 0
- .byte 0, 17, 1, 0, 16, 1, 17, 0, 17, 0, 16, 1, 0, 0, 0, 0
- .byte 16, 1, 16, 1, 16, 1, 16, 1, 16, 1, 16, 1, 0, 17, 17, 0
- .byte 0, 16, 1, 0, 0, 16, 1, 0, 0, 17, 17, 0, 0, 0, 0, 0
- .byte 17, 17, 17, 1, 17, 0, 16, 1, 1, 0, 17, 0, 0, 16, 1, 0
- .byte 0, 17, 0, 1, 16, 1, 16, 1, 17, 17, 17, 1, 0, 0, 0, 0
- .byte 16, 17, 1, 0, 16, 1, 0, 0, 16, 1, 0, 0, 16, 1, 0, 0
- .byte 16, 1, 0, 0, 16, 1, 0, 0, 16, 17, 1, 0, 0, 0, 0, 0
- .byte 17, 0, 0, 0, 16, 1, 0, 0, 0, 17, 0, 0, 0, 16, 1, 0
- .byte 0, 0, 17, 0, 0, 0, 16, 1, 0, 0, 0, 1, 0, 0, 0, 0
- .byte 16, 17, 1, 0, 0, 16, 1, 0, 0, 16, 1, 0, 0, 16, 1, 0
- .byte 0, 16, 1, 0, 0, 16, 1, 0, 16, 17, 1, 0, 0, 0, 0, 0
- .byte 0, 16, 0, 0, 0, 17, 1, 0, 16, 1, 17, 0, 17, 0, 16, 1
- .byte 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
- .byte 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
- .byte 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 17, 17, 17, 17
- .byte 0, 17, 0, 0, 0, 1, 0, 0, 0, 16, 0, 0, 0, 0, 0, 0
- .byte 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
- .byte 0, 0, 0, 0, 0, 0, 0, 0, 16, 17, 1, 0, 0, 0, 17, 0
- .byte 16, 17, 17, 0, 17, 0, 17, 0, 16, 17, 16, 1, 0, 0, 0, 0
- .byte 17, 1, 0, 0, 16, 1, 0, 0, 16, 1, 0, 0, 16, 17, 17, 0
- .byte 16, 1, 16, 1, 16, 1, 16, 1, 16, 17, 17, 0, 0, 0, 0, 0
- .byte 0, 0, 0, 0, 0, 0, 0, 0, 16, 17, 17, 0, 17, 0, 16, 1
- .byte 17, 0, 0, 0, 17, 0, 16, 1, 16, 17, 17, 0, 0, 0, 0, 0
- .byte 0, 16, 17, 0, 0, 0, 17, 0, 0, 0, 17, 0, 16, 17, 17, 0
- .byte 17, 0, 17, 0, 17, 0, 17, 0, 16, 17, 16, 1, 0, 0, 0, 0
- .byte 0, 0, 0, 0, 0, 0, 0, 0, 16, 17, 17, 0, 17, 0, 16, 1
- .byte 17, 17, 17, 1, 17, 0, 0, 0, 16, 17, 17, 0, 0, 0, 0, 0
- .byte 0, 16, 17, 0, 0, 17, 16, 1, 0, 17, 0, 0, 16, 17, 1, 0
- .byte 0, 17, 0, 0, 0, 17, 0, 0, 16, 17, 1, 0, 0, 0, 0, 0
- .byte 0, 0, 0, 0, 0, 0, 0, 0, 16, 17, 16, 1, 17, 0, 17, 0
- .byte 17, 0, 17, 0, 16, 17, 17, 0, 0, 0, 17, 0, 16, 17, 1, 0
- .byte 17, 1, 0, 0, 16, 1, 0, 0, 16, 1, 17, 0, 16, 17, 16, 1
- .byte 16, 1, 16, 1, 16, 1, 16, 1, 17, 1, 16, 1, 0, 0, 0, 0
- .byte 0, 16, 1, 0, 0, 0, 0, 0, 0, 17, 1, 0, 0, 16, 1, 0
- .byte 0, 16, 1, 0, 0, 16, 1, 0, 0, 17, 17, 0, 0, 0, 0, 0
- .byte 0, 0, 0, 0, 0, 0, 17, 0, 0, 0, 0, 0, 0, 16, 17, 0
- .byte 0, 0, 17, 0, 0, 0, 17, 0, 17, 0, 17, 0, 16, 17, 1, 0
- .byte 17, 1, 0, 0, 16, 1, 0, 0, 16, 1, 16, 1, 16, 1, 17, 0
- .byte 16, 17, 1, 0, 16, 1, 17, 0, 17, 1, 16, 1, 0, 0, 0, 0
- .byte 0, 17, 1, 0, 0, 16, 1, 0, 0, 16, 1, 0, 0, 16, 1, 0
- .byte 0, 16, 1, 0, 0, 16, 1, 0, 0, 17, 17, 0, 0, 0, 0, 0
- .byte 0, 0, 0, 0, 0, 0, 0, 0, 17, 0, 17, 0, 17, 17, 17, 1
- .byte 17, 16, 16, 1, 17, 16, 16, 1, 17, 16, 16, 1, 0, 0, 0, 0
- .byte 0, 0, 0, 0, 0, 0, 0, 0, 17, 16, 17, 0, 16, 1, 16, 1
- .byte 16, 1, 16, 1, 16, 1, 16, 1, 16, 1, 16, 1, 0, 0, 0, 0
- .byte 0, 0, 0, 0, 0, 0, 0, 0, 16, 17, 17, 0, 17, 0, 16, 1
- .byte 17, 0, 16, 1, 17, 0, 16, 1, 16, 17, 17, 0, 0, 0, 0, 0
- .byte 0, 0, 0, 0, 0, 0, 0, 0, 17, 16, 17, 0, 16, 1, 16, 1
- .byte 16, 1, 16, 1, 16, 17, 17, 0, 16, 1, 0, 0, 17, 17, 0, 0
- .byte 0, 0, 0, 0, 0, 0, 0, 0, 16, 17, 17, 0, 17, 0, 17, 0
- .byte 17, 0, 17, 0, 16, 17, 17, 0, 0, 0, 17, 0, 0, 16, 17, 1
- .byte 0, 0, 0, 0, 0, 0, 0, 0, 17, 16, 17, 1, 16, 17, 16, 1
- .byte 16, 1, 0, 0, 16, 1, 0, 0, 17, 17, 0, 0, 0, 0, 0, 0
- .byte 0, 0, 0, 0, 0, 0, 0, 0, 16, 17, 17, 0, 17, 0, 0, 0
- .byte 16, 17, 17, 0, 0, 0, 16, 1, 16, 17, 17, 0, 0, 0, 0, 0
- .byte 0, 16, 0, 0, 0, 17, 0, 0, 17, 17, 17, 0, 0, 17, 0, 0
- .byte 0, 17, 0, 0, 0, 17, 16, 0, 0, 16, 1, 0, 0, 0, 0, 0
- .byte 0, 0, 0, 0, 0, 0, 0, 0, 17, 0, 17, 0, 17, 0, 17, 0
- .byte 17, 0, 17, 0, 17, 0, 17, 0, 16, 17, 16, 1, 0, 0, 0, 0
- .byte 0, 0, 0, 0, 0, 0, 0, 0, 17, 0, 16, 1, 17, 0, 16, 1
- .byte 16, 1, 17, 0, 0, 17, 1, 0, 0, 16, 0, 0, 0, 0, 0, 0
- .byte 0, 0, 0, 0, 0, 0, 0, 0, 17, 0, 16, 1, 17, 16, 16, 1
- .byte 17, 16, 16, 1, 17, 17, 17, 1, 16, 1, 17, 0, 0, 0, 0, 0
- .byte 0, 0, 0, 0, 0, 0, 0, 0, 17, 0, 16, 1, 16, 1, 17, 0
- .byte 0, 17, 1, 0, 16, 1, 17, 0, 17, 0, 16, 1, 0, 0, 0, 0
- .byte 0, 0, 0, 0, 0, 0, 0, 0, 17, 0, 17, 0, 17, 0, 17, 0
- .byte 17, 0, 17, 0, 16, 17, 17, 0, 0, 0, 17, 0, 17, 17, 1, 0
- .byte 0, 0, 0, 0, 0, 0, 0, 0, 17, 17, 17, 0, 1, 16, 1, 0
- .byte 0, 17, 0, 0, 16, 1, 16, 0, 17, 17, 17, 0, 0, 0, 0, 0
- .byte 0, 0, 17, 1, 0, 16, 1, 0, 0, 16, 1, 0, 0, 17, 0, 0
- .byte 0, 16, 1, 0, 0, 16, 1, 0, 0, 0, 17, 1, 0, 0, 0, 0
- .byte 0, 16, 1, 0, 0, 16, 1, 0, 0, 16, 1, 0, 0, 0, 0, 0
- .byte 0, 16, 1, 0, 0, 16, 1, 0, 0, 16, 1, 0, 0, 0, 0, 0
- .byte 17, 1, 0, 0, 0, 17, 0, 0, 0, 17, 0, 0, 0, 16, 1, 0
- .byte 0, 17, 0, 0, 0, 17, 0, 0, 17, 1, 0, 0, 0, 0, 0, 0
- .byte 16, 17, 16, 1, 17, 16, 17, 0, 0, 0, 0, 0, 0, 0, 0, 0
- .byte 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
- .byte 0, 0, 0, 0, 0, 16, 0, 0, 0, 17, 1, 0, 16, 1, 17, 0
- .byte 17, 0, 16, 1, 17, 0, 16, 1, 17, 17, 17, 1, 0, 0, 0, 0
- .byte 16, 17, 17, 0, 17, 0, 16, 1, 17, 0, 0, 0, 17, 0, 0, 0
- .byte 17, 0, 16, 1, 16, 17, 17, 0, 0, 16, 1, 0, 16, 17, 0, 0
- .byte 17, 0, 17, 0, 0, 0, 0, 0, 17, 0, 17, 0, 17, 0, 17, 0
- .byte 17, 0, 17, 0, 17, 0, 17, 0, 16, 17, 16, 1, 0, 0, 0, 0
- .byte 0, 0, 17, 1, 0, 16, 0, 0, 16, 17, 17, 0, 17, 0, 16, 1
- .byte 17, 17, 17, 1, 17, 0, 0, 0, 16, 17, 17, 0, 0, 0, 0, 0
- .byte 16, 17, 17, 0, 1, 0, 0, 1, 0, 17, 1, 0, 0, 0, 17, 0
- .byte 16, 17, 17, 0, 17, 0, 17, 0, 16, 17, 16, 1, 0, 0, 0, 0
- .byte 17, 0, 17, 0, 0, 0, 0, 0, 16, 17, 1, 0, 0, 0, 17, 0
- .byte 16, 17, 17, 0, 17, 0, 17, 0, 16, 17, 16, 1, 0, 0, 0, 0
- .byte 17, 1, 0, 0, 0, 16, 0, 0, 16, 17, 1, 0, 0, 0, 17, 0
- .byte 16, 17, 17, 0, 17, 0, 17, 0, 16, 17, 16, 1, 0, 0, 0, 0
- .byte 0, 17, 0, 0, 0, 17, 0, 0, 16, 17, 1, 0, 0, 0, 17, 0
- .byte 16, 17, 17, 0, 17, 0, 17, 0, 16, 17, 16, 1, 0, 0, 0, 0
- .byte 0, 0, 0, 0, 0, 0, 0, 0, 16, 17, 17, 0, 17, 0, 0, 0
- .byte 17, 0, 0, 0, 16, 17, 17, 0, 0, 16, 1, 0, 16, 17, 0, 0
- .byte 16, 17, 17, 0, 1, 0, 0, 1, 16, 17, 17, 0, 17, 0, 16, 1
- .byte 17, 17, 17, 1, 17, 0, 0, 0, 16, 17, 17, 0, 0, 0, 0, 0
- .byte 17, 0, 16, 1, 0, 0, 0, 0, 16, 17, 17, 0, 17, 0, 16, 1
- .byte 17, 17, 17, 1, 17, 0, 0, 0, 16, 17, 17, 0, 0, 0, 0, 0
- .byte 17, 1, 0, 0, 0, 16, 0, 0, 16, 17, 17, 0, 17, 0, 16, 1
- .byte 17, 17, 17, 1, 17, 0, 0, 0, 16, 17, 17, 0, 0, 0, 0, 0
- .byte 16, 1, 16, 1, 0, 0, 0, 0, 0, 17, 1, 0, 0, 16, 1, 0
- .byte 0, 16, 1, 0, 0, 16, 1, 0, 0, 17, 17, 0, 0, 0, 0, 0
- .byte 16, 17, 17, 0, 1, 0, 0, 1, 0, 17, 1, 0, 0, 16, 1, 0
- .byte 0, 16, 1, 0, 0, 16, 1, 0, 0, 17, 17, 0, 0, 0, 0, 0
- .byte 17, 1, 0, 0, 0, 16, 0, 0, 0, 17, 1, 0, 0, 16, 1, 0
- .byte 0, 16, 1, 0, 0, 16, 1, 0, 0, 17, 17, 0, 0, 0, 0, 0
- .byte 17, 0, 16, 1, 0, 0, 0, 0, 16, 17, 17, 0, 17, 0, 16, 1
- .byte 17, 17, 17, 1, 17, 0, 16, 1, 17, 0, 16, 1, 0, 0, 0, 0
- .byte 0, 17, 1, 0, 0, 17, 1, 0, 16, 17, 17, 0, 17, 0, 16, 1
- .byte 17, 17, 17, 1, 17, 0, 16, 1, 17, 0, 16, 1, 0, 0, 0, 0
- .byte 0, 0, 17, 1, 0, 16, 0, 0, 17, 17, 17, 1, 16, 1, 0, 0
- .byte 16, 17, 1, 0, 16, 1, 0, 0, 17, 17, 17, 1, 0, 0, 0, 0
- .byte 0, 0, 0, 0, 0, 0, 0, 0, 16, 17, 17, 0, 0, 16, 0, 1
- .byte 16, 17, 17, 1, 17, 16, 0, 0, 16, 17, 17, 1, 0, 0, 0, 0
- .byte 16, 17, 17, 1, 17, 0, 1, 0, 17, 0, 1, 0, 17, 17, 17, 1
- .byte 17, 0, 1, 0, 17, 0, 1, 0, 17, 0, 17, 1, 0, 0, 0, 0
- .byte 16, 17, 17, 0, 1, 0, 0, 1, 16, 17, 17, 0, 17, 0, 16, 1
- .byte 17, 0, 16, 1, 17, 0, 16, 1, 16, 17, 17, 0, 0, 0, 0, 0
- .byte 17, 0, 16, 1, 0, 0, 0, 0, 16, 17, 17, 0, 17, 0, 16, 1
- .byte 17, 0, 16, 1, 17, 0, 16, 1, 16, 17, 17, 0, 0, 0, 0, 0
- .byte 17, 1, 0, 0, 0, 16, 0, 0, 16, 17, 17, 0, 17, 0, 16, 1
- .byte 17, 0, 16, 1, 17, 0, 16, 1, 16, 17, 17, 0, 0, 0, 0, 0
- .byte 16, 17, 17, 0, 1, 0, 0, 1, 17, 0, 17, 0, 17, 0, 17, 0
- .byte 17, 0, 17, 0, 17, 0, 17, 0, 16, 17, 16, 1, 0, 0, 0, 0
- .byte 17, 1, 0, 0, 0, 16, 0, 0, 17, 0, 17, 0, 17, 0, 17, 0
- .byte 17, 0, 17, 0, 17, 0, 17, 0, 16, 17, 16, 1, 0, 0, 0, 0
- .byte 17, 0, 17, 0, 0, 0, 0, 0, 17, 0, 17, 0, 17, 0, 17, 0
- .byte 17, 0, 17, 0, 16, 17, 17, 0, 0, 0, 17, 0, 17, 17, 1, 0
- .byte 17, 0, 16, 1, 16, 17, 17, 0, 17, 0, 16, 1, 17, 0, 16, 1
- .byte 17, 0, 16, 1, 17, 0, 16, 1, 16, 17, 17, 0, 0, 0, 0, 0
- .byte 17, 0, 16, 1, 0, 0, 0, 0, 17, 0, 16, 1, 17, 0, 16, 1
- .byte 17, 0, 16, 1, 17, 0, 16, 1, 16, 17, 17, 0, 0, 0, 0, 0
- .byte 0, 16, 1, 0, 16, 17, 17, 0, 17, 16, 16, 1, 17, 16, 0, 0
- .byte 17, 16, 16, 1, 16, 17, 17, 0, 0, 16, 1, 0, 0, 0, 0, 0
- .byte 0, 17, 1, 0, 16, 1, 17, 0, 16, 1, 0, 0, 17, 17, 0, 0
- .byte 16, 1, 0, 0, 17, 17, 0, 1, 17, 16, 17, 0, 0, 0, 0, 0
- .byte 16, 1, 16, 1, 0, 17, 17, 0, 0, 16, 1, 0, 16, 17, 17, 1
- .byte 0, 16, 1, 0, 16, 17, 17, 1, 0, 16, 1, 0, 0, 0, 0, 0
- .byte 17, 17, 1, 0, 17, 0, 17, 0, 17, 17, 1, 0, 17, 0, 16, 0
- .byte 17, 0, 17, 0, 17, 16, 17, 1, 17, 0, 17, 0, 0, 0, 16, 1
- .byte 0, 0, 17, 1, 0, 16, 1, 17, 0, 16, 1, 0, 0, 17, 17, 0
- .byte 0, 16, 1, 0, 0, 16, 1, 0, 17, 16, 1, 0, 16, 17, 0, 0
- .byte 0, 0, 17, 1, 0, 16, 0, 0, 16, 17, 1, 0, 0, 0, 17, 0
- .byte 16, 17, 17, 0, 17, 0, 17, 0, 16, 17, 16, 1, 0, 0, 0, 0
- .byte 0, 0, 17, 1, 0, 16, 0, 0, 0, 17, 1, 0, 0, 16, 1, 0
- .byte 0, 16, 1, 0, 0, 16, 1, 0, 0, 17, 17, 0, 0, 0, 0, 0
- .byte 0, 0, 17, 1, 0, 16, 0, 0, 16, 17, 17, 0, 17, 0, 16, 1
- .byte 17, 0, 16, 1, 17, 0, 16, 1, 16, 17, 17, 0, 0, 0, 0, 0
- .byte 0, 0, 17, 1, 0, 16, 0, 0, 17, 0, 17, 0, 17, 0, 17, 0
- .byte 17, 0, 17, 0, 17, 0, 17, 0, 16, 17, 16, 1, 0, 0, 0, 0
- .byte 16, 1, 16, 1, 1, 16, 1, 0, 17, 16, 17, 0, 16, 1, 16, 1
- .byte 16, 1, 16, 1, 16, 1, 16, 1, 16, 1, 16, 1, 0, 0, 0, 0
- .byte 16, 1, 16, 1, 1, 16, 1, 0, 17, 1, 16, 1, 17, 17, 16, 1
- .byte 17, 16, 17, 1, 17, 0, 17, 1, 17, 0, 16, 1, 0, 0, 0, 0
- .byte 0, 17, 1, 0, 0, 0, 17, 0, 0, 17, 17, 0, 0, 17, 16, 0
- .byte 0, 0, 0, 0, 16, 17, 17, 1, 0, 0, 0, 0, 0, 0, 0, 0
- .byte 0, 17, 1, 0, 16, 1, 17, 0, 16, 1, 17, 0, 0, 17, 1, 0
- .byte 0, 0, 0, 0, 16, 17, 17, 0, 0, 0, 0, 0, 0, 0, 0, 0
- .byte 0, 17, 0, 0, 0, 0, 0, 0, 0, 17, 0, 0, 16, 1, 0, 0
- .byte 17, 0, 16, 1, 17, 0, 16, 1, 16, 17, 17, 0, 0, 0, 0, 0
- .byte 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 17, 17, 17, 0
- .byte 17, 0, 0, 0, 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
- .byte 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 17, 17, 17, 0
- .byte 0, 0, 17, 0, 0, 0, 17, 0, 0, 0, 0, 0, 0, 0, 0, 0
- .byte 17, 0, 0, 0, 17, 0, 1, 0, 17, 16, 0, 0, 17, 17, 17, 1
- .byte 16, 0, 16, 1, 1, 0, 17, 0, 0, 16, 17, 1, 0, 0, 0, 0
- .byte 17, 0, 0, 0, 17, 0, 1, 0, 17, 16, 0, 0, 17, 1, 17, 0
- .byte 16, 16, 17, 0, 1, 17, 17, 1, 0, 0, 17, 0, 0, 0, 0, 0
- .byte 0, 16, 1, 0, 0, 0, 0, 0, 0, 16, 1, 0, 0, 16, 1, 0
- .byte 0, 17, 17, 0, 0, 17, 17, 0, 0, 16, 1, 0, 0, 0, 0, 0
- .byte 0, 0, 0, 0, 0, 17, 16, 1, 16, 1, 17, 0, 17, 16, 1, 0
- .byte 16, 1, 17, 0, 0, 17, 16, 1, 0, 0, 0, 0, 0, 0, 0, 0
- .byte 0, 0, 0, 0, 17, 16, 1, 0, 16, 1, 17, 0, 0, 17, 16, 1
- .byte 16, 1, 17, 0, 17, 16, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0
- .byte 0, 1, 0, 1, 1, 0, 1, 0, 0, 1, 0, 1, 1, 0, 1, 0
- .byte 0, 1, 0, 1, 1, 0, 1, 0, 0, 1, 0, 1, 1, 0, 1, 0
- .byte 16, 16, 16, 16, 1, 1, 1, 1, 16, 16, 16, 16, 1, 1, 1, 1
- .byte 16, 16, 16, 16, 1, 1, 1, 1, 16, 16, 16, 16, 1, 1, 1, 1
- .byte 17, 16, 1, 17, 16, 17, 16, 17, 17, 16, 1, 17, 17, 1, 17, 1
- .byte 17, 16, 1, 17, 16, 17, 16, 17, 17, 16, 1, 17, 17, 1, 17, 1
- .byte 0, 16, 1, 0, 0, 16, 1, 0, 0, 16, 1, 0, 0, 16, 1, 0
- .byte 0, 16, 1, 0, 0, 16, 1, 0, 0, 16, 1, 0, 0, 16, 1, 0
- .byte 0, 16, 1, 0, 0, 16, 1, 0, 0, 16, 1, 0, 0, 16, 1, 0
- .byte 17, 17, 1, 0, 0, 16, 1, 0, 0, 16, 1, 0, 0, 16, 1, 0
- .byte 0, 16, 1, 0, 0, 16, 1, 0, 17, 17, 1, 0, 0, 16, 1, 0
- .byte 17, 17, 1, 0, 0, 16, 1, 0, 0, 16, 1, 0, 0, 16, 1, 0
- .byte 0, 17, 16, 1, 0, 17, 16, 1, 0, 17, 16, 1, 0, 17, 16, 1
- .byte 17, 17, 16, 1, 0, 17, 16, 1, 0, 17, 16, 1, 0, 17, 16, 1
- .byte 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
- .byte 17, 17, 17, 1, 0, 17, 16, 1, 0, 17, 16, 1, 0, 17, 16, 1
- .byte 0, 0, 0, 0, 0, 0, 0, 0, 17, 17, 1, 0, 0, 16, 1, 0
- .byte 17, 17, 1, 0, 0, 16, 1, 0, 0, 16, 1, 0, 0, 16, 1, 0
- .byte 0, 17, 16, 1, 0, 17, 16, 1, 17, 17, 16, 1, 0, 0, 16, 1
- .byte 17, 17, 16, 1, 0, 17, 16, 1, 0, 17, 16, 1, 0, 17, 16, 1
- .byte 0, 17, 16, 1, 0, 17, 16, 1, 0, 17, 16, 1, 0, 17, 16, 1
- .byte 0, 17, 16, 1, 0, 17, 16, 1, 0, 17, 16, 1, 0, 17, 16, 1
- .byte 0, 0, 0, 0, 0, 0, 0, 0, 17, 17, 17, 1, 0, 0, 16, 1
- .byte 17, 17, 16, 1, 0, 17, 16, 1, 0, 17, 16, 1, 0, 17, 16, 1
- .byte 0, 17, 16, 1, 0, 17, 16, 1, 17, 17, 16, 1, 0, 0, 16, 1
- .byte 17, 17, 17, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
- .byte 0, 17, 16, 1, 0, 17, 16, 1, 0, 17, 16, 1, 0, 17, 16, 1
- .byte 17, 17, 17, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
- .byte 0, 16, 1, 0, 0, 16, 1, 0, 17, 17, 1, 0, 0, 16, 1, 0
- .byte 17, 17, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
- .byte 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
- .byte 17, 17, 1, 0, 0, 16, 1, 0, 0, 16, 1, 0, 0, 16, 1, 0
- .byte 0, 16, 1, 0, 0, 16, 1, 0, 0, 16, 1, 0, 0, 16, 1, 0
- .byte 0, 16, 17, 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
- .byte 0, 16, 1, 0, 0, 16, 1, 0, 0, 16, 1, 0, 0, 16, 1, 0
- .byte 17, 17, 17, 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
- .byte 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
- .byte 17, 17, 17, 17, 0, 16, 1, 0, 0, 16, 1, 0, 0, 16, 1, 0
- .byte 0, 16, 1, 0, 0, 16, 1, 0, 0, 16, 1, 0, 0, 16, 1, 0
- .byte 0, 16, 17, 17, 0, 16, 1, 0, 0, 16, 1, 0, 0, 16, 1, 0
- .byte 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
- .byte 17, 17, 17, 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
- .byte 0, 16, 1, 0, 0, 16, 1, 0, 0, 16, 1, 0, 0, 16, 1, 0
- .byte 17, 17, 17, 17, 0, 16, 1, 0, 0, 16, 1, 0, 0, 16, 1, 0
- .byte 0, 16, 1, 0, 0, 16, 1, 0, 0, 16, 17, 17, 0, 16, 1, 0
- .byte 0, 16, 17, 17, 0, 16, 1, 0, 0, 16, 1, 0, 0, 16, 1, 0
- .byte 0, 17, 16, 1, 0, 17, 16, 1, 0, 17, 16, 1, 0, 17, 16, 1
- .byte 0, 17, 16, 17, 0, 17, 16, 1, 0, 17, 16, 1, 0, 17, 16, 1
- .byte 0, 17, 16, 1, 0, 17, 16, 1, 0, 17, 16, 17, 0, 17, 0, 0
- .byte 0, 17, 17, 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
- .byte 0, 0, 0, 0, 0, 0, 0, 0, 0, 17, 17, 17, 0, 17, 0, 0
- .byte 0, 17, 16, 17, 0, 17, 16, 1, 0, 17, 16, 1, 0, 17, 16, 1
- .byte 0, 17, 16, 1, 0, 17, 16, 1, 17, 17, 16, 17, 0, 0, 0, 0
- .byte 17, 17, 17, 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
- .byte 0, 0, 0, 0, 0, 0, 0, 0, 17, 17, 17, 17, 0, 0, 0, 0
- .byte 17, 17, 16, 17, 0, 17, 16, 1, 0, 17, 16, 1, 0, 17, 16, 1
- .byte 0, 17, 16, 1, 0, 17, 16, 1, 0, 17, 16, 17, 0, 17, 0, 0
- .byte 0, 17, 16, 17, 0, 17, 16, 1, 0, 17, 16, 1, 0, 17, 16, 1
- .byte 0, 0, 0, 0, 0, 0, 0, 0, 17, 17, 17, 17, 0, 0, 0, 0
- .byte 17, 17, 17, 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
- .byte 0, 17, 16, 1, 0, 17, 16, 1, 17, 17, 16, 17, 0, 0, 0, 0
- .byte 17, 17, 16, 17, 0, 17, 16, 1, 0, 17, 16, 1, 0, 17, 16, 1
- .byte 0, 16, 1, 0, 0, 16, 1, 0, 17, 17, 17, 17, 0, 0, 0, 0
- .byte 17, 17, 17, 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
- .byte 0, 17, 16, 1, 0, 17, 16, 1, 0, 17, 16, 1, 0, 17, 16, 1
- .byte 17, 17, 17, 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
- .byte 0, 0, 0, 0, 0, 0, 0, 0, 17, 17, 17, 17, 0, 0, 0, 0
- .byte 17, 17, 17, 17, 0, 16, 1, 0, 0, 16, 1, 0, 0, 16, 1, 0
- .byte 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
- .byte 17, 17, 17, 17, 0, 17, 16, 1, 0, 17, 16, 1, 0, 17, 16, 1
- .byte 0, 17, 16, 1, 0, 17, 16, 1, 0, 17, 16, 1, 0, 17, 16, 1
- .byte 0, 17, 17, 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
- .byte 0, 16, 1, 0, 0, 16, 1, 0, 0, 16, 17, 17, 0, 16, 1, 0
- .byte 0, 16, 17, 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
- .byte 0, 0, 0, 0, 0, 0, 0, 0, 0, 16, 17, 17, 0, 16, 1, 0
- .byte 0, 16, 17, 17, 0, 16, 1, 0, 0, 16, 1, 0, 0, 16, 1, 0
- .byte 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
- .byte 0, 17, 17, 17, 0, 17, 16, 1, 0, 17, 16, 1, 0, 17, 16, 1
- .byte 0, 17, 16, 1, 0, 17, 16, 1, 0, 17, 16, 1, 0, 17, 16, 1
- .byte 17, 17, 17, 17, 0, 17, 16, 1, 0, 17, 16, 1, 0, 17, 16, 1
- .byte 0, 16, 1, 0, 0, 16, 1, 0, 17, 17, 17, 17, 0, 16, 1, 0
- .byte 17, 17, 17, 17, 0, 16, 1, 0, 0, 16, 1, 0, 0, 16, 1, 0
- .byte 0, 16, 1, 0, 0, 16, 1, 0, 0, 16, 1, 0, 0, 16, 1, 0
- .byte 17, 17, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
- .byte 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
- .byte 0, 16, 17, 17, 0, 16, 1, 0, 0, 16, 1, 0, 0, 16, 1, 0
- .byte 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17
- .byte 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17
- .byte 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
- .byte 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17
- .byte 17, 17, 0, 0, 17, 17, 0, 0, 17, 17, 0, 0, 17, 17, 0, 0
- .byte 17, 17, 0, 0, 17, 17, 0, 0, 17, 17, 0, 0, 17, 17, 0, 0
- .byte 0, 0, 17, 17, 0, 0, 17, 17, 0, 0, 17, 17, 0, 0, 17, 17
- .byte 0, 0, 17, 17, 0, 0, 17, 17, 0, 0, 17, 17, 0, 0, 17, 17
- .byte 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17
- .byte 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
- .byte 0, 0, 0, 0, 0, 0, 0, 0, 16, 17, 16, 0, 17, 0, 17, 0
- .byte 17, 0, 1, 0, 17, 16, 17, 0, 16, 17, 16, 1, 0, 0, 0, 0
- .byte 16, 17, 1, 0, 17, 0, 17, 0, 17, 16, 1, 0, 17, 0, 17, 0
- .byte 17, 0, 16, 1, 17, 0, 16, 1, 17, 16, 17, 0, 16, 0, 0, 0
- .byte 17, 17, 17, 1, 16, 1, 0, 1, 16, 1, 0, 0, 16, 1, 0, 0
- .byte 16, 1, 0, 0, 16, 1, 0, 0, 17, 17, 0, 0, 0, 0, 0, 0
- .byte 0, 0, 0, 0, 0, 0, 0, 1, 16, 17, 17, 1, 17, 1, 17, 0
- .byte 16, 1, 17, 0, 16, 1, 17, 0, 16, 0, 1, 0, 0, 0, 0, 0
- .byte 17, 17, 17, 1, 16, 1, 0, 1, 0, 17, 0, 0, 0, 16, 1, 0
- .byte 0, 17, 0, 0, 16, 1, 0, 1, 17, 17, 17, 1, 0, 0, 0, 0
- .byte 0, 0, 0, 0, 0, 0, 0, 0, 16, 17, 17, 1, 17, 16, 0, 0
- .byte 17, 0, 1, 0, 17, 0, 1, 0, 16, 17, 0, 0, 0, 0, 0, 0
- .byte 0, 0, 0, 0, 0, 0, 0, 0, 17, 0, 17, 0, 17, 0, 17, 0
- .byte 17, 0, 17, 0, 17, 0, 17, 0, 17, 17, 1, 0, 1, 0, 0, 0
- .byte 0, 0, 0, 0, 0, 0, 0, 0, 16, 17, 17, 1, 17, 16, 1, 0
- .byte 0, 16, 1, 0, 0, 16, 1, 0, 0, 16, 0, 0, 0, 0, 0, 0
- .byte 0, 17, 1, 0, 0, 16, 0, 0, 16, 17, 17, 0, 17, 16, 16, 1
- .byte 17, 16, 16, 1, 16, 17, 17, 0, 0, 16, 0, 0, 0, 17, 1, 0
- .byte 16, 17, 17, 0, 17, 0, 16, 1, 17, 0, 16, 1, 17, 17, 17, 1
- .byte 17, 0, 16, 1, 17, 0, 16, 1, 16, 17, 17, 0, 0, 0, 0, 0
- .byte 16, 17, 17, 0, 17, 0, 16, 1, 17, 0, 16, 1, 17, 0, 16, 1
- .byte 16, 1, 17, 0, 0, 1, 1, 0, 17, 1, 17, 1, 0, 0, 0, 0
- .byte 0, 17, 17, 0, 0, 1, 0, 1, 0, 16, 1, 0, 16, 17, 17, 0
- .byte 17, 0, 17, 0, 17, 0, 17, 0, 16, 17, 1, 0, 0, 0, 0, 0
- .byte 0, 0, 0, 0, 0, 0, 0, 0, 16, 1, 16, 1, 1, 16, 1, 16
- .byte 1, 16, 1, 16, 16, 1, 16, 1, 0, 0, 0, 0, 0, 0, 0, 0
- .byte 0, 0, 0, 0, 0, 0, 16, 1, 16, 17, 17, 0, 1, 16, 17, 1
- .byte 17, 17, 0, 1, 16, 17, 17, 0, 17, 0, 0, 0, 0, 0, 0, 0
- .byte 0, 0, 0, 0, 0, 0, 0, 0, 16, 17, 17, 0, 17, 0, 0, 0
- .byte 17, 17, 1, 0, 17, 0, 0, 0, 16, 17, 17, 0, 0, 0, 0, 0
- .byte 0, 0, 0, 0, 16, 17, 17, 0, 17, 0, 16, 1, 17, 0, 16, 1
- .byte 17, 0, 16, 1, 17, 0, 16, 1, 17, 0, 16, 1, 0, 0, 0, 0
- .byte 0, 0, 0, 0, 17, 17, 17, 1, 0, 0, 0, 0, 17, 17, 17, 1
- .byte 0, 0, 0, 0, 17, 17, 17, 1, 0, 0, 0, 0, 0, 0, 0, 0
- .byte 0, 16, 1, 0, 0, 16, 1, 0, 16, 17, 17, 1, 0, 16, 1, 0
- .byte 0, 16, 1, 0, 0, 0, 0, 0, 16, 17, 17, 1, 0, 0, 0, 0
- .byte 0, 17, 0, 0, 0, 16, 1, 0, 0, 0, 17, 0, 0, 16, 1, 0
- .byte 0, 17, 0, 0, 0, 0, 0, 0, 16, 17, 17, 0, 0, 0, 0, 0
- .byte 0, 16, 1, 0, 0, 17, 0, 0, 16, 1, 0, 0, 0, 17, 0, 0
- .byte 0, 16, 1, 0, 0, 0, 0, 0, 16, 17, 17, 0, 0, 0, 0, 0
- .byte 0, 0, 17, 1, 0, 16, 1, 17, 0, 16, 1, 17, 0, 16, 1, 0
- .byte 0, 16, 1, 0, 0, 16, 1, 0, 0, 16, 1, 0, 0, 16, 1, 0
- .byte 0, 16, 1, 0, 0, 16, 1, 0, 0, 16, 1, 0, 0, 16, 1, 0
- .byte 0, 16, 1, 0, 17, 16, 1, 0, 17, 16, 1, 0, 16, 17, 0, 0
- .byte 0, 0, 0, 0, 0, 16, 1, 0, 0, 0, 0, 0, 16, 17, 17, 1
- .byte 0, 0, 0, 0, 0, 16, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0
- .byte 0, 0, 0, 0, 16, 17, 16, 1, 17, 16, 17, 0, 0, 0, 0, 0
- .byte 16, 17, 16, 1, 17, 16, 17, 0, 0, 0, 0, 0, 0, 0, 0, 0
- .byte 0, 17, 1, 0, 16, 1, 17, 0, 0, 17, 1, 0, 0, 0, 0, 0
- .byte 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
- .byte 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 16, 1, 0
- .byte 0, 16, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
- .byte 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
- .byte 0, 16, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
- .byte 0, 0, 17, 17, 0, 0, 17, 0, 0, 0, 17, 0, 0, 0, 17, 0
- .byte 17, 1, 17, 0, 16, 1, 17, 0, 0, 17, 17, 0, 0, 0, 0, 0
- .byte 17, 16, 1, 0, 16, 1, 17, 0, 16, 1, 17, 0, 16, 1, 17, 0
- .byte 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
- .byte 17, 17, 0, 0, 0, 17, 0, 0, 17, 0, 0, 0, 17, 17, 0, 0
- .byte 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
- .byte 0, 0, 0, 0, 0, 0, 0, 0, 0, 17, 17, 0, 0, 17, 17, 0
- .byte 0, 17, 17, 0, 0, 17, 17, 0, 0, 0, 0, 0, 0, 0, 0, 0
- .byte 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
- .byte 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
-
- .global default_font_bin_end
-default_font_bin_end:
-
diff --git a/c/src/lib/libbsp/arm/nds/libnds/source/arm9/exceptionHandler.S b/c/src/lib/libbsp/arm/nds/libnds/source/arm9/exceptionHandler.S
deleted file mode 100644
index 74711537eb..0000000000
--- a/c/src/lib/libbsp/arm/nds/libnds/source/arm9/exceptionHandler.S
+++ /dev/null
@@ -1,109 +0,0 @@
-/*---------------------------------------------------------------------------------
- Copyright (C) 2005
- 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.
-
----------------------------------------------------------------------------------*/
- .text
-
- .arm
-
-@---------------------------------------------------------------------------------
- .global getCPSR
-@---------------------------------------------------------------------------------
-getCPSR:
-@---------------------------------------------------------------------------------
- mrs r0,cpsr
- bx r14
-
-@---------------------------------------------------------------------------------
- .global enterException
-@---------------------------------------------------------------------------------
-enterException:
-@---------------------------------------------------------------------------------
- // store context
- ldr r12,=exceptionRegisters
- stmia r12,{r0-r11}
- str r13,[r12,#oldStack - exceptionRegisters]
- // assign a stack
- ldr r13,=exceptionStack
- ldr r13,[r13]
-
- // renable MPU
- mrc p15,0,r0,c1,c0,0
- orr r0,r0,#1
- mcr p15,0,r0,c1,c0,0
-
- // bios exception stack
- ldr r0, =0x027FFD90
-
- // grab r15 from bios exception stack
- ldr r2,[r0,#8]
- str r2,[r12,#reg15 - exceptionRegisters]
-
- // grab stored r12 and SPSR from bios exception stack
- ldmia r0,{r2,r12}
-
-
- // grab banked registers from correct processor mode
- mrs r3,cpsr
- bic r4,r3,#0x1F
- and r2,r2,#0x1F
- orr r4,r4,r2
- msr cpsr,r4
- ldr r0,=reg12
- stmia r0,{r12-r14}
- msr cpsr,r3
-
- // Get C function & call it
- ldr r12,=exceptionC
- ldr r12,[r12,#0]
- bxne r12
-
- // restore registers
- ldr r12,=exceptionRegisters
- ldmia r12,{r0-r11}
- ldr r13,[r12,#oldStack - exceptionRegisters]
-
- // return through bios
- mov pc,lr
-
-@---------------------------------------------------------------------------------
- .global exceptionC
-@---------------------------------------------------------------------------------
-exceptionC:
-@---------------------------------------------------------------------------------
- .word 0x00000000
-@---------------------------------------------------------------------------------
- .global exceptionStack
-@---------------------------------------------------------------------------------
-exceptionStack:
-@---------------------------------------------------------------------------------
- .word 0x00000000
-@---------------------------------------------------------------------------------
- .global exceptionRegisters
-@---------------------------------------------------------------------------------
-exceptionRegisters:
-@---------------------------------------------------------------------------------
- .space 12 * 4
-reg12: .word 0
-reg13: .word 0
-reg14: .word 0
-reg15: .word 0
-oldStack: .word 0
diff --git a/c/src/lib/libbsp/arm/nds/libnds/source/arm9/exceptions.c b/c/src/lib/libbsp/arm/nds/libnds/source/arm9/exceptions.c
deleted file mode 100644
index 94c2d7c19b..0000000000
--- a/c/src/lib/libbsp/arm/nds/libnds/source/arm9/exceptions.c
+++ /dev/null
@@ -1,34 +0,0 @@
-/*---------------------------------------------------------------------------------
- Copyright (C) 2005
- 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/jtypes.h>
-#include <nds/arm9/exceptions.h>
-
-//---------------------------------------------------------------------------------
-void setExceptionHandler(VoidFunctionPointer handler) {
-//---------------------------------------------------------------------------------
- exceptionStack = (u32)0x23EFFFC ;
- EXCEPTION_VECTOR = enterException ;
- *exceptionC = handler ;
-}
-
diff --git a/c/src/lib/libbsp/arm/nds/libnds/source/arm9/gurumeditation.c b/c/src/lib/libbsp/arm/nds/libnds/source/arm9/gurumeditation.c
deleted file mode 100644
index f0bd2bb41a..0000000000
--- a/c/src/lib/libbsp/arm/nds/libnds/source/arm9/gurumeditation.c
+++ /dev/null
@@ -1,270 +0,0 @@
-/*---------------------------------------------------------------------------------
- Copyright (C) 2005
- 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/jtypes.h>
-#include <nds/memory.h>
-
-#include <nds/arm9/video.h>
-#include <nds/arm9/console.h>
-#include <nds/arm9/exceptions.h>
-#include <nds/arm9/background.h>
-
-#include <stdio.h>
-#include <inttypes.h>
-
-#include <bsp/linker-symbols.h>
-
-//---------------------------------------------------------------------------------
-static unsigned long ARMShift(unsigned long value,unsigned char shift) {
-//---------------------------------------------------------------------------------
- // no shift at all
- if (shift == 0x0B) return value ;
- int index ;
- if (shift & 0x01) {
- // shift index is a register
- index = exceptionRegisters[(shift >> 4) & 0x0F];
- } else {
- // constant shift index
- index = ((shift >> 3) & 0x1F) ;
- } ;
- int i ;
- bool isN ;
- switch (shift & 0x06) {
- case 0x00:
- // logical left
- return (value << index) ;
- case 0x02:
- // logical right
- return (value >> index) ;
- case 0x04:
- // arithmetical right
- isN = (value & 0x80000000) ;
- value = value >> index ;
- if (isN) {
- for (i=31;i>31-index;i--) {
- value = value | (1 << i) ;
- } ;
- } ;
- return value ;
- case 0x06:
- // rotate right
- index = index & 0x1F;
- value = (value >> index) | (value << (32-index));
- return value;
- };
- return value;
-}
-
-
-//---------------------------------------------------------------------------------
-static u32 getExceptionAddress( u32 opcodeAddress, u32 thumbState) {
-//---------------------------------------------------------------------------------
-
- int Rf, Rb, Rd, Rn, Rm;
-
- if (thumbState) {
- // Thumb
-
- unsigned short opcode = *(unsigned short *)opcodeAddress ;
- // ldr r,[pc,###] 01001ddd ffffffff
- // ldr r,[r,r] 0101xx0f ffbbbddd
- // ldrsh 0101xx1f ffbbbddd
- // ldr r,[r,imm] 011xxfff ffbbbddd
- // ldrh 1000xfff ffbbbddd
- // ldr r,[sp,###] 1001xddd ffffffff
- // push 1011x10l llllllll
- // ldm 1100xbbb llllllll
-
-
- if ((opcode & 0xF800) == 0x4800) {
- // ldr r,[pc,###]
- s8 offset = opcode & 0xff;
- return exceptionRegisters[15] + offset;
- } else if ((opcode & 0xF200) == 0x5000) {
- // ldr r,[r,r]
- Rb = (opcode >> 3) & 0x07 ;
- Rf = (opcode >> 6) & 0x07 ;
- return exceptionRegisters[Rb] + exceptionRegisters[Rf];
-
- } else if ((opcode & 0xF200) == 0x5200) {
- // ldrsh
- Rb = (opcode >> 3) & 0x07;
- Rf = (opcode >> 6) & 0x03;
- return exceptionRegisters[Rb] + exceptionRegisters[Rf];
-
- } else if ((opcode & 0xE000) == 0x6000) {
- // ldr r,[r,imm]
- Rb = (opcode >> 3) & 0x07;
- Rf = (opcode >> 6) & 0x1F ;
- return exceptionRegisters[Rb] + (Rf << 2);
- } else if ((opcode & 0xF000) == 0x8000) {
- // ldrh
- Rb = (opcode >> 3) & 0x07 ;
- Rf = (opcode >> 6) & 0x1F ;
- return exceptionRegisters[Rb] + (Rf << 2);
- } else if ((opcode & 0xF000) == 0x9000) {
- // ldr r,[sp,#imm]
- s8 offset = opcode & 0xff;
- return exceptionRegisters[13] + offset;
- } else if ((opcode & 0xF700) == 0xB500) {
- // push/pop
- return exceptionRegisters[13];
- } else if ((opcode & 0xF000) == 0xC000) {
- // ldm/stm
- Rd = (opcode >> 8) & 0x07;
- return exceptionRegisters[Rd];
- }
- } else {
- // arm32
- unsigned long opcode = *(unsigned long *)opcodeAddress ;
-
- // SWP xxxx0001 0x00nnnn dddd0000 1001mmmm
- // STR/LDR xxxx01xx xxxxnnnn ddddffff ffffffff
- // STRH/LDRH xxxx000x x0xxnnnn dddd0000 1xx1mmmm
- // STRH/LDRH xxxx000x x1xxnnnn ddddffff 1xx1ffff
- // STM/LDM xxxx100x xxxxnnnn llllllll llllllll
-
- if ((opcode & 0x0FB00FF0) == 0x01000090) {
- // SWP
- Rn = (opcode >> 16) & 0x0F;
- return exceptionRegisters[Rn];
- } else if ((opcode & 0x0C000000) == 0x04000000) {
- // STR/LDR
- Rn = (opcode >> 16) & 0x0F;
- if (opcode & 0x02000000) {
- // Register offset
- Rm = opcode & 0x0F;
- if (opcode & 0x01000000) {
- unsigned short shift = (unsigned short)((opcode >> 4) & 0xFF) ;
- // pre indexing
- long Offset = ARMShift(exceptionRegisters[Rm],shift);
- // add or sub the offset depending on the U-Bit
- return exceptionRegisters[Rn] + ((opcode & 0x00800000)?Offset:-Offset);
- } else {
- // post indexing
- return exceptionRegisters[Rn];
- }
- } else {
- // Immediate offset
- unsigned long Offset = (opcode & 0xFFF) ;
- if (opcode & 0x01000000) {
- // pre indexing
- // add or sub the offset depending on the U-Bit
- return exceptionRegisters[Rn] + ((opcode & 0x00800000)?Offset:-Offset);
- } else {
- // post indexing
- return exceptionRegisters[Rn];
- }
- }
- } else if ((opcode & 0x0E400F90) == 0x00000090) {
- // LDRH/STRH with register Rm
- Rn = (opcode >> 16) & 0x0F;
- Rd = (opcode >> 12) & 0x0F;
- Rm = opcode & 0x0F;
- unsigned short shift = (unsigned short)((opcode >> 4) & 0xFF);
- long Offset = ARMShift(exceptionRegisters[Rm],shift);
- // add or sub the offset depending on the U-Bit
- return exceptionRegisters[Rn] + ((opcode & 0x00800000)?Offset:-Offset);
- } else if ((opcode & 0x0E400F90) == 0x00400090) {
- // LDRH/STRH with immediate offset
- Rn = (opcode >> 16) & 0x0F;
- Rd = (opcode >> 12) & 0x0F;
- unsigned long Offset = (opcode & 0xF) | ((opcode & 0xF00)>>8) ;
- // add or sub the offset depending on the U-Bit
- return exceptionRegisters[Rn] + ((opcode & 0x00800000)?Offset:-Offset) ;
- } else if ((opcode & 0x0E000000) == 0x08000000) {
- // LDM/STM
- Rn = (opcode >> 16) & 0x0F;
- return exceptionRegisters[Rn];
- }
- }
- return 0;
-}
-
-static const char *registerNames[] =
- { "r0","r1","r2","r3","r4","r5","r6","r7",
- "r8 ","r9 ","r10","r11","r12","sp ","lr ","pc " };
-
-//---------------------------------------------------------------------------------
-static void defaultHandler(void) {
-//---------------------------------------------------------------------------------
- videoSetMode(0);
- videoSetModeSub(MODE_0_2D | DISPLAY_BG0_ACTIVE);
- vramSetBankC(VRAM_C_SUB_BG);
-
- SUB_BG0_CR = BG_MAP_BASE(31);
-
- BG_PALETTE_SUB[0] = RGB15(31,0,0);
- BG_PALETTE_SUB[255] = RGB15(31,31,31);
-
- consoleInitDefault((u16*)SCREEN_BASE_BLOCK_SUB(31), (u16*)CHAR_BASE_BLOCK_SUB(0), 16);
-
- iprintf("\x1b[5CGuru Meditation Error!\n");
- u32 currentMode = getCPSR() & 0x1f;
- u32 thumbState = ((*(u32*)0x027FFD90) & 0x20);
-
- u32 codeAddress, exceptionAddress = 0;
-
- int offset = 8;
-
- if ( currentMode == 0x17 ) {
- iprintf ("\x1b[10Cdata abort!\n\n");
- codeAddress = exceptionRegisters[15] - offset;
- if ( (codeAddress > 0x02000000 && codeAddress < 0x02400000) ||
- (codeAddress > (u32)bsp_section_fast_text_begin && codeAddress < (u32)(bsp_section_fast_text_begin + 32768)) )
- exceptionAddress = getExceptionAddress( codeAddress, thumbState);
- else
- exceptionAddress = codeAddress;
-
- } else {
- if (thumbState)
- offset = 2;
- else
- offset = 4;
- iprintf("\x1b[5Cundefined instruction!\n\n");
- codeAddress = exceptionRegisters[15] - offset;
- exceptionAddress = codeAddress;
- }
-
- iprintf(" pc: %08" PRIX32 " addr: %08" PRIX32 "\n\n",codeAddress,exceptionAddress);
-
- int i;
- for ( i=0; i < 8; i++ ) {
- iprintf( " %s: %08" PRIX32 " %s: %08" PRIX32 "\n",
- registerNames[i], exceptionRegisters[i],
- registerNames[i+8],exceptionRegisters[i+8]);
- }
- iprintf("\n");
- u32 *stack = (u32 *)exceptionRegisters[13];
- for ( i=0; i<10; i++ ) {
- iprintf( "\x1b[%d;2H%08" PRIX32 ": %08" PRIX32 " %08" PRIX32 "", i + 14, (u32)&stack[i*2],stack[i*2], stack[(i*2)+1] );
- }
- while(1);
-
-}
-
-//---------------------------------------------------------------------------------
-void defaultExceptionHandler() {
-//---------------------------------------------------------------------------------
- setExceptionHandler(defaultHandler) ;
-}
diff --git a/c/src/lib/libbsp/arm/nds/libnds/source/arm9/icache.S b/c/src/lib/libbsp/arm/nds/libnds/source/arm9/icache.S
deleted file mode 100644
index 19a89573ec..0000000000
--- a/c/src/lib/libbsp/arm/nds/libnds/source/arm9/icache.S
+++ /dev/null
@@ -1,55 +0,0 @@
-/*---------------------------------------------------------------------------------
- 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.
-
----------------------------------------------------------------------------------*/
-#define ICACHE_SIZE 0x2000
-#define DCACHE_SIZE 0x1000
-#define CACHE_LINE_SIZE 32
-//---------------------------------------------------------------------------------
- .arm
-//---------------------------------------------------------------------------------
- .global IC_InvalidateAll
-//---------------------------------------------------------------------------------
-IC_InvalidateAll:
-/*---------------------------------------------------------------------------------
- Clean and invalidate entire data cache
----------------------------------------------------------------------------------*/
- mov r0, #0
- mcr p15, 0, r0, c7, c5, 0
- bx lr
-
-//---------------------------------------------------------------------------------
- .global IC_InvalidateRange
-//---------------------------------------------------------------------------------
-IC_InvalidateRange:
-/*---------------------------------------------------------------------------------
- Invalidate a range
----------------------------------------------------------------------------------*/
- add r1, r1, r0
- bic r0, r0, #CACHE_LINE_SIZE - 1
-.invalidate:
- mcr p15, 0, r0, c7, c5, 1
- add r0, r0, #CACHE_LINE_SIZE
- cmp r0, r1
- blt .invalidate
- bx lr
diff --git a/c/src/lib/libbsp/arm/nds/libnds/source/arm9/image.c b/c/src/lib/libbsp/arm/nds/libnds/source/arm9/image.c
deleted file mode 100644
index bef1fa2fc0..0000000000
--- a/c/src/lib/libbsp/arm/nds/libnds/source/arm9/image.c
+++ /dev/null
@@ -1,132 +0,0 @@
-/*---------------------------------------------------------------------------------
-
- 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/jtypes.h>
-#include <nds/arm9/image.h>
-#include <nds/dma.h>
-
-
-#include <malloc.h>
-
-//---------------------------------------------------------------------------------
-void image24to16(sImage* img) {
-//---------------------------------------------------------------------------------
-
- int x;
- int y;
-
- u16* temp = (u16*)malloc(img->height*img->width*2);
-
- for(y=0;y<img->height;y++)
- {
- for(x=0;x<img->width;x++)
- temp[x+y*img->width]=(1<<15)|RGB15(img->image.data8[x*3+y*img->width*3]>>3, \
- img->image.data8[x*3+y*img->width*3+1]>>3, img->image.data8[x*3+y*img->width*3+2]>>3);
- }
-
- free(img->image.data8);
-
- img->bpp=16;
- img->image.data16 = temp;
-}
-
-//---------------------------------------------------------------------------------
-void image8to16(sImage* img) {
-//---------------------------------------------------------------------------------
- int i;
-
- u16* temp = (u16*)malloc(img->height*img->width*2);
-
- for(i = 0; i < img->height * img->width; i++)
- temp[i] = img->palette[img->image.data8[i]] | (1<<15);
-
- free (img->image.data8);
- free (img->palette);
-
- img->bpp = 16;
- img->image.data16 = temp;
-}
-
-//---------------------------------------------------------------------------------
-void image8to16trans(sImage* img, u8 transparentColor) {
-//---------------------------------------------------------------------------------
- int i;
- u8 c;
-
- u16* temp = (u16*)malloc(img->height*img->width*2);
-
- for(i = 0; i < img->height * img->width; i++) {
-
- c = img->image.data8[i];
-
- if(c != transparentColor)
- temp[i] = img->palette[c] | (1<<15);
- else
- temp[i] = img->palette[c];
- }
-
- free (img->image.data8);
- free (img->palette);
-
- img->bpp = 16;
- img->image.data16 = temp;
-}
-//---------------------------------------------------------------------------------
-void imageTileData(sImage* img) {
-//---------------------------------------------------------------------------------
- u32* temp;
-
- int ix, iy, tx, ty;
-
- int th, tw;
-
- int i = 0;
-
- //can only tile 8 bit data that is a multiple of 8 in dimention
- if(img->bpp != 8 || (img->height & 3) != 0 || (img->width & 3) != 0) return;
-
- th = img->height >> 3;
- tw = img->width >> 3;
-
- //buffer to hold data
- temp = (u32*)malloc(img->height * img->width);
-
- for(ty = 0; ty < th; ty++)
- for(tx = 0; tx < tw; tx++)
- for(iy = 0; iy < 8; iy++)
- for(ix = 0; ix < 2; ix++)
- temp[i++] = img->image.data32[ix + tx * 2 + (iy + ty * 8) * tw * 2 ];
-
- free(img->image.data32);
-
- img->image.data32 = (unsigned int *)temp;
-}
-
-//---------------------------------------------------------------------------------
-void imageDestroy(sImage* img) {
-//---------------------------------------------------------------------------------
- if(img->image.data8) free (img->image.data8);
- if(img->palette && img->bpp == 8) free (img->palette);
-}
diff --git a/c/src/lib/libbsp/arm/nds/libnds/source/arm9/initSystem.c b/c/src/lib/libbsp/arm/nds/libnds/source/arm9/initSystem.c
deleted file mode 100644
index da401ac506..0000000000
--- a/c/src/lib/libbsp/arm/nds/libnds/source/arm9/initSystem.c
+++ /dev/null
@@ -1,94 +0,0 @@
-/*---------------------------------------------------------------------------------
-
- initSystem.c -- Code for initialising the DS
-
- Copyright (C) 2007
- 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/jtypes.h>
-#include <nds/system.h>
-#include <nds/memory.h>
-#include <nds/timers.h>
-#include <nds/dma.h>
-#include <nds/ipc.h>
-#include <nds/arm9/video.h>
-
-#include <time.h>
-
-/*
- * Prototypes
- *
- * NOTE: Called from start.S
- */
-void initSystem(void);
-
-extern time_t *punixTime;
-
-//---------------------------------------------------------------------------------
-// Reset the DS registers to sensible defaults
-//---------------------------------------------------------------------------------
-void initSystem(void) {
-//---------------------------------------------------------------------------------
- register int i;
-
- //clear out ARM9 DMA channels
- for (i=0; i<4; i++) {
- DMA_CR(i) = 0;
- DMA_SRC(i) = 0;
- DMA_DEST(i) = 0;
- TIMER_CR(i) = 0;
- TIMER_DATA(i) = 0;
- }
-
- VRAM_CR = 0x80808080;
- VRAM_E_CR = 0x80;
- VRAM_F_CR = 0x80;
- VRAM_G_CR = 0x80;
- VRAM_H_CR = 0x80;
- VRAM_I_CR = 0x80;
-
- (*(vu32*)0x027FFE04) = 0; // temporary variable
- PALETTE[0] = 0xFFFF;
- dmaFillWords((void*)0x027FFE04, PALETTE+1, (2*1024)-2);
- dmaFillWords((void*)0x027FFE04, OAM, 2*1024);
- dmaFillWords((void*)0x027FFE04, (void*)0x04000000, 0x56); //clear main display registers
- dmaFillWords((void*)0x027FFE04, (void*)0x04001000, 0x56); //clear sub display registers
- dmaFillWords((void*)0x027FFE04, VRAM, 656*1024);
-
- REG_DISPSTAT = 0;
- videoSetMode(0);
- videoSetModeSub(0);
- VRAM_A_CR = 0;
- VRAM_B_CR = 0;
- VRAM_C_CR = 0;
- VRAM_D_CR = 0;
- VRAM_E_CR = 0;
- VRAM_F_CR = 0;
- VRAM_G_CR = 0;
- VRAM_H_CR = 0;
- VRAM_I_CR = 0;
- VRAM_CR = 0x03000000;
-
- punixTime = (time_t*)&IPC->unixTime;
-
-}
diff --git a/c/src/lib/libbsp/arm/nds/libnds/source/arm9/keys.c b/c/src/lib/libbsp/arm/nds/libnds/source/arm9/keys.c
deleted file mode 100644
index 8f71d96682..0000000000
--- a/c/src/lib/libbsp/arm/nds/libnds/source/arm9/keys.c
+++ /dev/null
@@ -1,97 +0,0 @@
-/*------------------------------------------------------------------------------
- key input code -- provides slightly higher level input forming
-
- Copyright (C) 2005
- Christian Auby (DesktopMan)
- 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 <stdlib.h>
-
-#include <nds/ipc.h>
-#include <nds/system.h>
-#include <nds/arm9/input.h>
-
-//------------------------------------------------------------------------------
-
-#define KEYS_CUR (( ((~REG_KEYINPUT)&0x3ff) | (((~IPC->buttons)&3)<<10) | (((~IPC->buttons)<<6) & (KEY_TOUCH|KEY_LID) ))^KEY_LID)
-
-static uint16 keys = 0;
-static uint16 keysold = 0;
-static uint16 keysrepeat = 0;
-
-static u8 delay = 60, repeat = 30, count = 60;
-
-//------------------------------------------------------------------------------
-void scanKeys(void) {
-//------------------------------------------------------------------------------
- keysold = keys;
- keys = KEYS_CUR;
-
- if ( delay != 0 ) {
- if ( keys != keysold ) {
- count = delay ;
- keysrepeat = keysDown() ;
- }
- count--;
- if ( count == 0 ) {
- count = repeat;
- keysrepeat = keys;
- }
- }
-}
-
-//------------------------------------------------------------------------------
-uint32 keysHeld(void) {
-//------------------------------------------------------------------------------
- return keys;
-}
-
-//------------------------------------------------------------------------------
-uint32 keysDown(void) {
-//------------------------------------------------------------------------------
- return (keys ^ keysold) & keys;
-}
-
-//------------------------------------------------------------------------------
-uint32 keysDownRepeat(void) {
-//------------------------------------------------------------------------------
- uint32 tmp = keysrepeat;
-
- keysrepeat = 0;
-
- return tmp;
-}
-
-//------------------------------------------------------------------------------
-void keysSetRepeat( u8 setDelay, u8 setRepeat ) {
-//------------------------------------------------------------------------------
- delay = setDelay ;
- repeat = setRepeat ;
- count = delay ;
- keysrepeat = 0 ;
-}
-
-//------------------------------------------------------------------------------
-uint32 keysUp(void) {
-//------------------------------------------------------------------------------
- return (keys ^ keysold) & (~keys);
-}
diff --git a/c/src/lib/libbsp/arm/nds/libnds/source/arm9/ndsmotion.c b/c/src/lib/libbsp/arm/nds/libnds/source/arm9/ndsmotion.c
deleted file mode 100644
index 1faadcd5de..0000000000
--- a/c/src/lib/libbsp/arm/nds/libnds/source/arm9/ndsmotion.c
+++ /dev/null
@@ -1,488 +0,0 @@
-/*---------------------------------------------------------------------------------
- DS Motion Card/DS Motion Pak functionality
-
- Copyright (C) 2007
- Michael Noland (joat)
- Jason Rogers (dovoto)
- Dave Murphy (WinterMute)
- Keith Epstein (KeithE)
-
- 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/card.h>
-#include <nds/system.h>
-#include <nds/memory.h>
-#include <nds/bios.h>
-#include <nds/arm9/ndsmotion.h>
-
-#define WAIT_CYCLES 185
-
-#define CARD_WaitBusy() while (CARD_CR1 & /*BUSY*/0x80);
-
-// enables SPI bus at 4.19 MHz
-#define SPI_On() CARD_CR1 = /*E*/0x8000 | /*SEL*/0x2000 | /*MODE*/0x40 | 0;
-
-// disables SPI bus
-#define SPI_Off() CARD_CR1 = 0;
-
-// Volatile GBA bus SRAM for reading from DS Motion Pak
-#define V_SRAM ((volatile unsigned char*)0x0A000000)
-
-
-int card_type = -1;
-
-//these are the default calibration values for sensitivity and offset
-MotionCalibration calibration = {2048, 2048, 2048, 1680, 819, 819, 819, 825};
-
-// sends and receives 1 byte on the SPI bus
-static unsigned char motion_spi(unsigned char in_byte){
-
- unsigned char out_byte;
- CARD_EEPDATA = in_byte; // send the output byte to the SPI bus
- CARD_WaitBusy(); // wait for transmission to complete
- out_byte=CARD_EEPDATA; // read the input byte from the SPI bus
- return out_byte;
-}
-
-
-static void motion_MK6_sensor_mode(void) {
- // send some commands on the SPI bus
- SPI_On()
- motion_spi(0xFE);
- SPI_Off()
- SPI_On()
- motion_spi(0xFD);
- SPI_Off()
- SPI_On()
- motion_spi(0xFB);
- SPI_Off()
- SPI_On()
- motion_spi(0xF8);
- SPI_Off()
-}
-
-static void motion_MK6_EEPROM_mode(void) {
- // send some commands on the SPI bus
- SPI_On()
- motion_spi(0xFE);
- SPI_Off()
- SPI_On()
- motion_spi(0xFD);
- SPI_Off()
- SPI_On()
- motion_spi(0xFB);
- SPI_Off()
- SPI_On()
- motion_spi(0xF9);
- SPI_Off()
-}
-
-// checks whether a DS Motion Pak is plugged in
-static int motion_pak_is_inserted(void){
- int motion_pak = 0;
- unsigned char return_byte = V_SRAM[10]; // read first byte of DS Motion Pak check
- swiDelay(WAIT_CYCLES);
- return_byte = V_SRAM[0];
- swiDelay(WAIT_CYCLES);
- if (return_byte==0xF0) { // DS Motion Pak returns 0xF0
- return_byte = V_SRAM[0]; // read second byte of DS Motion Pak check
- swiDelay(WAIT_CYCLES);
- if(return_byte==0x0F) { // DS Motion Pak returns 0x0F
- motion_pak = 1;
- }
- }
- return motion_pak;
-}
-
-// checks whether a DS Motion Card is plugged in
-// this only works after motion_init()
-// it will return false if it is run before motion_init()
-static int motion_card_is_inserted(void){
- // send 0x03 to read from DS Motion Card control register
- SPI_On()
- motion_spi(0x03); // command to read from control register
- // if the control register is 0x04 then the enable was successful
- if( motion_spi(0x00) == 0x04)
- {
- SPI_Off()
- return 1;
- }
- SPI_Off();
- return 0;
-}
-
-// turn on the DS Motion Sensor (DS Motion Pak or DS Motion Card)
-// Requires knowing which type is present (can be found by using motion_init)
-static int motion_enable(int card_type) {
- switch (card_type)
- {
- case 1: // DS Motion Pak - automatically enabled on powerup
- // check to see whether Motion Pak is alive
- return motion_pak_is_inserted();
- break;
- case 2: // DS Motion Card
- // send 0x04, 0x04 to enable
- SPI_On()
- motion_spi(0x04); // command to write to control register
- motion_spi(0x04); // enable
- SPI_Off()
- // check to see whether Motion Card is alive
- return motion_card_is_inserted();
- break;
- case 3: // MK6 - same command as DS Motion Card
- // send 0x04, 0x04 to enable
- SPI_On()
- motion_spi(0x04); // command to write to control register
- motion_spi(0x04); // enable
- SPI_Off()
- // check to see whether Motion Card is alive
- return motion_card_is_inserted();
- break;
- default: // if input parameter is not recognized, return 0
- return 0;
- break;
- }
-}
-
-// Initialize the DS Motion Sensor
-// Determines which DS Motion Sensor is present
-// Turns it on
-// Does not require knowing which type is present
-int motion_init(void) {
- sysSetBusOwners(true, true);
- // first, check for the DS Motion Pak - type 1
- if( motion_pak_is_inserted() == 1 )
- {
- card_type = 1;
- return 1;
- }// next, check for DS Motion Card - type 2
- if( motion_enable(2) == 1 )
- {
- card_type = 2;
- return 2;
- }
-
- motion_MK6_sensor_mode(); // send command to switch MK6 to sensor mode
-
- if( motion_enable(3) == 1 )
- {
- card_type = 3;
- return 3;
- }// if neither cases are true, then return 0 to indicate no DS Motion Sensor
- return 0;
-}
-
-// Deinitialize the DS Motion Sensor
-// In the case of a DS Motion Pak, do nothing - there is nothing to de-init
-// In the case of a DS Motion Card, turns off the accelerometer
-// In the case of an MK6, turns off accelerometer and switches out of sensor mode into EEPROM mode
-void motion_deinit(void) {
- // DS Motion Card - turn off accelerometer
- SPI_On()
- motion_spi(0x04); // command to write to control register
- motion_spi(0x00); // turn it off
- SPI_Off()
- // MK6 - switch to EEPROM mode
- motion_MK6_EEPROM_mode(); // switch MK6 to EEPROM mode
-}
-
-// read the X acceleration
-signed int motion_read_x(void) {
- unsigned char High_byte = 0;
- unsigned char Low_byte = 0;
- signed int output = 0;
- switch(card_type)
- {
- case 1: // DS Motion Pak
- High_byte = V_SRAM[2]; // Command to load X High onto bus
- swiDelay(WAIT_CYCLES); // wait for data ready
- High_byte = V_SRAM[0]; // get the high byte
- swiDelay(WAIT_CYCLES); // wait for data ready
- Low_byte = V_SRAM[0]; // get the low byte
- swiDelay(WAIT_CYCLES); // wait after for Motion Pak to be ready for next command
- output = (signed int)( (High_byte<<8 | Low_byte)>>4);
- return output;
- break;
- case 2: // DS Motion Card
- SPI_On()
- motion_spi(0x00); // command to convert X axis
- swiDelay(625); // wait at least 40 microseconds for the A-D conversion
- output = ( (motion_spi(0x00)<<8)|motion_spi(0x00) )>>4; // read 16 bits and store as a 12 bit number
- SPI_Off()
- return output;
- break;
- case 3: // MK6 - same command as DS Motion Card
- SPI_On()
- motion_spi(0x00); // command to convert X axis
- swiDelay(625); // wait at least 40 microseconds for the A-D conversion
- output = ( (motion_spi(0x00)<<8)|motion_spi(0x00) )>>4; // read 16 bits and store as a 12 bit number
- SPI_Off()
- return output;
- break;
- default:
- return 0;
- break;
- }
-}
-
-// read the Y acceleration
-signed int motion_read_y(void) {
- unsigned char High_byte = 0;
- unsigned char Low_byte = 0;
- signed int output = 0;
- switch (card_type)
- {
- case 1: // DS Motion Pak
- High_byte = V_SRAM[4]; // Command to load Y High onto bus
- swiDelay(WAIT_CYCLES); // wait for data ready
- High_byte = V_SRAM[0]; // get the high byte
- swiDelay(WAIT_CYCLES); // wait for data ready
- Low_byte = V_SRAM[0]; // get the low byte
- swiDelay(WAIT_CYCLES); // wait after for Motion Pak to be ready for next command
- output = (signed int)( (High_byte<<8 | Low_byte)>>4);
- return output;
- break;
- case 2: // DS Motion Card
- SPI_On()
- motion_spi(0x02); // command to convert Y axis
- swiDelay(625); // wait at least 40 microseconds for the A-D conversion
- output = ( (motion_spi(0x00)<<8)|motion_spi(0x00) )>>4; // read 16 bits and store as a 12 bit number
- SPI_Off()
- return output;
- break;
- case 3: // MK6 - same command as DS Motion Card
- SPI_On()
- motion_spi(0x02); // command to convert Y axis
- swiDelay(625); // wait at least 40 microseconds for the A-D conversion
- output = ( (motion_spi(0x00)<<8)|motion_spi(0x00) )>>4; // read 16 bits and store as a 12 bit number
- SPI_Off()
- return output;
- break;
- default:
- return 0;
- break;
- }
-}
-
-// read the Z acceleration
-signed int motion_read_z(void) {
- unsigned char High_byte = 0;
- unsigned char Low_byte = 0;
- signed int output = 0;
- switch (card_type)
- {
- case 1: // DS Motion Pak
- High_byte = V_SRAM[6]; // Command to load Z High onto bus
- swiDelay(WAIT_CYCLES); // wait for data ready
- High_byte = V_SRAM[0]; // get the high byte
- swiDelay(WAIT_CYCLES); // wait for data ready
- Low_byte = V_SRAM[0]; // get the low byte
- swiDelay(WAIT_CYCLES); // wait after for Motion Pak to be ready for next command
- output = (signed int)( (High_byte<<8 | Low_byte)>>4);
- return output;
- break;
- case 2: // DS Motion Card
- SPI_On()
- motion_spi(0x01); // command to convert Z axis
- swiDelay(625); // wait at least 40 microseconds for the A-D conversion
- output = ( (motion_spi(0x00)<<8)|motion_spi(0x00) )>>4; // read 16 bits and store as a 12 bit number
- SPI_Off()
- return output;
- break;
- case 3: // MK6 - same command as DS Motion Card
- SPI_On()
- motion_spi(0x01); // command to convert Z axis
- swiDelay(625); // wait at least 40 microseconds for the A-D conversion
- output = ( (motion_spi(0x00)<<8)|motion_spi(0x00) )>>4; // read 16 bits and store as a 12 bit number
- SPI_Off()
- return output;
- break;
- default:
- return 0;
- break;
- }
-}
-
-// read the Z rotation (gyro)
-signed int motion_read_gyro(void) {
- unsigned char High_byte = 0;
- unsigned char Low_byte = 0;
- signed int output = 0;
- switch (card_type)
- {
- case 1: // DS Motion Pak
- High_byte = V_SRAM[8]; // Command to load Gyro High onto bus
- swiDelay(WAIT_CYCLES); // wait for data ready
- High_byte = V_SRAM[0]; // get the high byte
- swiDelay(WAIT_CYCLES); // wait for data ready
- Low_byte = V_SRAM[0]; // get the low byte
- swiDelay(WAIT_CYCLES); // wait after for Motion Pak to be ready for next command
- output = (signed int)( (High_byte<<8 | Low_byte)>>4);
- return output;
- break;
- case 2: // DS Motion Card
- SPI_On()
- motion_spi(0x07); // command to convert Gyro axis
- swiDelay(625); // wait at least 40 microseconds for the A-D conversion
- output = ( (motion_spi(0x00)<<8)|motion_spi(0x00) )>>4; // read 16 bits and store as a 12 bit number
- SPI_Off()
- return output;
- break;
- case 3: // MK6 - same command as DS Motion Card
- SPI_On()
- motion_spi(0x07); // command to convert Gyro axis
- swiDelay(625); // wait at least 40 microseconds for the A-D conversion
- output = ( (motion_spi(0x00)<<8)|motion_spi(0x00) )>>4; // read 16 bits and store as a 12 bit number
- SPI_Off()
- return output;
- break;
- default:
- return 0;
- break;
- }
-}
-
-//gets acceleration value in mili G (where g is 9.8 m/s*s)
-int motion_acceleration_x(void){
- int accel = motion_read_x();
- return (accel - calibration.xoff) * 1000 / calibration.xsens;
-}
-
-//gets acceleration value in mili G (where g is 9.8 m/s*s)
-int motion_acceleration_y(void){
- int accel = motion_read_y();
- return (accel - calibration.yoff) * 1000 / calibration.ysens;
-}
-//gets acceleration value in mili G (where g is 9.8 m/s*s)
-int motion_acceleration_z(void){
- int accel = motion_read_z();
- return (accel - calibration.zoff) * 1000 / calibration.zsens;
-}
-
-//converts raw rotation value to degrees per second
-int motion_rotation(void){
- int rotation = motion_read_gyro();
- return (rotation - calibration.goff) * 1000 / calibration.gsens;
-}
-
-//this should be passed the raw reading at 1g for accurate
-//acceleration calculations. Default is 819
-void motion_set_sens_x(int sens){
- calibration.xsens = sens - calibration.xoff;
-}
-
-//this should be passed the raw reading at 1g for accurate
-//acceleration calculations. Default is 819
-void motion_set_sens_y(int sens){
- calibration.ysens = sens - calibration.yoff;
-}
-
-//this should be passed the raw reading at 1g for accurate
-//acceleration calculations. Default is 819
-void motion_set_sens_z(int sens){
- calibration.zsens = sens - calibration.zoff;
-}
-
-//this should be passed the raw reading at 1g for accurate
-//acceleration calculations. Default is 825
-void motion_set_sens_gyro(int sens){
- calibration.gsens = sens;
-}
-
-//this should be called when the axis is under no acceleration
-//default is 2048
-void motion_set_offs_x(void){
- calibration.xoff = motion_read_x();
-}
-
-//this should be called when the axis is under no acceleration
-//default is 2048
-void motion_set_offs_y(void){
- calibration.yoff = motion_read_y();
-}
-
-//this should be called when the axis is under no acceleration
-//default is 2048
-void motion_set_offs_z(void){
- calibration.zoff = motion_read_z();
-}
-
-//this should be called when the axis is under no acceleration
-//default is 1680
-void motion_set_offs_gyro(void){
- calibration.goff = motion_read_gyro();
-}
-
-MotionCalibration* motion_get_calibration(void){
- return &calibration;
-}
-
-void motion_set_calibration(MotionCalibration* cal){
- calibration.xsens = cal->xsens;
- calibration.ysens = cal->ysens;
- calibration.zsens = cal->zsens;
- calibration.gsens = cal->gsens;
- calibration.xoff = cal->xoff;
- calibration.yoff = cal->yoff;
- calibration.zoff = cal->zoff;
- calibration.goff = cal->goff;
-}
-
-// enable analog input number 1 (ain_1)
-void motion_enable_ain_1(void){
- unsigned char return_byte;
- (void) return_byte; /* avoid set but unused warning */
- return_byte = V_SRAM[16];
- swiDelay(WAIT_CYCLES);
-}
-
-// enable analog input number 2 (ain_2)
-void motion_enable_ain_2(void){
- unsigned char return_byte;
- (void) return_byte; /* avoid set but unused warning */
- return_byte = V_SRAM[18];
- swiDelay(WAIT_CYCLES);
-}
-
-// read from the analog input number 1 - requires enabling ain_1 first
-int motion_read_ain_1(void){
- unsigned char High_byte = V_SRAM[12]; // Command to load AIN_1 High onto bus
- swiDelay(WAIT_CYCLES); // wait for data ready
- High_byte = V_SRAM[0]; // get the high byte
- swiDelay(WAIT_CYCLES); // wait for data ready
- unsigned char Low_byte = V_SRAM[0]; // get the low byte
- swiDelay(WAIT_CYCLES); // wait after for Motion Pak to be ready for next command
- signed int output = (signed int)( (High_byte<<8 | Low_byte)>>4);
- return output;
-}
-
-// read from the analog input number 2 - requires enabling ain_2 first
-int motion_read_ain_2(void){
- unsigned char High_byte = V_SRAM[14]; // Command to load AIN_1 High onto bus
- swiDelay(WAIT_CYCLES); // wait for data ready
- High_byte = V_SRAM[0]; // get the high byte
- swiDelay(WAIT_CYCLES); // wait for data ready
- unsigned char Low_byte = V_SRAM[0]; // get the low byte
- swiDelay(WAIT_CYCLES); // wait after for Motion Pak to be ready for next command
- signed int output = (signed int)( (High_byte<<8 | Low_byte)>>4);
- return output;
-}
-
-
diff --git a/c/src/lib/libbsp/arm/nds/libnds/source/arm9/pcx.c b/c/src/lib/libbsp/arm/nds/libnds/source/arm9/pcx.c
deleted file mode 100644
index 292f70fb6c..0000000000
--- a/c/src/lib/libbsp/arm/nds/libnds/source/arm9/pcx.c
+++ /dev/null
@@ -1,85 +0,0 @@
-/*---------------------------------------------------------------------------------
- Copyright (C) 2005
- 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/jtypes.h>
-#include <nds/arm9/video.h>
-#include <nds/arm9/image.h>
-#include <malloc.h>
-
-//---------------------------------------------------------------------------------
-int loadPCX(unsigned char* pcx, sImage* image) {
-//---------------------------------------------------------------------------------
- //struct rgb {unsigned char b,g,r;};
- RGB_24* pal;
-
- PCXHeader* hdr = (PCXHeader*) pcx;
-
- pcx += sizeof(PCXHeader);
-
- unsigned char c;
- int size;
- int count;
- int run;
- int i;
-
- image->width = hdr->xmax - hdr->xmin + 1 ;
- image->height = hdr->ymax - hdr->ymin + 1;
-
- size = image->width *image->height;
-
- image->image.data8 = (unsigned char*)malloc(size);
- image->palette = (unsigned short*)malloc(256 * 2);
-
- if(hdr->bitsPerPixel != 8)
- return 0;
-
- count = 0;
-
- while(count < size) {
- c = *pcx++;
-
- if(c < 192) {
- image->image.data8[count++] = c;
- } else {
- run = c - 192;
-
- c = *pcx++;
-
- for(i = 0; i < run; i++)
- image->image.data8[count++] = c;
- }
- }
-
- pal = (RGB_24*)(pcx + 1);
-
- image->bpp = 8;
-
- for(i = 0; i < 256; i++)
- {
- u8 r = (pal[i].r + 4 > 255) ? 255 : (pal[i].r + 4);
- u8 g = (pal[i].g + 4 > 255) ? 255 : (pal[i].g + 4);
- u8 b = (pal[i].b + 4 > 255) ? 255 : (pal[i].b + 4);
- image->palette[i] = RGB15(r >> 3 , g >> 3 , b >> 3) ;
- }
- return 1;
-}
diff --git a/c/src/lib/libbsp/arm/nds/libnds/source/arm9/rumble.c b/c/src/lib/libbsp/arm/nds/libnds/source/arm9/rumble.c
deleted file mode 100644
index fc340cd07a..0000000000
--- a/c/src/lib/libbsp/arm/nds/libnds/source/arm9/rumble.c
+++ /dev/null
@@ -1,73 +0,0 @@
-/*---------------------------------------------------------------------------------
- Copyright (C) 2005
- Michael Noland (joat)
- Jason Rogers (dovoto)
- Dave Murphy (WinterMute)
- Mike Parks (BigRedPimp)
- 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/jtypes.h>
-#include <nds/memory.h>
-#include <nds/arm9/rumble.h>
-
-static RUMBLE_TYPE rumbleType;
-
-//---------------------------------------------------------------------------------
-bool isRumbleInserted(void) {
-//---------------------------------------------------------------------------------
- uint16 four[4];
- sysSetCartOwner(BUS_OWNER_ARM9);
- // First, check for 0x96 to see if it's a GBA game
- if (GBA_HEADER.is96h == 0x96) {
-
- //if it is a game, we check the game code
- //to see if it is warioware twisted
- if ( (GBA_HEADER.gamecode[0] == 'R') &&
- (GBA_HEADER.gamecode[1] == 'Z') &&
- (GBA_HEADER.gamecode[2] == 'W') &&
- (GBA_HEADER.gamecode[3] == 'E')
- )
- {
- rumbleType = WARIOWARE;
- WARIOWARE_ENABLE = 8;
- return true;
- }
- return false;
-
- } else {
-
- rumbleType = RUMBLE;
- // Now check to see if it's true open bus, or if D1 is pulled low
- four[0] = GBA_BUS[0] & 0xFF;
- four[1] = GBA_BUS[1] & 0xFF;
- four[2] = GBA_BUS[2] & 0xFF;
- four[3] = GBA_BUS[3] & 0xFF;
- return (four[0] == 0x00) && (four[2] == 0x00) && (four[1] == 0x01) && (four[3] == 0x01);
- }
-}
-//---------------------------------------------------------------------------------
-void setRumble(bool position) {
-//---------------------------------------------------------------------------------
-
- if( rumbleType == WARIOWARE) {
- WARIOWARE_PAK = (position ? 8 : 0);
- } else {
- RUMBLE_PAK = (position ? 2 : 0);
- }
-
-}
diff --git a/c/src/lib/libbsp/arm/nds/libnds/source/arm9/sound.c b/c/src/lib/libbsp/arm/nds/libnds/source/arm9/sound.c
deleted file mode 100644
index 7f03f69f19..0000000000
--- a/c/src/lib/libbsp/arm/nds/libnds/source/arm9/sound.c
+++ /dev/null
@@ -1,72 +0,0 @@
-/*---------------------------------------------------------------------------------
- Sound Functions
-
- Copyright (C) 2005
- 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/arm9/sound.h>
-#include <nds/arm9/cache.h>
-#include <string.h>
-
-//---------------------------------------------------------------------------------
-static void playSoundBlock(TransferSound *snd) {
-//---------------------------------------------------------------------------------
- DC_FlushRange( snd, sizeof(TransferSound) );
-
- IPC->soundData = snd;
-}
-
-//---------------------------------------------------------------------------------
-static TransferSound Snd;
-static TransferSoundData SndDat = { (void *)0 , 0, 11025, 64, 64, 1 };
-
-//---------------------------------------------------------------------------------
-void setGenericSound( u32 rate, u8 vol, u8 pan, u8 format) {
-//---------------------------------------------------------------------------------
-
- SndDat.rate = rate;
- SndDat.vol = vol;
- SndDat.pan = pan;
- SndDat.format = format;
-}
-
-//---------------------------------------------------------------------------------
-void playSound( pTransferSoundData sound) {
-//---------------------------------------------------------------------------------
- Snd.count = 1;
-
- memcpy( &Snd.data[0], sound, sizeof(TransferSoundData) );
-
- playSoundBlock(&Snd);
-
-}
-
-//---------------------------------------------------------------------------------
-void playGenericSound(const void* data, u32 length) {
-//---------------------------------------------------------------------------------
- Snd.count = 1;
-
- memcpy( &Snd.data[0], &SndDat, sizeof(TransferSoundData) );
- Snd.data[0].data = data;
- Snd.data[0].len = length;
-
- playSoundBlock(&Snd);
-}
diff --git a/c/src/lib/libbsp/arm/nds/libnds/source/arm9/system.c b/c/src/lib/libbsp/arm/nds/libnds/source/arm9/system.c
deleted file mode 100644
index aea29bad69..0000000000
--- a/c/src/lib/libbsp/arm/nds/libnds/source/arm9/system.c
+++ /dev/null
@@ -1,31 +0,0 @@
-/*---------------------------------------------------------------------------------
-
-system.c -- System code
-
-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/memory.h>
diff --git a/c/src/lib/libbsp/arm/nds/libnds/source/arm9/touch.c b/c/src/lib/libbsp/arm/nds/libnds/source/arm9/touch.c
deleted file mode 100644
index 9417d03577..0000000000
--- a/c/src/lib/libbsp/arm/nds/libnds/source/arm9/touch.c
+++ /dev/null
@@ -1,46 +0,0 @@
-/*---------------------------------------------------------------------------------
- touch screen input code
-
- Copyright (C) 2005
- 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.h>
-
-#include <nds/ipc.h>
-#include <nds/arm9/input.h>
-
-//---------------------------------------------------------------------------------
-touchPosition touchReadXY() {
-//---------------------------------------------------------------------------------
-
- touchPosition touchPos;
-
- touchPos.x = IPC->touchX;
- touchPos.y = IPC->touchY;
-
- touchPos.px = IPC->touchXpx;
- touchPos.py = IPC->touchYpx;
-
- return touchPos;
-
-}
-
diff --git a/c/src/lib/libbsp/arm/nds/libnds/source/arm9/video.c b/c/src/lib/libbsp/arm/nds/libnds/source/arm9/video.c
deleted file mode 100644
index 6b516db57c..0000000000
--- a/c/src/lib/libbsp/arm/nds/libnds/source/arm9/video.c
+++ /dev/null
@@ -1,122 +0,0 @@
-//////////////////////////////////////////////////////////////////////
-//
-// video.cpp -- Vram control
-//
-// version 0.1, February 19, 2005
-//
-// Copyright (C) 2005 Michael Noland (joat) and Jason Rogers (dovoto)
-//
-// 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.
-//
-// Changelog:
-// 0.1: First version
-//
-//////////////////////////////////////////////////////////////////////
-
-#include <nds/jtypes.h>
-#include <nds/arm9/video.h>
-
-//////////////////////////////////////////////////////////////////////
-
-uint32 vramSetMainBanks(VRAM_A_TYPE a, VRAM_B_TYPE b, VRAM_C_TYPE c, VRAM_D_TYPE d)
-{
- uint32 vramTemp = VRAM_CR;
-
- VRAM_A_CR = VRAM_ENABLE | a;
- VRAM_B_CR = VRAM_ENABLE | b;
- VRAM_C_CR = VRAM_ENABLE | c;
- VRAM_D_CR = VRAM_ENABLE | d;
-
- return vramTemp;
-}
-
-//////////////////////////////////////////////////////////////////////
-
-//////////////////////////////////////////////////////////////////////
-
-void vramRestoreMainBanks(uint32 vramTemp); /* used in videoGL.c */
-void vramRestoreMainBanks(uint32 vramTemp)
-{
- VRAM_CR = vramTemp;
-}
-
-//////////////////////////////////////////////////////////////////////
-
-void vramSetBankA(VRAM_A_TYPE a)
-{
- VRAM_A_CR = VRAM_ENABLE | a;
-}
-
-//////////////////////////////////////////////////////////////////////
-
-void vramSetBankB(VRAM_B_TYPE b)
-{
- VRAM_B_CR = VRAM_ENABLE | b;
-}
-
-//////////////////////////////////////////////////////////////////////
-
-void vramSetBankC(VRAM_C_TYPE c)
-{
- VRAM_C_CR = VRAM_ENABLE | c;
-}
-
-//////////////////////////////////////////////////////////////////////
-
-void vramSetBankD(VRAM_D_TYPE d)
-{
- VRAM_D_CR = VRAM_ENABLE | d;
-}
-
-//////////////////////////////////////////////////////////////////////
-
-void vramSetBankE(VRAM_E_TYPE e)
-{
- VRAM_E_CR = VRAM_ENABLE | e;
-}
-
-//////////////////////////////////////////////////////////////////////
-
-void vramSetBankF(VRAM_F_TYPE f)
-{
- VRAM_F_CR = VRAM_ENABLE | f;
-}
-
-//////////////////////////////////////////////////////////////////////
-
-void vramSetBankG(VRAM_G_TYPE g)
-{
- VRAM_G_CR = VRAM_ENABLE | g;
-}
-
-//////////////////////////////////////////////////////////////////////
-
-void vramSetBankH(VRAM_H_TYPE h)
-{
- VRAM_H_CR = VRAM_ENABLE | h;
-}
-
-//////////////////////////////////////////////////////////////////////
-
-void vramSetBankI(VRAM_I_TYPE i)
-{
- VRAM_I_CR = VRAM_ENABLE | i;
-}
-
-//////////////////////////////////////////////////////////////////////
-
diff --git a/c/src/lib/libbsp/arm/nds/libnds/source/arm9/videoGL.c b/c/src/lib/libbsp/arm/nds/libnds/source/arm9/videoGL.c
deleted file mode 100644
index 013e666acd..0000000000
--- a/c/src/lib/libbsp/arm/nds/libnds/source/arm9/videoGL.c
+++ /dev/null
@@ -1,424 +0,0 @@
-/*---------------------------------------------------------------------------------
- Video API vaguely similar to OpenGL
-
- 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/jtypes.h>
-#include <nds/memory.h>
-#include <nds/bios.h>
-#include <nds/arm9/math.h>
-#include <nds/arm9/video.h>
-#include <nds/arm9/videoGL.h>
-#include <nds/arm9/trig_lut.h>
-
-// this is the actual data of the globals for videoGL
-// Please use the glGlob pointer to access this data since that makes it easier to move stuff in/out of the header.
-static gl_hidden_globals glGlobalData;
-
-// This returns the pointer to the globals for videoGL
-gl_hidden_globals* glGetGlobals() {
- return &glGlobalData;
-}
-
-//---------------------------------------------------------------------------------
-void glRotatef32i(int angle, int32 x, int32 y, int32 z) {
-//---------------------------------------------------------------------------------
- int32 axis[3];
- int32 sine = SIN[angle & LUT_MASK];
- int32 cosine = COS[angle & LUT_MASK];
- int32 one_minus_cosine = inttof32(1) - cosine;
-
- axis[0]=x;
- axis[1]=y;
- axis[2]=z;
-
- normalizef32(axis); // should require passed in normalized?
-
- MATRIX_MULT3x3 = cosine + mulf32(one_minus_cosine, mulf32(axis[0], axis[0]));
- MATRIX_MULT3x3 = mulf32(one_minus_cosine, mulf32(axis[0], axis[1])) - mulf32(axis[2], sine);
- MATRIX_MULT3x3 = mulf32(mulf32(one_minus_cosine, axis[0]), axis[2]) + mulf32(axis[1], sine);
-
- MATRIX_MULT3x3 = mulf32(mulf32(one_minus_cosine, axis[0]), axis[1]) + mulf32(axis[2], sine);
- MATRIX_MULT3x3 = cosine + mulf32(mulf32(one_minus_cosine, axis[1]), axis[1]);
- MATRIX_MULT3x3 = mulf32(mulf32(one_minus_cosine, axis[1]), axis[2]) - mulf32(axis[0], sine);
-
- MATRIX_MULT3x3 = mulf32(mulf32(one_minus_cosine, axis[0]), axis[2]) - mulf32(axis[1], sine);
- MATRIX_MULT3x3 = mulf32(mulf32(one_minus_cosine, axis[1]), axis[2]) + mulf32(axis[0], sine);
- MATRIX_MULT3x3 = cosine + mulf32(mulf32(one_minus_cosine, axis[2]), axis[2]);
-}
-
-
-
-
-//---------------------------------------------------------------------------------
-void glMaterialf(GL_MATERIALS_ENUM mode, rgb color) {
-//---------------------------------------------------------------------------------
- static uint32 diffuse_ambient = 0;
- static uint32 specular_emission = 0;
-
- switch(mode) {
- case GL_AMBIENT:
- diffuse_ambient = (color << 16) | (diffuse_ambient & 0xFFFF);
- break;
- case GL_DIFFUSE:
- diffuse_ambient = color | (diffuse_ambient & 0xFFFF0000);
- break;
- case GL_AMBIENT_AND_DIFFUSE:
- diffuse_ambient= color + (color << 16);
- break;
- case GL_SPECULAR:
- specular_emission = color | (specular_emission & 0xFFFF0000);
- break;
- case GL_SHININESS:
- break;
- case GL_EMISSION:
- specular_emission = (color << 16) | (specular_emission & 0xFFFF);
- break;
- }
-
- GFX_DIFFUSE_AMBIENT = diffuse_ambient;
- GFX_SPECULAR_EMISSION = specular_emission;
-}
-
-//---------------------------------------------------------------------------------
-void glInit_C(void) {
-//---------------------------------------------------------------------------------
- glGlob = glGetGlobals();
-
- glGlob->clearColor = 0;
-
- // init texture globals
- glGlob->activeTexture = 0;
- glGlob->nextBlock = (uint32*)0x06800000;
- glGlob->nextPBlock = 0;
- glGlob->nameCount = 1;
-
- while (GFX_STATUS & (1<<27)); // wait till gfx engine is not busy
-
- // Clear the FIFO
- GFX_STATUS |= (1<<29);
-
- // Clear overflows from list memory
- glResetMatrixStack();
-
- // prime the vertex/polygon buffers
- glFlush(0);
-
- // reset the control bits
- GFX_CONTROL = 0;
-
- // reset the rear-plane(a.k.a. clear color) to black, ID=0, and opaque
- glClearColor(0,0,0,31);
- glClearPolyID(0);
-
- // reset stored texture locations
- glResetTextures();
-
- // reset the depth to it's max
- glClearDepth(GL_MAX_DEPTH);
-
- GFX_TEX_FORMAT = 0;
- GFX_POLY_FORMAT = 0;
-
- glMatrixMode(GL_PROJECTION);
- glLoadIdentity();
-
- glMatrixMode(GL_MODELVIEW);
- glLoadIdentity();
-
- glMatrixMode(GL_TEXTURE);
- glLoadIdentity();
-}
-
-//---------------------------------------------------------------------------------
-void glResetTextures(void) {
-//---------------------------------------------------------------------------------
- glGlob->activeTexture = 0;
- glGlob->nextBlock = (uint32*)0x06800000;
- glGlob->nextPBlock = 0;
- glGlob->nameCount = 1;
-}
-
-//---------------------------------------------------------------------------------
-// glGenTextures creates integer names for your table
-// takes n as the number of textures to generate and
-// a pointer to the names array that it needs to fill.
-// Returns 1 if succesful and 0 if out of texture names
-//---------------------------------------------------------------------------------
-
-int glGenTextures(int n, int *names) {
-//---------------------------------------------------------------------------------
- int index = 0;
- for(index = 0; index < n; index++) {
- if(glGlob->nameCount >= MAX_TEXTURES)
- return 0;
- else
- names[index] = glGlob->nameCount++;
- }
- return 1;
-}
-
-//---------------------------------------------------------------------------------
-// glBindTexure sets the current named
-// texture to the active texture. Target
-// is ignored as all DS textures are 2D
-//---------------------------------------------------------------------------------
-void glBindTexture(int target, int name) {
-//---------------------------------------------------------------------------------
- if (name == 0)
- GFX_TEX_FORMAT = 0;
- else
- GFX_TEX_FORMAT = glGlob->textures[name];
-
-
- glGlob->activeTexture = name;
-}
-//---------------------------------------------------------------------------------
-// glColorTable establishes the location of the current palette.
-// Roughly follows glColorTableEXT. Association of palettes with
-// named textures is left to the application.
-//---------------------------------------------------------------------------------
-void glColorTable( uint8 format, uint32 addr ) {
-//---------------------------------------------------------------------------------
- GFX_PAL_FORMAT = addr>>(4-(format==GL_RGB4));
-}
-
-//---------------------------------------------------------------------------------
-//---------------------------------------------------------------------------------
-void glTexCoord2f32(int32 u, int32 v) {
-//---------------------------------------------------------------------------------
- int x, y;
-
- x = ((glGlob->textures[glGlob->activeTexture]) >> 20) & 7;
- y = ((glGlob->textures[glGlob->activeTexture]) >> 23) & 7;
-
- glTexCoord2t16(f32tot16 (mulf32(u,inttof32(8<<x))), f32tot16 (mulf32(v,inttof32(8<<y))));
-}
-
-//---------------------------------------------------------------------------------
-// glTexParameter although named the same
-// as its gl counterpart it is not compatible
-// Effort may be made in the future to make it so.
-//---------------------------------------------------------------------------------
-void glTexParameter( uint8 sizeX, uint8 sizeY,
- const uint32* addr,
- GL_TEXTURE_TYPE_ENUM mode,
- uint32 param) {
-//---------------------------------------------------------------------------------
- glGlob->textures[glGlob->activeTexture] = param | (sizeX << 20) | (sizeY << 23) | (((uint32)addr >> 3) & 0xFFFF) | (mode << 26);
-}
-//---------------------------------------------------------------------------------
-//glGetTexturePointer gets a pointer to vram which contains the texture
-//
-//---------------------------------------------------------------------------------
-void* glGetTexturePointer( int name) {
-//---------------------------------------------------------------------------------
- return (void*) ((glGlob->textures[name] & 0xFFFF) << 3);
-}
-
-//---------------------------------------------------------------------------------
-u32 glGetTexParameter(){
-//---------------------------------------------------------------------------------
- return glGlob->textures[glGlob->activeTexture];
-}
-
-
-//---------------------------------------------------------------------------------
-static inline uint32 alignVal( uint32 val, uint32 to ) {
- return (val & (to-1))? (val & ~(to-1)) + to : val;
-}
-
-//---------------------------------------------------------------------------------
-static int getNextPaletteSlot(u16 count, uint8 format) {
-//---------------------------------------------------------------------------------
- // ensure the result aligns on a palette block for this format
- uint32 result = alignVal(glGlob->nextPBlock, 1<<(4-(format==GL_RGB4)));
-
- // convert count to bytes and align to next (smallest format) palette block
- count = alignVal( count<<1, 1<<3 );
-
- // ensure that end is within palette video mem
- if( result+count > 0x10000 ) // VRAM_F - VRAM_E
- return -1;
-
- glGlob->nextPBlock = result+count;
- return (int)result;
-}
-
-//---------------------------------------------------------------------------------
-static uint16* vramGetBank(uint16 *addr) {
-//---------------------------------------------------------------------------------
- if(addr >= VRAM_A && addr < VRAM_B)
- return VRAM_A;
- else if(addr >= VRAM_B && addr < VRAM_C)
- return VRAM_B;
- else if(addr >= VRAM_C && addr < VRAM_D)
- return VRAM_C;
- else if(addr >= VRAM_D && addr < VRAM_E)
- return VRAM_D;
- else if(addr >= VRAM_E && addr < VRAM_F)
- return VRAM_E;
- else if(addr >= VRAM_F && addr < VRAM_G)
- return VRAM_F;
- else if(addr >= VRAM_G && addr < VRAM_H)
- return VRAM_H;
- else if(addr >= VRAM_H && addr < VRAM_I)
- return VRAM_H;
- else return VRAM_I;
-}
-
-
-//---------------------------------------------------------------------------------
-static int vramIsTextureBank(uint16 *addr) {
-//---------------------------------------------------------------------------------
- uint16* vram = vramGetBank(addr);
-
- if(vram == VRAM_A)
- {
- if((VRAM_A_CR & 3) == ((VRAM_A_TEXTURE) & 3))
- return 1;
- else return 0;
- }
- else if(vram == VRAM_B)
- {
- if((VRAM_B_CR & 3) == ((VRAM_B_TEXTURE) & 3))
- return 1;
- else return 0;
- }
- else if(vram == VRAM_C)
- {
- if((VRAM_C_CR & 3) == ((VRAM_C_TEXTURE) & 3))
- return 1;
- else return 0;
- }
- else if(vram == VRAM_D)
- {
- if((VRAM_D_CR & 3) == ((VRAM_D_TEXTURE) & 3))
- return 1;
- else return 0;
- }
- else
- return 0;
-}
-//---------------------------------------------------------------------------------
-static uint32* getNextTextureSlot(int size) {
-//---------------------------------------------------------------------------------
- uint32* result = glGlob->nextBlock;
- glGlob->nextBlock += size >> 2;
-
- //uh-oh...out of texture memory in this bank...find next one assigned to textures
- while(!vramIsTextureBank((uint16*)glGlob->nextBlock - 1) && glGlob->nextBlock <= (uint32*)VRAM_E)
- {
- glGlob->nextBlock = (uint32*)vramGetBank((uint16*)result) + (0x20000 >> 2); //next bank
- result = glGlob->nextBlock;
- glGlob->nextBlock += size >> 2;
- }
-
- if(glGlob->nextBlock > (uint32*)VRAM_E) {
- result = 0;
- }
- return result;
-}
-
-//---------------------------------------------------------------------------------
-// Similer to glTextImage2D from gl it takes a pointer to data
-// Empty fields and target are unused but provided for code compatibility.
-// type is simply the texture type (GL_RGB, GL_RGB8 ect...)
-//---------------------------------------------------------------------------------
-int glTexImage2D(int target, int empty1, GL_TEXTURE_TYPE_ENUM type, int sizeX, int sizeY, int empty2, int param, const uint8* texture) {
-//---------------------------------------------------------------------------------
- uint32 size = 0;
- uint32* addr;
- uint32 vramTemp;
-
- size = 1 << (sizeX + sizeY + 6);
-
-
- switch (type) {
- case GL_RGB:
- case GL_RGBA:
- size = size << 1;
- break;
- case GL_RGB4:
- size = size >> 2;
- break;
- case GL_RGB16:
- size = size >> 1;
- break;
- default:
- break;
- }
-
- addr = getNextTextureSlot(size);
-
- if(!addr)
- return 0;
-
- // unlock texture memory
- vramTemp = vramSetMainBanks(VRAM_A_LCD,VRAM_B_LCD,VRAM_C_LCD,VRAM_D_LCD);
-
- if (type == GL_RGB) {
- // We do GL_RGB as GL_RGBA, but we set each alpha bit to 1 during the copy
- u16 * src = (u16*)texture;
- u16 * dest = (u16*)addr;
-
- glTexParameter(sizeX, sizeY, addr, GL_RGBA, param);
-
- while (size--) {
- *dest++ = *src | (1 << 15);
- src++;
- }
- } else {
- // For everything else, we do a straight copy
- glTexParameter(sizeX, sizeY, addr, type, param);
- swiCopy((uint32*)texture, addr , size / 4 | COPY_MODE_WORD);
- }
- vramRestoreMainBanks(vramTemp);
- return 1;
-}
-
-//---------------------------------------------------------------------------------
-void glTexLoadPal(const u16* pal, u16 count, u32 addr) {
-//---------------------------------------------------------------------------------
- vramSetBankE(VRAM_E_LCD);
- swiCopy( pal, &VRAM_E[addr>>1] , count / 2 | COPY_MODE_WORD);
- vramSetBankE(VRAM_E_TEX_PALETTE);
-}
-
-//---------------------------------------------------------------------------------
-int gluTexLoadPal(const u16* pal, u16 count, uint8 format) {
-//---------------------------------------------------------------------------------
- int addr = getNextPaletteSlot(count, format);
- if( addr>=0 )
- glTexLoadPal(pal, count, (u32) addr);
-
- return addr;
-}
-
-
-
-
-
diff --git a/c/src/lib/libbsp/arm/nds/libnds/source/common/biosCalls.S b/c/src/lib/libbsp/arm/nds/libnds/source/common/biosCalls.S
deleted file mode 100644
index 94e0bc908b..0000000000
--- a/c/src/lib/libbsp/arm/nds/libnds/source/common/biosCalls.S
+++ /dev/null
@@ -1,333 +0,0 @@
-/*---------------------------------------------------------------------------------
- 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.
-
----------------------------------------------------------------------------------*/
-
- .text
- .align 4
-
- .thumb
-
-@---------------------------------------------------------------------------------
- .global swiSoftReset
- .thumb_func
-@---------------------------------------------------------------------------------
-swiSoftReset:
-@---------------------------------------------------------------------------------
- swi 0x00
- bx lr
-
-
-@---------------------------------------------------------------------------------
- .global swiDelay
- .thumb_func
-@---------------------------------------------------------------------------------
-swiDelay:
-@---------------------------------------------------------------------------------
- swi 0x03
- bx lr
-
-@---------------------------------------------------------------------------------
- .global swiIntrWait
- .thumb_func
-@---------------------------------------------------------------------------------
-swiIntrWait:
-@---------------------------------------------------------------------------------
- swi 0x04
- bx lr
-
-
-@---------------------------------------------------------------------------------
- .global swiWaitForVBlank
- .thumb_func
-@---------------------------------------------------------------------------------
-swiWaitForVBlank:
-@---------------------------------------------------------------------------------
- swi 0x05
- bx lr
-
-@---------------------------------------------------------------------------------
- .global swiSleep
- .thumb_func
-@---------------------------------------------------------------------------------
-swiSleep:
-@---------------------------------------------------------------------------------
- swi 0x07
- bx lr
-
-@---------------------------------------------------------------------------------
- .global swiChangeSoundBias
- .thumb_func
-@---------------------------------------------------------------------------------
-swiChangeSoundBias:
-@---------------------------------------------------------------------------------
- swi 0x08
- bx lr
-
-@---------------------------------------------------------------------------------
- .global swiDivide
- .thumb_func
-@---------------------------------------------------------------------------------
-swiDivide:
-@---------------------------------------------------------------------------------
- swi 0x09
- bx lr
-
-@---------------------------------------------------------------------------------
- .global swiRemainder
- .thumb_func
-@---------------------------------------------------------------------------------
-swiRemainder:
-@---------------------------------------------------------------------------------
- swi 0x09
- mov r0, r1
- bx lr
-
-@---------------------------------------------------------------------------------
- .global swiDivMod
- .thumb_func
-@---------------------------------------------------------------------------------
-swiDivMod:
-@---------------------------------------------------------------------------------
- push {r2, r3}
- swi 0x09
- pop {r2, r3}
- str r0, [r2]
- str r1, [r3]
- bx lr
-
-@---------------------------------------------------------------------------------
- .global swiCopy
- .thumb_func
-@---------------------------------------------------------------------------------
-swiCopy:
-@---------------------------------------------------------------------------------
- swi 0x0B
- bx lr
-
-@---------------------------------------------------------------------------------
- .global swiFastCopy
- .thumb_func
-@---------------------------------------------------------------------------------
-swiFastCopy:
-@---------------------------------------------------------------------------------
- swi 0x0C
- bx lr
-
-@---------------------------------------------------------------------------------
- .global swiSqrt
- .thumb_func
-@---------------------------------------------------------------------------------
-swiSqrt:
-@---------------------------------------------------------------------------------
- swi 0x0D
- bx lr
-
-@---------------------------------------------------------------------------------
- .global swiCRC16
- .thumb_func
-@---------------------------------------------------------------------------------
-swiCRC16:
-@---------------------------------------------------------------------------------
- swi 0x0E
- bx lr
-
-@---------------------------------------------------------------------------------
- .global swiIsDebugger
- .thumb_func
-@---------------------------------------------------------------------------------
-swiIsDebugger:
-@---------------------------------------------------------------------------------
- swi 0x0F
- bx lr
-
-@---------------------------------------------------------------------------------
- .global swiUnpackBits
- .thumb_func
-@---------------------------------------------------------------------------------
-swiUnpackBits:
-@---------------------------------------------------------------------------------
- swi 0x10
- bx lr
-
-@---------------------------------------------------------------------------------
- .global swiDecompressLZSSWram
- .thumb_func
-@---------------------------------------------------------------------------------
-swiDecompressLZSSWram:
-@---------------------------------------------------------------------------------
- swi 0x11
- bx lr
-
-@---------------------------------------------------------------------------------
- .global swiDecompressLZSSVram
- .thumb_func
-@---------------------------------------------------------------------------------
-swiDecompressLZSSVram:
-@---------------------------------------------------------------------------------
- swi 0x12
- bx lr
-
-@---------------------------------------------------------------------------------
- .global swiDecompressHuffman
- .thumb_func
-@---------------------------------------------------------------------------------
-swiDecompressHuffman:
-@---------------------------------------------------------------------------------
- swi 0x13
- bx lr
-
-@---------------------------------------------------------------------------------
- .global swiDecompressRLEWram
- .thumb_func
-@---------------------------------------------------------------------------------
-swiDecompressRLEWram:
-@---------------------------------------------------------------------------------
- swi 0x14
- bx lr
-
-@---------------------------------------------------------------------------------
- .global swiDecompressRLEVram
- .thumb_func
-@---------------------------------------------------------------------------------
-swiDecompressRLEVram:
-@---------------------------------------------------------------------------------
- swi 0x15
- bx lr
-
-@---------------------------------------------------------------------------------
-@ ARM7 only bios calls
-@---------------------------------------------------------------------------------
-#ifdef ARM7
-
-@---------------------------------------------------------------------------------
- .global swiHalt
- .thumb_func
-@---------------------------------------------------------------------------------
-swiHalt:
-@---------------------------------------------------------------------------------
- swi 0x06
- bx lr
-
-@---------------------------------------------------------------------------------
- .global swiGetSineTable
- .thumb_func
-@---------------------------------------------------------------------------------
-swiGetSineTable:
-@---------------------------------------------------------------------------------
- swi 0x1A
- bx lr
-
-@---------------------------------------------------------------------------------
- .global swiGetPitchTable
- .thumb_func
-@---------------------------------------------------------------------------------
-swiGetPitchTable:
-@---------------------------------------------------------------------------------
- swi 0x1B
- bx lr
-
-@---------------------------------------------------------------------------------
- .global swiGetVolumeTable
- .thumb_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
-
-
-@---------------------------------------------------------------------------------
- .global swiSwitchToGBAMode
- .thumb_func
-@---------------------------------------------------------------------------------
-swiSwitchToGBAMode:
-@---------------------------------------------------------------------------------
- mov r0, #0x40
- swi 0x1F
-@ does not return, of course
-
-@---------------------------------------------------------------------------------
- .global swiSetHaltCR
- .thumb_func
-@---------------------------------------------------------------------------------
-swiSetHaltCR:
-@---------------------------------------------------------------------------------
- mov r2, r0
- swi 0x1F
- bx lr
-
-#endif // ARM7
-
-@---------------------------------------------------------------------------------
-@ ARM9 only bios calls
-@---------------------------------------------------------------------------------
-#ifdef ARM9
-
-@---------------------------------------------------------------------------------
- .global swiWaitForIRQ
- .thumb_func
-@---------------------------------------------------------------------------------
-swiWaitForIRQ:
-@---------------------------------------------------------------------------------
- swi 0x06
- bx lr
-
-@---------------------------------------------------------------------------------
- .global swiDecodeDelta8
- .thumb_func
-@---------------------------------------------------------------------------------
-swiDecodeDelta8:
-@---------------------------------------------------------------------------------
- swi 0x16
- bx lr
-
-@---------------------------------------------------------------------------------
- .global swiDecodeDelta16
- .thumb_func
-@---------------------------------------------------------------------------------
-swiDecodeDelta16:
-@---------------------------------------------------------------------------------
- swi 0x18
- bx lr
-
-@---------------------------------------------------------------------------------
- .global swiSetHaltCR
- .thumb_func
-@---------------------------------------------------------------------------------
-swiSetHaltCR:
-@---------------------------------------------------------------------------------
- swi 0x1F
- bx lr
-
-#endif // ARM9
-
diff --git a/c/src/lib/libbsp/arm/nds/libnds/source/common/card.c b/c/src/lib/libbsp/arm/nds/libnds/source/common/card.c
deleted file mode 100644
index 523bb6ca68..0000000000
--- a/c/src/lib/libbsp/arm/nds/libnds/source/common/card.c
+++ /dev/null
@@ -1,393 +0,0 @@
-/*---------------------------------------------------------------------------------
- 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/card.h"
-#include "nds/dma.h"
-#include "nds/memory.h"
-
-
-//---------------------------------------------------------------------------------
-void cardWriteCommand(const uint8 * command) {
-//---------------------------------------------------------------------------------
- int index;
-
- CARD_CR1H = CARD_CR1_ENABLE | CARD_CR1_IRQ;
-
- for (index = 0; index < 8; index++) {
- CARD_COMMAND[7-index] = command[index];
- }
-}
-
-
-//---------------------------------------------------------------------------------
-void cardPolledTransfer(uint32 flags, uint32 * destination, uint32 length, const uint8 * command) {
-//---------------------------------------------------------------------------------
- u32 data;
- cardWriteCommand(command);
- CARD_CR2 = flags;
- uint32 * target = destination + length;
- do {
- // Read data if available
- if (CARD_CR2 & CARD_DATA_READY) {
- data=CARD_DATA_RD;
- if (destination < target)
- *destination = data;
- destination++;
- }
- } while (CARD_CR2 & CARD_BUSY);
-}
-
-
-//---------------------------------------------------------------------------------
-void cardStartTransfer(const uint8 * command, uint32 * destination, int channel, uint32 flags) {
-//---------------------------------------------------------------------------------
- cardWriteCommand(command);
-
- // Set up a DMA channel to transfer a word every time the card makes one
- DMA_SRC(channel) = (uint32)&CARD_DATA_RD;
- DMA_DEST(channel) = (uint32)destination;
- DMA_CR(channel) = DMA_ENABLE | DMA_START_CARD | DMA_32_BIT | DMA_REPEAT | DMA_SRC_FIX | 0x0001;
-
- CARD_CR2 = flags;
-}
-
-
-//---------------------------------------------------------------------------------
-uint32 cardWriteAndRead(const uint8 * command, uint32 flags) {
-//---------------------------------------------------------------------------------
- cardWriteCommand(command);
- CARD_CR2 = flags | CARD_ACTIVATE | CARD_nRESET | 0x07000000;
- while (!(CARD_CR2 & CARD_DATA_READY)) ;
- return CARD_DATA_RD;
-}
-
-
-//---------------------------------------------------------------------------------
-void cardRead00(uint32 address, uint32 * destination, uint32 length, uint32 flags) {
-//---------------------------------------------------------------------------------f
- uint8 command[8];
- command[7] = 0;
- command[6] = (address >> 24) & 0xff;
- command[5] = (address >> 16) & 0xff;
- command[4] = (address >> 8) & 0xff;
- command[3] = address & 0xff;
- command[2] = 0;
- command[1] = 0;
- command[0] = 0;
- cardPolledTransfer(flags, destination, length, command);
-}
-
-
-//---------------------------------------------------------------------------------
-void cardReadHeader(uint8 * header) {
-//---------------------------------------------------------------------------------
- cardRead00(0, (uint32 *)header, 512, 0xA93F1FFF);
-}
-
-
-//---------------------------------------------------------------------------------
-int cardReadID(uint32 flags) {
-//---------------------------------------------------------------------------------
- uint8 command[8] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x90};
- return cardWriteAndRead(command, flags);
-}
-
-
-//---------------------------------------------------------------------------------
-static inline void EepromWaitBusy(void) {
-//---------------------------------------------------------------------------------
- while (CARD_CR1 & /*BUSY*/0x80);
-}
-
-//---------------------------------------------------------------------------------
-uint8 cardEepromReadID(uint8 i) {
-//---------------------------------------------------------------------------------
- return cardEepromCommand(/*READID*/0xAB, i&1);
-}
-
-//---------------------------------------------------------------------------------
-uint8 cardEepromCommand(uint8 command, uint32 address) {
-//---------------------------------------------------------------------------------
- uint8 retval;
- int k;
- CARD_CR1 = /*E*/0x8000 | /*SEL*/0x2000 | /*MODE*/0x40;
-
- CARD_CR1 = 0xFFFF;
- CARD_EEPDATA = command;
-
- EepromWaitBusy();
-
- CARD_EEPDATA = (address >> 16) & 0xFF;
- EepromWaitBusy();
-
- CARD_EEPDATA = (address >> 8) & 0xFF;
- EepromWaitBusy();
-
- CARD_EEPDATA = (address) & 0xFF;
- EepromWaitBusy();
-
- for(k=0;k<256;k++)
- {
- retval = CARD_EEPDATA;
- if(retval!=0xFF)
- break;
- EepromWaitBusy();
- }
-
- CARD_CR1 = /*MODE*/0x40;
- return retval;
-}
-
-//---------------------------------------------------------------------------------
-int cardEepromGetType(void)
-//---------------------------------------------------------------------------------
-{
- uint8 c00;
- uint8 c05;
- uint8 c9f;
- uint8 c03;
-
-#ifdef ARM9
- sysSetBusOwners(BUS_OWNER_ARM9, BUS_OWNER_ARM9);
-#endif
-
- (void) c03; /* avoid set but not used warning */
- c03=cardEepromCommand(0x03,0);
- c05=cardEepromCommand(0x05,0);
- c9f=cardEepromCommand(0x9f,0);
- c00=cardEepromCommand(0x00,0);
-
- if((c00==0x00) && (c9f==0x00)) return 0; // PassMe?
- if((c00==0xff) && (c05==0xff) && (c9f==0xff))return -1;
-
- if((c00==0xff) && (c05 & 0xFD) == 0xF0 && (c9f==0xff))return 1;
- if((c00==0xff) && (c05 & 0xFD) == 0x00 && (c9f==0xff))return 2;
- if((c00==0xff) && (c05 & 0xFD) == 0x00 && (c9f==0x00))return 3;
- if((c00==0xff) && (c05 & 0xFD) == 0x00 && (c9f==0x12))return 3; // NEW TYPE 3
- if((c00==0xff) && (c05 & 0xFD) == 0x00 && (c9f==0x13))return 3; // NEW TYPE 3+ 4Mbit
- if((c00==0xff) && (c05 & 0xFD) == 0x00 && (c9f==0x14))return 3; // NEW TYPE 3++ 8Mbit MK4-FLASH Memory
-
- return 0;
-}
-
-//---------------------------------------------------------------------------------
-uint32 cardEepromGetSize() {
-//---------------------------------------------------------------------------------
-
- int type = cardEepromGetType();
-
- if(type == -1)
- return 0;
- if(type == 0)
- return 8192;
- if(type == 1)
- return 512;
- if(type == 2) {
- static const uint32 offset0 = (8*1024-1); // 8KB
- static const uint32 offset1 = (2*8*1024-1); // 16KB
- u8 buf1; // +0k data read -> write
- u8 buf2; // +8k data read -> read
- u8 buf3; // +0k ~data write
- u8 buf4; // +8k data new comp buf2
- cardReadEeprom(offset0,&buf1,1,type);
- cardReadEeprom(offset1,&buf2,1,type);
- buf3=~buf1;
- cardWriteEeprom(offset0,&buf3,1,type);
- cardReadEeprom (offset1,&buf4,1,type);
- cardWriteEeprom(offset0,&buf1,1,type);
- if(buf4!=buf2) // +8k
- return 8*1024; // 8KB(64kbit)
- else
- return 64*1024; // 64KB(512kbit)
- }
- if(type == 3) {
- uint8 c9f;
- c9f=cardEepromCommand(0x9f,0);
-
- if(c9f==0x14)
- return 1024*1024; // NEW TYPE 3++ 8Mbit(1024KByte)
-
- if(c9f==0x13)
- return 512*1024; // NEW TYPE 3+ 4Mbit(512KByte)
-
- return 256*1024; // TYPE 3 2Mbit(256KByte)
- }
-
- return 0;
-}
-
-
-//---------------------------------------------------------------------------------
-void cardReadEeprom(uint32 address, uint8 *data, uint32 length, uint32 addrtype) {
-//---------------------------------------------------------------------------------
-
- CARD_CR1 = /*E*/0x8000 | /*SEL*/0x2000 | /*MODE*/0x40;
- CARD_EEPDATA = 0x03 | ((addrtype == 1) ? address>>8<<3 : 0);
- EepromWaitBusy();
-
- if (addrtype == 3) {
- CARD_EEPDATA = (address >> 16) & 0xFF;
- EepromWaitBusy();
- }
-
- if (addrtype >= 2) {
- CARD_EEPDATA = (address >> 8) & 0xFF;
- EepromWaitBusy();
- }
-
-
- CARD_EEPDATA = (address) & 0xFF;
- EepromWaitBusy();
-
- while (length > 0) {
- CARD_EEPDATA = 0;
- EepromWaitBusy();
- *data++ = CARD_EEPDATA;
- length--;
- }
-
- EepromWaitBusy();
- CARD_CR1 = /*MODE*/0x40;
-}
-
-
-//---------------------------------------------------------------------------------
-void cardWriteEeprom(uint32 address, uint8 *data, uint32 length, uint32 addrtype) {
-//---------------------------------------------------------------------------------
-
- uint32 address_end = address + length;
- int i;
- int maxblocks = 32;
- if(addrtype == 1) maxblocks = 16;
- if(addrtype == 2) maxblocks = 32;
- if(addrtype == 3) maxblocks = 256;
-
- while (address < address_end) {
- // set WEL (Write Enable Latch)
- CARD_CR1 = /*E*/0x8000 | /*SEL*/0x2000 | /*MODE*/0x40;
- CARD_EEPDATA = 0x06; EepromWaitBusy();
- CARD_CR1 = /*MODE*/0x40;
-
- // program maximum of 32 bytes
- CARD_CR1 = /*E*/0x8000 | /*SEL*/0x2000 | /*MODE*/0x40;
-
- if(addrtype == 1) {
- // WRITE COMMAND 0x02 + A8 << 3
- CARD_EEPDATA = 0x02 | (address & BIT(8)) >> (8-3) ;
- EepromWaitBusy();
- CARD_EEPDATA = address & 0xFF;
- EepromWaitBusy();
- }
- else if(addrtype == 2) {
- CARD_EEPDATA = 0x02;
- EepromWaitBusy();
- CARD_EEPDATA = address >> 8;
- EepromWaitBusy();
- CARD_EEPDATA = address & 0xFF;
- EepromWaitBusy();
- }
- else if(addrtype == 3) {
- CARD_EEPDATA = 0x02;
- EepromWaitBusy();
- CARD_EEPDATA = (address >> 16) & 0xFF;
- EepromWaitBusy();
- CARD_EEPDATA = (address >> 8) & 0xFF;
- EepromWaitBusy();
- CARD_EEPDATA = address & 0xFF;
- EepromWaitBusy();
- }
-
- for (i=0; address<address_end && i<maxblocks; i++, address++) {
- CARD_EEPDATA = *data++;
- EepromWaitBusy();
- }
- CARD_CR1 = /*MODE*/0x40;
-
- // wait programming to finish
- CARD_CR1 = /*E*/0x8000 | /*SEL*/0x2000 | /*MODE*/0x40;
- CARD_EEPDATA = 0x05; EepromWaitBusy();
- do { CARD_EEPDATA = 0; EepromWaitBusy(); } while (CARD_EEPDATA & 0x01); // WIP (Write In Progress) ?
- EepromWaitBusy();
- CARD_CR1 = /*MODE*/0x40;
- }
-}
-
-
-// Chip Erase : clear FLASH MEMORY (TYPE 3 ONLY)
-//---------------------------------------------------------------------------------
-void cardEepromChipErase(void) {
-//---------------------------------------------------------------------------------
- int sz;
- sz=cardEepromGetSize();
- cardEepromSectorErase(0x00000);
- cardEepromSectorErase(0x10000);
- cardEepromSectorErase(0x20000);
- cardEepromSectorErase(0x30000);
- if(sz==512*1024)
- {
- cardEepromSectorErase(0x40000);
- cardEepromSectorErase(0x50000);
- cardEepromSectorErase(0x60000);
- cardEepromSectorErase(0x70000);
- }
-}
-
-// COMMAND Sec.erase 0xD8
-void cardEepromSectorErase(uint32 address)
-{
- // set WEL (Write Enable Latch)
- CARD_CR1 = /*E*/0x8000 | /*SEL*/0x2000 | /*MODE*/0x40;
- CARD_EEPDATA = 0x06;
- EepromWaitBusy();
-
- CARD_CR1 = /*MODE*/0x40;
-
- // SectorErase 0xD8
- CARD_CR1 = /*E*/0x8000 | /*SEL*/0x2000 | /*MODE*/0x40;
- CARD_EEPDATA = 0xD8;
- EepromWaitBusy();
- CARD_EEPDATA = (address >> 16) & 0xFF;
- EepromWaitBusy();
- CARD_EEPDATA = (address >> 8) & 0xFF;
- EepromWaitBusy();
- CARD_EEPDATA = address & 0xFF;
- EepromWaitBusy();
-
- CARD_CR1 = /*MODE*/0x40;
-
- // wait erase to finish
- CARD_CR1 = /*E*/0x8000 | /*SEL*/0x2000 | /*MODE*/0x40;
- CARD_EEPDATA = 0x05;
- EepromWaitBusy();
-
- do
- {
- CARD_EEPDATA = 0;
- EepromWaitBusy();
- } while (CARD_EEPDATA & 0x01); // WIP (Write In Progress) ?
- CARD_CR1 = /*MODE*/0x40;
-}
-
-
diff --git a/c/src/lib/libbsp/arm/nds/libnds/source/common/gbfs.c b/c/src/lib/libbsp/arm/nds/libnds/source/common/gbfs.c
deleted file mode 100644
index 7f174e4c84..0000000000
--- a/c/src/lib/libbsp/arm/nds/libnds/source/common/gbfs.c
+++ /dev/null
@@ -1,202 +0,0 @@
-/*---------------------------------------------------------------------------------
- access object in a GBFS file
-
- Copyright 2002-2005 Damian Yerrick
-
- Additional code Dave Murphy
-
- Permission is hereby granted, free of charge, to any person obtaining
- a copy of this software and associated documentation files (the
- "Software"), to deal in the Software without restriction, including
- without limitation the rights to use, copy, modify, merge, publish,
- distribute, sublicense, and/or sell copies of the Software, and to
- permit persons to whom the Software is furnished to do so, subject to
- the following conditions:
-
- The above copyright notice and this permission notice shall be
- included in all copies or substantial portions of the Software.
-
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
- BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
- AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
- OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
- IN THE SOFTWARE.
-
----------------------------------------------------------------------------------*/
-
-
-/*---------------------------------------------------------------------------------
- This code assumes a LITTLE ENDIAN target. It'll need a boatload
- of itohs and itohl calls if converted to run on Sega Genesis. It
- also assumes that the target uses 16-bit short and 32-bit longs.
----------------------------------------------------------------------------------*/
-
-#include <stdlib.h>
-#include <string.h>
-#include <nds/jtypes.h>
-#include "gbfs.h"
-
-/*---------------------------------------------------------------------------------
- change this to the end of your ROM,
- or to 0x02040000 for gba multiboot
- or to 0x24000000 for nds main ram
----------------------------------------------------------------------------------*/
-
-static const u32 * GBFS_1ST_SEARCH_LIMIT = (const u32 *)0x02400000;
-static const u32 * GBFS_2ND_SEARCH_START = (const u32 *)0x08000000;
-static const u32 * GBFS_2ND_SEARCH_LIMIT = (const u32 *)0x0a000000;
-/*---------------------------------------------------------------------------------
- a power of two, less than or equal to the argument passed to
- padbin. Increasing the stride makes find_first_gbfs_file()
- faster at the cost of a slightly larger binary.
----------------------------------------------------------------------------------*/
-static int GBFS_STRIDE = 256;
-
-/*---------------------------------------------------------------------------------
- Set the search limits and stride for searching
----------------------------------------------------------------------------------*/
-void gbfs_search_range(
- u32 gbfs_1st_limit,
- u32 gbfs_2nd_start, u32 gbfs_2nd_limit,
- u32 gbfs_stride
-) {
-//---------------------------------------------------------------------------------
- if ( 0 != gbfs_1st_limit ) GBFS_1ST_SEARCH_LIMIT = (u32 *)gbfs_1st_limit;
- if ( 0 != gbfs_2nd_limit ) GBFS_2ND_SEARCH_LIMIT = (u32 *)gbfs_2nd_limit;
- if ( 0 != gbfs_2nd_start ) GBFS_2ND_SEARCH_START = (u32 *)gbfs_2nd_start;
- if ( 0 != gbfs_stride ) GBFS_STRIDE = gbfs_stride;
-
-}
-
-//---------------------------------------------------------------------------------
-const GBFS_FILE * find_first_gbfs_file(const void *start) {
-//---------------------------------------------------------------------------------
- /* align the pointer */
- const u32 *here = (const u32 *)
- ((unsigned long)start & (-GBFS_STRIDE));
- const char rest_of_magic[] = "ightGBFS\r\n\x1a\n";
-
- /* Linear-search first in multiboot space. */
- while(here < GBFS_1ST_SEARCH_LIMIT)
- {
- /* We have to keep the magic code in two pieces; otherwise,
- this function may find itself and think it's a GBFS file.
- This obviously won't work if your compiler stores this
- numeric literal just before the literal string, but Devkit
- Advance R4 and R5 seem to keep numeric constant pools
- separate enough from string pools for this to work.
- */
- if(*here == 0x456e6950) { /* ASCII code for little endian "PinE" */
- /* We've matched the first four bytes.
- If the rest of the magic matches, then we've found a file. */
- if(!memcmp(here + 1, rest_of_magic, 12))
- return (const GBFS_FILE *)here;
- }
- here += GBFS_STRIDE / sizeof(here);
- }
-
- /* Now search in ROM space. */
- if(here < GBFS_2ND_SEARCH_START)
- here = GBFS_2ND_SEARCH_START;
- while(here < GBFS_2ND_SEARCH_LIMIT) {
- /* Search loop same as above. */
- if(*here == 0x456e6950) { /* ASCII code for little endian "PinE" */
- if(!memcmp(here + 1, rest_of_magic, 12))
- return (const GBFS_FILE *)here;
- }
- here += GBFS_STRIDE / sizeof(*here);
- }
- return 0;
-}
-
-
-//---------------------------------------------------------------------------------
-const void *skip_gbfs_file(const GBFS_FILE *file) {
-//---------------------------------------------------------------------------------
- return ((char *)file + file->total_len);
-}
-
-
-//---------------------------------------------------------------------------------
-static int namecmp(const void *a, const void *b) {
-//---------------------------------------------------------------------------------
- return memcmp(a, b, 24);
-}
-
-
-//---------------------------------------------------------------------------------
-const void *gbfs_get_obj( const GBFS_FILE *file,
- const char *name,
- u32 *len) {
-//---------------------------------------------------------------------------------
- char key[24] = {0};
-
- const GBFS_ENTRY *dirbase = (const GBFS_ENTRY *)((const char *)file + file->dir_off);
- size_t n_entries = file->dir_nmemb;
- const GBFS_ENTRY *here;
-
- strncpy(key, name, 24);
-
- here = bsearch( key, dirbase,
- n_entries, sizeof(GBFS_ENTRY),
- namecmp);
- if(!here)
- return NULL;
-
- if(len)
- *len = here->len;
- return (char *)file + here->data_offset;
-}
-
-
-//---------------------------------------------------------------------------------
-const void *gbfs_get_nth_obj( const GBFS_FILE *file,
- size_t n,
- char *name,
- u32 *len)
-//---------------------------------------------------------------------------------
-{
- const GBFS_ENTRY *dirbase = (const GBFS_ENTRY *)((const char *)file + file->dir_off);
- size_t n_entries = file->dir_nmemb;
- const GBFS_ENTRY *here = dirbase + n;
-
- if(n >= n_entries)
- return NULL;
-
- if(name) {
- strncpy(name, here->name, 24);
- name[24] = 0;
- }
-
- if(len)
- *len = here->len;
-
- return (char *)file + here->data_offset;
-}
-
-
-//---------------------------------------------------------------------------------
-void *gbfs_copy_obj( void *dst,
- const GBFS_FILE *file,
- const char *name) {
-//---------------------------------------------------------------------------------
- u32 len;
- const void *src = gbfs_get_obj(file, name, &len);
-
- if(!src)
- return NULL;
-
- memcpy(dst, src, len);
- return dst;
-}
-
-
-//---------------------------------------------------------------------------------
-size_t gbfs_count_objs(const GBFS_FILE *file) {
-//---------------------------------------------------------------------------------
- return file ? file->dir_nmemb : 0;
-}
-
diff --git a/c/src/lib/libbsp/arm/nds/libnds/source/common/interruptDispatcher.S b/c/src/lib/libbsp/arm/nds/libnds/source/common/interruptDispatcher.S
deleted file mode 100644
index 927fa74e65..0000000000
--- a/c/src/lib/libbsp/arm/nds/libnds/source/common/interruptDispatcher.S
+++ /dev/null
@@ -1,117 +0,0 @@
-/*---------------------------------------------------------------------------------
- Copyright (C) 2005
- 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.
-
----------------------------------------------------------------------------------*/
-
-#ifdef ARM7
- .text
-#endif
-
-#ifdef ARM9
- .section .bsp_fast_text,"ax",%progbits
-#endif
-
- .extern irqTable
- .code 32
-
- .global IntrMain
-@---------------------------------------------------------------------------------
-IntrMain:
-@---------------------------------------------------------------------------------
- mov r3, #0x4000000 @ REG_BASE
-
- ldr r1, [r3, #0x208] @ r1 = IME
- str r3, [r3, #0x208] @ disable IME
- mrs r0, spsr
- stmfd sp!, {r0-r1,r3,lr} @ {spsr, IME, REG_BASE, lr_irq}
-
- ldr r1, [r3,#0x210] @ REG_IE
- ldr r2, [r3,#0x214] @ REG_IF
- and r1,r1,r2
-
- ldr r0,=__irq_flags @ defined by linker script
-
- ldr r2,[r0]
- orr r2,r2,r1
- str r2,[r0]
-
- ldr r2,=irqTable
-@---------------------------------------------------------------------------------
-findIRQ:
-@---------------------------------------------------------------------------------
- ldr r0, [r2, #4]
- cmp r0,#0
- beq no_handler
- ands r0, r0, r1
- bne jump_intr
- add r2, r2, #8
- b findIRQ
-
-@---------------------------------------------------------------------------------
-no_handler:
-@---------------------------------------------------------------------------------
- str r1, [r3, #0x0214] @ IF Clear
- ldmfd sp!, {r0-r1,r3,lr} @ {spsr, IME, REG_BASE, lr_irq}
- str r1, [r3, #0x208] @ restore REG_IME
- mov pc,lr
-
-@---------------------------------------------------------------------------------
-jump_intr:
-@---------------------------------------------------------------------------------
- ldr r1, [r2] @ user IRQ handler address
- cmp r1, #0
- bne got_handler
- mov r1, r0
- b no_handler
-@---------------------------------------------------------------------------------
-got_handler:
-@---------------------------------------------------------------------------------
-
- mrs r2, cpsr
- bic r2, r2, #0xdf @ \__
- orr r2, r2, #0x1f @ / --> Enable IRQ & FIQ. Set CPU mode to System.
- msr cpsr,r2
-
- str r0, [r3, #0x0214] @ IF Clear
-
- push {lr}
- adr lr, IntrRet
- bx r1
-
-@---------------------------------------------------------------------------------
-IntrRet:
-@---------------------------------------------------------------------------------
- mov r3, #0x4000000 @ REG_BASE
- str r3, [r3, #0x208] @ disable IME
- pop {lr}
-
- mrs r3, cpsr
- bic r3, r3, #0xdf @ \__
- orr r3, r3, #0x92 @ / --> Disable IRQ. Enable FIQ. Set CPU mode to IRQ.
- msr cpsr, r3
-
- ldmfd sp!, {r0-r1,r3,lr} @ {spsr, IME, REG_BASE, lr_irq}
- msr spsr, r0 @ restore spsr
- str r1, [r3, #0x208] @ restore REG_IME
- mov pc,lr
-
- .pool
- .end
diff --git a/c/src/lib/libbsp/arm/nds/libnds/source/common/interrupts.c b/c/src/lib/libbsp/arm/nds/libnds/source/common/interrupts.c
deleted file mode 100644
index 7e42ebf942..0000000000
--- a/c/src/lib/libbsp/arm/nds/libnds/source/common/interrupts.c
+++ /dev/null
@@ -1,145 +0,0 @@
-/*---------------------------------------------------------------------------------
- Copyright (C) 2005
- 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/interrupts.h>
-#include <nds/system.h>
-
-void IntrMain(void); // Prototype for assembly interrupt dispatcher
-
-static void irqDummy(void) {}
-
-
-#ifdef ARM9
-#define INT_TABLE_SECTION __attribute__((section(".bsp_fast_text")))
-#else
-#define INT_TABLE_SECTION
-#endif
-
-struct IntTable irqTable[MAX_INTERRUPTS] INT_TABLE_SECTION;
-
-//---------------------------------------------------------------------------------
-void irqSet(int mask, IntFn handler) {
-//---------------------------------------------------------------------------------
- if (!mask) return;
-
- int i;
-
- for (i=0;i<MAX_INTERRUPTS;i++)
- if (!irqTable[i].mask || irqTable[i].mask == mask) break;
-
- if ( i == MAX_INTERRUPTS ) return;
-
- irqTable[i].handler = handler;
- irqTable[i].mask = mask;
-
- if(mask & IRQ_VBLANK)
- REG_DISPSTAT |= DISP_VBLANK_IRQ ;
- if(mask & IRQ_HBLANK)
- REG_DISPSTAT |= DISP_HBLANK_IRQ ;
-
- REG_IE |= mask;
-}
-
-//---------------------------------------------------------------------------------
-void irqInit() {
-//---------------------------------------------------------------------------------
- int i;
-
- // Set all interrupts to dummy functions.
- for(i = 0; i < MAX_INTERRUPTS; i ++)
- {
- irqTable[i].handler = irqDummy;
- irqTable[i].mask = 0;
- }
-
- IRQ_HANDLER = IntrMain;
-
- REG_IE = 0; // disable all interrupts
- REG_IF = IRQ_ALL; // clear all pending interrupts
- REG_IME = 1; // enable global interrupt
-
-}
-
-
-//---------------------------------------------------------------------------------
-void irqClear(int mask) {
-//---------------------------------------------------------------------------------
- int i = 0;
-
- for (i=0;i<MAX_INTERRUPTS;i++)
- if (irqTable[i].mask == mask) break;
-
- if ( i == MAX_INTERRUPTS ) return;
-
- irqTable[i].handler = irqDummy;
-
- if (mask & IRQ_VBLANK)
- REG_DISPSTAT &= ~DISP_VBLANK_IRQ ;
- if (mask & IRQ_HBLANK)
- REG_DISPSTAT &= ~DISP_HBLANK_IRQ ;
- if (mask & IRQ_VCOUNT)
- REG_DISPSTAT &= ~DISP_YTRIGGER_IRQ;
-
- REG_IE &= ~mask;
-}
-
-
-//---------------------------------------------------------------------------------
-void irqInitHandler(IntFn handler) {
-//---------------------------------------------------------------------------------
- REG_IME = 0;
- REG_IF = ~0;
- REG_IE = 0;
-
- IRQ_HANDLER = handler;
-
- REG_IME = 1;
-}
-
-//---------------------------------------------------------------------------------
-void irqEnable(uint32 irq) {
-//---------------------------------------------------------------------------------
- if (irq & IRQ_VBLANK)
- REG_DISPSTAT |= DISP_VBLANK_IRQ ;
- if (irq & IRQ_HBLANK)
- REG_DISPSTAT |= DISP_HBLANK_IRQ ;
- if (irq & IRQ_VCOUNT)
- REG_DISPSTAT |= DISP_YTRIGGER_IRQ;
-
- REG_IE |= irq;
- REG_IME = 1;
-}
-
-//---------------------------------------------------------------------------------
-void irqDisable(uint32 irq) {
-//---------------------------------------------------------------------------------
- if (irq & IRQ_VBLANK)
- REG_DISPSTAT &= ~DISP_VBLANK_IRQ ;
- if (irq & IRQ_HBLANK)
- REG_DISPSTAT &= ~DISP_HBLANK_IRQ ;
- if (irq & IRQ_VCOUNT)
- REG_DISPSTAT &= ~DISP_YTRIGGER_IRQ;
-
- REG_IE &= ~irq;
-}
-