addd bugs, clean code
This commit is contained in:
parent
4ea1912318
commit
1100333487
22
bugs/issue-032fab33a68ffbeb19f1e9fa4856101996759255.yaml
Normal file
22
bugs/issue-032fab33a68ffbeb19f1e9fa4856101996759255.yaml
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
--- !ditz.rubyforge.org,2008-03-06/issue
|
||||||
|
title: relocate code
|
||||||
|
desc: |-
|
||||||
|
move main code to upper page like 0xe4 and use 0x4f as shared mem window
|
||||||
|
or even combine this
|
||||||
|
code seems to reloacte and start, but ram doesn't seem accessable. broked
|
||||||
|
sprintfs
|
||||||
|
type: :bugfix
|
||||||
|
component: fatfs
|
||||||
|
release:
|
||||||
|
reporter: David <david@optixx.org>
|
||||||
|
status: :unstarted
|
||||||
|
disposition:
|
||||||
|
creation_time: 2009-06-10 14:22:10.400739 Z
|
||||||
|
references: []
|
||||||
|
|
||||||
|
id: 032fab33a68ffbeb19f1e9fa4856101996759255
|
||||||
|
log_events:
|
||||||
|
- - 2009-06-10 14:22:11.288638 Z
|
||||||
|
- David <david@optixx.org>
|
||||||
|
- created
|
||||||
|
- ""
|
||||||
21
bugs/issue-6498cae9de5e51829e5dbb6b8fcaa20c7a647aa6.yaml
Normal file
21
bugs/issue-6498cae9de5e51829e5dbb6b8fcaa20c7a647aa6.yaml
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
--- !ditz.rubyforge.org,2008-03-06/issue
|
||||||
|
title: "debug ram mapping "
|
||||||
|
desc: |-
|
||||||
|
global vars seem to be borked or miss used. seems all kind of buffers are overlapping
|
||||||
|
just reordering global var order renders the code unusable.
|
||||||
|
also the strange sprintf buffer conflicts seem to related to this issue
|
||||||
|
type: :bugfix
|
||||||
|
component: fatfs
|
||||||
|
release:
|
||||||
|
reporter: David <david@optixx.org>
|
||||||
|
status: :unstarted
|
||||||
|
disposition:
|
||||||
|
creation_time: 2009-06-10 14:23:44.121219 Z
|
||||||
|
references: []
|
||||||
|
|
||||||
|
id: 6498cae9de5e51829e5dbb6b8fcaa20c7a647aa6
|
||||||
|
log_events:
|
||||||
|
- - 2009-06-10 14:23:45.632999 Z
|
||||||
|
- David <david@optixx.org>
|
||||||
|
- created
|
||||||
|
- ""
|
||||||
20
bugs/issue-99ae09d1da472e76501325424bc586f78980199e.yaml
Normal file
20
bugs/issue-99ae09d1da472e76501325424bc586f78980199e.yaml
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
--- !ditz.rubyforge.org,2008-03-06/issue
|
||||||
|
title: debug sta return val
|
||||||
|
desc: |-
|
||||||
|
debug the sta value in diskio.c
|
||||||
|
never seems to take the correct value, looks like global,local scope problem
|
||||||
|
type: :bugfix
|
||||||
|
component: fatfs
|
||||||
|
release:
|
||||||
|
reporter: David <david@optixx.org>
|
||||||
|
status: :unstarted
|
||||||
|
disposition:
|
||||||
|
creation_time: 2009-06-10 14:20:20.608109 Z
|
||||||
|
references: []
|
||||||
|
|
||||||
|
id: 99ae09d1da472e76501325424bc586f78980199e
|
||||||
|
log_events:
|
||||||
|
- - 2009-06-10 14:20:24.343929 Z
|
||||||
|
- David <david@optixx.org>
|
||||||
|
- created
|
||||||
|
- ""
|
||||||
@ -3,43 +3,52 @@
|
|||||||
byte tileMapLocation[4];
|
byte tileMapLocation[4];
|
||||||
word characterLocation[4];
|
word characterLocation[4];
|
||||||
|
|
||||||
void waitForVBlank(void) {
|
void waitForVBlank(void)
|
||||||
|
{
|
||||||
byte Status;
|
byte Status;
|
||||||
do {
|
do {
|
||||||
Status = *(byte *) 0x4210;
|
Status = *(byte *) 0x4210;
|
||||||
} while (!(Status & 0x80));
|
} while (!(Status & 0x80));
|
||||||
}
|
}
|
||||||
|
|
||||||
void setTileMapLocation(word vramDst, byte screenProp, byte bgNumber) {
|
void setTileMapLocation(word vramDst, byte screenProp, byte bgNumber)
|
||||||
|
{
|
||||||
tileMapLocation[bgNumber] = ((vramDst >> 8) & 0xfc) | (screenProp & 0x03);
|
tileMapLocation[bgNumber] = ((vramDst >> 8) & 0xfc) | (screenProp & 0x03);
|
||||||
*(byte *) (0x2107 + bgNumber) = tileMapLocation[bgNumber];
|
*(byte *) (0x2107 + bgNumber) = tileMapLocation[bgNumber];
|
||||||
}
|
}
|
||||||
|
|
||||||
void restoreTileMapLocation(byte bgNumber) {
|
void restoreTileMapLocation(byte bgNumber)
|
||||||
|
{
|
||||||
*(byte *) (0x2107 + bgNumber) = tileMapLocation[bgNumber];
|
*(byte *) (0x2107 + bgNumber) = tileMapLocation[bgNumber];
|
||||||
}
|
}
|
||||||
|
|
||||||
void setCharacterLocation(word vramDst, byte bgNumber) {
|
void setCharacterLocation(word vramDst, byte bgNumber)
|
||||||
|
{
|
||||||
characterLocation[bgNumber] = vramDst;
|
characterLocation[bgNumber] = vramDst;
|
||||||
if (bgNumber < 2) {
|
if (bgNumber < 2) {
|
||||||
*(byte*) 0x210b = (characterLocation[1] >> 8 & 0xf0 ) + (characterLocation[0] >> 12);
|
*(byte *) 0x210b =
|
||||||
|
(characterLocation[1] >> 8 & 0xf0) + (characterLocation[0] >> 12);
|
||||||
} else {
|
} else {
|
||||||
*(byte*) 0x210c = (characterLocation[3] >> 8 & 0xf0 ) + (characterLocation[2] >> 12);
|
*(byte *) 0x210c =
|
||||||
|
(characterLocation[3] >> 8 & 0xf0) + (characterLocation[2] >> 12);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void restoreCharacterLocation(byte bgNumber) {
|
void restoreCharacterLocation(byte bgNumber)
|
||||||
|
{
|
||||||
setCharacterLocation(characterLocation[bgNumber], bgNumber);
|
setCharacterLocation(characterLocation[bgNumber], bgNumber);
|
||||||
}
|
}
|
||||||
|
|
||||||
void VRAMByteWrite(byte value, word vramDst) {
|
void VRAMByteWrite(byte value, word vramDst)
|
||||||
|
{
|
||||||
*(byte *) 0x2115 = 0x80;
|
*(byte *) 0x2115 = 0x80;
|
||||||
*(word *) 0x2116 = vramDst;
|
*(word *) 0x2116 = vramDst;
|
||||||
|
|
||||||
*(byte *) 0x2118 = value;
|
*(byte *) 0x2118 = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
void VRAMLoad(word src, word vramDst, word size) {
|
void VRAMLoad(word src, word vramDst, word size)
|
||||||
|
{
|
||||||
// set address in VRam for read or write ($2116) + block size transfer ($2115)
|
// set address in VRam for read or write ($2116) + block size transfer ($2115)
|
||||||
*(byte *) 0x2115 = 0x80;
|
*(byte *) 0x2115 = 0x80;
|
||||||
*(word *) 0x2116 = vramDst;
|
*(word *) 0x2116 = vramDst;
|
||||||
@ -59,7 +68,8 @@ void VRAMLoad(word src, word vramDst, word size) {
|
|||||||
*(byte *) 0x2100 = 0x00;
|
*(byte *) 0x2100 = 0x00;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CGRAMLoad(word src, byte cgramDst, word size) {
|
void CGRAMLoad(word src, byte cgramDst, word size)
|
||||||
|
{
|
||||||
|
|
||||||
// set address in VRam for read or write + block size
|
// set address in VRam for read or write + block size
|
||||||
*(byte *) 0x2121 = cgramDst;
|
*(byte *) 0x2121 = cgramDst;
|
||||||
|
|||||||
@ -17,7 +17,8 @@ static char debug_buffer[512];
|
|||||||
static char screen_buffer[512];
|
static char screen_buffer[512];
|
||||||
|
|
||||||
|
|
||||||
void debug_init(void) {
|
void debug_init(void)
|
||||||
|
{
|
||||||
word i;
|
word i;
|
||||||
for (i = 0; i < 0x400; i++) {
|
for (i = 0; i < 0x400; i++) {
|
||||||
debugMap[i] = 0x00;
|
debugMap[i] = 0x00;
|
||||||
@ -26,7 +27,8 @@ void debug_init(void) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void debug_enable(void){
|
void debug_enable(void)
|
||||||
|
{
|
||||||
VRAMLoad((word) debugFont_pic, 0x5000, 2048);
|
VRAMLoad((word) debugFont_pic, 0x5000, 2048);
|
||||||
VRAMLoad((word) debugMap, 0x4000, 0x0800);
|
VRAMLoad((word) debugMap, 0x4000, 0x0800);
|
||||||
setTileMapLocation(0x4000, (byte) 0x00, (byte) 0);
|
setTileMapLocation(0x4000, (byte) 0x00, (byte) 0);
|
||||||
@ -52,7 +54,8 @@ void debug_enable(void){
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void clears(void) {
|
void clears(void)
|
||||||
|
{
|
||||||
word i, y;
|
word i, y;
|
||||||
for (y = 0; y < 20; y++) {
|
for (y = 0; y < 20; y++) {
|
||||||
waitForVBlank();
|
waitForVBlank();
|
||||||
@ -64,12 +67,14 @@ void clears(void) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void _print_char(word y,word x, char c){
|
void _print_char(word y, word x, char c)
|
||||||
|
{
|
||||||
waitForVBlank();
|
waitForVBlank();
|
||||||
VRAMByteWrite((byte) (c - 32), (word) (0x4000 + x + (y * 0x20)));
|
VRAMByteWrite((byte) (c - 32), (word) (0x4000 + x + (y * 0x20)));
|
||||||
}
|
}
|
||||||
|
|
||||||
void _print_screen(word y, char *buffer){
|
void _print_screen(word y, char *buffer)
|
||||||
|
{
|
||||||
char l;
|
char l;
|
||||||
char x = 0;
|
char x = 0;
|
||||||
l = strlen(buffer);
|
l = strlen(buffer);
|
||||||
@ -97,7 +102,8 @@ void _print_screen(word y, char *buffer){
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
void _print_console(const char *buffer){
|
void _print_console(const char *buffer)
|
||||||
|
{
|
||||||
while (*buffer)
|
while (*buffer)
|
||||||
*(byte *) 0x3000 = *buffer++;
|
*(byte *) 0x3000 = *buffer++;
|
||||||
}
|
}
|
||||||
@ -105,7 +111,8 @@ void _print_console(const char *buffer){
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
void printfc(const char *fmt,...){
|
void printfc(const char *fmt, ...)
|
||||||
|
{
|
||||||
va_list ap;
|
va_list ap;
|
||||||
va_start(ap, fmt);
|
va_start(ap, fmt);
|
||||||
vsprintf(debug_buffer, fmt, ap);
|
vsprintf(debug_buffer, fmt, ap);
|
||||||
@ -115,7 +122,8 @@ void printfc(const char *fmt,...){
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void printfs(word y,const char *fmt,...){
|
void printfs(word y, const char *fmt, ...)
|
||||||
|
{
|
||||||
va_list ap;
|
va_list ap;
|
||||||
va_start(ap, fmt);
|
va_start(ap, fmt);
|
||||||
vsprintf(screen_buffer, fmt, ap);
|
vsprintf(screen_buffer, fmt, ap);
|
||||||
@ -124,7 +132,8 @@ void printfs(word y,const char *fmt,...){
|
|||||||
memset(screen_buffer, 0, 255);
|
memset(screen_buffer, 0, 255);
|
||||||
}
|
}
|
||||||
|
|
||||||
void printc_packet(unsigned long addr,unsigned int len,byte *packet){
|
void printc_packet(unsigned long addr, unsigned int len, byte * packet)
|
||||||
|
{
|
||||||
unsigned int i, j;
|
unsigned int i, j;
|
||||||
unsigned int sum = 0;
|
unsigned int sum = 0;
|
||||||
unsigned int clear = 0;
|
unsigned int clear = 0;
|
||||||
@ -158,40 +167,48 @@ void printc_packet(unsigned long addr,unsigned int len,byte *packet){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* keep the linker happy */
|
/*
|
||||||
int open(const char * _name, int _mode){
|
* keep the linker happy
|
||||||
|
*/
|
||||||
|
int open(const char *_name, int _mode)
|
||||||
|
{
|
||||||
_print_console("open called\n");
|
_print_console("open called\n");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int close(int fd){
|
int close(int fd)
|
||||||
|
{
|
||||||
_print_console("close called\n");
|
_print_console("close called\n");
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t read(int fd, void * buff, size_t len){
|
size_t read(int fd, void *buff, size_t len)
|
||||||
|
{
|
||||||
_print_console("read called\n");
|
_print_console("read called\n");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t write(int fd, void * buffer, size_t len){
|
size_t write(int fd, void *buffer, size_t len)
|
||||||
|
{
|
||||||
_print_console("write called\n");
|
_print_console("write called\n");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
long lseek(int fd, long off, int count){
|
long lseek(int fd, long off, int count)
|
||||||
|
{
|
||||||
_print_console("lseek called\n");
|
_print_console("lseek called\n");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int unlink(const char * name){
|
int unlink(const char *name)
|
||||||
|
{
|
||||||
_print_console("unlink called\n");
|
_print_console("unlink called\n");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int isatty(){
|
int isatty()
|
||||||
|
{
|
||||||
_print_console("isatty called\n");
|
_print_console("isatty called\n");
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -7,25 +7,18 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* Interface
|
/*
|
||||||
** Scratch Buffer
|
* Interface ** Scratch Buffer addr 3 byte size 1 byte
|
||||||
addr 3 byte
|
*
|
||||||
size 1 byte
|
* ** Call Interface cmd 1 byte sector 4 bytes count 1 byte return 1 byte
|
||||||
|
*
|
||||||
** Call Interface
|
* ** Commands * disk_init * disk_read * disk_write
|
||||||
cmd 1 byte
|
|
||||||
sector 4 bytes
|
|
||||||
count 1 byte
|
|
||||||
return 1 byte
|
|
||||||
|
|
||||||
** Commands
|
|
||||||
* disk_init
|
|
||||||
* disk_read
|
|
||||||
* disk_write
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*-----------------------------------------------------------------------*/
|
/*-----------------------------------------------------------------------*/
|
||||||
/* Initialize Disk Drive */
|
/*
|
||||||
|
* Initialize Disk Drive
|
||||||
|
*/
|
||||||
/*-----------------------------------------------------------------------*/
|
/*-----------------------------------------------------------------------*/
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
@ -36,13 +29,15 @@ return 1 byte
|
|||||||
DSTATUS Stat = 0; // STA_NOINIT; /* Disk status */
|
DSTATUS Stat = 0; // STA_NOINIT; /* Disk status */
|
||||||
|
|
||||||
|
|
||||||
DSTATUS disk_initialize (BYTE drv) {
|
DSTATUS disk_initialize(BYTE drv)
|
||||||
|
{
|
||||||
|
|
||||||
byte retval;
|
byte retval;
|
||||||
#ifdef MMIO_DEBUG
|
#ifdef MMIO_DEBUG
|
||||||
printfc("SNES::disk_initialize: called drv=%i stat=%i\n", drv, Stat);
|
printfc("SNES::disk_initialize: called drv=%i stat=%i\n", drv, Stat);
|
||||||
#endif
|
#endif
|
||||||
if (drv) return STA_NOINIT; /* Supports only single drive */
|
if (drv)
|
||||||
|
return STA_NOINIT; /* Supports only single drive */
|
||||||
Stat |= STA_NOINIT;
|
Stat |= STA_NOINIT;
|
||||||
#ifdef MMIO_DEBUG
|
#ifdef MMIO_DEBUG
|
||||||
printfc("SNES::disk_initialize: stat=%i\n", Stat);
|
printfc("SNES::disk_initialize: stat=%i\n", Stat);
|
||||||
@ -62,21 +57,26 @@ DSTATUS disk_initialize (BYTE drv) {
|
|||||||
|
|
||||||
|
|
||||||
/*-----------------------------------------------------------------------*/
|
/*-----------------------------------------------------------------------*/
|
||||||
/* Return Disk Status */
|
/*
|
||||||
|
* Return Disk Status
|
||||||
|
*/
|
||||||
/*-----------------------------------------------------------------------*/
|
/*-----------------------------------------------------------------------*/
|
||||||
|
|
||||||
DSTATUS disk_status (BYTE drv){
|
DSTATUS disk_status(BYTE drv)
|
||||||
if (drv) return STA_NOINIT; /* Supports only single drive */
|
{
|
||||||
|
if (drv)
|
||||||
|
return STA_NOINIT; /* Supports only single drive */
|
||||||
return Stat;
|
return Stat;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*-----------------------------------------------------------------------*/
|
/*-----------------------------------------------------------------------*/
|
||||||
/* Read Sector(s) */
|
/*
|
||||||
|
* Read Sector(s)
|
||||||
|
*/
|
||||||
/*-----------------------------------------------------------------------*/
|
/*-----------------------------------------------------------------------*/
|
||||||
|
|
||||||
DRESULT disk_read (
|
DRESULT disk_read(BYTE drv, /* Physical drive nmuber (0) */
|
||||||
BYTE drv, /* Physical drive nmuber (0) */
|
|
||||||
BYTE * buff, /* Data buffer to store read data */
|
BYTE * buff, /* Data buffer to store read data */
|
||||||
DWORD sector, /* Sector number (LBA) */
|
DWORD sector, /* Sector number (LBA) */
|
||||||
BYTE count /* Sector count (1..255) */
|
BYTE count /* Sector count (1..255) */
|
||||||
@ -90,11 +90,13 @@ DRESULT disk_read (
|
|||||||
#ifdef MMIO_DEBUG
|
#ifdef MMIO_DEBUG
|
||||||
printfc("SNES::disk_read: sector=%li count=%i\n", sector, count);
|
printfc("SNES::disk_read: sector=%li count=%i\n", sector, count);
|
||||||
#endif
|
#endif
|
||||||
if (drv || !count) return RES_PARERR;
|
if (drv || !count)
|
||||||
|
return RES_PARERR;
|
||||||
#ifdef MMIO_DEBUG
|
#ifdef MMIO_DEBUG
|
||||||
printfc("SNES::disk_read: drv ok\n");
|
printfc("SNES::disk_read: drv ok\n");
|
||||||
#endif
|
#endif
|
||||||
if (Stat & STA_NOINIT) return RES_NOTRDY;
|
if (Stat & STA_NOINIT)
|
||||||
|
return RES_NOTRDY;
|
||||||
#ifdef MMIO_DEBUG
|
#ifdef MMIO_DEBUG
|
||||||
printfc("SNES::disk_read: sta ok\n");
|
printfc("SNES::disk_read: sta ok\n");
|
||||||
#endif
|
#endif
|
||||||
@ -134,12 +136,13 @@ DRESULT disk_read (
|
|||||||
|
|
||||||
|
|
||||||
/*-----------------------------------------------------------------------*/
|
/*-----------------------------------------------------------------------*/
|
||||||
/* Write Sector(s) */
|
/*
|
||||||
|
* Write Sector(s)
|
||||||
|
*/
|
||||||
/*-----------------------------------------------------------------------*/
|
/*-----------------------------------------------------------------------*/
|
||||||
|
|
||||||
#if _READONLY == 0
|
#if _READONLY == 0
|
||||||
DRESULT disk_write (
|
DRESULT disk_write(BYTE drv, /* Physical drive nmuber (0) */
|
||||||
BYTE drv, /* Physical drive nmuber (0) */
|
|
||||||
const BYTE * buff, /* Data to be written */
|
const BYTE * buff, /* Data to be written */
|
||||||
DWORD sector, /* Sector number (LBA) */
|
DWORD sector, /* Sector number (LBA) */
|
||||||
BYTE count /* Sector count (1..255) */
|
BYTE count /* Sector count (1..255) */
|
||||||
@ -148,8 +151,10 @@ DRESULT disk_write (
|
|||||||
DWORD offset;
|
DWORD offset;
|
||||||
INT size;
|
INT size;
|
||||||
|
|
||||||
if (drv || !count) return RES_PARERR;
|
if (drv || !count)
|
||||||
if (Stat & STA_NOINIT) return RES_NOTRDY;
|
return RES_PARERR;
|
||||||
|
if (Stat & STA_NOINIT)
|
||||||
|
return RES_NOTRDY;
|
||||||
|
|
||||||
offset = sector * 512;
|
offset = sector * 512;
|
||||||
size = count * 512;
|
size = count * 512;
|
||||||
@ -158,12 +163,13 @@ DRESULT disk_write (
|
|||||||
#endif /* _READONLY */
|
#endif /* _READONLY */
|
||||||
|
|
||||||
/*-----------------------------------------------------------------------*/
|
/*-----------------------------------------------------------------------*/
|
||||||
/* Miscellaneous Functions */
|
/*
|
||||||
|
* Miscellaneous Functions
|
||||||
|
*/
|
||||||
/*-----------------------------------------------------------------------*/
|
/*-----------------------------------------------------------------------*/
|
||||||
|
|
||||||
#if _USE_IOCTL != 0
|
#if _USE_IOCTL != 0
|
||||||
DRESULT disk_ioctl (
|
DRESULT disk_ioctl(BYTE drv, /* Physical drive nmuber (0) */
|
||||||
BYTE drv, /* Physical drive nmuber (0) */
|
|
||||||
BYTE ctrl, /* Control code */
|
BYTE ctrl, /* Control code */
|
||||||
void *buff /* Buffer to send/receive data block */
|
void *buff /* Buffer to send/receive data block */
|
||||||
)
|
)
|
||||||
@ -171,12 +177,16 @@ DRESULT disk_ioctl (
|
|||||||
BYTE n, w, ofs, dl, dh, *ptr = (BYTE *) buff;
|
BYTE n, w, ofs, dl, dh, *ptr = (BYTE *) buff;
|
||||||
|
|
||||||
|
|
||||||
if (drv) return RES_PARERR;
|
if (drv)
|
||||||
if (Stat & STA_NOINIT) return RES_NOTRDY;
|
return RES_PARERR;
|
||||||
|
if (Stat & STA_NOINIT)
|
||||||
|
return RES_NOTRDY;
|
||||||
|
|
||||||
switch (ctrl) {
|
switch (ctrl) {
|
||||||
case GET_SECTOR_COUNT: /* Get number of sectors on the disk (DWORD) */
|
case GET_SECTOR_COUNT: /* Get number of sectors on the disk (DWORD) */
|
||||||
ofs = 60; w = 2; n = 0;
|
ofs = 60;
|
||||||
|
w = 2;
|
||||||
|
n = 0;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case GET_SECTOR_SIZE: /* Get sectors on the disk (WORD) */
|
case GET_SECTOR_SIZE: /* Get sectors on the disk (WORD) */
|
||||||
@ -193,7 +203,3 @@ DRESULT disk_ioctl (
|
|||||||
return RES_OK;
|
return RES_OK;
|
||||||
}
|
}
|
||||||
#endif /* _USE_IOCTL != 0 */
|
#endif /* _USE_IOCTL != 0 */
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -5,11 +5,13 @@
|
|||||||
|
|
||||||
event *events;
|
event *events;
|
||||||
|
|
||||||
void initEvents(void) {
|
void initEvents(void)
|
||||||
|
{
|
||||||
events = NULL;
|
events = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
event *createEvent(char (*callback)(word counter)) {
|
event *createEvent(char (*callback) (word counter))
|
||||||
|
{
|
||||||
event *myEvent;
|
event *myEvent;
|
||||||
|
|
||||||
myEvent = (event *) malloc(sizeof(event));
|
myEvent = (event *) malloc(sizeof(event));
|
||||||
@ -23,7 +25,8 @@ event *createEvent(char (*callback)(word counter)) {
|
|||||||
return myEvent;
|
return myEvent;
|
||||||
}
|
}
|
||||||
|
|
||||||
event* addEvent(char (*callback)(word counter), int noDuplicateCallback) {
|
event *addEvent(char (*callback) (word counter), int noDuplicateCallback)
|
||||||
|
{
|
||||||
|
|
||||||
event *lastEvent;
|
event *lastEvent;
|
||||||
event *myEvent;
|
event *myEvent;
|
||||||
@ -52,7 +55,8 @@ event* addEvent(char (*callback)(word counter), int noDuplicateCallback) {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void removeEvent(event *eventElement) {
|
void removeEvent(event * eventElement)
|
||||||
|
{
|
||||||
|
|
||||||
byte alone = 0;
|
byte alone = 0;
|
||||||
event *next, *previous;
|
event *next, *previous;
|
||||||
@ -82,7 +86,8 @@ void removeEvent(event *eventElement) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void processEvents(void) {
|
void processEvents(void)
|
||||||
|
{
|
||||||
|
|
||||||
event *currentEvent;
|
event *currentEvent;
|
||||||
char returnValue;
|
char returnValue;
|
||||||
|
|||||||
1302
snes/fatfstest/ff.c
1302
snes/fatfstest/ff.c
File diff suppressed because it is too large
Load Diff
@ -13,18 +13,6 @@
|
|||||||
#include "debug.h"
|
#include "debug.h"
|
||||||
#include "crc.h"
|
#include "crc.h"
|
||||||
|
|
||||||
/*
|
|
||||||
|
|
||||||
o relocate main code
|
|
||||||
o exec loaded file
|
|
||||||
|
|
||||||
o debug STA global
|
|
||||||
o optimize internal transfer buffer
|
|
||||||
o direct writeto mempage
|
|
||||||
|
|
||||||
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
#define ROM_NAME "TURRICAN.SMC"
|
#define ROM_NAME "TURRICAN.SMC"
|
||||||
#define BLOCK_SIZE 512
|
#define BLOCK_SIZE 512
|
||||||
@ -57,7 +45,9 @@ void initInternalRegisters(void)
|
|||||||
characterLocation[2] = 0x0000;
|
characterLocation[2] = 0x0000;
|
||||||
characterLocation[3] = 0x0000;
|
characterLocation[3] = 0x0000;
|
||||||
debug_init();
|
debug_init();
|
||||||
} void preInit(void)
|
}
|
||||||
|
|
||||||
|
void preInit(void)
|
||||||
{
|
{
|
||||||
|
|
||||||
// For testing purpose ...
|
// For testing purpose ...
|
||||||
@ -252,7 +242,6 @@ void boot(DWORD addr)
|
|||||||
printfc("SNES::main: read cnt=%i s2=%i\n", cnt, s2);
|
printfc("SNES::main: read cnt=%i s2=%i\n", cnt, s2);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
printc_packet(addr, 512, (byte *) (addr));
|
printc_packet(addr, 512, (byte *) (addr));
|
||||||
wait();
|
wait();
|
||||||
@ -287,7 +276,9 @@ void boot(DWORD addr)
|
|||||||
|
|
||||||
void IRQHandler(void)
|
void IRQHandler(void)
|
||||||
{
|
{
|
||||||
} void NMIHandler(void)
|
}
|
||||||
|
|
||||||
|
void NMIHandler(void)
|
||||||
{
|
{
|
||||||
|
|
||||||
// processEvents();
|
// processEvents();
|
||||||
|
|||||||
@ -5,7 +5,8 @@
|
|||||||
extern padStatus pad1;
|
extern padStatus pad1;
|
||||||
extern word scrollValue;
|
extern word scrollValue;
|
||||||
|
|
||||||
char fadeOut(word counter) {
|
char fadeOut(word counter)
|
||||||
|
{
|
||||||
static byte fadeOutValue;
|
static byte fadeOutValue;
|
||||||
|
|
||||||
if (counter == 0) {
|
if (counter == 0) {
|
||||||
@ -24,7 +25,8 @@ char fadeOut(word counter) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
char fadeIn(word counter) {
|
char fadeIn(word counter)
|
||||||
|
{
|
||||||
static byte fadeInValue;
|
static byte fadeInValue;
|
||||||
|
|
||||||
if (counter == 0) {
|
if (counter == 0) {
|
||||||
@ -43,7 +45,8 @@ char fadeIn(word counter) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
char mosaicOut(word counter) {
|
char mosaicOut(word counter)
|
||||||
|
{
|
||||||
static byte mosaicOutValue;
|
static byte mosaicOutValue;
|
||||||
|
|
||||||
if (counter == 0) {
|
if (counter == 0) {
|
||||||
@ -62,7 +65,8 @@ char mosaicOut(word counter) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
char mosaicIn(word counter) {
|
char mosaicIn(word counter)
|
||||||
|
{
|
||||||
static byte mosaicInValue;
|
static byte mosaicInValue;
|
||||||
|
|
||||||
if (counter == 0) {
|
if (counter == 0) {
|
||||||
@ -81,13 +85,15 @@ char mosaicIn(word counter) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
char NMIReadPad(word counter) {
|
char NMIReadPad(word counter)
|
||||||
|
{
|
||||||
pad1 = readPad((byte) 0);
|
pad1 = readPad((byte) 0);
|
||||||
|
|
||||||
return EVENT_CONTINUE;
|
return EVENT_CONTINUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
char scrollLeft(word counter) {
|
char scrollLeft(word counter)
|
||||||
|
{
|
||||||
scrollValue++;
|
scrollValue++;
|
||||||
|
|
||||||
*(byte *) 0x210d = (byte) scrollValue;
|
*(byte *) 0x210d = (byte) scrollValue;
|
||||||
|
|||||||
@ -2,17 +2,20 @@
|
|||||||
#include "pad.h";
|
#include "pad.h";
|
||||||
#include "debug.h";
|
#include "debug.h";
|
||||||
|
|
||||||
void enablePad(void) {
|
void enablePad(void)
|
||||||
|
{
|
||||||
// Enable pad reading and NMI
|
// Enable pad reading and NMI
|
||||||
*(byte *) 0x4200 = 0x01;
|
*(byte *) 0x4200 = 0x01;
|
||||||
}
|
}
|
||||||
|
|
||||||
void disablePad(void) {
|
void disablePad(void)
|
||||||
|
{
|
||||||
// Enable pad reading and NMI
|
// Enable pad reading and NMI
|
||||||
*(byte *) 0x4200 = 0x00;
|
*(byte *) 0x4200 = 0x00;
|
||||||
}
|
}
|
||||||
|
|
||||||
padStatus readPad(byte padNumber) {
|
padStatus readPad(byte padNumber)
|
||||||
|
{
|
||||||
word test;
|
word test;
|
||||||
padStatus *status;
|
padStatus *status;
|
||||||
padNumber = padNumber << 1;
|
padNumber = padNumber << 1;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user