Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*---------------------------------------------------------------------*
- Copyright (C) 1998 Nintendo. (Originated by SGI)
- $RCSfile: main.c,v $
- $Revision: 1.15 $
- $Date: 1999/01/19 03:25:20 $
- *---------------------------------------------------------------------*/
- #include <ultra64.h>
- #include <PR/leo.h>
- #include "thread.h"
- #include "textlib.h"
- #include "ncode.h"
- #define NUM_MESSAGE 1
- #define NUM_OF_FILE 16
- #define CONT_VALID 1
- #define CONT_INVALID 0
- #define WAIT_CNT 5
- #define LABEL1 "Nintendo64 CONTROLLER PAK "
- extern OSMesgQueue retraceMessageQ;
- extern u16 *bitmap_buf;
- extern u16 bitmap_buf1[];
- extern u16 bitmap_buf2[];
- extern u8 backup_buffer[];
- OSMesgQueue pifMesgQueue;
- OSMesg dummyMessage;
- OSMesg pifMesgBuf[NUM_MESSAGE];
- static OSContStatus contstat[MAXCONTROLLERS];
- static OSContPad contdata[MAXCONTROLLERS];
- static int controller[MAXCONTROLLERS];
- OSPfs pfs0;
- //64DD
- #define DISK_MSG_NUM 1
- #define NUM_LEO_MESGS 8
- static OSMesg LeoMessages[NUM_LEO_MESGS];
- OSMesgQueue diskMsgQ;
- OSMesg diskMsgBuf[DISK_MSG_NUM];
- LEODiskID _diskID ,_savedID;
- static LEODiskTime _rtc;
- static LEOCmd _cmdBlk;
- void
- mainproc(void *arg)
- {
- int i, j;
- int cont_no = 0;
- s32 no;
- u16 number;
- u32 total_size;
- int error;
- char *s;
- u32 data_no = 0;
- int cursor = 0;
- u32 ret;
- u8 bitpattern;
- u16 button = 0, oldbutton = 0, newbutton = 0;
- u8 label[BLOCKSIZE];
- u8 extbuf[__Z - __A];
- int waitcnt = WAIT_CNT;
- int len = BLOCKSIZE;
- osCreateMesgQueue(&pifMesgQueue, pifMesgBuf, NUM_MESSAGE);
- osSetEventMesg(OS_EVENT_SI, &pifMesgQueue, dummyMessage);
- osContInit(&pifMesgQueue, &bitpattern, &contstat[0]);
- for (i = 0; i < MAXCONTROLLERS; i++) {
- if ((bitpattern & (1<<i)) &&
- ((contstat[i].type & CONT_TYPE_MASK) == CONT_TYPE_NORMAL)) {
- controller[i] = CONT_VALID;
- } else {
- controller[i] = CONT_INVALID;
- }
- }
- osCreateMesgQueue(&diskMsgQ, diskMsgBuf, DISK_MSG_NUM);
- init_draw();
- setcolor(0,255,0);
- draw_puts("RTC Test\n64DD !!!\n");
- LeoCJCreateLeoManager((OSPri)OS_PRIORITY_LEOMGR-1, (OSPri)OS_PRIORITY_LEOMGR, LeoMessages, NUM_LEO_MESGS);
- draw_puts("YESSS !!!\n");
- while(1) {
- osContStartReadData(&pifMesgQueue);
- osRecvMesg(&pifMesgQueue, NULL, OS_MESG_BLOCK);
- osContGetReadData(&contdata[0]);
- if (contdata[cont_no].errno & CONT_NO_RESPONSE_ERROR) {
- button = oldbutton;
- } else {
- oldbutton = button;
- button = contdata[cont_no].button;
- }
- newbutton = ~oldbutton & button;
- clear_draw();
- setcolor(0,255,0);
- draw_puts("RTC Test\n");
- setcolor(255,255,255);
- LeoReadRTC(&_cmdBlk, &diskMsgQ);
- osRecvMesg(&diskMsgQ, (OSMesg *)&error, OS_MESG_BLOCK);
- switch (error)
- {
- case LEO_ERROR_GOOD:
- bcopy( &_cmdBlk.data.time, &_rtc, sizeof(LEODiskTime));
- draw_char(_rtc.month);
- draw_puts("/");
- draw_char(_rtc.day);
- draw_puts("/");
- draw_char(_rtc.yearlo);
- draw_puts(" - ");
- draw_char(_rtc.hour);
- draw_puts(":");
- draw_char(_rtc.minute);
- draw_puts(":");
- draw_char(_rtc.second);
- draw_puts("\n");
- break;
- case LEO_ERROR_REAL_TIME_CLOCK_FAILURE:
- draw_puts("ERROR\n");
- break;
- }
- draw_puts(CR25);
- /*
- draw_puts("\n\n TEST!");
- draw_puts(CR25);
- */
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement