summaryrefslogtreecommitdiff
path: root/arm7/source
diff options
context:
space:
mode:
authorIan C <ianc@noddybox.co.uk>2007-01-12 00:40:03 +0000
committerIan C <ianc@noddybox.co.uk>2007-01-12 00:40:03 +0000
commitef641589bf763ea12e73abf4bf42e45ac1acd2ff (patch)
tree0afa591a9c5294a07508f6c5c56a0857adfd2285 /arm7/source
parent50d960d99f0783799f81236d9225a6940606fe38 (diff)
Gone back to a simpler ARM9 only build as the new dynamic libfat library means I can use that, and dswifi wouldn't work with my AP.
Diffstat (limited to 'arm7/source')
-rw-r--r--arm7/source/main.c179
1 files changed, 0 insertions, 179 deletions
diff --git a/arm7/source/main.c b/arm7/source/main.c
deleted file mode 100644
index 6579ad2..0000000
--- a/arm7/source/main.c
+++ /dev/null
@@ -1,179 +0,0 @@
-/*
- ds81 - Nintendo DS ZX81 emulator.
-
- Copyright (C) 2006 Ian Cowburn <ianc@noddybox.co.uk>
-
- This program is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License
- as published by the Free Software Foundation; either version 2
- of the License, or (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
- $Id$
-
- This file is largely based on the libnds examples.
-*/
-
-#include <nds.h>
-
-#include <nds/bios.h>
-#include <nds/arm7/touch.h>
-#include <nds/arm7/clock.h>
-
-#include <dswifi7.h>
-
-#include "ds81_ipc.h"
-
-static void FIFO_Handler(u32 msg);
-
-static void VblankHandler(void)
-{
- static int heartbeat = 0;
-
- uint16 but=0, x=0, y=0, xpx=0, ypx=0, z1=0, z2=0, batt=0, aux=0;
- int t1=0, t2=0;
- uint32 temp=0;
- uint8 ct[sizeof(IPC->curtime)];
- u32 i;
-
- /* Update the heartbeat */
- heartbeat++;
-
- /* Read the touch screen */
- but = REG_KEYXY;
-
- if (!(but & (1<<6)))
- {
- touchPosition tempPos = touchReadXY();
-
- x = tempPos.x;
- y = tempPos.y;
- xpx = tempPos.px;
- ypx = tempPos.py;
- }
-
- z1 = touchRead(TSC_MEASURE_Z1);
- z2 = touchRead(TSC_MEASURE_Z2);
-
- batt = touchRead(TSC_MEASURE_BATTERY);
- aux = touchRead(TSC_MEASURE_AUX);
-
- /* Read the time */
- rtcGetTime((uint8 *)ct);
- BCDToInteger((uint8 *)&(ct[1]), 7);
-
- /* Read the temperature */
- temp = touchReadTemperature(&t1, &t2);
-
- /* Update the IPC struct */
- IPC->mailBusy = 1;
-
- IPC->heartbeat = heartbeat;
- IPC->buttons = but;
- IPC->touchX = x;
- IPC->touchY = y;
- IPC->touchXpx = xpx;
- IPC->touchYpx = ypx;
- IPC->touchZ1 = z1;
- IPC->touchZ2 = z2;
- IPC->battery = batt;
- IPC->aux = aux;
-
- for(i=0; i<sizeof(ct); i++)
- {
- IPC->curtime[i] = ct[i];
- }
-
- IPC->temperature = temp;
- IPC->tdiode1 = t1;
- IPC->tdiode2 = t2;
-
- IPC->mailBusy = 0;
-
- Wifi_Update();
-}
-
-/* callback to allow wifi library to notify arm9
-*/
-static void ARM7_SyncToARM9(void)
-{
- REG_IPC_FIFO_TX = DS81_WIFI_SYNC_IPC;
-}
-
-/* interrupt handler to allow incoming notifications from arm9
-*/
-static void ARM7_Fifo(void)
-{
- while(!(REG_IPC_FIFO_CR & IPC_FIFO_RECV_EMPTY))
- {
- u32 msg;
-
- msg = REG_IPC_FIFO_RX;
- FIFO_Handler(msg);
- }
-}
-
-/* Handler for FIFO messages
-*/
-static void FIFO_Handler(u32 msg)
-{
- static int next_is_wifi=0;
-
- if (next_is_wifi)
- {
- next_is_wifi = 0;
- Wifi_Init(msg);
- Wifi_SetSyncHandler(ARM7_SyncToARM9);
-
- irqSet(IRQ_WIFI, Wifi_Interrupt);
- irqEnable(IRQ_WIFI);
- }
- else
- {
- switch(msg)
- {
- case DS81_WIFI_INIT_IPC:
- next_is_wifi = 1;
- break;
-
- case DS81_WIFI_SYNC_IPC:
- Wifi_Sync();
- break;
- }
- }
-}
-
-int main(int argc, char ** argv)
-{
- /* enable & prepare fifo asap */
- REG_IPC_FIFO_CR = IPC_FIFO_ENABLE | IPC_FIFO_SEND_CLEAR;
-
- IPC->mailBusy = 1;
-
- /* Reset the clock if needed */
- rtcReset();
-
- irqInit();
- irqSet(IRQ_VBLANK, VblankHandler);
- irqEnable(IRQ_VBLANK);
-
- irqSet(IRQ_FIFO_NOT_EMPTY,ARM7_Fifo); /* set up fifo irq */
- irqEnable(IRQ_FIFO_NOT_EMPTY);
-
- REG_IPC_FIFO_CR = IPC_FIFO_ENABLE | IPC_FIFO_RECV_IRQ;
-
- while (1)
- {
- swiWaitForVBlank();
- }
-}
-
-