Fix the warnings.

This commit is contained in:
sorgelig
2019-01-08 10:08:02 +08:00
parent aaf0712856
commit f344ac931a
10 changed files with 103 additions and 84 deletions

View File

@@ -19,7 +19,7 @@ typedef struct
static archie_config_t config;
fileTYPE floppy[MAX_FLOPPY] = { 0 };
fileTYPE floppy[MAX_FLOPPY] = {};
#define ARCHIE_FILE_TX 0x53
#define ARCHIE_FILE_TX_DAT 0x54
@@ -83,7 +83,7 @@ const char *archie_get_rom_name(void)
return p;
}
const char *archie_get_floppy_name(char i)
const char *archie_get_floppy_name(int i)
{
if (!floppy[i].size) return "* no disk *";
@@ -125,7 +125,7 @@ void archie_send_file(unsigned char id, char *name)
{
archie_debugf("Sending file with id %d", id);
fileTYPE file = { 0 };
fileTYPE file = {};
if (!FileOpen(&file, name)) return;
// prepare transmission of new file
@@ -184,7 +184,7 @@ void archie_fdc_set_status(void)
DisableFpga();
}
void archie_set_floppy(char i, char *name)
void archie_set_floppy(int i, char *name)
{
if (!name)
{
@@ -202,7 +202,7 @@ void archie_set_floppy(char i, char *name)
archie_fdc_set_status();
}
char archie_floppy_is_inserted(char i)
char archie_floppy_is_inserted(int i)
{
return(floppy[i].size != 0);
}
@@ -264,7 +264,7 @@ static void archie_kbd_reset(void)
void archie_init(void)
{
char i;
int i;
archie_debugf("init");
@@ -301,7 +301,7 @@ void archie_init(void)
char fdc_name[] = "Archie/FLOPPY0.ADF";
fdc_name[13] = '0' + i;
if (FileOpen(&floppy[i], fdc_name))
archie_debugf("Inserted floppy %d with %d bytes", i, floppy[i].size);
archie_debugf("Inserted floppy %d with %llu bytes", i, floppy[i].size);
else
floppy[i].size = 0;
}

View File

@@ -8,10 +8,10 @@ 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(char b);
const char *archie_get_floppy_name(int b);
void archie_set_rom(char *);
void archie_set_floppy(char i, char *);
char archie_floppy_is_inserted(char i);
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);

View File

@@ -166,7 +166,7 @@ void ReadTrack(adfTYPE *drive)
unsigned char status;
unsigned char track;
unsigned short dsksync;
unsigned short dsklen;
//unsigned short dsklen;
uint16_t tmp;
//unsigned short n;
@@ -201,7 +201,7 @@ void ReadTrack(adfTYPE *drive)
status = (uint8_t)(tmp>>8); // read request signal
track = (uint8_t)tmp; // track number (cylinder & head)
dsksync = spi_w(0); // disk sync
dsklen = spi_w(0) & 0x3FFF; // mfm words to transfer
//dsklen = spi_w(0) & 0x3FFF; // mfm words to transfer
DisableFpga();
if (track >= drive->tracks)
@@ -218,7 +218,7 @@ void ReadTrack(adfTYPE *drive)
status = (uint8_t)(tmp >> 8); // read request signal
track = (uint8_t)tmp; // track number (cylinder & head)
dsksync = spi_w(0); // disk sync
dsklen = spi_w(0) & 0x3FFF; // mfm words to transfer
//dsklen = spi_w(0) & 0x3FFF; // mfm words to transfer
if (track >= drive->tracks)
track = drive->tracks - 1;
@@ -281,7 +281,7 @@ void ReadTrack(adfTYPE *drive)
unsigned char FindSync(adfTYPE *drive)
// reads data from fifo till it finds sync word or fifo is empty and dma inactive (so no more data is expected)
{
unsigned char c1, c2, c3, c4;
unsigned char c1, c2;
unsigned short n;
uint16_t tmp;
@@ -641,7 +641,6 @@ void InsertFloppy(adfTYPE *drive, char* path)
return;
}
unsigned char i, j;
unsigned long tracks;
// calculate number of tracks in the ADF image file

View File

@@ -81,12 +81,12 @@ typedef struct
uint16_t sector_count;
} hdfTYPE;
static hdfTYPE HDF[4] = { 0 };
static hdfTYPE HDF[4] = {};
static uint8_t sector_buffer[512];
static void CalcGeometry(hdfTYPE *hdf)
{
uint32_t head, cyl, spt;
uint32_t head = 0, cyl = 0, spt = 0;
uint32_t sptt[] = { 63, 127, 255, 0 };
uint32_t total = hdf->file.size / 512;
for (int i = 0; sptt[i] != 0; i++)
@@ -205,7 +205,6 @@ static uint32_t RDBChecksum(uint32_t *p, int set)
// if the HDF file doesn't have a RigidDiskBlock, we synthesize one
static void FakeRDB(hdfTYPE *hdf)
{
int i;
// start by clearing the sector buffer
memset(sector_buffer, 0, 512);
@@ -285,7 +284,8 @@ static void FakeRDB(hdfTYPE *hdf)
// builds Identify Device struct
static void IdentifyDevice(uint16_t *pBuffer, hdfTYPE *hdf)
{
char *p, i, x;
char *p, x;
int i;
uint32_t total_sectors = hdf->cylinders * hdf->heads * hdf->sectors;
memset(pBuffer, 0, 512);
@@ -368,6 +368,7 @@ static void WriteStatus(uint8_t status)
static void ATA_Recalibrate(uint8_t* tfr, hdfTYPE *hdf)
{
// Recalibrate 0x10-0x1F (class 3 command: no data)
(void)hdf;
hdd_debugf("IDE%d: Recalibrate", hdf->unit);
WriteTaskFile(0, 0, tfr[6] & 0x40 ? 0 : 1, 0, 0, tfr[6] & 0xF0);
WriteStatus(IDE_STATUS_END | IDE_STATUS_IRQ);
@@ -376,6 +377,8 @@ static void ATA_Recalibrate(uint8_t* tfr, hdfTYPE *hdf)
static void ATA_Diagnostic(uint8_t* tfr, hdfTYPE *hdf)
{
// Execute Drive Diagnostic (0x90)
(void)hdf;
(void)tfr;
hdd_debugf("IDE: Drive Diagnostic");
WriteTaskFile(1, 0, 0, 0, 0, 0);
WriteStatus(IDE_STATUS_END | IDE_STATUS_IRQ);
@@ -383,7 +386,6 @@ static void ATA_Diagnostic(uint8_t* tfr, hdfTYPE *hdf)
static void ATA_IdentifyDevice(uint8_t* tfr, hdfTYPE *hdf)
{
int i;
// Identify Device (0xec)
hdd_debugf("IDE%d: Identify Device", hdf->unit);
IdentifyDevice((uint16_t*)sector_buffer, hdf);
@@ -401,6 +403,7 @@ static void ATA_IdentifyDevice(uint8_t* tfr, hdfTYPE *hdf)
static void ATA_Initialize(uint8_t* tfr, hdfTYPE *hdf)
{
// Initialize Device Parameters (0x91)
(void)hdf;
hdd_debugf("Initialize Device Parameters");
hdd_debugf("IDE%d: %02X.%02X.%02X.%02X.%02X.%02X.%02X.%02X", hdf->unit, tfr[0], tfr[1], tfr[2], tfr[3], tfr[4], tfr[5], tfr[6], tfr[7]);
WriteTaskFile(0, tfr[2], tfr[3], tfr[4], tfr[5], tfr[6]);
@@ -535,7 +538,7 @@ static void WriteSector(hdfTYPE *hdf)
else
{
GetRDBGeometry(hdf);
printf("Using new CHS: %u/%u/%u (%lu MB)\n", hdf->cylinders, hdf->heads, hdf->sectors, ((((uint32_t)hdf->cylinders) * hdf->heads * hdf->sectors) >> 11));
printf("Using new CHS: %u/%u/%u (%llu MB)\n", hdf->cylinders, hdf->heads, hdf->sectors, ((((uint64_t)hdf->cylinders) * hdf->heads * hdf->sectors) >> 11));
}
}
FileWriteSec(&hdf->file, sector_buffer);
@@ -660,6 +663,8 @@ static void ATA_WriteMultiple(uint8_t* tfr, hdfTYPE *hdf)
void HandleHDD(uint8_t c1, uint8_t c2)
{
(void)c2;
if (c1 & CMD_IDECMD)
{
uint8_t unit = 0;
@@ -727,7 +732,7 @@ uint8_t OpenHardfile(uint8_t unit)
SetHardfileGeometry(hdf, !strcasecmp(".hdf", config.hardfile[unit].filename + strlen(config.hardfile[unit].filename) - 4));
printf("size: %llu (%llu MB)\n", hdf->file.size, hdf->file.size >> 20);
printf("CHS: %u/%u/%u", hdf->cylinders, hdf->heads, hdf->sectors);
printf(" (%lu MB), ", ((((uint32_t)hdf->cylinders) * hdf->heads * hdf->sectors) >> 11));
printf(" (%llu MB), ", ((((uint64_t)hdf->cylinders) * hdf->heads * hdf->sectors) >> 11));
printf("Offset: %d\n", hdf->offset);
return 1;
}
@@ -742,7 +747,7 @@ uint8_t OpenHardfile(uint8_t unit)
int checkHDF(const char* name, struct RigidDiskBlock **rdb)
{
fileTYPE file = { 0 };
fileTYPE file = {};
*rdb = NULL;
if (FileOpenEx(&file, name, O_RDONLY))

View File

@@ -253,7 +253,7 @@ int sharpmz_reload_config(short setStatus)
//
void sharpmz_init(void)
{
char i;
int i;
sharpmz_debugf("Sharp MZ Series Initialisation");
@@ -1253,7 +1253,7 @@ void sharpmz_set_fdc_rom_enabled(short machineModel, short on, short setStatus)
//
short sharpmz_get_custom_rom_enabled(short machineModel, short romType)
{
short romEnabled;
short romEnabled = 0;
machineModel &= 0x07;
romType &= 0x07;
@@ -1492,7 +1492,7 @@ void sharpmz_send_file(romData_t &image, char *dirPrefix)
unsigned int actualReadSize;
unsigned long time = GetTimer(0);
unsigned short i;
fileTYPE file = { 0 };
fileTYPE file = {};
// If a prefix is given (ie. core directory), prepend it before use.
//
@@ -1528,7 +1528,7 @@ void sharpmz_send_file(romData_t &image, char *dirPrefix)
sharpmz_debugf("[");
for (i = 0; i < image.loadSize; i += actualReadSize)
{
if (!(i & 127)) sharpmz_debugf("*");
if (!(i & 127)) { sharpmz_debugf("*"); }
// Work out size of data block to read.
int readSize = (image.loadSize - i >= 512 ? 512 : image.loadSize - i);
@@ -1574,7 +1574,7 @@ void sharpmz_send_file(romData_t &image, char *dirPrefix)
short sharpmz_read_ram(const char *memDumpFile, short bank)
{
unsigned int actualWriteSize;
fileTYPE file = { 0 };
fileTYPE file = {};
// Open the memory image debug file for writing.
if (!sharpmz_file_write(&file, memDumpFile))
@@ -1585,7 +1585,7 @@ short sharpmz_read_ram(const char *memDumpFile, short bank)
// Depending on the bank, or all banks, loop until request is complete.
//
for(unsigned int mb=(bank == SHARPMZ_MEMBANK_ALL ? 0 : bank); mb <= (bank == SHARPMZ_MEMBANK_ALL ? SHARPMZ_MEMBANK_MAXBANKS-1 : bank); mb++)
for(unsigned int mb=(bank == SHARPMZ_MEMBANK_ALL ? 0 : bank); mb <= (uint)(bank == SHARPMZ_MEMBANK_ALL ? SHARPMZ_MEMBANK_MAXBANKS-1 : bank); mb++)
{
// Skip bank 1, as SYSROM spans two physical banks 0 and 1.
if(mb == 1) mb = SHARPMZ_MEMBANK_SYSRAM;
@@ -1603,7 +1603,7 @@ short sharpmz_read_ram(const char *memDumpFile, short bank)
sharpmz_debugf("[");
for (unsigned long j = 0; j < MZBANKSIZE[mb] or actualWriteSize == 0; j += actualWriteSize)
{
if (!(j & 127)) sharpmz_debugf("*");
if (!(j & 127)) { sharpmz_debugf("*"); }
spi_read(sector_buffer, 512, 0);
@@ -1637,7 +1637,7 @@ short sharpmz_read_tape_header(const char *tapeFile)
// Handle for the MZF file to be processed.
//
fileTYPE file = { 0 };
fileTYPE file = {};
// Try and open the tape file, exit if it cannot be opened.
//
@@ -1668,13 +1668,13 @@ short sharpmz_load_tape_to_ram(const char *tapeFile, unsigned char dstCMT)
{
unsigned int actualReadSize;
unsigned long time = GetTimer(0);
char fileName[17];
//char fileName[17];
//sharpmz_debugf("Sending tape file:%s to emulator ram", tapeFile);
// Handle for the MZF file to be processed.
//
fileTYPE file = { 0 };
fileTYPE file = {};
// Try and open the tape file, exit if it cannot be opened.
//
@@ -1692,10 +1692,12 @@ short sharpmz_load_tape_to_ram(const char *tapeFile, unsigned char dstCMT)
// Some sanity checks.
//
if(tapeHeader.dataType == 0 || tapeHeader.dataType > 5) return(4);
/*
for(int i=0; i < 17; i++)
{
fileName[i] = tapeHeader.fileName[i] == 0x0d ? 0x00 : tapeHeader.fileName[i];
}
*/
// Debug output to indicate the file loaded and information about the tape image.
//
@@ -1756,7 +1758,7 @@ short sharpmz_load_tape_to_ram(const char *tapeFile, unsigned char dstCMT)
sharpmz_debugf("[");
for (unsigned short i = 0; i < tapeHeader.fileSize; i += actualReadSize)
{
if (!(i & 127)) sharpmz_debugf("*");
if (!(i & 127)) { sharpmz_debugf("*"); }
DISKLED_ON;
actualReadSize = sharpmz_file_read(&file, sector_buffer, 512);
@@ -1865,7 +1867,7 @@ short sharpmz_save_tape_from_cmt(const char *tapeFile)
// Handle for the MZF file to be written.
//
fileTYPE file = { 0 };
fileTYPE file = {};
// Read the header, then data, but limit data size to the 'file size' stored in the header.
//
@@ -1946,6 +1948,7 @@ short sharpmz_save_tape_from_cmt(const char *tapeFile)
void sharpmz_select_file(const char* pFileExt, unsigned char Options, char *fs_pFileExt, char chdir, char *SelectedPath)
{
sharpmz_debugf("pFileExt = %s\n", pFileExt);
(void)chdir;
if (strncasecmp(SHARPMZ_CORE_NAME, SelectedPath, strlen(SHARPMZ_CORE_NAME))) strcpy(SelectedPath, SHARPMZ_CORE_NAME);
@@ -1991,17 +1994,19 @@ void sharpmz_ui(int idleState, int idle2State, int system
static short scrollPos = 0;
static short volumeDir = 0;
int menuItem;
int subItem;
uint32_t subItem;
short romEnabled;
short itemCount;
char sBuf[40];
char *fileName;
(void)plus;
(void)minus;
// Idle2 state (MENU_NONE2) is our main hook, when the HandleUI state machine reaches this state, if the menu key is pressed,
// we takeover control in this method.
//
if(*menustate == idle2State && menu)
if(*menustate == (uint32_t)idle2State && menu)
{
OsdSetSize(16);
*menusub = 0;

View File

@@ -375,10 +375,11 @@ void ikbd_reset(void) {
// process inout from atari core into ikbd
void ikbd_handle_input(unsigned char cmd) {
// store byte in buffer
ikbd.buffer.byte[ikbd.buffer.size++] = cmd;
unsigned char *byte = ikbd.buffer.byte;
byte[(int)(ikbd.buffer.size++)] = cmd;
// check if there's a known command in the buffer
char c;
int c;
for (c = 0; ikbd_command_handler[c].length &&
(ikbd_command_handler[c].code != ikbd.buffer.command.code); c++);
@@ -445,7 +446,7 @@ static void ikbd_update_time()
void ikbd_poll(void) {
#ifdef IKBD_DEBUG
static unsigned long xtimer = 0;
static int last_cnt = 0;
static unsigned int last_cnt = 0;
if (CheckTimer(xtimer)) {
xtimer = GetTimer(2000);
if (ikbd.tx_cnt != last_cnt) {
@@ -469,7 +470,7 @@ void ikbd_poll(void) {
/* --------- joystick ---------- */
if (ikbd.state & IKBD_STATE_JOYSTICK_EVENT_REPORTING) {
char i;
int i;
for (i = 0; i<2; i++) {
unsigned char state = ikbd.joy[i].state;
@@ -599,7 +600,7 @@ void ikbd_keyboard(unsigned char code) {
enqueue(code);
}
void ikbd_mouse(unsigned char b, char x, char y) {
void ikbd_mouse(unsigned char b, signed char x, signed char y) {
// honour reversal of y axis
if (ikbd.state & IKBD_STATE_MOUSE_Y_BOTTOM)

View File

@@ -5,7 +5,7 @@ void ikbd_init(void);
void ikbd_poll(void);
void ikbd_reset(void);
void ikbd_joystick(unsigned char joy, unsigned char map);
void ikbd_mouse(unsigned char buttons, char x, char y);
void ikbd_mouse(unsigned char buttons, signed char x, signed char y);
void ikbd_keyboard(unsigned char code);
#endif // IKBD_H

View File

@@ -36,10 +36,10 @@ static struct {
fileTYPE file;
unsigned char sides;
unsigned char spt;
} fdd_image[2] = { 0 };
} fdd_image[2] = {};
// one harddisk
fileTYPE hdd_image[2] = { 0 };
fileTYPE hdd_image[2] = {};
unsigned long hdd_direct = 0;
static unsigned char dma_buffer[512];
@@ -66,7 +66,7 @@ static const char *acsi_cmd_name(int cmd) {
return cmdname[cmd];
}
void tos_set_video_adjust(char axis, char value) {
void tos_set_video_adjust(int axis, char value) {
config.video_adjust[axis] += value;
EnableFpga();
@@ -76,7 +76,7 @@ void tos_set_video_adjust(char axis, char value) {
DisableFpga();
}
char tos_get_video_adjust(char axis) {
char tos_get_video_adjust(int axis) {
return config.video_adjust[axis];
}
@@ -105,6 +105,7 @@ static void mist_set_control(unsigned long ctrl) {
DisableFpga();
}
/*
static void mist_memory_read(char *data, unsigned long words) {
EnableFpga();
spi8(MIST_READ_MEMORY);
@@ -117,6 +118,7 @@ static void mist_memory_read(char *data, unsigned long words) {
DisableFpga();
}
*/
static void mist_memory_write(unsigned char *data, unsigned long words) {
EnableFpga();
@@ -162,6 +164,7 @@ void mist_memory_set(char data, unsigned long words) {
// enable direct sd card access on acsi0
void tos_set_direct_hdd(char on) {
(void)on;
config.sd_direct = 0;
tos_debugf("ACSI: disable direct sd access");
@@ -208,12 +211,12 @@ static void handle_acsi(unsigned char *buffer) {
if (length == 0) length = 256;
if (user_io_dip_switch1()) {
tos_debugf("ACSI: target %d.%d, \"%s\" (%02x)", target, device, acsi_cmd_name(cmd), cmd);
tos_debugf("ACSI: target %u.%u, \"%s\" (%02x)", target, device, acsi_cmd_name(cmd), cmd);
tos_debugf("ACSI: lba %lu (%lx), length %u", lba, lba, length);
tos_debugf("DMA: scnt %u, addr %p", scnt, dma_address);
tos_debugf("DMA: scnt %u, addr %X", scnt, dma_address);
if (buffer[20] == 0xa5) {
tos_debugf("DMA: fifo %d/%d %x %s",
tos_debugf("DMA: fifo %u/%u %x %s",
(buffer[21] >> 4) & 0x0f, buffer[21] & 0x0f,
buffer[22], (buffer[2] & 1) ? "OUT" : "IN");
tos_debugf("DMA stat=%x, mode=%x, fdc_irq=%d, acsi_irq=%d",
@@ -308,7 +311,7 @@ static void handle_acsi(unsigned char *buffer) {
asc[target] = 0x00;
}
else {
tos_debugf("ACSI: read (%d+%d) exceeds device limits (%d)",
tos_debugf("ACSI: read (%lu+%u) exceeds device limits (%lu)",
lba, length, blocks);
dma_ack(0x02);
asc[target] = 0x21;
@@ -348,7 +351,7 @@ static void handle_acsi(unsigned char *buffer) {
asc[target] = 0x00;
}
else {
tos_debugf("ACSI: write (%d+%d) exceeds device limits (%d)",
tos_debugf("ACSI: write (%lu+%u) exceeds device limits (%lu)",
lba, length, blocks);
dma_ack(0x02);
asc[target] = 0x21;
@@ -380,7 +383,7 @@ static void handle_acsi(unsigned char *buffer) {
case 0x1a: // mode sense
if (device == 0) {
tos_debugf("ACSI: mode sense, blocks = %u", blocks);
tos_debugf("ACSI: mode sense, blocks = %lu", blocks);
bzero(dma_buffer, 512);
dma_buffer[3] = 8; // size of extent descriptor list
dma_buffer[5] = blocks >> 16;
@@ -430,7 +433,7 @@ static void handle_fdc(unsigned char *buffer) {
unsigned char fdc_cmd = buffer[4];
unsigned char fdc_track = buffer[5];
unsigned char fdc_sector = buffer[6];
unsigned char fdc_data = buffer[7];
//unsigned char fdc_data = buffer[7];
unsigned char drv_sel = 3 - ((buffer[8] >> 2) & 3);
unsigned char drv_side = 1 - ((buffer[8] >> 1) & 1);
@@ -450,7 +453,7 @@ static void handle_fdc(unsigned char *buffer) {
offset += fdc_sector - 1;
if (user_io_dip_switch1()) {
tos_debugf("FDC %s req %d sec (%c, SD:%d, T:%d, S:%d = %d) -> %p",
tos_debugf("FDC %s req %d sec (%c, SD:%d, T:%d, S:%d = %d) -> %X",
(fdc_cmd & 0x10) ? "multi" : "single", scnt,
'A' + drv_sel - 1, drv_side, fdc_track, fdc_sector, offset,
dma_address);
@@ -534,6 +537,7 @@ static void mist_get_dmastate() {
#define PLANES 4
static void tos_write(const char *str);
/*
static void tos_color_test() {
unsigned short buffer[COLORS][PLANES];
@@ -569,6 +573,7 @@ static void tos_color_test() {
// for(;;);
#endif
}
*/
static void tos_write(const char *str) {
static int y = 0;
@@ -614,7 +619,7 @@ static void tos_clr() {
extern unsigned char charfont[256][8];
static void tos_font_load() {
fileTYPE file = { 0 };
fileTYPE file = {};
if (FileOpen(&file, "SYSTEM.FNT")) {
if (file.size == 4096) {
int i;
@@ -648,7 +653,7 @@ static void tos_font_load() {
void tos_load_cartridge(const char *name)
{
fileTYPE file = { 0 };
fileTYPE file = {};
if (name)
strncpy(config.cart_img, name, 11);
@@ -658,7 +663,7 @@ void tos_load_cartridge(const char *name)
int i;
unsigned char buffer[512];
tos_debugf("%s:\n size = %d", config.cart_img, file.size);
tos_debugf("%s:\n size = %llu", config.cart_img, file.size);
int blocks = file.size / 512;
tos_debugf(" blocks = %d", blocks);
@@ -697,7 +702,7 @@ char tos_cartridge_is_inserted() {
void tos_upload(const char *name)
{
fileTYPE file = { 0 };
fileTYPE file = {};
// set video offset in fpga
tos_set_video_adjust(0, 0);
@@ -727,7 +732,7 @@ void tos_upload(const char *name)
unsigned long time;
unsigned long tos_base = TOS_BASE_ADDRESS_192k;
tos_debugf("TOS.IMG:\n size = %d", file.size);
tos_debugf("TOS.IMG:\n size = %llu", file.size);
if (file.size >= 256 * 1024)
tos_base = TOS_BASE_ADDRESS_256k;
@@ -737,7 +742,7 @@ void tos_upload(const char *name)
int blocks = file.size / 512;
tos_debugf(" blocks = %d", blocks);
tos_debugf(" address = $%08x", tos_base);
tos_debugf(" address = $%08lx", tos_base);
// clear first 16k
mist_memory_set_address(0, 16384 / 512, 0);
@@ -828,7 +833,7 @@ void tos_upload(const char *name)
#endif
time = GetTimer(0) - time;
tos_debugf("TOS.IMG uploaded in %lu ms (%d kB/s / %d kBit/s)",
tos_debugf("TOS.IMG uploaded in %lu ms (%llu kB/s / %llu kBit/s)",
time >> 20, file.size / (time >> 20), 8 * file.size / (time >> 20));
}
@@ -851,9 +856,9 @@ void tos_upload(const char *name)
// try to open both floppies
int i;
for (i = 0; i<2; i++) {
char msg[] = "Found floppy disk image for drive X: ";
//char msg[] = "Found floppy disk image for drive X: ";
char name[] = "DISK_A.ST";
msg[34] = name[5] = 'A' + i;
//msg[34] = name[5] = 'A' + i;
tos_insert_disk(i, name);
}
@@ -889,6 +894,7 @@ void tos_upload(const char *name)
mist_set_control(config.system_ctrl);
}
/*
static unsigned long get_long(char *buffer, int offset) {
unsigned long retval = 0;
int i;
@@ -898,6 +904,7 @@ static unsigned long get_long(char *buffer, int offset) {
return retval;
}
*/
void tos_poll() {
// 1 == button not pressed, 2 = 1 sec exceeded, else timer running
@@ -950,9 +957,8 @@ static void nice_name(char *dest, char *src) {
static char buffer[17]; // local buffer to assemble file name (8+3+2)
char *tos_get_disk_name(char index) {
char *tos_get_disk_name(int index) {
fileTYPE file;
char *c;
if (index <= 1)
file = fdd_image[index].file;
@@ -983,14 +989,14 @@ char *tos_get_cartridge_name() {
return buffer;
}
char tos_disk_is_inserted(char index) {
char tos_disk_is_inserted(int index) {
if (index <= 1)
return (fdd_image[index].file.size != 0);
return hdd_image[index - 2].size != 0;
}
void tos_select_hdd_image(char i, const char *name)
void tos_select_hdd_image(int i, const char *name)
{
tos_debugf("Select ACSI%c image %s", '0' + i, name);
@@ -1015,7 +1021,7 @@ void tos_select_hdd_image(char i, const char *name)
mist_set_control(config.system_ctrl);
}
void tos_insert_disk(char i, const char *name)
void tos_insert_disk(int i, const char *name)
{
if (i > 1)
{
@@ -1136,7 +1142,7 @@ void tos_config_init(void)
int size = FileLoadConfig(CONFIG_FILENAME, 0, 0);
if (size>0)
{
tos_debugf("Configuration file size: %lu (should be %lu)", size, sizeof(tos_config_t));
tos_debugf("Configuration file size: %u (should be %u)", size, sizeof(tos_config_t));
if (size == sizeof(tos_config_t))
{
FileLoadConfig(CONFIG_FILENAME, &config, size);

View File

@@ -85,11 +85,11 @@ unsigned long tos_system_ctrl(void);
void tos_upload(const char *);
void tos_poll();
void tos_update_sysctrl(unsigned long);
char *tos_get_disk_name(char);
char tos_disk_is_inserted(char index);
void tos_insert_disk(char i, const char *name);
char *tos_get_disk_name(int);
char tos_disk_is_inserted(int index);
void tos_insert_disk(int i, const char *name);
void tos_eject_all();
void tos_select_hdd_image(char i, const char *name);
void tos_select_hdd_image(int i, const char *name);
void tos_set_direct_hdd(char on);
char tos_get_direct_hdd();
void tos_reset(char cold);
@@ -98,8 +98,8 @@ char *tos_get_cartridge_name();
char tos_cartridge_is_inserted();
void tos_load_cartridge(const char *);
void tos_set_video_adjust(char axis, char value);
char tos_get_video_adjust(char axis);
void tos_set_video_adjust(int axis, char value);
char tos_get_video_adjust(int axis);
void tos_config_init(void);
void tos_config_save(void);

View File

@@ -72,6 +72,7 @@ static uint8_t dma_sdio(int status)
return res;
}
/*
static uint32_t dma_get(uint32_t address)
{
EnableFpga();
@@ -81,6 +82,7 @@ static uint32_t dma_get(uint32_t address)
DisableFpga();
return res;
}
*/
static void dma_set(uint32_t address, uint32_t data)
{
@@ -111,7 +113,7 @@ static void dma_rcvbuf(uint32_t address, uint32_t length, uint32_t *data)
static int load_bios(const char* name, uint8_t index)
{
fileTYPE f = { 0 };
fileTYPE f = {};
static uint32_t buf[128];
if (!FileOpen(&f, name)) return 0;
@@ -155,10 +157,10 @@ static bool floppy_is_2_88m= false;
#define CMOS_FDD_TYPE ((floppy_is_2_88m) ? 0x50 : (floppy_is_1_44m || floppy_is_1_68m) ? 0x40 : (floppy_is_720k) ? 0x30 : (floppy_is_1_2m) ? 0x20 : 0x10)
static fileTYPE fdd_image0 = { 0 };
static fileTYPE fdd_image1 = { 0 };
static fileTYPE hdd_image0 = { 0 };
static fileTYPE hdd_image1 = { 0 };
static fileTYPE fdd_image0 = {};
static fileTYPE fdd_image1 = {};
static fileTYPE hdd_image0 = {};
static fileTYPE hdd_image1 = {};
static bool boot_from_floppy = 1;
#define IMG_TYPE_FDD0 0x0800
@@ -210,8 +212,8 @@ static int img_write(uint32_t type, uint32_t lba, void *buf, uint32_t len)
#define IOWR(base, reg, value) dma_set(base+(reg<<2), value)
static uint32_t cmos[128];
void cmos_set(int addr, uint8_t val)
/*
static void cmos_set(uint addr, uint8_t val)
{
if (addr >= sizeof(cmos)) return;
@@ -229,6 +231,7 @@ void cmos_set(int addr, uint8_t val)
IOWR(RTC_BASE, 0x2E, cmos[0x2E]);
IOWR(RTC_BASE, 0x2F, cmos[0x2F]);
}
*/
static int fdd_set(char* filename)
{
@@ -661,7 +664,7 @@ struct sd_param_t
uint32_t bl_cnt;
};
static struct sd_param_t sd_params = { 0 };
static struct sd_param_t sd_params = {};
void x86_poll()
{