Archie: remove fdc/file customization.
This commit is contained in:
15
menu.cpp
15
menu.cpp
@@ -873,11 +873,11 @@ void HandleUI(void)
|
||||
OsdWrite(0, "", 0, 0);
|
||||
|
||||
strcpy(s, " Floppy 0: ");
|
||||
strncat(s, archie_get_floppy_name(0),27);
|
||||
strncat(s, get_image_name(0) ? get_image_name(0) : "* no disk *",27);
|
||||
OsdWrite(1, s, menusub == 0, 0);
|
||||
|
||||
strcpy(s, " Floppy 1: ");
|
||||
strncat(s, archie_get_floppy_name(1), 27);
|
||||
strncat(s, get_image_name(1) ? get_image_name(1) : "* no disk *", 27);
|
||||
OsdWrite(2, s, menusub == 1, 0);
|
||||
|
||||
OsdWrite(3, "", 0, 0);
|
||||
@@ -921,12 +921,7 @@ void HandleUI(void)
|
||||
switch (menusub) {
|
||||
case 0: // Floppy 0
|
||||
case 1: // Floppy 1
|
||||
if (archie_floppy_is_inserted(menusub)) {
|
||||
archie_set_floppy(menusub, NULL);
|
||||
menustate = MENU_ARCHIE_MAIN1;
|
||||
}
|
||||
else
|
||||
SelectFile("ADF", SCANO_DIR, MENU_ARCHIE_MAIN_FILE_SELECTED, MENU_ARCHIE_MAIN1);
|
||||
SelectFile("ADF", SCANO_DIR | SCANO_UMOUNT, MENU_ARCHIE_MAIN_FILE_SELECTED, MENU_ARCHIE_MAIN1);
|
||||
break;
|
||||
|
||||
case 2: // Load ROM
|
||||
@@ -967,8 +962,8 @@ void HandleUI(void)
|
||||
break;
|
||||
|
||||
case MENU_ARCHIE_MAIN_FILE_SELECTED: // file successfully selected
|
||||
if (menusub == 0) archie_set_floppy(0, SelectedPath);
|
||||
if (menusub == 1) archie_set_floppy(1, SelectedPath);
|
||||
if (menusub == 0) user_io_file_mount(SelectedPath, 0);
|
||||
if (menusub == 1) user_io_file_mount(SelectedPath, 1);
|
||||
if (menusub == 2) archie_set_rom(SelectedPath);
|
||||
menustate = MENU_ARCHIE_MAIN1;
|
||||
break;
|
||||
|
||||
@@ -7,8 +7,6 @@
|
||||
#include "../../debug.h"
|
||||
#include "../../user_io.h"
|
||||
|
||||
#define MAX_FLOPPY 4
|
||||
|
||||
#define CONFIG_FILENAME "ARCHIE.CFG"
|
||||
|
||||
typedef struct
|
||||
@@ -19,14 +17,6 @@ typedef struct
|
||||
|
||||
static archie_config_t config;
|
||||
|
||||
fileTYPE floppy[MAX_FLOPPY] = {};
|
||||
|
||||
#define ARCHIE_FILE_TX 0x53
|
||||
#define ARCHIE_FILE_TX_DAT 0x54
|
||||
#define ARCHIE_FDC_GET_STATUS 0x55
|
||||
#define ARCHIE_FDC_TX_DATA 0x56
|
||||
#define ARCHIE_FDC_SET_STATUS 0x57
|
||||
|
||||
#define archie_debugf(a, ...) printf("\033[1;31mARCHIE: " a "\033[0m\n", ##__VA_ARGS__)
|
||||
// #define archie_debugf(a, ...)
|
||||
#define archie_x_debugf(a, ...) printf("\033[1;32mARCHIE: " a "\033[0m\n", ##__VA_ARGS__)
|
||||
@@ -73,8 +63,6 @@ static unsigned char flags;
|
||||
static unsigned long hold_off_timer;
|
||||
#endif
|
||||
|
||||
static uint8_t sector_buffer[1024];
|
||||
|
||||
const char *archie_get_rom_name(void)
|
||||
{
|
||||
char *p = strrchr(config.rom_img, '/');
|
||||
@@ -83,16 +71,6 @@ const char *archie_get_rom_name(void)
|
||||
return p;
|
||||
}
|
||||
|
||||
const char *archie_get_floppy_name(int i)
|
||||
{
|
||||
if (!floppy[i].size) return "* no disk *";
|
||||
|
||||
char *p = strrchr(floppy[i].name, '/');
|
||||
if (!p) p = floppy[i].name; else p++;
|
||||
|
||||
return p;
|
||||
}
|
||||
|
||||
void archie_set_ar(char i)
|
||||
{
|
||||
if (i) config.system_ctrl |= 1;
|
||||
@@ -121,89 +99,6 @@ void archie_save_config(void)
|
||||
FileSaveConfig(CONFIG_FILENAME, &config, sizeof(config));
|
||||
}
|
||||
|
||||
void archie_send_file(unsigned char id, char *name)
|
||||
{
|
||||
archie_debugf("Sending file with id %d", id);
|
||||
|
||||
fileTYPE file = {};
|
||||
if (!FileOpen(&file, name)) return;
|
||||
|
||||
// prepare transmission of new file
|
||||
EnableFpga();
|
||||
spi8(ARCHIE_FILE_TX);
|
||||
spi8(id);
|
||||
DisableFpga();
|
||||
|
||||
unsigned long time = GetTimer(0);
|
||||
|
||||
printf("[");
|
||||
|
||||
unsigned short i, blocks = file.size / 512;
|
||||
for (i = 0; i<blocks; i++) {
|
||||
if (!(i & 127)) printf("*");
|
||||
|
||||
DISKLED_ON;
|
||||
FileReadSec(&file, sector_buffer);
|
||||
DISKLED_OFF;
|
||||
|
||||
EnableFpga();
|
||||
spi8(ARCHIE_FILE_TX_DAT);
|
||||
spi_block_write(sector_buffer, 1);
|
||||
DisableFpga();
|
||||
}
|
||||
|
||||
FileClose(&file);
|
||||
printf("]\n");
|
||||
|
||||
time = GetTimer(0) - time;
|
||||
archie_debugf("Uploaded in %lu ms", time >> 20);
|
||||
|
||||
// signal end of transmission
|
||||
EnableFpga();
|
||||
spi8(ARCHIE_FILE_TX);
|
||||
spi8(0x00);
|
||||
DisableFpga();
|
||||
}
|
||||
|
||||
void archie_fdc_set_status(void)
|
||||
{
|
||||
int i;
|
||||
|
||||
// send status bytes for all four possible floppies
|
||||
EnableFpga();
|
||||
spi8(ARCHIE_FDC_SET_STATUS);
|
||||
for (i = 0; i<MAX_FLOPPY; i++)
|
||||
{
|
||||
unsigned char floppy_status = 0x00;
|
||||
if (floppy[i].size) floppy_status |= 1;
|
||||
spi8(floppy_status);
|
||||
}
|
||||
DisableFpga();
|
||||
}
|
||||
|
||||
void archie_set_floppy(int i, char *name)
|
||||
{
|
||||
if (!name)
|
||||
{
|
||||
archie_debugf("Floppy %d eject", i);
|
||||
FileClose(&floppy[i]);
|
||||
floppy[i].size = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
archie_debugf("Floppy %d insert %s", i, name);
|
||||
FileOpen(&floppy[i], name);
|
||||
}
|
||||
|
||||
// update floppy status in fpga
|
||||
archie_fdc_set_status();
|
||||
}
|
||||
|
||||
char archie_floppy_is_inserted(int i)
|
||||
{
|
||||
return(floppy[i].size != 0);
|
||||
}
|
||||
|
||||
void archie_set_rom(char *name)
|
||||
{
|
||||
if (!name) return;
|
||||
@@ -212,8 +107,7 @@ void archie_set_rom(char *name)
|
||||
|
||||
// save file name
|
||||
strcpy(config.rom_img, name);
|
||||
|
||||
archie_send_file(0x01, name);
|
||||
user_io_file_tx(name, 1);
|
||||
}
|
||||
|
||||
static void archie_kbd_enqueue(unsigned char state, unsigned char byte)
|
||||
@@ -261,8 +155,6 @@ static void archie_kbd_reset(void)
|
||||
|
||||
void archie_init(void)
|
||||
{
|
||||
int i;
|
||||
|
||||
archie_debugf("init");
|
||||
|
||||
// set config defaults
|
||||
@@ -290,8 +182,10 @@ void archie_init(void)
|
||||
archie_set_rom(config.rom_img);
|
||||
|
||||
// upload ext file
|
||||
//archie_send_file(0x02, "RISCOS.EXT");
|
||||
user_io_file_tx("Archie/RISCOS.EXT", 2);
|
||||
|
||||
/*
|
||||
int i;
|
||||
// try to open default floppies
|
||||
for (i = 0; i<MAX_FLOPPY; i++)
|
||||
{
|
||||
@@ -302,9 +196,7 @@ void archie_init(void)
|
||||
else
|
||||
floppy[i].size = 0;
|
||||
}
|
||||
// update floppy status in fpga
|
||||
archie_fdc_set_status();
|
||||
|
||||
*/
|
||||
archie_kbd_send(STATE_RAK1, HRST);
|
||||
ack_timeout = GetTimer(20); // give archie 20ms to reply
|
||||
}
|
||||
@@ -396,7 +288,7 @@ static void archie_check_queue(void)
|
||||
tx_queue_rptr = QUEUE_NEXT(tx_queue_rptr);
|
||||
}
|
||||
|
||||
void archie_handle_kbd(void)
|
||||
void archie_poll(void)
|
||||
{
|
||||
#ifdef HOLD_OFF_TIME
|
||||
if ((kbd_state == STATE_HOLD_OFF) && CheckTimer(hold_off_timer)) {
|
||||
@@ -473,18 +365,27 @@ void archie_handle_kbd(void)
|
||||
|
||||
// arm acks first byte
|
||||
case BACK:
|
||||
if (kbd_state != STATE_WAIT4ACK1)
|
||||
archie_debugf("KBD unexpected BACK");
|
||||
|
||||
#ifdef HOLD_OFF_TIME
|
||||
// wait some time before sending next byte
|
||||
archie_debugf("KBD starting hold off");
|
||||
kbd_state = STATE_HOLD_OFF;
|
||||
hold_off_timer = GetTimer(10);
|
||||
#else
|
||||
kbd_state = STATE_IDLE;
|
||||
archie_check_queue();
|
||||
#endif
|
||||
if (kbd_state != STATE_WAIT4ACK1) {
|
||||
archie_debugf("KBD unexpected BACK, resetting KBD");
|
||||
kbd_state = STATE_HRST;
|
||||
}
|
||||
else {
|
||||
#ifdef HOLD_OFF_TIME
|
||||
// wait some time before sending next byte
|
||||
archie_debugf("KBD starting hold off");
|
||||
kbd_state = STATE_HOLD_OFF;
|
||||
hold_off_timer = GetTimer(10);
|
||||
// wait some time before sending next byte
|
||||
archie_debugf("KBD starting hold off");
|
||||
kbd_state = STATE_HOLD_OFF;
|
||||
hold_off_timer = GetTimer(10);
|
||||
#else
|
||||
kbd_state = STATE_IDLE;
|
||||
archie_check_queue();
|
||||
kbd_state = STATE_IDLE;
|
||||
archie_check_queue();
|
||||
#endif
|
||||
}
|
||||
break;
|
||||
|
||||
// arm acks second byte
|
||||
@@ -528,80 +429,3 @@ void archie_handle_kbd(void)
|
||||
else
|
||||
DisableIO();
|
||||
}
|
||||
|
||||
void archie_handle_fdc(void)
|
||||
{
|
||||
static uint8_t buffer[1024];
|
||||
static unsigned char old_status[4] = { 0,0,0,0 };
|
||||
unsigned char status[4];
|
||||
|
||||
// read status
|
||||
EnableFpga();
|
||||
spi8(ARCHIE_FDC_GET_STATUS);
|
||||
status[0] = spi_in();
|
||||
status[1] = spi_in();
|
||||
status[2] = spi_in();
|
||||
status[3] = spi_in();
|
||||
DisableFpga();
|
||||
|
||||
if (memcmp(status, old_status, 4) != 0)
|
||||
{
|
||||
//archie_x_debugf("status changed to %x %x %x %x", status[0], status[1], status[2], status[3]);
|
||||
memcpy(old_status, status, 4);
|
||||
|
||||
// top four bits must be magic marker 1010
|
||||
if (((status[0] & 0xf0) == 0xa0) && (status[0] & 1))
|
||||
{
|
||||
//archie_x_debugf("status changed to %x %x %x %x", status[0], status[1], status[2], status[3]);
|
||||
//archie_x_debugf("DIO: BUSY with commmand %lx", status[1]);
|
||||
|
||||
// check for read sector command
|
||||
if ((status[1] & 0xe0) == 0x80)
|
||||
{
|
||||
if (status[0] & 2)
|
||||
{
|
||||
int floppy_map = status[3] >> 4;
|
||||
int side = (status[2] & 0x80) ? 0 : 1;
|
||||
int track = status[2] & 0x7f;
|
||||
int sector = status[3] & 0x0f;
|
||||
unsigned long lba = 2 * (10 * track + 5 * side + sector);
|
||||
int floppy_index = -1;
|
||||
|
||||
// allow only single floppy drives to be selected
|
||||
int i;
|
||||
for (i = 0; i<MAX_FLOPPY; i++)
|
||||
if (floppy_map == (0x0f ^ (1 << i)))
|
||||
floppy_index = i;
|
||||
|
||||
if (floppy_index < 0) archie_x_debugf("DIO: unexpected floppy_map %x", floppy_map);
|
||||
else
|
||||
{
|
||||
fileTYPE *f = &floppy[floppy_index];
|
||||
|
||||
//archie_x_debugf("DIO: floppy %d sector read SD%d T%d S%d -> %ld", floppy_index, side, track, sector, lba);
|
||||
|
||||
if (!f->size) archie_x_debugf("DIO: floppy not inserted. Core should not do this!!");
|
||||
else {
|
||||
DISKLED_ON;
|
||||
// read two consecutive sectors
|
||||
FileSeekLBA(f, lba);
|
||||
FileReadAdv(f, buffer, 1024);
|
||||
|
||||
EnableFpga();
|
||||
spi8(ARCHIE_FDC_TX_DATA);
|
||||
spi_write(buffer, 1024, 0);
|
||||
DisableFpga();
|
||||
DISKLED_OFF;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void archie_poll(void)
|
||||
{
|
||||
archie_handle_kbd();
|
||||
archie_handle_fdc();
|
||||
}
|
||||
|
||||
@@ -8,10 +8,7 @@ void archie_poll(void);
|
||||
void archie_kbd(unsigned short code);
|
||||
void archie_mouse(unsigned char b, int16_t x, int16_t y);
|
||||
const char *archie_get_rom_name(void);
|
||||
const char *archie_get_floppy_name(int b);
|
||||
void archie_set_rom(char *);
|
||||
void archie_set_floppy(int i, char *);
|
||||
char archie_floppy_is_inserted(int i);
|
||||
void archie_save_config(void);
|
||||
|
||||
void archie_set_ar(char i);
|
||||
|
||||
241
user_io.cpp
241
user_io.cpp
@@ -64,6 +64,16 @@ static bool scrl_status = 0;
|
||||
|
||||
static char minimig_adjust = 0;
|
||||
|
||||
const char *get_image_name(int i)
|
||||
{
|
||||
if (!sd_image[i].size) return NULL;
|
||||
|
||||
char *p = strrchr(sd_image[i].name, '/');
|
||||
if (!p) p = sd_image[i].name; else p++;
|
||||
|
||||
return p;
|
||||
}
|
||||
|
||||
static uint32_t uart_mode;
|
||||
uint32_t user_io_get_uart_mode()
|
||||
{
|
||||
@@ -1670,143 +1680,113 @@ void user_io_poll()
|
||||
{
|
||||
DisableIO();
|
||||
}
|
||||
}
|
||||
|
||||
// sd card emulation
|
||||
if (is_x86_core())
|
||||
{
|
||||
x86_poll();
|
||||
}
|
||||
else
|
||||
{
|
||||
static uint8_t buffer[4][512];
|
||||
uint32_t lba;
|
||||
uint16_t c = user_io_sd_get_status(&lba);
|
||||
//if(c&3) printf("user_io_sd_get_status: cmd=%02x, lba=%08x\n", c, lba);
|
||||
// sd card emulation
|
||||
if (is_x86_core())
|
||||
{
|
||||
x86_poll();
|
||||
}
|
||||
else if (core_type == CORE_TYPE_8BIT || core_type == CORE_TYPE_ARCHIE)
|
||||
{
|
||||
static uint8_t buffer[4][512];
|
||||
uint32_t lba;
|
||||
uint16_t c = user_io_sd_get_status(&lba);
|
||||
//if(c&3) printf("user_io_sd_get_status: cmd=%02x, lba=%08x\n", c, lba);
|
||||
|
||||
// valid sd commands start with "5x" to avoid problems with
|
||||
// cores that don't implement this command
|
||||
if ((c & 0xf0) == 0x50)
|
||||
// valid sd commands start with "5x" to avoid problems with
|
||||
// cores that don't implement this command
|
||||
if ((c & 0xf0) == 0x50)
|
||||
{
|
||||
// check if core requests configuration
|
||||
if (c & 0x08)
|
||||
{
|
||||
// check if core requests configuration
|
||||
if (c & 0x08)
|
||||
{
|
||||
printf("core requests SD config\n");
|
||||
user_io_sd_set_config();
|
||||
}
|
||||
printf("core requests SD config\n");
|
||||
user_io_sd_set_config();
|
||||
}
|
||||
|
||||
if(c & 0x3802)
|
||||
{
|
||||
int disk = 3;
|
||||
if (c & 0x0002) disk = 0;
|
||||
else if (c & 0x0800) disk = 1;
|
||||
else if (c & 0x1000) disk = 2;
|
||||
if(c & 0x3802)
|
||||
{
|
||||
int disk = 3;
|
||||
if (c & 0x0002) disk = 0;
|
||||
else if (c & 0x0800) disk = 1;
|
||||
else if (c & 0x1000) disk = 2;
|
||||
|
||||
// only write if the inserted card is not sdhc or
|
||||
// if the core uses sdhc
|
||||
if(c & 0x04)
|
||||
// only write if the inserted card is not sdhc or
|
||||
// if the core uses sdhc
|
||||
if(c & 0x04)
|
||||
{
|
||||
//printf("SD WR %d on %d\n", lba, disk);
|
||||
|
||||
int done = 0;
|
||||
buffer_lba[disk] = lba;
|
||||
|
||||
// Fetch sector data from FPGA ...
|
||||
spi_uio_cmd_cont(UIO_SECTOR_WR);
|
||||
spi_block_read(buffer[disk], fio_size);
|
||||
DisableIO();
|
||||
|
||||
|
||||
if (sd_image[disk].type == 2 && !lba)
|
||||
{
|
||||
//printf("SD WR %d on %d\n", lba, disk);
|
||||
|
||||
int done = 0;
|
||||
buffer_lba[disk] = lba;
|
||||
|
||||
// Fetch sector data from FPGA ...
|
||||
spi_uio_cmd_cont(UIO_SECTOR_WR);
|
||||
spi_block_read(buffer[disk], fio_size);
|
||||
DisableIO();
|
||||
|
||||
|
||||
if (sd_image[disk].type == 2 && !lba)
|
||||
//Create the file
|
||||
if (FileOpenEx(&sd_image[disk], sd_image[disk].path, O_CREAT | O_RDWR | O_SYNC))
|
||||
{
|
||||
//Create the file
|
||||
if (FileOpenEx(&sd_image[disk], sd_image[disk].path, O_CREAT | O_RDWR | O_SYNC))
|
||||
diskled_on();
|
||||
if (FileWriteSec(&sd_image[disk], buffer[disk]))
|
||||
{
|
||||
diskled_on();
|
||||
if (FileWriteSec(&sd_image[disk], buffer[disk]))
|
||||
{
|
||||
sd_image[disk].size = 512;
|
||||
done = 1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
printf("Error in creating file: %s\n", sd_image[disk].path);
|
||||
sd_image[disk].size = 512;
|
||||
done = 1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// ... and write it to disk
|
||||
__off64_t size = sd_image[disk].size>>9;
|
||||
if (size && size>=lba)
|
||||
{
|
||||
diskled_on();
|
||||
if (FileSeekLBA(&sd_image[disk], lba))
|
||||
{
|
||||
if (FileWriteSec(&sd_image[disk], buffer[disk]))
|
||||
{
|
||||
done = 1;
|
||||
if (size == lba)
|
||||
{
|
||||
size++;
|
||||
sd_image[disk].size = size << 9;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
printf("Error in creating file: %s\n", sd_image[disk].path);
|
||||
}
|
||||
|
||||
if (!done) buffer_lba[disk] = -1;
|
||||
}
|
||||
}
|
||||
else
|
||||
if (c & 0x0701)
|
||||
{
|
||||
int disk = 3;
|
||||
if (c & 0x0001) disk = 0;
|
||||
else if (c & 0x0100) disk = 1;
|
||||
else if (c & 0x0200) disk = 2;
|
||||
|
||||
//printf("SD RD %d on %d\n", lba, disk);
|
||||
|
||||
int done = 0;
|
||||
|
||||
if (buffer_lba[disk] != lba)
|
||||
else
|
||||
{
|
||||
if (sd_image[disk].size)
|
||||
// ... and write it to disk
|
||||
__off64_t size = sd_image[disk].size>>9;
|
||||
if (size && size>=lba)
|
||||
{
|
||||
diskled_on();
|
||||
if (FileSeekLBA(&sd_image[disk], lba))
|
||||
{
|
||||
if (FileReadSec(&sd_image[disk], buffer[disk]))
|
||||
if (FileWriteSec(&sd_image[disk], buffer[disk]))
|
||||
{
|
||||
done = 1;
|
||||
if (size == lba)
|
||||
{
|
||||
size++;
|
||||
sd_image[disk].size = size << 9;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//Even after error we have to provide the block to the core
|
||||
//Give an empty block.
|
||||
if (!done) memset(buffer[disk], 0, sizeof(buffer[disk]));
|
||||
buffer_lba[disk] = lba;
|
||||
}
|
||||
|
||||
if(buffer_lba[disk] == lba)
|
||||
{
|
||||
//hexdump(buffer, 32, 0);
|
||||
if (!done) buffer_lba[disk] = -1;
|
||||
}
|
||||
}
|
||||
else
|
||||
if (c & 0x0701)
|
||||
{
|
||||
int disk = 3;
|
||||
if (c & 0x0001) disk = 0;
|
||||
else if (c & 0x0100) disk = 1;
|
||||
else if (c & 0x0200) disk = 2;
|
||||
|
||||
// data is now stored in buffer. send it to fpga
|
||||
spi_uio_cmd_cont(UIO_SECTOR_RD);
|
||||
spi_block_write(buffer[disk], fio_size);
|
||||
DisableIO();
|
||||
}
|
||||
//printf("SD RD %d on %d, WIDE=%d\n", lba, disk, fio_size);
|
||||
|
||||
// just load the next sector now, so it may be prefetched
|
||||
// for the next request already
|
||||
done = 0;
|
||||
int done = 0;
|
||||
|
||||
if (buffer_lba[disk] != lba)
|
||||
{
|
||||
if (sd_image[disk].size)
|
||||
{
|
||||
diskled_on();
|
||||
if (FileSeekLBA(&sd_image[disk], lba + 1))
|
||||
if (FileSeekLBA(&sd_image[disk], lba))
|
||||
{
|
||||
if (FileReadSec(&sd_image[disk], buffer[disk]))
|
||||
{
|
||||
@@ -1814,22 +1794,55 @@ void user_io_poll()
|
||||
}
|
||||
}
|
||||
}
|
||||
if(done) buffer_lba[disk] = lba + 1;
|
||||
|
||||
if (sd_image[disk].type == 2)
|
||||
//Even after error we have to provide the block to the core
|
||||
//Give an empty block.
|
||||
if (!done) memset(buffer[disk], 0, sizeof(buffer[disk]));
|
||||
buffer_lba[disk] = lba;
|
||||
}
|
||||
|
||||
if(buffer_lba[disk] == lba)
|
||||
{
|
||||
//hexdump(buffer, 32, 0);
|
||||
|
||||
// data is now stored in buffer. send it to fpga
|
||||
spi_uio_cmd_cont(UIO_SECTOR_RD);
|
||||
spi_block_write(buffer[disk], fio_size);
|
||||
DisableIO();
|
||||
}
|
||||
|
||||
// just load the next sector now, so it may be prefetched
|
||||
// for the next request already
|
||||
done = 0;
|
||||
if (sd_image[disk].size)
|
||||
{
|
||||
diskled_on();
|
||||
if (FileSeekLBA(&sd_image[disk], lba + 1))
|
||||
{
|
||||
buffer_lba[disk] = -1;
|
||||
if (FileReadSec(&sd_image[disk], buffer[disk]))
|
||||
{
|
||||
done = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if(done) buffer_lba[disk] = lba + 1;
|
||||
|
||||
if(diskled_is_on && CheckTimer(diskled_timer))
|
||||
{
|
||||
DISKLED_OFF;
|
||||
diskled_is_on = 0;
|
||||
if (sd_image[disk].type == 2)
|
||||
{
|
||||
buffer_lba[disk] = -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(diskled_is_on && CheckTimer(diskled_timer))
|
||||
{
|
||||
DISKLED_OFF;
|
||||
diskled_is_on = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (core_type == CORE_TYPE_8BIT)
|
||||
{
|
||||
// frequently check ps2 mouse for events
|
||||
if (CheckTimer(mouse_timer))
|
||||
{
|
||||
|
||||
@@ -182,7 +182,6 @@ char is_archie();
|
||||
char is_sharpmz();
|
||||
void user_io_poll();
|
||||
char user_io_menu_button();
|
||||
char user_io_button_dip_switch1();
|
||||
char user_io_user_button();
|
||||
void user_io_osd_key_enable(char);
|
||||
void user_io_serial_tx(char *, uint16_t);
|
||||
@@ -198,6 +197,8 @@ char is_x86_core();
|
||||
char is_snes_core();
|
||||
char has_menu();
|
||||
|
||||
const char *get_image_name(int i);
|
||||
|
||||
int user_io_get_kbdemu();
|
||||
uint32_t user_io_get_uart_mode();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user