diff --git a/src/cdrom/cdrom.c b/src/cdrom/cdrom.c index 89d0edd6e..4d1571491 100644 --- a/src/cdrom/cdrom.c +++ b/src/cdrom/cdrom.c @@ -1434,23 +1434,23 @@ static void cdrom_command_common(uint8_t id) cdrom[id].pos = 0; if (cdrom[id].packet_status == CDROM_PHASE_COMPLETE) { - cdrom[id].callback = 20 * CDROM_TIME; + cdrom[id].callback = 20LL * CDROM_TIME; } else if (cdrom[id].packet_status == CDROM_PHASE_DATA_IN) { if (cdrom[id].current_cdb[0] == 0x42) { cdrom_log("CD-ROM %i: READ SUBCHANNEL\n"); - cdrom[id].callback = 1000 * CDROM_TIME; + cdrom[id].callback = 1000LL * CDROM_TIME; } else { - cdrom[id].callback = 60 * CDROM_TIME; + cdrom[id].callback = 60LL * CDROM_TIME; } } else { - cdrom[id].callback = 60 * CDROM_TIME; + cdrom[id].callback = 60LL * CDROM_TIME; } } @@ -1565,7 +1565,7 @@ static void cdrom_cmd_error(uint8_t id) cdrom[id].status = READY_STAT | ERR_STAT; cdrom[id].phase = 3; cdrom[id].packet_status = 0x80; - cdrom[id].callback = 50 * CDROM_TIME; + cdrom[id].callback = 50LL * CDROM_TIME; cdrom_log("CD-ROM %i: ERROR: %02X/%02X/%02X\n", id, cdrom_sense_key, cdrom_asc, cdrom_ascq); } @@ -1580,7 +1580,7 @@ static void cdrom_unit_attention(uint8_t id) cdrom[id].status = READY_STAT | ERR_STAT; cdrom[id].phase = 3; cdrom[id].packet_status = 0x80; - cdrom[id].callback = 50 * CDROM_TIME; + cdrom[id].callback = 50LL * CDROM_TIME; cdrom_log("CD-ROM %i: UNIT ATTENTION\n", id); } @@ -2179,7 +2179,7 @@ void cdrom_clear_callback(uint8_t channel) if (id <= CDROM_NUM) { - cdrom[id].callback = 0; + cdrom[id].callback = 0LL; } } @@ -2207,7 +2207,7 @@ void cdrom_reset(uint8_t id) { cdrom_rezero(id); cdrom[id].status = 0; - cdrom[id].callback = 0; + cdrom[id].callback = 0LL; cdrom[id].packet_status = 0xff; cdrom[id].unit_attention = 0; } @@ -2560,7 +2560,7 @@ cdrom_readtoc_fallback: SCSIPhase = SCSI_PHASE_STATUS; /* cdrom_log("CD-ROM %i: All done - callback set\n", id); */ cdrom[id].packet_status = CDROM_PHASE_COMPLETE; - cdrom[id].callback = 20 * CDROM_TIME; + cdrom[id].callback = 20LL * CDROM_TIME; break; } diff --git a/src/cdrom/cdrom.h b/src/cdrom/cdrom.h index 7524dbf2c..842810f7d 100644 --- a/src/cdrom/cdrom.h +++ b/src/cdrom/cdrom.h @@ -33,8 +33,8 @@ #define CDROM_IMAGE 200 -#define IDE_TIME (5 * 100 * (1 << TIMER_SHIFT)) -#define CDROM_TIME (5 * 100 * (1 << TIMER_SHIFT)) +#define IDE_TIME (5LL * 100LL * (1LL << TIMER_SHIFT)) +#define CDROM_TIME (5LL * 100LL * (1LL << TIMER_SHIFT)) typedef struct { diff --git a/src/disk/hdc_esdi_at.c b/src/disk/hdc_esdi_at.c index 3872a8511..ce5dc3e69 100644 --- a/src/disk/hdc_esdi_at.c +++ b/src/disk/hdc_esdi_at.c @@ -37,7 +37,7 @@ #include "hdd.h" -#define HDC_TIME (TIMER_USEC*10) +#define HDC_TIME (TIMER_USEC*10LL) #define BIOS_FILE L"roms/hdd/esdi_at/62-000279-061.bin" #define STAT_ERR 0x01 @@ -95,7 +95,7 @@ typedef struct { uint16_t buffer[256]; int irqstat; - int callback; + int64_t callback; drive_t drives[2]; @@ -201,7 +201,7 @@ esdi_writew(uint16_t port, uint16_t val, void *priv) esdi->pos = 0; esdi->status = STAT_BUSY; timer_process(); - esdi->callback = 6*HDC_TIME; + esdi->callback = 6LL*HDC_TIME; timer_update_outstanding(); } } @@ -256,7 +256,7 @@ esdi_write(uint16_t port, uint8_t val, void *priv) esdi->command &= ~0x0f; /*Mask off step rate*/ esdi->status = STAT_BUSY; timer_process(); - esdi->callback = 200*HDC_TIME; + esdi->callback = 200LL*HDC_TIME; timer_update_outstanding(); break; @@ -264,7 +264,7 @@ esdi_write(uint16_t port, uint8_t val, void *priv) esdi->command &= ~0x0f; /*Mask off step rate*/ esdi->status = STAT_BUSY; timer_process(); - esdi->callback = 200*HDC_TIME; + esdi->callback = 200LL*HDC_TIME; timer_update_outstanding(); break; @@ -273,7 +273,7 @@ esdi_write(uint16_t port, uint8_t val, void *priv) case CMD_NOP: esdi->status = STAT_BUSY; timer_process(); - esdi->callback = 200*HDC_TIME; + esdi->callback = 200LL*HDC_TIME; timer_update_outstanding(); break; @@ -288,7 +288,7 @@ esdi_write(uint16_t port, uint8_t val, void *priv) case 0xa0: esdi->status = STAT_BUSY; timer_process(); - esdi->callback = 200*HDC_TIME; + esdi->callback = 200LL*HDC_TIME; timer_update_outstanding(); break; @@ -308,7 +308,7 @@ esdi_write(uint16_t port, uint8_t val, void *priv) esdi->command &= ~1; esdi->status = STAT_BUSY; timer_process(); - esdi->callback = 200*HDC_TIME; + esdi->callback = 200LL*HDC_TIME; timer_update_outstanding(); break; @@ -320,14 +320,14 @@ esdi_write(uint16_t port, uint8_t val, void *priv) case CMD_SET_PARAMETERS: /* Initialize Drive Parameters */ esdi->status = STAT_BUSY; timer_process(); - esdi->callback = 30*HDC_TIME; + esdi->callback = 30LL*HDC_TIME; timer_update_outstanding(); break; case CMD_DIAGNOSE: /* Execute Drive Diagnostics */ esdi->status = STAT_BUSY; timer_process(); - esdi->callback = 200*HDC_TIME; + esdi->callback = 200LL*HDC_TIME; timer_update_outstanding(); break; @@ -335,7 +335,7 @@ esdi_write(uint16_t port, uint8_t val, void *priv) case CMD_READ_PARAMETERS: esdi->status = STAT_BUSY; timer_process(); - esdi->callback = 200*HDC_TIME; + esdi->callback = 200LL*HDC_TIME; timer_update_outstanding(); break; @@ -344,7 +344,7 @@ esdi_write(uint16_t port, uint8_t val, void *priv) case 0xe8: /*???*/ esdi->status = STAT_BUSY; timer_process(); - esdi->callback = 200*HDC_TIME; + esdi->callback = 200LL*HDC_TIME; timer_update_outstanding(); break; } @@ -354,7 +354,7 @@ esdi_write(uint16_t port, uint8_t val, void *priv) case 0x3F6: /* Device control */ if ((esdi->fdisk & 4) && !(val & 4)) { timer_process(); - esdi->callback = 500*HDC_TIME; + esdi->callback = 500LL*HDC_TIME; timer_update_outstanding(); esdi->reset = 1; esdi->status = STAT_BUSY; @@ -363,7 +363,7 @@ esdi_write(uint16_t port, uint8_t val, void *priv) if (val & 4) { /*Drive held in reset*/ timer_process(); - esdi->callback = 0; + esdi->callback = 0LL; timer_update_outstanding(); esdi->status = STAT_BUSY; } @@ -391,7 +391,7 @@ esdi_readw(uint16_t port, void *priv) next_sector(esdi); esdi->status = STAT_BUSY; timer_process(); - esdi->callback = 6*HDC_TIME; + esdi->callback = 6LL*HDC_TIME; timer_update_outstanding(); } } @@ -579,7 +579,7 @@ esdi_callback(void *priv) next_sector(esdi); esdi->secount = (esdi->secount - 1) & 0xff; if (esdi->secount) - esdi->callback = 6*HDC_TIME; + esdi->callback = 6LL*HDC_TIME; else { esdi->pos = 0; esdi->status = STAT_READY | STAT_DSC; diff --git a/src/disk/hdc_esdi_mca.c b/src/disk/hdc_esdi_mca.c index 6f50a7622..e7ca5cc0d 100644 --- a/src/disk/hdc_esdi_mca.c +++ b/src/disk/hdc_esdi_mca.c @@ -87,7 +87,7 @@ #define BIOS_FILE_H L"roms/hdd/esdi/90x8970.bin" -#define ESDI_TIME (200*TIMER_USEC) +#define ESDI_TIME (200LL*TIMER_USEC) #define CMD_ADAPTER 0 @@ -133,7 +133,7 @@ typedef struct esdi { int cmd_state; int in_reset; - int callback; + int64_t callback; uint32_t rba; @@ -278,7 +278,7 @@ esdi_callback(void *priv) drive_t *drive; int val; - dev->callback = 0; + dev->callback = 0LL; /* If we are returning from a RESET, handle this first. */ if (dev->in_reset) { @@ -679,7 +679,7 @@ esdi_write(uint16_t port, uint8_t val, void *priv) case 2: /*Basic control register*/ if ((dev->basic_ctrl & CTRL_RESET) && !(val & CTRL_RESET)) { dev->in_reset = 1; - dev->callback = ESDI_TIME * 50; + dev->callback = ESDI_TIME * 50LL; dev->status = STATUS_BUSY; } dev->basic_ctrl = val; @@ -709,7 +709,7 @@ esdi_write(uint16_t port, uint8_t val, void *priv) case ATTN_RESET: dev->in_reset = 1; - dev->callback = ESDI_TIME * 50; + dev->callback = ESDI_TIME * 50LL; dev->status = STATUS_BUSY; break; @@ -1029,7 +1029,7 @@ esdi_init(device_t *info) /* Mark for a reset. */ dev->in_reset = 1; - dev->callback = ESDI_TIME * 50; + dev->callback = ESDI_TIME * 50LL; dev->status = STATUS_BUSY; /* Set the reply timer. */ diff --git a/src/disk/hdc_ide.c b/src/disk/hdc_ide.c index da90da64f..38ad9aefb 100644 --- a/src/disk/hdc_ide.c +++ b/src/disk/hdc_ide.c @@ -92,7 +92,7 @@ IDE *ext_ide; int (*ide_bus_master_read)(int channel, uint8_t *data, int transfer_length); int (*ide_bus_master_write)(int channel, uint8_t *data, int transfer_length); void (*ide_bus_master_set_irq)(int channel); -int idecallback[5] = {0, 0, 0, 0, 0}; +int64_t idecallback[5] = {0LL, 0LL, 0LL, 0LL, 0LL}; int cur_ide[5]; @@ -629,9 +629,9 @@ void ide_reset(void) ide_drives[d].board = d >> 1; } - idecallback[0]=idecallback[1]=0; - idecallback[2]=idecallback[3]=0; - idecallback[4]=0; + idecallback[0]=idecallback[1]=0LL; + idecallback[2]=idecallback[3]=0LL; + idecallback[4]=0LL; pclog("IDE: loading disks...\n"); c = 0; @@ -748,7 +748,7 @@ void ide_write_data(int ide_board, uint32_t val, int length) } else { - idecallback[ide_board]=6*IDE_TIME; + idecallback[ide_board]=6LL*IDE_TIME; } timer_update_outstanding(); } @@ -878,7 +878,7 @@ void writeide(int ide_board, uint16_t addr, uint8_t val) cdrom[atapi_cdrom_drives[ide->channel]].error = 1; cdrom[atapi_cdrom_drives[ide->channel]].phase = 1; cdrom[atapi_cdrom_drives[ide->channel]].request_length = 0xEB14; - cdrom[atapi_cdrom_drives[ide->channel]].callback = 0; + cdrom[atapi_cdrom_drives[ide->channel]].callback = 0LL; ide->cylinder = 0xEB14; } if (ide_drive_is_cdrom(ide_other)) @@ -887,11 +887,11 @@ void writeide(int ide_board, uint16_t addr, uint8_t val) cdrom[atapi_cdrom_drives[ide_other->channel]].error = 1; cdrom[atapi_cdrom_drives[ide_other->channel]].phase = 1; cdrom[atapi_cdrom_drives[ide_other->channel]].request_length = 0xEB14; - cdrom[atapi_cdrom_drives[ide_other->channel]].callback = 0; + cdrom[atapi_cdrom_drives[ide_other->channel]].callback = 0LL; ide->cylinder = 0xEB14; } - idecallback[ide_board] = 0; + idecallback[ide_board] = 0LL; timer_update_outstanding(); return; } @@ -938,9 +938,9 @@ void writeide(int ide_board, uint16_t addr, uint8_t val) timer_process(); if (ide_drive_is_cdrom(ide)) { - cdrom[atapi_cdrom_drives[ide->channel]].callback = 100*IDE_TIME; + cdrom[atapi_cdrom_drives[ide->channel]].callback = 100LL*IDE_TIME; } - idecallback[ide_board]=100*IDE_TIME; + idecallback[ide_board]=100LL*IDE_TIME; timer_update_outstanding(); return; @@ -957,9 +957,9 @@ void writeide(int ide_board, uint16_t addr, uint8_t val) timer_process(); if (ide_drive_is_cdrom(ide)) { - cdrom[atapi_cdrom_drives[ide->channel]].callback = 100*IDE_TIME; + cdrom[atapi_cdrom_drives[ide->channel]].callback = 100LL*IDE_TIME; } - idecallback[ide_board]=100*IDE_TIME; + idecallback[ide_board]=100LL*IDE_TIME; timer_update_outstanding(); return; @@ -985,9 +985,9 @@ void writeide(int ide_board, uint16_t addr, uint8_t val) timer_process(); if (ide_drive_is_cdrom(ide)) { - cdrom[atapi_cdrom_drives[ide->channel]].callback = 200*IDE_TIME; + cdrom[atapi_cdrom_drives[ide->channel]].callback = 200LL*IDE_TIME; } - idecallback[ide_board]=200*IDE_TIME; + idecallback[ide_board]=200LL*IDE_TIME; timer_update_outstanding(); ide->do_initial_read = 1; return; @@ -1025,9 +1025,9 @@ void writeide(int ide_board, uint16_t addr, uint8_t val) timer_process(); if (ide_drive_is_cdrom(ide)) { - cdrom[atapi_cdrom_drives[ide->channel]].callback = 200*IDE_TIME; + cdrom[atapi_cdrom_drives[ide->channel]].callback = 200LL*IDE_TIME; } - idecallback[ide_board]=200*IDE_TIME; + idecallback[ide_board]=200LL*IDE_TIME; timer_update_outstanding(); return; @@ -1044,9 +1044,9 @@ void writeide(int ide_board, uint16_t addr, uint8_t val) timer_process(); if (ide_drive_is_cdrom(ide)) { - cdrom[atapi_cdrom_drives[ide->channel]].callback = 200*IDE_TIME; + cdrom[atapi_cdrom_drives[ide->channel]].callback = 200LL*IDE_TIME; } - idecallback[ide_board]=200*IDE_TIME; + idecallback[ide_board]=200LL*IDE_TIME; timer_update_outstanding(); return; @@ -1074,9 +1074,9 @@ void writeide(int ide_board, uint16_t addr, uint8_t val) timer_process(); if (ide_drive_is_cdrom(ide)) { - cdrom[atapi_cdrom_drives[ide->channel]].callback = 30*IDE_TIME; + cdrom[atapi_cdrom_drives[ide->channel]].callback = 30LL*IDE_TIME; } - idecallback[ide_board]=30*IDE_TIME; + idecallback[ide_board]=30LL*IDE_TIME; timer_update_outstanding(); return; @@ -1105,9 +1105,9 @@ void writeide(int ide_board, uint16_t addr, uint8_t val) /* callbackide(ide_board); */ if (ide_drive_is_cdrom(ide)) { - cdrom[atapi_cdrom_drives[ide->channel]].callback = 200 * IDE_TIME; + cdrom[atapi_cdrom_drives[ide->channel]].callback = 200LL * IDE_TIME; } - idecallback[ide_board] = 200 * IDE_TIME; + idecallback[ide_board] = 200LL * IDE_TIME; timer_update_outstanding(); } else @@ -1123,9 +1123,9 @@ void writeide(int ide_board, uint16_t addr, uint8_t val) timer_process(); if (ide_drive_is_cdrom(ide)) { - cdrom[atapi_cdrom_drives[ide->channel]].callback = 30 * IDE_TIME; + cdrom[atapi_cdrom_drives[ide->channel]].callback = 30LL * IDE_TIME; } - idecallback[ide_board] = 30 * IDE_TIME; + idecallback[ide_board] = 30LL * IDE_TIME; timer_update_outstanding(); } return; @@ -1143,9 +1143,9 @@ void writeide(int ide_board, uint16_t addr, uint8_t val) timer_process(); if (ide_drive_is_cdrom(ide)) { - cdrom[atapi_cdrom_drives[ide->channel]].callback = 200*IDE_TIME; + cdrom[atapi_cdrom_drives[ide->channel]].callback = 200LL*IDE_TIME; } - idecallback[ide_board]=200*IDE_TIME; + idecallback[ide_board]=200LL*IDE_TIME; timer_update_outstanding(); return; @@ -1162,7 +1162,7 @@ void writeide(int ide_board, uint16_t addr, uint8_t val) { ide->atastat = BUSY_STAT; timer_process(); - idecallback[ide_board]=1; + idecallback[ide_board]=1LL; timer_update_outstanding(); ide->pos=0; } @@ -1192,9 +1192,9 @@ ide_bad_command: timer_process(); if (ide_drive_is_cdrom(ide)) { - cdrom[atapi_cdrom_drives[ide->channel]].callback = 0; + cdrom[atapi_cdrom_drives[ide->channel]].callback = 0LL; } - idecallback[ide_board]=500*IDE_TIME; + idecallback[ide_board]=500LL*IDE_TIME; timer_update_outstanding(); if (ide->type != IDE_NONE) @@ -1215,7 +1215,7 @@ ide_bad_command: { /*Drive held in reset*/ timer_process(); - idecallback[ide_board] = 0; + idecallback[ide_board] = 0LL; timer_update_outstanding(); ide->atastat = ide_other->atastat = BUSY_STAT; } @@ -1291,7 +1291,7 @@ uint32_t ide_read_data(int ide_board, int length) } else { - idecallback[ide_board]=6*IDE_TIME; + idecallback[ide_board]=6LL*IDE_TIME; } timer_update_outstanding(); } @@ -1497,7 +1497,7 @@ void callbackide(int ide_board) if (ide_drive_is_cdrom(ide)) { - cdrom[atapi_cdrom_drives[cur_ide[ide_board]]].callback = 0; + cdrom[atapi_cdrom_drives[cur_ide[ide_board]]].callback = 0LL; } if (ide->command==0x30) times30++; @@ -1678,7 +1678,7 @@ void callbackide(int ide_board) { if (ide_bus_master_read(ide_board, &ide->sector_buffer[ide->sector_pos*512], 512)) { - idecallback[ide_board]=6*IDE_TIME; /*DMA not performed, try again later*/ + idecallback[ide_board]=6LL*IDE_TIME; /*DMA not performed, try again later*/ } else { @@ -1691,7 +1691,7 @@ void callbackide(int ide_board) { ide_next_sector(ide); ide->atastat = BUSY_STAT; - idecallback[ide_board]=6*IDE_TIME; + idecallback[ide_board]=6LL*IDE_TIME; StatusBarUpdateIcon(SB_HDD | hdd[ide->hdd_num].bus, 1); } else @@ -1795,7 +1795,7 @@ void callbackide(int ide_board) { if (ide_bus_master_write(ide_board, (uint8_t *)ide->buffer, 512)) { - idecallback[ide_board]=6*IDE_TIME; /*DMA not performed, try again later*/ + idecallback[ide_board]=6LL*IDE_TIME; /*DMA not performed, try again later*/ } else { @@ -1809,7 +1809,7 @@ void callbackide(int ide_board) { ide_next_sector(ide); ide->atastat = BUSY_STAT; - idecallback[ide_board]=6*IDE_TIME; + idecallback[ide_board]=6LL*IDE_TIME; StatusBarUpdateIcon(SB_HDD | hdd[ide->hdd_num].bus, 1); } else @@ -2053,31 +2053,31 @@ id_not_found: void ide_callback_pri() { - idecallback[0] = 0; + idecallback[0] = 0LL; callbackide(0); } void ide_callback_sec() { - idecallback[1] = 0; + idecallback[1] = 0LL; callbackide(1); } void ide_callback_ter() { - idecallback[2] = 0; + idecallback[2] = 0LL; callbackide(2); } void ide_callback_qua() { - idecallback[3] = 0; + idecallback[3] = 0LL; callbackide(3); } void ide_callback_xtide() { - idecallback[4] = 0; + idecallback[4] = 0LL; callbackide(4); } diff --git a/src/disk/hdc_ide.h b/src/disk/hdc_ide.h index ffccd356f..2ee0b0f50 100644 --- a/src/disk/hdc_ide.h +++ b/src/disk/hdc_ide.h @@ -60,7 +60,7 @@ extern int ide_enable[5]; extern int ide_irq[5]; extern IDE ide_drives[IDE_NUM + XTIDE_NUM]; -extern int idecallback[5]; +extern int64_t idecallback[5]; extern void ide_irq_raise(IDE *ide); diff --git a/src/disk/hdc_mfm_at.c b/src/disk/hdc_mfm_at.c index 21c6081a2..e75b2b451 100644 --- a/src/disk/hdc_mfm_at.c +++ b/src/disk/hdc_mfm_at.c @@ -34,7 +34,7 @@ #include "hdd.h" -#define MFM_TIME (TIMER_USEC*10) +#define MFM_TIME (TIMER_USEC*10LL) #define MFM_DEBUG 0 #define STAT_ERR 0x01 @@ -96,7 +96,7 @@ typedef struct { pad; int pos; /* offset within data buffer */ - int callback; /* callback delay timer */ + int64_t callback; /* callback delay timer */ uint16_t buffer[256]; /* data buffer (16b wide) */ @@ -220,7 +220,7 @@ mfm_cmd(mfm_t *mfm, uint8_t val) mfm->command = 0xff; mfm->status = STAT_BUSY; timer_process(); - mfm->callback = 200*MFM_TIME; + mfm->callback = 200LL*MFM_TIME; timer_update_outstanding(); return; @@ -247,7 +247,7 @@ mfm_cmd(mfm_t *mfm, uint8_t val) mfm->command = (val & 0xf0); mfm->status = STAT_BUSY; timer_process(); - mfm->callback = 200*MFM_TIME; + mfm->callback = 200LL*MFM_TIME; timer_update_outstanding(); break; @@ -266,7 +266,7 @@ mfm_cmd(mfm_t *mfm, uint8_t val) fatal("WD1003: READ with ECC\n"); mfm->status = STAT_BUSY; timer_process(); - mfm->callback = 200*MFM_TIME; + mfm->callback = 200LL*MFM_TIME; timer_update_outstanding(); break; @@ -290,7 +290,7 @@ mfm_cmd(mfm_t *mfm, uint8_t val) mfm->command = (val & 0xfe); mfm->status = STAT_BUSY; timer_process(); - mfm->callback = 200*MFM_TIME; + mfm->callback = 200LL*MFM_TIME; timer_update_outstanding(); break; @@ -304,7 +304,7 @@ mfm_cmd(mfm_t *mfm, uint8_t val) mfm->command = val; mfm->status = STAT_BUSY; timer_process(); - mfm->callback = 200*MFM_TIME; + mfm->callback = 200LL*MFM_TIME; timer_update_outstanding(); break; @@ -347,7 +347,7 @@ mfm_cmd(mfm_t *mfm, uint8_t val) pclog("WD1003: bad command %02X\n", val); mfm->status = STAT_BUSY; timer_process(); - mfm->callback = 200*MFM_TIME; + mfm->callback = 200LL*MFM_TIME; timer_update_outstanding(); break; } @@ -367,7 +367,7 @@ mfm_writew(uint16_t port, uint16_t val, void *priv) mfm->pos = 0; mfm->status = STAT_BUSY; timer_process(); - mfm->callback = 6*MFM_TIME; + mfm->callback = 6LL*MFM_TIME; timer_update_outstanding(); } } @@ -425,14 +425,14 @@ mfm_write(uint16_t port, uint8_t val, void *priv) mfm->status = STAT_BUSY; mfm->reset = 1; timer_process(); - mfm->callback = 500*MFM_TIME; + mfm->callback = 500LL*MFM_TIME; timer_update_outstanding(); } if (val & 0x04) { /* Drive held in reset. */ mfm->status = STAT_BUSY; - mfm->callback = 0; + mfm->callback = 0LL; timer_process(); timer_update_outstanding(); } @@ -459,7 +459,7 @@ mfm_readw(uint16_t port, void *priv) next_sector(mfm); mfm->status = STAT_BUSY; timer_process(); - mfm->callback = 6*MFM_TIME; + mfm->callback = 6LL*MFM_TIME; timer_update_outstanding(); } else { StatusBarUpdateIcon(SB_HDD|HDD_BUS_MFM, 0); @@ -545,7 +545,7 @@ do_callback(void *priv) drive_t *drive = &mfm->drives[mfm->drvsel]; off64_t addr; - mfm->callback = 0; + mfm->callback = 0LL; if (mfm->reset) { #if MFM_DEBUG pclog("WD1003(%d) reset\n", mfm->drvsel); diff --git a/src/disk/hdc_mfm_xt.c b/src/disk/hdc_mfm_xt.c index 569b6afba..9d524c92d 100644 --- a/src/disk/hdc_mfm_xt.c +++ b/src/disk/hdc_mfm_xt.c @@ -66,7 +66,7 @@ #include "hdd.h" -#define MFM_TIME (2000*TIMER_USEC) +#define MFM_TIME (2000LL*TIMER_USEC) #define XEBEC_BIOS_FILE L"roms/hdd/mfm_xebec/ibm_xebec_62x0822_1985.bin" #define DTC_BIOS_FILE L"roms/hdd/mfm_xebec/dtc_cxd21a.bin" @@ -97,7 +97,7 @@ typedef struct { typedef struct { rom_t bios_rom; - int callback; + int64_t callback; int state; uint8_t status; uint8_t command[6]; @@ -338,7 +338,7 @@ mfm_callback(void *priv) drive_t *drive; off64_t addr; - mfm->callback = 0; + mfm->callback = 0LL; mfm->drive_sel = (mfm->command[1] & 0x20) ? 1 : 0; mfm->completion_byte = mfm->drive_sel & 0x20; diff --git a/src/floppy/fdc.c b/src/floppy/fdc.c index 1a3b7d8da..fdac86afd 100644 --- a/src/floppy/fdc.c +++ b/src/floppy/fdc.c @@ -34,7 +34,7 @@ #include "fdd.h" -extern int motoron[FDD_NUM]; +extern int64_t motoron[FDD_NUM]; int ui_writeprot[FDD_NUM] = {0, 0, 0, 0}; @@ -106,8 +106,8 @@ typedef struct FDC int pcjr, ps1; - int watchdog_timer; - int watchdog_count; + int64_t watchdog_timer; + int64_t watchdog_count; int data_ready; int inread; @@ -152,7 +152,7 @@ typedef struct FDC uint16_t base_address; } FDC; -int floppytime; +int64_t floppytime; static FDC fdc; @@ -393,10 +393,10 @@ static void fdc_watchdog_poll(void *p) fdc->watchdog_count--; if (fdc->watchdog_count) - fdc->watchdog_timer += 1000 * TIMER_USEC; + fdc->watchdog_timer += 1000LL * TIMER_USEC; else { - fdc->watchdog_timer = 0; + fdc->watchdog_timer = 0LL; if (fdc->dor & 0x20) picint(1 << 6); } @@ -668,14 +668,14 @@ void fdc_write(uint16_t addr, uint8_t val, void *priv) { if ((fdc.dor & 0x40) && !(val & 0x40)) { - fdc.watchdog_timer = 1000 * TIMER_USEC; - fdc.watchdog_count = 1000; + fdc.watchdog_timer = 1000LL * TIMER_USEC; + fdc.watchdog_count = 1000LL; picintc(1 << 6); } if ((val & 0x80) && !(fdc.dor & 0x80)) { timer_process(); - floppytime = 128 * (1 << TIMER_SHIFT); + floppytime = 128LL * (1LL << TIMER_SHIFT); timer_update_outstanding(); floppyint=-1; StatusBarUpdateIcon(SB_FLOPPY | 0, 0); @@ -708,7 +708,7 @@ void fdc_write(uint16_t addr, uint8_t val, void *priv) if ((val&4) && !(fdc.dor&4)) { timer_process(); - floppytime = 128 * (1 << TIMER_SHIFT); + floppytime = 128LL * (1LL << TIMER_SHIFT); timer_update_outstanding(); floppyint=-1; fdc.perp &= 0xfc; @@ -751,7 +751,7 @@ void fdc_write(uint16_t addr, uint8_t val, void *priv) if (val & 0x80) { timer_process(); - floppytime = 128 * (1 << TIMER_SHIFT); + floppytime = 128LL * (1LL << TIMER_SHIFT); timer_update_outstanding(); floppyint=-1; fdc.perp &= 0xfc; @@ -932,7 +932,7 @@ bad_command: fdc.stat |= 0x10; floppyint=0xfc; timer_process(); - floppytime = 200 * (1 << TIMER_SHIFT); + floppytime = 200LL * (1LL << TIMER_SHIFT); timer_update_outstanding(); break; } @@ -958,7 +958,7 @@ bad_command: fdc_log("Got all params %02X\n", fdc.command); floppyint=fdc.command&0x1F; timer_process(); - floppytime = 1024 * (1 << TIMER_SHIFT); + floppytime = 1024LL * (1LL << TIMER_SHIFT); timer_update_outstanding(); fdc_reset_stat = 0; switch (floppyint & 0x1F) @@ -987,7 +987,7 @@ bad_command: { fdc.stat = 0x50; } - floppytime = 0; + floppytime = 0LL; StatusBarUpdateIcon(SB_FLOPPY | fdc.drive, 1); fdc.inread = 1; break; @@ -997,7 +997,7 @@ bad_command: fdc.specify[0] = fdc.params[0]; fdc.specify[1] = fdc.params[1]; fdc.dma = (fdc.specify[1] & 1) ^ 1; - floppytime = 0; + floppytime = 0LL; break; case 0x12: @@ -1011,7 +1011,7 @@ bad_command: fdc.perp &= 0xfc; fdc.perp |= (fdc.params[0] & 0x03); } - floppytime = 0; + floppytime = 0LL; return; case 4: @@ -1031,7 +1031,7 @@ bad_command: fdc_implied_seek(); fdc.rw_track = fdc.params[1]; floppy_writesector(fdc.drive, fdc.sector, fdc.params[1], fdc.head, fdc.rate, fdc.params[4]); - floppytime = 0; + floppytime = 0LL; fdc.written = 0; StatusBarUpdateIcon(SB_FLOPPY | fdc.drive, 1); fdc.pos = 0; @@ -1064,7 +1064,7 @@ bad_command: fdc_implied_seek(); fdc.rw_track = fdc.params[1]; floppy_comparesector(fdc.drive, fdc.sector, fdc.params[1], fdc.head, fdc.rate, fdc.params[4]); - floppytime = 0; + floppytime = 0LL; fdc.written = 0; StatusBarUpdateIcon(SB_FLOPPY | fdc.drive, 1); fdc.pos = 0; @@ -1109,7 +1109,7 @@ bad_command: { fdc.stat = 0x50; } - floppytime = 0; + floppytime = 0LL; StatusBarUpdateIcon(SB_FLOPPY | fdc.drive, 1); fdc.inread = 1; break; @@ -1117,7 +1117,7 @@ bad_command: case 7: /*Recalibrate*/ seek_time_base = fdd_doublestep_40(real_drive(fdc.drive)) ? 10 : 5; fdc.stat = (1 << real_drive(fdc.drive)) | 0x80; - floppytime = 0; + floppytime = 0LL; drive_num = real_drive(fdc.drive); @@ -1133,10 +1133,10 @@ bad_command: fdc.st0 = 0x20 | (fdc.params[0] & 3); } fdc.pcn[fdc.params[0] & 3] = 0; - floppytime = 0; + floppytime = 0LL; floppyint=-3; timer_process(); - floppytime = 2048 * (1 << TIMER_SHIFT); + floppytime = 2048LL * (1LL << TIMER_SHIFT); timer_update_outstanding(); break; } @@ -1145,7 +1145,7 @@ bad_command: { fdc_seek(fdc.drive, -fdc.max_track); } - floppytime = fdc.max_track * seek_time_base * TIMER_USEC; + floppytime = ((int64_t) fdc.max_track) * ((int64_t) seek_time_base) * TIMER_USEC; break; case 0x0d: /*Format*/ @@ -1165,7 +1165,7 @@ bad_command: fdc.stat = (1 << fdc.drive) | 0x80; fdc.head = (fdc.params[0] & 4) ? 1 : 0; fdd_set_head(fdc.drive, (fdc.params[0] & 4) ? 1 : 0); - floppytime = 0; + floppytime = 0LL; drive_num = real_drive(fdc.drive); seek_time_base = fdd_doublestep_40(drive_num) ? 10 : 5; @@ -1190,10 +1190,10 @@ bad_command: { fdc.pcn[fdc.params[0] & 3] = fdc.params[1]; } - floppytime = 0; + floppytime = 0LL; floppyint=-3; timer_process(); - floppytime = 2048 * (1 << TIMER_SHIFT); + floppytime = 2048LL * (1LL << TIMER_SHIFT); timer_update_outstanding(); break; } @@ -1214,17 +1214,17 @@ bad_command: fdc_seek(fdc.drive, -fdc.params[1]); fdc.pcn[fdc.params[0] & 3] -= fdc.params[1]; } - floppytime = ((int) fdc.params[1]) * seek_time_base * TIMER_USEC; + floppytime = ((int64_t) fdc.params[1]) * ((int64_t) seek_time_base) * TIMER_USEC; } else { - floppytime = seek_time_base * TIMER_USEC; + floppytime = ((int64_t) seek_time_base) * TIMER_USEC; fdc.st0 = 0x20 | (fdc.params[0] & 7); - floppytime = 0; + floppytime = 0LL; floppyint=-3; timer_process(); - floppytime = 2048 * (1 << TIMER_SHIFT); + floppytime = 2048LL * (1LL << TIMER_SHIFT); timer_update_outstanding(); break; } @@ -1237,10 +1237,10 @@ bad_command: if ((fdc.params[1] - fdc.pcn[fdc.params[0] & 3]) == 0) { fdc.st0 = 0x20 | (fdc.params[0] & 7); - floppytime = 0; + floppytime = 0LL; floppyint=-3; timer_process(); - floppytime = 2048 * (1 << TIMER_SHIFT); + floppytime = 2048LL * (1LL << TIMER_SHIFT); timer_update_outstanding(); break; } @@ -1248,13 +1248,13 @@ bad_command: fdc_seek(fdc.drive, fdc.params[1] - fdc.pcn[fdc.params[0] & 3]); fdc.pcn[fdc.params[0] & 3] = fdc.params[1]; if (seek_time < 0) seek_time = -seek_time; - floppytime = seek_time; + floppytime = ((int64_t) seek_time); } break; case 10: /*Read sector ID*/ fdc_rate(fdc.drive); - floppytime = 0; + floppytime = 0LL; fdc.head = (fdc.params[0] & 4) ? 1 : 0; fdd_set_head(fdc.drive, (fdc.params[0] & 4) ? 1 : 0); if ((real_drive(fdc.drive) != 1) || fdc.drv2en) @@ -1390,7 +1390,7 @@ uint8_t fdc_read(uint16_t addr, void *priv) /* if (floppyint==0xA) { timer_process(); - floppytime = 1024 * (1 << TIMER_SHIFT); + floppytime = 1024LL * (1LL << TIMER_SHIFT); timer_update_outstanding(); } */ fdc.stat &= 0xf0; @@ -1481,7 +1481,7 @@ void fdc_poll_readwrite_finish(int compare) void fdc_no_dma_end(int compare) { - floppytime = 0; + floppytime = 0LL; fdc_poll_common_finish(compare, 0x80); } @@ -1491,7 +1491,7 @@ void fdc_callback(void *priv) int compare = 0; int drive_num = 0; int old_sector = 0; - floppytime = 0; + floppytime = 0LL; switch (floppyint) { case -3: /*End of command with interrupt*/ @@ -1549,7 +1549,7 @@ void fdc_callback(void *priv) fdc.stat = (fdc.stat & 0xf) | 0xd0; paramstogo = 1; floppyint = 0; - floppytime = 0; + floppytime = 0LL; return; case 5: /*Write data*/ case 9: /*Write deleted data*/ @@ -1728,7 +1728,7 @@ void fdc_callback(void *priv) } floppyint=-3; timer_process(); - floppytime = 2048 * (1 << TIMER_SHIFT); + floppytime = 2048LL * (1LL << TIMER_SHIFT); timer_update_outstanding(); fdc.stat = 0x80 | (1 << fdc.drive); return; @@ -1766,7 +1766,7 @@ void fdc_callback(void *priv) paramstogo = 2; floppyint = 0; - floppytime = 0; + floppytime = 0LL; return; case 0x0d: /*Format track*/ @@ -1774,7 +1774,7 @@ void fdc_callback(void *priv) { fdc.format_state = 2; timer_process(); - floppytime = 128 * (1 << TIMER_SHIFT); + floppytime = 128LL * (1LL << TIMER_SHIFT); timer_update_outstanding(); } else if (fdc.format_state == 2) @@ -1805,7 +1805,7 @@ void fdc_callback(void *priv) fdc.st0 = 0x20 | (fdc.params[0] & 7); floppyint=-3; timer_process(); - floppytime = 2048 * (1 << TIMER_SHIFT); + floppytime = 2048LL * (1LL << TIMER_SHIFT); timer_update_outstanding(); fdc.stat = 0x80 | (1 << fdc.drive); return; @@ -1823,7 +1823,7 @@ void fdc_callback(void *priv) fdc.res[10] = fdc.pretrk; paramstogo = 10; floppyint=0; - floppytime = 0; + floppytime = 0LL; return; case 0x10: /*Version*/ @@ -1831,7 +1831,7 @@ void fdc_callback(void *priv) fdc.res[10] = 0x90; paramstogo=1; floppyint=0; - floppytime = 0; + floppytime = 0LL; return; case 0x13: /*Configure*/ @@ -1840,7 +1840,7 @@ void fdc_callback(void *priv) fdc.fifo = (fdc.params[1] & 0x20) ? 0 : 1; fdc.tfifo = (fdc.params[1] & 0xF); fdc.stat = 0x80; - floppytime = 0; + floppytime = 0LL; return; case 0x14: /*Unlock*/ fdc.lock = 0; @@ -1848,7 +1848,7 @@ void fdc_callback(void *priv) fdc.res[10] = 0; paramstogo=1; floppyint=0; - floppytime = 0; + floppytime = 0LL; return; case 0x94: /*Lock*/ fdc.lock = 1; @@ -1856,7 +1856,7 @@ void fdc_callback(void *priv) fdc.res[10] = 0x10; paramstogo=1; floppyint=0; - floppytime = 0; + floppytime = 0LL; return; case 0x18: /*NSC*/ @@ -1864,7 +1864,7 @@ void fdc_callback(void *priv) fdc.res[10] = 0x73; paramstogo=1; floppyint=0; - floppytime = 0; + floppytime = 0LL; return; case 0xfc: /*Invalid*/ @@ -1873,14 +1873,14 @@ void fdc_callback(void *priv) fdc.res[10] = fdc.st0; paramstogo=1; floppyint=0; - floppytime = 0; + floppytime = 0LL; return; } } void fdc_error(int st5, int st6) { - floppytime = 0; + floppytime = 0LL; fdc_int(); fdc.fintr = 0; diff --git a/src/floppy/floppy.c b/src/floppy/floppy.c index b451067e7..a54f61b05 100644 --- a/src/floppy/floppy.c +++ b/src/floppy/floppy.c @@ -41,7 +41,7 @@ extern int driveempty[4]; wchar_t floppyfns[4][512]; -int floppy_poll_time[FDD_NUM] = { 16, 16, 16, 16 }; +int64_t floppy_poll_time[FDD_NUM] = { 16LL, 16LL, 16LL, 16LL }; int floppy_track[FDD_NUM]; int writeprot[FDD_NUM], fwriteprot[FDD_NUM]; @@ -65,7 +65,7 @@ int drive_empty[FDD_NUM] = {1, 1, 1, 1}; int floppy_changed[FDD_NUM]; int motorspin; -int motoron[FDD_NUM]; +int64_t motoron[FDD_NUM]; int fdc_indexcount = 52; @@ -243,7 +243,7 @@ void floppy_poll(int drive) fatal("Attempting to poll floppy drive %i that is not supposed to be there\n", drive); } - floppy_poll_time[drive] += (int) floppy_real_period(drive); + floppy_poll_time[drive] += (int64_t) floppy_real_period(drive); if (drives[drive].poll) drives[drive].poll(drive); diff --git a/src/floppy/floppy.h b/src/floppy/floppy.h index cdc637b4d..28d9a47aa 100644 --- a/src/floppy/floppy.h +++ b/src/floppy/floppy.h @@ -42,7 +42,7 @@ extern DRIVE drives[FDD_NUM]; extern int curdrive; extern int floppy_time; -extern int floppy_poll_time[FDD_NUM]; +extern int64_t floppy_poll_time[FDD_NUM]; extern void floppy_load(int drive, wchar_t *fn); @@ -88,7 +88,7 @@ extern int fdc_ready; extern int fdc_indexcount;*/ extern int motorspin; -extern int motoron[FDD_NUM]; +extern int64_t motoron[FDD_NUM]; extern int swwp; extern int disable_write; diff --git a/src/game/gameport.c b/src/game/gameport.c index 756887599..624955027 100644 --- a/src/game/gameport.c +++ b/src/game/gameport.c @@ -49,52 +49,52 @@ static joystick_if_t *joystick_list[] = NULL }; -char *joystick_get_name(int joystick) +char *joystick_get_name(int64_t joystick) { if (!joystick_list[joystick]) return NULL; return joystick_list[joystick]->name; } -int joystick_get_max_joysticks(int joystick) +int64_t joystick_get_max_joysticks(int64_t joystick) { return joystick_list[joystick]->max_joysticks; } -int joystick_get_axis_count(int joystick) +int64_t joystick_get_axis_count(int64_t joystick) { return joystick_list[joystick]->axis_count; } -int joystick_get_button_count(int joystick) +int64_t joystick_get_button_count(int64_t joystick) { return joystick_list[joystick]->button_count; } -int joystick_get_pov_count(int joystick) +int64_t joystick_get_pov_count(int64_t joystick) { return joystick_list[joystick]->pov_count; } - char *joystick_get_axis_name(int joystick, int id) + char *joystick_get_axis_name(int64_t joystick, int64_t id) { return joystick_list[joystick]->axis_names[id]; } -char *joystick_get_button_name(int joystick, int id) +char *joystick_get_button_name(int64_t joystick, int64_t id) { return joystick_list[joystick]->button_names[id]; } -char *joystick_get_pov_name(int joystick, int id) +char *joystick_get_pov_name(int64_t joystick, int64_t id) { return joystick_list[joystick]->pov_names[id]; } typedef struct gameport_axis_t { - int count; - int axis_nr; + int64_t count; + int64_t axis_nr; struct gameport_t *gameport; } gameport_axis_t; @@ -110,7 +110,7 @@ typedef struct gameport_t static gameport_t *gameport_global = NULL; -static int gameport_time(int axis) +static int64_t gameport_time(int64_t axis) { if (axis == AXIS_NOT_PRESENT) return 0; diff --git a/src/game/gameport.h b/src/game/gameport.h index f81762ce1..af663b78b 100644 --- a/src/game/gameport.h +++ b/src/game/gameport.h @@ -30,14 +30,14 @@ extern device_t gameport_201_device; extern int joystick_type; -extern char *joystick_get_name(int joystick); -extern int joystick_get_max_joysticks(int joystick); -extern int joystick_get_axis_count(int joystick); -extern int joystick_get_button_count(int joystick); -extern int joystick_get_pov_count(int joystick); -extern char *joystick_get_axis_name(int joystick, int id); -extern char *joystick_get_button_name(int joystick, int id); -extern char *joystick_get_pov_name(int joystick, int id); +extern char *joystick_get_name(int64_t joystick); +extern int64_t joystick_get_max_joysticks(int64_t joystick); +extern int64_t joystick_get_axis_count(int64_t joystick); +extern int64_t joystick_get_button_count(int64_t joystick); +extern int64_t joystick_get_pov_count(int64_t joystick); +extern char *joystick_get_axis_name(int64_t joystick, int64_t id); +extern char *joystick_get_button_name(int64_t joystick, int64_t id); +extern char *joystick_get_pov_name(int64_t joystick, int64_t id); extern void gameport_update_joystick_type(void); diff --git a/src/game/joystick_sw_pad.c b/src/game/joystick_sw_pad.c index 481228dbc..842931629 100644 --- a/src/game/joystick_sw_pad.c +++ b/src/game/joystick_sw_pad.c @@ -34,14 +34,14 @@ typedef struct { - int poll_time; - int poll_left; - int poll_clock; + int64_t poll_time; + int64_t poll_left; + int64_t poll_clock; uint64_t poll_data; - int poll_mode; + int64_t poll_mode; - int trigger_time; - int data_mode; + int64_t trigger_time; + int64_t data_mode; } sw_data; static void sw_timer_over(void *p) @@ -59,7 +59,7 @@ static void sw_timer_over(void *p) } if (sw->poll_left == 1 && !sw->poll_clock) - sw->poll_time += TIMER_USEC * 160; + sw->poll_time += TIMER_USEC * 160LL; else if (sw->poll_left) sw->poll_time += TIMER_USEC * 5; else @@ -225,7 +225,7 @@ static int sw_read_axis(void *p, int axis) if (!JOYSTICK_PRESENT(0)) return AXIS_NOT_PRESENT; - return 0; /*No analogue support on Sidewinder game pad*/ + return 0LL; /*No analogue support on Sidewinder game pad*/ } static void sw_a0_over(void *p) diff --git a/src/ibm.h b/src/ibm.h index 26cde0dff..099db3494 100644 --- a/src/ibm.h +++ b/src/ibm.h @@ -288,38 +288,38 @@ extern int cpl_override; /*Timer*/ typedef struct PIT_nr { - int nr; + int64_t nr; struct PIT *pit; } PIT_nr; typedef struct PIT { uint32_t l[3]; - int c[3]; + int64_t c[3]; uint8_t m[3]; uint8_t ctrl,ctrls[3]; - int wp,rm[3],wm[3]; + int64_t wp,rm[3],wm[3]; uint16_t rl[3]; - int thit[3]; - int delay[3]; - int rereadlatch[3]; - int gate[3]; - int out[3]; - int running[3]; - int enabled[3]; - int newcount[3]; - int count[3]; - int using_timer[3]; - int initial[3]; - int latched[3]; - int disabled[3]; + int64_t thit[3]; + int64_t delay[3]; + int64_t rereadlatch[3]; + int64_t gate[3]; + int64_t out[3]; + int64_t running[3]; + int64_t enabled[3]; + int64_t newcount[3]; + int64_t count[3]; + int64_t using_timer[3]; + int64_t initial[3]; + int64_t latched[3]; + int64_t disabled[3]; uint8_t read_status[3]; - int do_read_status[3]; + int64_t do_read_status[3]; PIT_nr pit_nr[3]; - void (*set_out_funcs[3])(int new_out, int old_out); + void (*set_out_funcs[3])(int64_t new_out, int64_t old_out); } PIT; PIT pit, pit2; @@ -375,7 +375,7 @@ extern PIC pic, pic2; extern int pic_intpending; -extern int floppytime; +extern int64_t floppytime; extern wchar_t floppyfns[4][512]; extern int driveempty[4]; @@ -483,7 +483,7 @@ extern wchar_t cfg_path[1024]; /*Keyboard*/ -extern int keybsenddelay; +extern int64_t keybsenddelay; /*CD-ROM*/ @@ -496,7 +496,7 @@ enum CDROM_BUS_USB = 8 }; -extern int idecallback[5]; +extern int64_t idecallback[5]; #define CD_STATUS_EMPTY 0 #define CD_STATUS_DATA_ONLY 1 diff --git a/src/intel.c b/src/intel.c index 41462046f..10442aff1 100644 --- a/src/intel.c +++ b/src/intel.c @@ -27,7 +27,7 @@ uint8_t batman_brdconfig(uint16_t port, void *p) } static uint16_t batman_timer_latch; -static int batman_timer = 0; +static int64_t batman_timer = 0; static void batman_timer_over(void *p) { batman_timer = 0; diff --git a/src/keyboard.c b/src/keyboard.c index 91822a804..86ae823f4 100644 --- a/src/keyboard.c +++ b/src/keyboard.c @@ -25,7 +25,7 @@ int keybsendcallback = 0; -int keybsenddelay; +int64_t keybsenddelay; typedef struct diff --git a/src/keyboard_at.c b/src/keyboard_at.c index 86e3f5509..2b98f21f6 100644 --- a/src/keyboard_at.c +++ b/src/keyboard_at.c @@ -47,7 +47,7 @@ #define STAT_IFULL 0x02 #define STAT_OFULL 0x01 -#define PS2_REFRESH_TIME (16 * TIMER_USEC) +#define PS2_REFRESH_TIME (16LL * TIMER_USEC) #define CCB_UNUSED 0x80 #define CCB_TRANSLATE 0x40 @@ -88,7 +88,7 @@ struct void (*mouse_write)(uint8_t val, void *p); void *mouse_p; - int refresh_time; + int64_t refresh_time; int refresh; int is_ps2; @@ -145,7 +145,7 @@ void keyboard_at_log(const char *format, ...) static void keyboard_at_poll(void) { - keybsenddelay += (1000 * TIMER_USEC); + keybsenddelay += (1000LL * TIMER_USEC); if ((keyboard_at.out_new != -1) && !keyboard_at.last_irq) { diff --git a/src/keyboard_olim24.c b/src/keyboard_olim24.c index 2425c1ff9..371a104c3 100644 --- a/src/keyboard_olim24.c +++ b/src/keyboard_olim24.c @@ -49,7 +49,7 @@ static uint8_t mouse_scancodes[7]; static void keyboard_olim24_poll(void) { - keybsenddelay += (1000 * TIMER_USEC); + keybsenddelay += (1000LL * TIMER_USEC); if (keyboard_olim24.wantirq) { keyboard_olim24.wantirq = 0; diff --git a/src/keyboard_pcjr.c b/src/keyboard_pcjr.c index 9d5fd7e91..ccd9986f2 100644 --- a/src/keyboard_pcjr.c +++ b/src/keyboard_pcjr.c @@ -46,7 +46,7 @@ static int key_queue_start = 0, key_queue_end = 0; void keyboard_pcjr_poll() { - keybsenddelay += (220 * TIMER_USEC); + keybsenddelay += (220LL * TIMER_USEC); if (key_queue_start != key_queue_end && !keyboard_pcjr.serial_pos && !keyboard_pcjr.latched) diff --git a/src/keyboard_xt.c b/src/keyboard_xt.c index 86e7f0a8e..3e93125c9 100644 --- a/src/keyboard_xt.c +++ b/src/keyboard_xt.c @@ -46,7 +46,7 @@ static int key_queue_start = 0, key_queue_end = 0; static void keyboard_xt_poll(void) { - keybsenddelay += (1000 * TIMER_USEC); + keybsenddelay += (1000LL * TIMER_USEC); if (key_queue_start != key_queue_end && !keyboard_xt.blocked) { keyboard_xt.pa = key_queue[key_queue_start]; diff --git a/src/mouse_serial.c b/src/mouse_serial.c index c52e20cce..69420b17f 100644 --- a/src/mouse_serial.c +++ b/src/mouse_serial.c @@ -28,8 +28,8 @@ typedef struct mouse_serial_t { int8_t port, type; - int pos, - delay; + int pos; + int64_t delay; int oldb; SERIAL *serial; } mouse_serial_t; @@ -47,7 +47,7 @@ sermouse_callback(struct SERIAL *serial, void *priv) /* Start a timer to wake us up in a little while. */ ms->pos = -1; - ms->delay = 5000 * (1 << TIMER_SHIFT); + ms->delay = 5000LL * (1LL << TIMER_SHIFT); } @@ -57,7 +57,7 @@ sermouse_timer(void *priv) { mouse_serial_t *ms = (mouse_serial_t *)priv; - ms->delay = 0; + ms->delay = 0LL; if (ms->pos != -1) return; diff --git a/src/nvr.c b/src/nvr.c index 2ef576b41..da018461b 100644 --- a/src/nvr.c +++ b/src/nvr.c @@ -216,25 +216,25 @@ #define NVR_FOLDER_PATH L"NVR" -int enable_sync; /* configuration variable: enable time sync */ -int nvr_dosave; /* NVR is dirty, needs saved */ +int64_t enable_sync; /* configuration variable: enable time sync */ +int64_t nvr_dosave; /* NVR is dirty, needs saved */ static nvr_t *saved_nvr = NULL; static int8_t days_in_month[12] = { 31,28,31,30,31,30,31,31,30,31,30,31 }; static struct { - int sec; - int min; - int hour; - int mday; - int mon; - int year; + int64_t sec; + int64_t min; + int64_t hour; + int64_t mday; + int64_t mon; + int64_t year; } intclk; /* the internal clock */ /* Determine whether or not the year is leap. */ static int -is_leap(int year) +is_leap(int64_t year) { if (year % 400 == 0) return(1); if (year % 100 == 0) return(0); @@ -246,7 +246,7 @@ is_leap(int year) /* Determine the days in the current month. */ static int -get_days(int month, int year) +get_days(int64_t month, int64_t year) { if (month != 2) return(days_in_month[month - 1]); @@ -333,7 +333,7 @@ rtc_getnvr(uint8_t *nvr, struct tm *tm) static void rtc_setnvr(uint8_t *nvr) { - int temp; + int64_t temp; if (nvr[RTC_REGB] & REGB_DM) { intclk.sec = nvr[RTC_SECONDS]; @@ -403,18 +403,18 @@ onesec_timer(void *priv) /* Re-calculate the timer. */ nvr_recalc(); - nvr->upd_ecount = (int)((244.0 + 1984.0) * TIMER_USEC); + nvr->upd_ecount = (int64_t)((244.0 + 1984.0) * TIMER_USEC); } nvr->onesec_cnt = 0; } - nvr->onesec_time += (int)(10000 * TIMER_USEC); + nvr->onesec_time += (int64_t)(10000 * TIMER_USEC); } /* Check if the current time matches a set alarm time. */ static int -check_alarm(nvr_t *nvr, int addr) +check_alarm(nvr_t *nvr, int64_t addr) { #define ALARM_DONTCARE 0xc0 return((nvr->regs[addr+1] == nvr->regs[addr]) || @@ -428,7 +428,7 @@ update_timer(void *priv) { nvr_t *nvr = (nvr_t *)priv; struct tm tm; - int dom, mon, yr, cent, sum, wd; + int64_t dom, mon, yr, cent, sum, wd; if (! (nvr->regs[RTC_REGB] & REGB_SET)) { /* Get the current time from the internal clock. */ @@ -485,7 +485,7 @@ static void ticker_timer(void *priv) { nvr_t *nvr = (nvr_t *)priv; - int c; + int64_t c; if (! (nvr->regs[RTC_REGA] & REGA_RS)) { nvr->rtctime = 0x7fffffff; @@ -494,7 +494,7 @@ ticker_timer(void *priv) /* Update our ticker interval. */ c = 1 << ((nvr->regs[RTC_REGA] & REGA_RS) - 1); - nvr->rtctime += (int)(RTCCONST*c*(1<rtctime += (int64_t)(RTCCONST*c*(1<regs[RTC_REGC] |= REGC_PF; if (nvr->regs[RTC_REGB] & REGB_PIE) { @@ -511,7 +511,7 @@ ticker_timer(void *priv) static void nvr_write(nvr_t *nvr, uint16_t reg, uint8_t val) { - int c, old; + int64_t c, old; old = nvr->regs[reg]; switch(reg) { @@ -519,7 +519,7 @@ nvr_write(nvr_t *nvr, uint16_t reg, uint8_t val) nvr->regs[reg] = val; if (val & REGA_RS) { c = 1 << ((val & REGA_RS) - 1); - nvr->rtctime += (int)(RTCCONST*c*(1<rtctime += (int64_t)(RTCCONST*c*(1<rtctime = 0x7fffffff; } @@ -598,7 +598,7 @@ void nvr_init(nvr_t *nvr) { char temp[32]; - int c; + int64_t c; /* Clear some of it. */ nvr->upd_stat = 0; @@ -636,13 +636,13 @@ nvr_init(nvr_t *nvr) void nvr_recalc(void) { - int c, nt; + int64_t c, nt; /* Make sure we have been initialized. */ if (saved_nvr == NULL) return; c = 1 << ((saved_nvr->regs[RTC_REGA] & REGA_RS) - 1); - nt = (int)(RTCCONST * c * (1<rtctime > nt) saved_nvr->rtctime = nt; } @@ -659,11 +659,11 @@ nvr_recalc(void) * the local RTC to operate, so it can update either the local RTC, * and/or the supplied by a client. */ -int +int64_t nvr_load(void) { FILE *f; - int c; + int64_t c; /* Make sure we have been initialized. */ if (saved_nvr == NULL) return(0); @@ -706,14 +706,14 @@ nvr_load(void) saved_nvr->regs[RTC_REGA] = (REGA_RS2|REGA_RS1); saved_nvr->regs[RTC_REGB] = REGB_2412; c = 1 << ((saved_nvr->regs[RTC_REGA] & REGA_RS) - 1); - saved_nvr->rtctime += (int)(RTCCONST * c * (1<rtctime += (int64_t)(RTCCONST * c * (1<set_out_funcs, 3 * sizeof(void *)); @@ -62,9 +62,9 @@ void pit_reset(PIT *pit) memcpy(pit->set_out_funcs, old_set_out_funcs, 3 * sizeof(void *)); memcpy(pit->pit_nr, old_pit_nr, 3 * sizeof(PIT_nr)); - pit->l[0] = 0xFFFF; pit->c[0] = 0xFFFF*PITCONST; - pit->l[1] = 0xFFFF; pit->c[1] = 0xFFFF*PITCONST; - pit->l[2] = 0xFFFF; pit->c[2] = 0xFFFF*PITCONST; + pit->l[0] = 0xFFFF; pit->c[0] = 0xFFFFLL*PITCONST; + pit->l[1] = 0xFFFF; pit->c[1] = 0xFFFFLL*PITCONST; + pit->l[2] = 0xFFFF; pit->c[2] = 0xFFFFLL*PITCONST; pit->m[0] = pit->m[1] = pit->m[2] = 0; pit->ctrls[0] = pit->ctrls[1] = pit->ctrls[2] = 0; pit->thit[0]=1; @@ -86,15 +86,15 @@ float pit_timer0_freq() return (1193181.0 + (2.0 / 3.0))/(float)0x10000; } -static void pit_set_out(PIT *pit, int t, int out) +static void pit_set_out(PIT *pit, int64_t t, int64_t out) { pit->set_out_funcs[t](out, pit->out[t]); pit->out[t] = out; } -static void pit_load(PIT *pit, int t) +static void pit_load(PIT *pit, int64_t t) { - int l = pit->l[t] ? pit->l[t] : 0x10000; + int64_t l = pit->l[t] ? pit->l[t] : 0x10000LL; timer_process(); pit->newcount[t] = 0; pit->disabled[t] = 0; @@ -102,7 +102,7 @@ static void pit_load(PIT *pit, int t) { case 0: /*Interrupt on terminal count*/ pit->count[t] = l; - pit->c[t] = (int)((l << TIMER_SHIFT) * PITCONST); + pit->c[t] = (int64_t)((l << TIMER_SHIFT) * PITCONST); pit_set_out(pit, t, 0); pit->thit[t] = 0; pit->enabled[t] = pit->gate[t]; @@ -114,7 +114,7 @@ static void pit_load(PIT *pit, int t) if (pit->initial[t]) { pit->count[t] = l - 1; - pit->c[t] = (int)(((l - 1) << TIMER_SHIFT) * PITCONST); + pit->c[t] = (int64_t)(((l - 1) << TIMER_SHIFT) * PITCONST); pit_set_out(pit, t, 1); pit->thit[t] = 0; } @@ -124,7 +124,7 @@ static void pit_load(PIT *pit, int t) if (pit->initial[t]) { pit->count[t] = l; - pit->c[t] = (int)((((l + 1) >> 1) << TIMER_SHIFT) * PITCONST); + pit->c[t] = (int64_t)((((l + 1) >> 1) << TIMER_SHIFT) * PITCONST); pit_set_out(pit, t, 1); pit->thit[t] = 0; } @@ -136,7 +136,7 @@ static void pit_load(PIT *pit, int t) else { pit->count[t] = l; - pit->c[t] = (int)((l << TIMER_SHIFT) * PITCONST); + pit->c[t] = (int64_t)((l << TIMER_SHIFT) * PITCONST); pit_set_out(pit, t, 0); pit->thit[t] = 0; } @@ -151,9 +151,9 @@ static void pit_load(PIT *pit, int t) timer_update_outstanding(); } -void pit_set_gate_no_timer(PIT *pit, int t, int gate) +void pit_set_gate_no_timer(PIT *pit, int64_t t, int64_t gate) { - int l = pit->l[t] ? pit->l[t] : 0x10000; + int64_t l = pit->l[t] ? pit->l[t] : 0x10000LL; if (pit->disabled[t]) { @@ -172,7 +172,7 @@ void pit_set_gate_no_timer(PIT *pit, int t, int gate) if (gate && !pit->gate[t]) { pit->count[t] = l; - pit->c[t] = (int)((l << TIMER_SHIFT) * PITCONST); + pit->c[t] = (int64_t)((l << TIMER_SHIFT) * PITCONST); pit_set_out(pit, t, 0); pit->thit[t] = 0; pit->enabled[t] = 1; @@ -182,7 +182,7 @@ void pit_set_gate_no_timer(PIT *pit, int t, int gate) if (gate && !pit->gate[t]) { pit->count[t] = l - 1; - pit->c[t] = (int)(((l - 1) << TIMER_SHIFT) * PITCONST); + pit->c[t] = (int64_t)(((l - 1) << TIMER_SHIFT) * PITCONST); pit_set_out(pit, t, 1); pit->thit[t] = 0; } @@ -192,7 +192,7 @@ void pit_set_gate_no_timer(PIT *pit, int t, int gate) if (gate && !pit->gate[t]) { pit->count[t] = l; - pit->c[t] = (int)((((l + 1) >> 1) << TIMER_SHIFT) * PITCONST); + pit->c[t] = (int64_t)((((l + 1) >> 1) << TIMER_SHIFT) * PITCONST); pit_set_out(pit, t, 1); pit->thit[t] = 0; } @@ -203,7 +203,7 @@ void pit_set_gate_no_timer(PIT *pit, int t, int gate) pit->running[t] = pit->enabled[t] && pit->using_timer[t] && !pit->disabled[t]; } -void pit_set_gate(PIT *pit, int t, int gate) +void pit_set_gate(PIT *pit, int64_t t, int64_t gate) { if (pit->disabled[t]) { @@ -218,13 +218,13 @@ void pit_set_gate(PIT *pit, int t, int gate) timer_update_outstanding(); } -static void pit_over(PIT *pit, int t) +static void pit_over(PIT *pit, int64_t t) { - int l = pit->l[t] ? pit->l[t] : 0x10000; + int64_t l = pit->l[t] ? pit->l[t] : 0x10000LL; if (pit->disabled[t]) { pit->count[t] += 0xffff; - pit->c[t] += (int)((0xffff << TIMER_SHIFT) * PITCONST); + pit->c[t] += (int64_t)((0xffff << TIMER_SHIFT) * PITCONST); return; } @@ -236,11 +236,11 @@ static void pit_over(PIT *pit, int t) pit_set_out(pit, t, 1); pit->thit[t] = 1; pit->count[t] += 0xffff; - pit->c[t] += (int)((0xffff << TIMER_SHIFT) * PITCONST); + pit->c[t] += (int64_t)((0xffff << TIMER_SHIFT) * PITCONST); break; case 2: /*Rate generator*/ pit->count[t] += l; - pit->c[t] += (int)((l << TIMER_SHIFT) * PITCONST); + pit->c[t] += (int64_t)((l << TIMER_SHIFT) * PITCONST); pit_set_out(pit, t, 0); pit_set_out(pit, t, 1); break; @@ -249,13 +249,13 @@ static void pit_over(PIT *pit, int t) { pit_set_out(pit, t, 0); pit->count[t] += (l >> 1); - pit->c[t] += (int)(((l >> 1) << TIMER_SHIFT) * PITCONST); + pit->c[t] += (int64_t)(((l >> 1) << TIMER_SHIFT) * PITCONST); } else { pit_set_out(pit, t, 1); pit->count[t] += ((l + 1) >> 1); - pit->c[t] = (int)((((l + 1) >> 1) << TIMER_SHIFT) * PITCONST); + pit->c[t] = (int64_t)((((l + 1) >> 1) << TIMER_SHIFT) * PITCONST); } break; case 4: /*Software triggered strove*/ @@ -268,13 +268,13 @@ static void pit_over(PIT *pit, int t) { pit->newcount[t] = 0; pit->count[t] += l; - pit->c[t] += (int)((l << TIMER_SHIFT) * PITCONST); + pit->c[t] += (int64_t)((l << TIMER_SHIFT) * PITCONST); } else { pit->thit[t] = 1; pit->count[t] += 0xffff; - pit->c[t] += (int)((0xffff << TIMER_SHIFT) * PITCONST); + pit->c[t] += (int64_t)((0xffff << TIMER_SHIFT) * PITCONST); } break; case 5: /*Hardware triggered strove*/ @@ -285,52 +285,52 @@ static void pit_over(PIT *pit, int t) } pit->thit[t] = 1; pit->count[t] += 0xffff; - pit->c[t] += (int)((0xffff << TIMER_SHIFT) * PITCONST); + pit->c[t] += (int64_t)((0xffff << TIMER_SHIFT) * PITCONST); break; } pit->running[t] = pit->enabled[t] && pit->using_timer[t] && !pit->disabled[t]; } -int pit_get_timer_0() +int64_t pit_get_timer_0() { - int read = (int)((pit.c[0] + ((1 << TIMER_SHIFT) - 1)) / PITCONST) >> TIMER_SHIFT; + int64_t read = (int64_t)((pit.c[0] + ((1 << TIMER_SHIFT) - 1)) / PITCONST) >> TIMER_SHIFT; if (pit.m[0] == 2) read++; - if (read < 0) - read = 0; - if (read > 0x10000) - read = 0x10000; - if (pit.m[0] == 3) - read <<= 1; + if (read < 0LL) + read = 0LL; + if (read > 0x10000LL) + read = 0x10000LL; + if (pit.m[0] == 3LL) + read <<= 1LL; return read; } -static int pit_read_timer(PIT *pit, int t) +static int64_t pit_read_timer(PIT *pit, int64_t t) { timer_clock(); if (pit->using_timer[t]) { - int read = (int)((pit->c[t] + ((1 << TIMER_SHIFT) - 1)) / PITCONST) >> TIMER_SHIFT; + int64_t read = (int64_t)((pit->c[t] + ((1 << TIMER_SHIFT) - 1)) / PITCONST) >> TIMER_SHIFT; if (pit->m[t] == 2) read++; - if (read < 0) - read = 0; - if (read > 0x10000) - read = 0x10000; - if (pit->m[t] == 3) - read <<= 1; + if (read < 0LL) + read = 0LL; + if (read > 0x10000LL) + read = 0x10000LL; + if (pit->m[t] == 3LL) + read <<= 1LL; return read; } - if (pit->m[t] == 2) - return pit->count[t] + 1; + if (pit->m[t] == 2LL) + return pit->count[t] + 1LL; return pit->count[t]; } void pit_write(uint16_t addr, uint8_t val, void *p) { PIT *pit = (PIT *)p; - int t; - cycles -= (int)PITCONST; + int64_t t; + cycles -= (int64_t)PITCONST; switch (addr&3) { @@ -340,11 +340,11 @@ void pit_write(uint16_t addr, uint8_t val, void *p) if (!(val&0x20)) { if (val & 2) - pit->rl[0] = pit->using_timer[0] ? ((int)(pit->c[0] / PITCONST) >> TIMER_SHIFT) : pit->count[0]; + pit->rl[0] = pit->using_timer[0] ? ((int64_t)(pit->c[0] / PITCONST) >> TIMER_SHIFT) : pit->count[0]; if (val & 4) - pit->rl[1] = pit->using_timer[1] ? ((int)(pit->c[1] / PITCONST) >> TIMER_SHIFT) : pit->count[1]; + pit->rl[1] = pit->using_timer[1] ? ((int64_t)(pit->c[1] / PITCONST) >> TIMER_SHIFT) : pit->count[1]; if (val & 8) - pit->rl[2] = pit->using_timer[2] ? ((int)(pit->c[2] / PITCONST) >> TIMER_SHIFT) : pit->count[2]; + pit->rl[2] = pit->using_timer[2] ? ((int64_t)(pit->c[2] / PITCONST) >> TIMER_SHIFT) : pit->count[2]; } if (!(val & 0x10)) { @@ -437,9 +437,9 @@ void pit_write(uint16_t addr, uint8_t val, void *p) uint8_t pit_read(uint16_t addr, void *p) { PIT *pit = (PIT *)p; - int t; + int64_t t; uint8_t temp = 0xff; - cycles -= (int)PITCONST; + cycles -= (int64_t)PITCONST; switch (addr&3) { case 0: case 1: case 2: /*Timers*/ @@ -493,12 +493,12 @@ void pit_timer_over(void *p) { PIT_nr *pit_nr = (PIT_nr *)p; PIT *pit = pit_nr->pit; - int timer = pit_nr->nr; + int64_t timer = pit_nr->nr; pit_over(pit, timer); } -void pit_clock(PIT *pit, int t) +void pit_clock(PIT *pit, int64_t t) { if (pit->thit[t] || !pit->enabled[t]) return; @@ -511,28 +511,28 @@ void pit_clock(PIT *pit, int t) pit_over(pit, t); } -void pit_set_using_timer(PIT *pit, int t, int using_timer) +void pit_set_using_timer(PIT *pit, int64_t t, int64_t using_timer) { timer_process(); if (pit->using_timer[t] && !using_timer) pit->count[t] = pit_read_timer(pit, t); if (!pit->using_timer[t] && using_timer) - pit->c[t] = (int)((pit->count[t] << TIMER_SHIFT) * PITCONST); + pit->c[t] = (int64_t)((pit->count[t] << TIMER_SHIFT) * PITCONST); pit->using_timer[t] = using_timer; pit->running[t] = pit->enabled[t] && pit->using_timer[t] && !pit->disabled[t]; timer_update_outstanding(); } -void pit_set_out_func(PIT *pit, int t, void (*func)(int new_out, int old_out)) +void pit_set_out_func(PIT *pit, int64_t t, void (*func)(int64_t new_out, int64_t old_out)) { pit->set_out_funcs[t] = func; } -void pit_null_timer(int new_out, int old_out) +void pit_null_timer(int64_t new_out, int64_t old_out) { } -void pit_irq0_timer(int new_out, int old_out) +void pit_irq0_timer(int64_t new_out, int64_t old_out) { if (new_out && !old_out) picint(1); @@ -540,7 +540,7 @@ void pit_irq0_timer(int new_out, int old_out) picintc(1); } -void pit_irq0_timer_pcjr(int new_out, int old_out) +void pit_irq0_timer_pcjr(int64_t new_out, int64_t old_out) { if (new_out && !old_out) { @@ -551,7 +551,7 @@ void pit_irq0_timer_pcjr(int new_out, int old_out) picintc(1); } -void pit_irq0_ps2(int new_out, int old_out) +void pit_irq0_ps2(int64_t new_out, int64_t old_out) { if (new_out && !old_out) { @@ -564,21 +564,21 @@ void pit_irq0_ps2(int new_out, int old_out) pit_clock(&pit2, 0); } -void pit_refresh_timer_xt(int new_out, int old_out) +void pit_refresh_timer_xt(int64_t new_out, int64_t old_out) { if (new_out && !old_out) dma_channel_read(0); } -void pit_refresh_timer_at(int new_out, int old_out) +void pit_refresh_timer_at(int64_t new_out, int64_t old_out) { if (new_out && !old_out) ppi.pb ^= 0x10; } -void pit_speaker_timer(int new_out, int old_out) +void pit_speaker_timer(int64_t new_out, int64_t old_out) { - int l; + int64_t l; speaker_update(); @@ -591,7 +591,7 @@ void pit_speaker_timer(int new_out, int old_out) } -void pit_nmi_ps2(int new_out, int old_out) +void pit_nmi_ps2(int64_t new_out, int64_t old_out) { nmi = new_out; if (nmi) diff --git a/src/pit.h b/src/pit.h index 67db785b8..3fceeca27 100644 --- a/src/pit.h +++ b/src/pit.h @@ -3,15 +3,15 @@ extern double PITCONST; extern void pit_init(void); extern void pit_ps2_init(void); extern void pit_reset(PIT *pit); -extern void pit_set_gate(PIT *pit, int channel, int gate); -extern void pit_set_using_timer(PIT *pit, int t, int using_timer); -extern void pit_set_out_func(PIT *pit, int t, void (*func)(int new_out, int old_out)); -extern void pit_clock(PIT *pit, int t); +extern void pit_set_gate(PIT *pit, int64_t channel, int64_t gate); +extern void pit_set_using_timer(PIT *pit, int64_t t, int64_t using_timer); +extern void pit_set_out_func(PIT *pit, int64_t t, void (*func)(int64_t new_out, int64_t old_out)); +extern void pit_clock(PIT *pit, int64_t t); -extern void pit_null_timer(int new_out, int old_out); -extern void pit_irq0_timer(int new_out, int old_out); -extern void pit_irq0_timer_pcjr(int new_out, int old_out); -extern void pit_refresh_timer_xt(int new_out, int old_out); -extern void pit_refresh_timer_at(int new_out, int old_out); -extern void pit_speaker_timer(int new_out, int old_out); +extern void pit_null_timer(int64_t new_out, int64_t old_out); +extern void pit_irq0_timer(int64_t new_out, int64_t old_out); +extern void pit_irq0_timer_pcjr(int64_t new_out, int64_t old_out); +extern void pit_refresh_timer_xt(int64_t new_out, int64_t old_out); +extern void pit_refresh_timer_at(int64_t new_out, int64_t old_out); +extern void pit_speaker_timer(int64_t new_out, int64_t old_out); diff --git a/src/scsi/scsi_aha154x.c b/src/scsi/scsi_aha154x.c index 1759662fa..4282e6db0 100644 --- a/src/scsi/scsi_aha154x.c +++ b/src/scsi/scsi_aha154x.c @@ -395,7 +395,7 @@ typedef struct { wchar_t *nvr_path; /* path to NVR image file */ uint8_t *nvr; /* EEPROM buffer */ - int ResetCB; + int64_t ResetCB; volatile uint8_t /* for multi-threading, keep */ Status, /* these volatile */ @@ -636,7 +636,7 @@ aha_reset(aha_t *dev) } } - dev->ResetCB = 0; + dev->ResetCB = 0LL; dev->Status = STAT_IDLE | STAT_INIT; dev->Geometry = 0x80; @@ -682,7 +682,7 @@ aha_reset_poll(void *priv) dev->Status &= ~STAT_STST; dev->Status |= STAT_IDLE; - dev->ResetCB = 0; + dev->ResetCB = 0LL; } diff --git a/src/scsi/scsi_buslogic.c b/src/scsi/scsi_buslogic.c index 84e3df90c..828f2a82e 100644 --- a/src/scsi/scsi_buslogic.c +++ b/src/scsi/scsi_buslogic.c @@ -515,7 +515,7 @@ typedef struct { #pragma pack(pop) -static int BuslogicResetCallback = 0; +static int64_t BuslogicResetCallback = 0LL; static void BuslogicCommandThread(void *p); @@ -814,7 +814,7 @@ BuslogicReset(Buslogic_t *bl) } } - BuslogicResetCallback = 0; + BuslogicResetCallback = 0LL; bl->scan_restart = 0; bl->Geometry = 0x80; @@ -2559,7 +2559,7 @@ BuslogicResetPoll(void *p) bl->Status &= ~STAT_STST; bl->Status |= STAT_IDLE; - BuslogicResetCallback = 0; + BuslogicResetCallback = 0LL; } diff --git a/src/scsi/scsi_ncr5380.c b/src/scsi/scsi_ncr5380.c index 0dc487b3a..f57f53806 100644 --- a/src/scsi/scsi_ncr5380.c +++ b/src/scsi/scsi_ncr5380.c @@ -59,7 +59,7 @@ #define NCR_DMAINIRECV 7 /* DMA initiator receive (write only) */ #define NCR_RESETPARITY 7 /* reset parity/interrupt (read only) */ -#define POLL_TIME_US 10 +#define POLL_TIME_US 10LL #define MAX_BYTES_TRANSFERRED_PER_POLL 50 /*10us poll period with 50 bytes transferred per poll = 5MB/sec*/ @@ -131,8 +131,8 @@ typedef struct { ncr5380_t ncr; int ncr5380_dma_enabled; - int dma_callback; - int dma_enabled; + int64_t dma_callback; + int64_t dma_enabled; int ncr_busy; } ncr_t; diff --git a/src/serial.c b/src/serial.c index 2ec788530..8470f7428 100644 --- a/src/serial.c +++ b/src/serial.c @@ -189,7 +189,7 @@ uint8_t serial_read(uint16_t addr, void *p) serial_update_ints(serial); temp = serial_read_fifo(serial); if (serial->fifo_read != serial->fifo_write) - serial->recieve_delay = 1000 * TIMER_USEC; + serial->recieve_delay = 1000LL * TIMER_USEC; break; case 1: if (serial->lcr & 0x80) diff --git a/src/serial.h b/src/serial.h index 4decfec6f..f127d74f0 100644 --- a/src/serial.h +++ b/src/serial.h @@ -56,7 +56,7 @@ typedef struct _serial_ { uint8_t fifo[256]; int fifo_read, fifo_write; - int receive_delay; + int64_t receive_delay; void *bh; /* BottomHalf handler */ } SERIAL; @@ -99,7 +99,7 @@ typedef struct uint8_t fifo[256]; int fifo_read, fifo_write; - int recieve_delay; + int64_t recieve_delay; } SERIAL; void serial_write_fifo(SERIAL *serial, uint8_t dat); diff --git a/src/sound/snd_ad1848.c b/src/sound/snd_ad1848.c index a33160d77..4a22e4c76 100644 --- a/src/sound/snd_ad1848.c +++ b/src/sound/snd_ad1848.c @@ -62,7 +62,7 @@ void ad1848_write(uint16_t addr, uint8_t val, void *p) switch (ad1848->index) { case 8: - freq = (val & 1) ? 16934400 : 24576000; + freq = (val & 1) ? 16934400LL : 24576000LL; switch ((val >> 1) & 7) { case 0: freq /= 3072; break; @@ -75,7 +75,7 @@ void ad1848_write(uint16_t addr, uint8_t val, void *p) case 7: freq /= 2560; break; } ad1848->freq = freq; - ad1848->timer_latch = (int)((double)TIMER_USEC * (1000000.0 / (double)ad1848->freq)); + ad1848->timer_latch = (int64_t)((double)TIMER_USEC * (1000000.0 / (double)ad1848->freq)); break; case 9: @@ -101,7 +101,7 @@ void ad1848_write(uint16_t addr, uint8_t val, void *p) void ad1848_speed_changed(ad1848_t *ad1848) { - ad1848->timer_latch = (int)((double)TIMER_USEC * (1000000.0 / (double)ad1848->freq)); + ad1848->timer_latch = (int64_t)((double)TIMER_USEC * (1000000.0 / (double)ad1848->freq)); } void ad1848_update(ad1848_t *ad1848) diff --git a/src/sound/snd_ad1848.h b/src/sound/snd_ad1848.h index 3a0dd4e46..39dc60a5e 100644 --- a/src/sound/snd_ad1848.h +++ b/src/sound/snd_ad1848.h @@ -11,13 +11,13 @@ typedef struct ad1848_t int16_t out_l, out_r; - int enable; + int64_t enable; int irq, dma; - int freq; + int64_t freq; - int timer_count, timer_latch; + int64_t timer_count, timer_latch; int16_t buffer[SOUNDBUFLEN * 2]; int pos; diff --git a/src/sound/snd_adlibgold.c b/src/sound/snd_adlibgold.c index 449cbc8a2..aa13ef792 100644 --- a/src/sound/snd_adlibgold.c +++ b/src/sound/snd_adlibgold.c @@ -40,7 +40,7 @@ typedef struct adgold_t int16_t adgold_mma_out[2]; int adgold_mma_intpos[2]; - int adgold_mma_timer_count; + int64_t adgold_mma_timer_count; struct { @@ -579,9 +579,9 @@ void adgold_timer_poll(void *p) { adgold_t *adgold = (adgold_t *)p; - while (adgold->adgold_mma_timer_count <= 0) + while (adgold->adgold_mma_timer_count <= 0LL) { - adgold->adgold_mma_timer_count += (int)((double)TIMER_USEC * 1.88964); + adgold->adgold_mma_timer_count += (int64_t)((double)TIMER_USEC * 1.88964); if (adgold->adgold_mma_regs[0][8] & 0x01) /*Timer 0*/ { adgold->adgold_mma.timer0_count--; diff --git a/src/sound/snd_gus.c b/src/sound/snd_gus.c index d9043371b..860c93e77 100644 --- a/src/sound/snd_gus.c +++ b/src/sound/snd_gus.c @@ -44,13 +44,13 @@ typedef struct gus_t int16_t buffer[2][SOUNDBUFLEN]; int pos; - int samp_timer, samp_latch; + int64_t samp_timer, samp_latch; uint8_t *ram; int irqnext; - int timer_1, timer_2; + int64_t timer_1, timer_2; int irq, dma, irq_midi; int latch_enable; @@ -742,7 +742,7 @@ void gus_poll_timer_1(void *p) { gus_t *gus = (gus_t *)p; - gus->timer_1 += (TIMER_USEC * 80); + gus->timer_1 += (TIMER_USEC * 80LL); if (gus->t1on) { gus->t1++; @@ -773,7 +773,7 @@ void gus_poll_timer_2(void *p) { gus_t *gus = (gus_t *)p; - gus->timer_2 += (TIMER_USEC * 320); + gus->timer_2 += (TIMER_USEC * 320LL); if (gus->t2on) { gus->t2++; @@ -1022,7 +1022,7 @@ void *gus_init(device_t *info) printf("Top volume %f %f %f %f\n",vol16bit[4095],vol16bit[3800],vol16bit[3000],vol16bit[2048]); gus->voices=14; - gus->samp_timer = gus->samp_latch = (int)(TIMER_USEC * (1000000.0 / 44100.0)); + gus->samp_timer = gus->samp_latch = (int64_t)(TIMER_USEC * (1000000.0 / 44100.0)); gus->t1l = gus->t2l = 0xff; diff --git a/src/sound/snd_lpt_dss.c b/src/sound/snd_lpt_dss.c index fec50803d..8dfb1ddab 100644 --- a/src/sound/snd_lpt_dss.c +++ b/src/sound/snd_lpt_dss.c @@ -18,7 +18,7 @@ typedef struct dss_t uint8_t dac_val; - int time; + int64_t time; int16_t buffer[SOUNDBUFLEN]; int pos; @@ -88,7 +88,7 @@ static void dss_callback(void *p) dss->read_idx++; } - dss->time += (TIMER_USEC * (1000000.0 / 7000.0)); + dss->time += (int64_t) (TIMER_USEC * (1000000.0 / 7000.0)); } static void *dss_init() diff --git a/src/sound/snd_mpu401.c b/src/sound/snd_mpu401.c index bbe24d5f8..3506764e3 100644 --- a/src/sound/snd_mpu401.c +++ b/src/sound/snd_mpu401.c @@ -45,9 +45,9 @@ static void MPU401_EOIHandlerDispatch(void *p); int mpu401_standalone_enable = 0; -static int mpu401_event_callback = 0; -static int mpu401_eoi_callback = 0; -static int mpu401_reset_callback = 0; +static int64_t mpu401_event_callback = 0LL; +static int64_t mpu401_eoi_callback = 0LL; +static int64_t mpu401_reset_callback = 0LL; #ifdef ENABLE_MPU401_LOG static int mpu401_do_log = 1; @@ -151,7 +151,7 @@ static void MPU401_ResetDone(void *p) pclog("MPU-401 reset callback\n"); - mpu401_reset_callback = 0; + mpu401_reset_callback = 0LL; mpu->state.reset=0; if (mpu->state.cmd_pending) @@ -184,7 +184,7 @@ static void MPU401_WriteCommand(mpu_t *mpu, uint8_t val) { case 0x4: /* Stop */ mpu->state.playing=0; - mpu401_event_callback = 0; + mpu401_event_callback = 0LL; for (i=0xb0;i<0xbf;i++) { /* All notes off */ midi_write(i); @@ -195,7 +195,7 @@ static void MPU401_WriteCommand(mpu_t *mpu, uint8_t val) case 0x8: /* Play */ // LOG(LOG_MISC,LOG_NORMAL)("MPU-401:Intelligent mode playback started"); mpu->state.playing=1; - mpu401_event_callback = (MPU401_TIMECONSTANT / (mpu->clock.tempo*mpu->clock.timebase)) * 1000 * TIMER_USEC; + mpu401_event_callback = (MPU401_TIMECONSTANT / (mpu->clock.tempo*mpu->clock.timebase)) * 1000LL * TIMER_USEC; ClrQueue(mpu); break; } @@ -300,7 +300,7 @@ static void MPU401_WriteCommand(mpu_t *mpu, uint8_t val) break; case 0xff: /* Reset MPU-401 */ pclog("MPU-401:Reset %X\n",val); - mpu401_reset_callback = MPU401_RESETBUSY * 33 * TIMER_USEC; + mpu401_reset_callback = MPU401_RESETBUSY * 33LL * TIMER_USEC; mpu->state.reset=1; MPU401_Reset(mpu); #if 0 @@ -565,7 +565,7 @@ static void MPU401_EOIHandler(void *p) pclog("MPU-401 end of input callback\n"); - mpu401_eoi_callback = 0; + mpu401_eoi_callback = 0LL; mpu->state.eoi_scheduled=0; if (mpu->state.send_now) { @@ -592,7 +592,7 @@ static void MPU401_EOIHandlerDispatch(void *p) if (mpu->state.send_now) { mpu->state.eoi_scheduled=1; - mpu401_eoi_callback = 60 * TIMER_USEC; /* Possible a bit longer */ + mpu401_eoi_callback = 60LL * TIMER_USEC; /* Possible a bit longer */ } else if (!mpu->state.eoi_scheduled) MPU401_EOIHandler(mpu); @@ -698,7 +698,7 @@ static void MPU401_Event(void *p) if (mpu->mode==M_UART) { - mpu401_event_callback = 0; + mpu401_event_callback = 0LL; return; } if (mpu->state.irq_pending) goto next_event; @@ -721,16 +721,16 @@ static void MPU401_Event(void *p) } if (!mpu->state.irq_pending && mpu->state.req_mask) MPU401_EOIHandler(mpu); next_event: - /* mpu401_event_callback = 0; */ + /* mpu401_event_callback = 0LL; */ new_time = (mpu->clock.tempo * mpu->clock.timebase); if (new_time == 0) { - mpu401_event_callback = 0; + mpu401_event_callback = 0LL; return; } else { - mpu401_event_callback += (MPU401_TIMECONSTANT/new_time) * 1000 * TIMER_USEC; + mpu401_event_callback += (MPU401_TIMECONSTANT/new_time) * 1000LL * TIMER_USEC; pclog("Next event after %i us (time constant: %i)\n", (int) ((MPU401_TIMECONSTANT/new_time) * 1000 * TIMER_USEC), (int) MPU401_TIMECONSTANT); } } @@ -754,9 +754,9 @@ void mpu401_init(mpu_t *mpu, uint16_t addr, int irq, int mode) mpu->intelligent = (mode == M_INTELLIGENT) ? 1 : 0; pclog("Starting as %s (mode is %s)\n", mpu->intelligent ? "INTELLIGENT" : "UART", (mode == M_INTELLIGENT) ? "INTELLIGENT" : "UART"); - mpu401_event_callback = 0; - mpu401_eoi_callback = 0; - mpu401_reset_callback = 0; + mpu401_event_callback = 0LL; + mpu401_eoi_callback = 0LL; + mpu401_reset_callback = 0LL; io_sethandler(addr, 0x0002, mpu401_read, NULL, NULL, mpu401_write, NULL, NULL, mpu); io_sethandler(0x2A20, 0x0010, NULL, NULL, NULL, imf_write, NULL, NULL, mpu); diff --git a/src/sound/snd_opl.c b/src/sound/snd_opl.c index fdaeefbfe..990769d58 100644 --- a/src/sound/snd_opl.c +++ b/src/sound/snd_opl.c @@ -114,7 +114,7 @@ void ym3812_timer_set_0(void *param, int timer, int64_t period) { opl_t *opl = (opl_t *)param; - opl->timers[0][timer] = period * TIMER_USEC * 20; + opl->timers[0][timer] = period * TIMER_USEC * 20LL; if (!opl->timers[0][timer]) opl->timers[0][timer] = 1; opl->timers_enable[0][timer] = period ? 1 : 0; } @@ -122,7 +122,7 @@ void ym3812_timer_set_1(void *param, int timer, int64_t period) { opl_t *opl = (opl_t *)param; - opl->timers[1][timer] = period * TIMER_USEC * 20; + opl->timers[1][timer] = period * TIMER_USEC * 20LL; if (!opl->timers[1][timer]) opl->timers[1][timer] = 1; opl->timers_enable[1][timer] = period ? 1 : 0; } @@ -131,7 +131,7 @@ void ymf262_timer_set(void *param, int timer, int64_t period) { opl_t *opl = (opl_t *)param; - opl->timers[0][timer] = period * TIMER_USEC * 20; + opl->timers[0][timer] = period * TIMER_USEC * 20LL; if (!opl->timers[0][timer]) opl->timers[0][timer] = 1; opl->timers_enable[0][timer] = period ? 1 : 0; } diff --git a/src/sound/snd_opl.h b/src/sound/snd_opl.h index 14df05b9d..e99f716f9 100644 --- a/src/sound/snd_opl.h +++ b/src/sound/snd_opl.h @@ -5,8 +5,8 @@ typedef struct opl_t { int chip_nr[2]; - int timers[2][2]; - int timers_enable[2][2]; + int64_t timers[2][2]; + int64_t timers_enable[2][2]; int16_t filtbuf[2]; diff --git a/src/sound/snd_ps1.c b/src/sound/snd_ps1.c index 7b851c3cf..60a836995 100644 --- a/src/sound/snd_ps1.c +++ b/src/sound/snd_ps1.c @@ -19,7 +19,7 @@ typedef struct ps1_audio_t uint8_t status, ctrl; - int timer_latch, timer_count, timer_enable; + int64_t timer_latch, timer_count, timer_enable; uint8_t fifo[2048]; int fifo_read_idx, fifo_write_idx; @@ -89,7 +89,7 @@ static void ps1_audio_write(uint16_t port, uint8_t val, void *p) break; case 3: /*Timer reload value*/ ps1->timer_latch = val; - ps1->timer_count = (0xff-val) * TIMER_USEC; + ps1->timer_count = (int64_t) ((0xff-val) * TIMER_USEC); ps1->timer_enable = (val != 0); break; case 4: /*Almost empty*/ diff --git a/src/sound/snd_pssj.c b/src/sound/snd_pssj.c index 5b7df72b9..395717350 100644 --- a/src/sound/snd_pssj.c +++ b/src/sound/snd_pssj.c @@ -25,8 +25,8 @@ typedef struct pssj_t int amplitude; int irq; - int timer_count; - int enable; + int64_t timer_count; + int64_t enable; int wave_pos; int pulse_width; @@ -168,7 +168,7 @@ static void pssj_callback(void *p) pssj->wave_pos = (pssj->wave_pos + 1) & 31; } - pssj->timer_count += (int)(TIMER_USEC * (1000000.0 / 3579545.0) * (double)(pssj->freq ? pssj->freq : 0x400)); + pssj->timer_count += (int64_t)(TIMER_USEC * (1000000.0 / 3579545.0) * (double)(pssj->freq ? pssj->freq : 0x400)); } static void pssj_get_buffer(int32_t *buffer, int len, void *p) diff --git a/src/sound/snd_sb_dsp.c b/src/sound/snd_sb_dsp.c index 65ab96406..1ce9796df 100644 --- a/src/sound/snd_sb_dsp.c +++ b/src/sound/snd_sb_dsp.c @@ -158,14 +158,14 @@ void sb_doreset(sb_dsp_t *dsp) void sb_dsp_speed_changed(sb_dsp_t *dsp) { if (dsp->sb_timeo < 256) - dsp->sblatcho = TIMER_USEC * (256 - dsp->sb_timeo); + dsp->sblatcho = TIMER_USEC * (256LL - dsp->sb_timeo); else - dsp->sblatcho = (int)(TIMER_USEC * (1000000.0f / (float)(dsp->sb_timeo - 256))); + dsp->sblatcho = (int64_t)(TIMER_USEC * (1000000.0f / (float)(dsp->sb_timeo - 256LL))); if (dsp->sb_timei < 256) dsp->sblatchi = TIMER_USEC * (256 - dsp->sb_timei); else - dsp->sblatchi = (int)(TIMER_USEC * (1000000.0f / (float)(dsp->sb_timei - 256))); + dsp->sblatchi = (int64_t)(TIMER_USEC * (1000000.0f / (float)(dsp->sb_timei - 256LL))); } void sb_add_data(sb_dsp_t *dsp, uint8_t v) @@ -322,7 +322,7 @@ void sb_exec_command(sb_dsp_t *dsp) break; case 0x40: /*Set time constant*/ dsp->sb_timei = dsp->sb_timeo = dsp->sb_data[0]; - dsp->sblatcho = dsp->sblatchi = TIMER_USEC * (256 - dsp->sb_data[0]); + dsp->sblatcho = dsp->sblatchi = TIMER_USEC * (256LL - dsp->sb_data[0]); temp = 256 - dsp->sb_data[0]; temp = 1000000 / temp; dsp->sb_freq = temp; @@ -353,7 +353,7 @@ void sb_exec_command(sb_dsp_t *dsp) case 0x41: /*Set output sampling rate*/ case 0x42: /*Set input sampling rate*/ if (dsp->sb_type < SB16) break; - dsp->sblatcho = (int)(TIMER_USEC * (1000000.0f / (float)(dsp->sb_data[1] + (dsp->sb_data[0] << 8)))); + dsp->sblatcho = (int64_t)(TIMER_USEC * (1000000.0f / (float)(dsp->sb_data[1] + (dsp->sb_data[0] << 8)))); dsp->sb_freq = dsp->sb_data[1] + (dsp->sb_data[0] << 8); dsp->sb_timeo = 256 + dsp->sb_freq; dsp->sblatchi = dsp->sblatcho; @@ -554,7 +554,7 @@ void sb_write(uint16_t a, uint8_t v, void *priv) return; } timer_process(); - dsp->wb_time = TIMER_USEC * 1; + dsp->wb_time = TIMER_USEC * 1LL; dsp->wb_full = 1; timer_update_outstanding(); if (dsp->asp_data_len) @@ -622,7 +622,7 @@ static void sb_wb_clear(void *p) { sb_dsp_t *dsp = (sb_dsp_t *)p; - dsp->wb_time = 0; + dsp->wb_time = 0LL; } void sb_dsp_init(sb_dsp_t *dsp, int type) diff --git a/src/sound/snd_sb_dsp.h b/src/sound/snd_sb_dsp.h index fb14284fa..ea5923f11 100644 --- a/src/sound/snd_sb_dsp.h +++ b/src/sound/snd_sb_dsp.h @@ -42,17 +42,17 @@ typedef struct sb_dsp_t uint8_t sbreaddat; uint8_t sb_command; uint8_t sb_test; - int sb_timei, sb_timeo; + int64_t sb_timei, sb_timeo; int sb_irq8, sb_irq16; uint8_t sb_asp_regs[256]; - int sbenable, sb_enable_i; + int64_t sbenable, sb_enable_i; - int sbcount, sb_count_i; + int64_t sbcount, sb_count_i; - int sblatcho, sblatchi; + int64_t sblatcho, sblatchi; uint16_t sb_addr; @@ -60,7 +60,7 @@ typedef struct sb_dsp_t int asp_data_len; - int wb_time, wb_full; + int64_t wb_time, wb_full; int16_t buffer[SOUNDBUFLEN * 2]; int pos; diff --git a/src/sound/sound.c b/src/sound/sound.c index 2dfadca42..0333cf3aa 100644 --- a/src/sound/sound.c +++ b/src/sound/sound.c @@ -136,7 +136,7 @@ static struct static int sound_handlers_num; -static int sound_poll_time = 0, sound_poll_latch; +static int64_t sound_poll_time = 0LL, sound_poll_latch; int sound_pos_global = 0; int soundon = 1; @@ -403,7 +403,7 @@ void sound_poll(void *priv) void sound_speed_changed(void) { - sound_poll_latch = (int)((double)TIMER_USEC * (1000000.0 / 48000.0)); + sound_poll_latch = (int64_t)((double)TIMER_USEC * (1000000.0 / 48000.0)); } void sound_reset(void) diff --git a/src/timer.c b/src/timer.c index 252a79274..8313ebed6 100644 --- a/src/timer.c +++ b/src/timer.c @@ -11,29 +11,29 @@ static struct { - int present; + int64_t present; void (*callback)(void *priv); void *priv; - int *enable; - int *count; + int64_t *enable; + int64_t *count; } timers[TIMERS_MAX]; -int TIMER_USEC; -int timers_present = 0; -int timer_one = 1; +int64_t TIMER_USEC; +int64_t timers_present = 0; +int64_t timer_one = 1; -int timer_count = 0, timer_latch = 0; -int timer_start = 0; +int64_t timer_count = 0, timer_latch = 0; +int64_t timer_start = 0; void timer_process(void) { - int c; - int process = 0; + int64_t c; + int64_t process = 0; /*Get actual elapsed time*/ - int diff = timer_latch - timer_count; - int enable[TIMERS_MAX]; + int64_t diff = timer_latch - timer_count; + int64_t enable[TIMERS_MAX]; timer_latch = 0; @@ -58,7 +58,7 @@ void timer_process(void) while (1) { - int lowest = 1, lowest_c; + int64_t lowest = 1, lowest_c; for (c = 0; c < timers_present; c++) { @@ -83,8 +83,8 @@ void timer_process(void) void timer_update_outstanding(void) { - int c; - timer_latch = 0x7fffffff; + int64_t c; + timer_latch = 0x7fffffffffffffff; for (c = 0; c < timers_present; c++) { if (*timers[c].enable && *timers[c].count < timer_latch) @@ -102,9 +102,9 @@ void timer_reset(void) } -int timer_add(void (*callback)(void *priv), int *count, int *enable, void *priv) +int64_t timer_add(void (*callback)(void *priv), int64_t *count, int64_t *enable, void *priv) { - int i = 0; + int64_t i = 0; if (timers_present < TIMERS_MAX) { @@ -132,7 +132,7 @@ int timer_add(void (*callback)(void *priv), int *count, int *enable, void *priv) } -void timer_set_callback(int timer, void (*callback)(void *priv)) +void timer_set_callback(int64_t timer, void (*callback)(void *priv)) { timers[timer].callback = callback; } diff --git a/src/timer.h b/src/timer.h index bdc77493b..5806a4b6b 100644 --- a/src/timer.h +++ b/src/timer.h @@ -2,7 +2,7 @@ #define _TIMER_H_ -extern int timer_start; +extern int64_t timer_start; #define timer_start_period(cycles) \ timer_start = cycles; @@ -10,7 +10,7 @@ extern int timer_start; #define timer_end_period(cycles) \ do \ { \ - int diff = timer_start - (cycles); \ + int64_t diff = timer_start - (cycles); \ timer_count -= diff; \ timer_start = cycles; \ if (timer_count <= 0) \ @@ -23,7 +23,7 @@ extern int timer_start; #define timer_clock() \ do \ { \ - int diff; \ + int64_t diff; \ if (AT) \ { \ diff = timer_start - (cycles << TIMER_SHIFT); \ @@ -42,16 +42,16 @@ extern int timer_start; extern void timer_process(void); extern void timer_update_outstanding(void); extern void timer_reset(void); -extern int timer_add(void (*callback)(void *priv), int *count, int *enable, void *priv); -extern void timer_set_callback(int timer, void (*callback)(void *priv)); +extern int64_t timer_add(void (*callback)(void *priv), int64_t *count, int64_t *enable, void *priv); +extern void timer_set_callback(int64_t timer, void (*callback)(void *priv)); #define TIMER_ALWAYS_ENABLED &timer_one -extern int timer_count; -extern int timer_one; +extern int64_t timer_count; +extern int64_t timer_one; #define TIMER_SHIFT 6 -extern int TIMER_USEC; +extern int64_t TIMER_USEC; #endif /*_TIMER_H_*/ diff --git a/src/video/vid_cga.c b/src/video/vid_cga.c index 3ae4ddb2b..34d7b721f 100644 --- a/src/video/vid_cga.c +++ b/src/video/vid_cga.c @@ -154,8 +154,8 @@ void cga_recalctimings(cga_t *cga) _dispofftime = disptime - _dispontime; _dispontime *= CGACONST; _dispofftime *= CGACONST; - cga->dispontime = (int)(_dispontime * (1 << TIMER_SHIFT)); - cga->dispofftime = (int)(_dispofftime * (1 << TIMER_SHIFT)); + cga->dispontime = (int64_t)(_dispontime * (1LL << TIMER_SHIFT)); + cga->dispofftime = (int64_t)(_dispofftime * (1LL << TIMER_SHIFT)); } void cga_poll(void *p) diff --git a/src/video/vid_cga.h b/src/video/vid_cga.h index bd8d5dbc5..80dd1bad8 100644 --- a/src/video/vid_cga.h +++ b/src/video/vid_cga.h @@ -35,8 +35,8 @@ typedef struct cga_t uint16_t ma, maback; int oddeven; - int dispontime, dispofftime; - int vidtime; + int64_t dispontime, dispofftime; + int64_t vidtime; int firstline, lastline; diff --git a/src/video/vid_ega.c b/src/video/vid_ega.c index 445ce7453..440843e7c 100644 --- a/src/video/vid_ega.c +++ b/src/video/vid_ega.c @@ -511,8 +511,8 @@ void ega_recalctimings(ega_t *ega) _dispontime *= crtcconst; _dispofftime *= crtcconst; - ega->dispontime = (int)(_dispontime * (1 << TIMER_SHIFT)); - ega->dispofftime = (int)(_dispofftime * (1 << TIMER_SHIFT)); + ega->dispontime = (int64_t)(_dispontime * (1LL << TIMER_SHIFT)); + ega->dispofftime = (int64_t)(_dispofftime * (1LL << TIMER_SHIFT)); } void ega_poll(void *p) @@ -1064,10 +1064,10 @@ void *ega_standalone_init() } ega->crtc[0] = 63; - ega->dispontime = 1000 * (1 << TIMER_SHIFT); - ega->dispofftime = 1000 * (1 << TIMER_SHIFT); - ega->dispontime <<= 1; - ega->dispofftime <<= 1; + ega->dispontime = 1000LL * (1LL << TIMER_SHIFT); + ega->dispofftime = 1000LL * (1LL << TIMER_SHIFT); + ega->dispontime <<= 1LL; + ega->dispofftime <<= 1LL; ega_init(ega); diff --git a/src/video/vid_ega.h b/src/video/vid_ega.h index e9835d1fb..13fbde8ac 100644 --- a/src/video/vid_ega.h +++ b/src/video/vid_ega.h @@ -65,8 +65,8 @@ typedef struct ega_t int vres; - int dispontime, dispofftime; - int vidtime; + int64_t dispontime, dispofftime; + int64_t vidtime; uint8_t scrblank; diff --git a/src/video/vid_genius.c b/src/video/vid_genius.c index 6411125d2..fb88bb382 100644 --- a/src/video/vid_genius.c +++ b/src/video/vid_genius.c @@ -103,13 +103,13 @@ typedef struct genius_t int enabled; /* Display enabled, 0 or 1 */ int detach; /* Detach cursor, 0 or 1 */ - int dispontime, dispofftime; - int vidtime; + int64_t dispontime, dispofftime; + int64_t vidtime; int linepos, displine; int vc; int dispon, blink; - int vsynctime; + int64_t vsynctime; uint8_t *vram; } genius_t; @@ -249,8 +249,8 @@ void genius_recalctimings(genius_t *genius) _dispofftime = disptime - _dispontime; _dispontime *= MDACONST; _dispofftime *= MDACONST; - genius->dispontime = (int)(_dispontime * (1 << TIMER_SHIFT)); - genius->dispofftime = (int)(_dispofftime * (1 << TIMER_SHIFT)); + genius->dispontime = (int64_t)(_dispontime * (1LL << TIMER_SHIFT)); + genius->dispofftime = (int64_t)(_dispofftime * (1LL << TIMER_SHIFT)); } diff --git a/src/video/vid_hercules.c b/src/video/vid_hercules.c index cf50cb6d6..99a3a9aa5 100644 --- a/src/video/vid_hercules.c +++ b/src/video/vid_hercules.c @@ -29,8 +29,8 @@ typedef struct hercules_t uint8_t ctrl, ctrl2, stat; - int dispontime, dispofftime; - int vidtime; + int64_t dispontime, dispofftime; + int64_t vidtime; int firstline, lastline; @@ -39,7 +39,8 @@ typedef struct hercules_t uint16_t ma, maback; int con, coff, cursoron; int dispon, blink; - int vsynctime, vadj; + int64_t vsynctime; + int vadj; uint8_t *vram; } hercules_t; @@ -125,8 +126,8 @@ void hercules_recalctimings(hercules_t *hercules) _dispofftime = disptime - _dispontime; _dispontime *= MDACONST; _dispofftime *= MDACONST; - hercules->dispontime = (int)(_dispontime * (1 << TIMER_SHIFT)); - hercules->dispofftime = (int)(_dispofftime * (1 << TIMER_SHIFT)); + hercules->dispontime = (int64_t)(_dispontime * (1 << TIMER_SHIFT)); + hercules->dispofftime = (int64_t)(_dispofftime * (1 << TIMER_SHIFT)); } void hercules_poll(void *p) diff --git a/src/video/vid_herculesplus.c b/src/video/vid_herculesplus.c index 1215a0dee..3bd261cf7 100644 --- a/src/video/vid_herculesplus.c +++ b/src/video/vid_herculesplus.c @@ -56,8 +56,8 @@ typedef struct herculesplus_t uint8_t ctrl, ctrl2, stat; - int dispontime, dispofftime; - int vidtime; + int64_t dispontime, dispofftime; + int64_t vidtime; int firstline, lastline; @@ -66,7 +66,8 @@ typedef struct herculesplus_t uint16_t ma, maback; int con, coff, cursoron; int dispon, blink; - int vsynctime, vadj; + int64_t vsynctime; + int vadj; uint8_t *vram; } herculesplus_t; @@ -163,8 +164,8 @@ void herculesplus_recalctimings(herculesplus_t *herculesplus) _dispofftime = disptime - _dispontime; _dispontime *= MDACONST; _dispofftime *= MDACONST; - herculesplus->dispontime = (int)(_dispontime * (1 << TIMER_SHIFT)); - herculesplus->dispofftime = (int)(_dispofftime * (1 << TIMER_SHIFT)); + herculesplus->dispontime = (int64_t)(_dispontime * (1 << TIMER_SHIFT)); + herculesplus->dispofftime = (int64_t)(_dispofftime * (1 << TIMER_SHIFT)); } diff --git a/src/video/vid_incolor.c b/src/video/vid_incolor.c index 2d3df7514..85a37dd52 100644 --- a/src/video/vid_incolor.c +++ b/src/video/vid_incolor.c @@ -155,8 +155,8 @@ typedef struct incolor_t uint8_t ctrl, ctrl2, stat; - int dispontime, dispofftime; - int vidtime; + int64_t dispontime, dispofftime; + int64_t vidtime; int firstline, lastline; @@ -165,7 +165,8 @@ typedef struct incolor_t uint16_t ma, maback; int con, coff, cursoron; int dispon, blink; - int vsynctime, vadj; + int64_t vsynctime; + int vadj; uint8_t palette[16]; /* EGA-style 16 -> 64 palette registers */ uint8_t palette_idx; /* Palette write index */ @@ -372,8 +373,8 @@ void incolor_recalctimings(incolor_t *incolor) _dispofftime = disptime - _dispontime; _dispontime *= MDACONST; _dispofftime *= MDACONST; - incolor->dispontime = (int)(_dispontime * (1 << TIMER_SHIFT)); - incolor->dispofftime = (int)(_dispofftime * (1 << TIMER_SHIFT)); + incolor->dispontime = (int64_t)(_dispontime * (1 << TIMER_SHIFT)); + incolor->dispofftime = (int64_t)(_dispofftime * (1 << TIMER_SHIFT)); } diff --git a/src/video/vid_mda.c b/src/video/vid_mda.c index 3cc45400a..cdc8e1f0c 100644 --- a/src/video/vid_mda.c +++ b/src/video/vid_mda.c @@ -29,8 +29,8 @@ typedef struct mda_t uint8_t ctrl, stat; - int dispontime, dispofftime; - int vidtime; + int64_t dispontime, dispofftime; + int64_t vidtime; int firstline, lastline; @@ -39,7 +39,8 @@ typedef struct mda_t uint16_t ma, maback; int con, coff, cursoron; int dispon, blink; - int vsynctime, vadj; + int64_t vsynctime; + int vadj; uint8_t *vram; } mda_t; @@ -111,8 +112,8 @@ void mda_recalctimings(mda_t *mda) _dispofftime = disptime - _dispontime; _dispontime *= MDACONST; _dispofftime *= MDACONST; - mda->dispontime = (int)(_dispontime * (1 << TIMER_SHIFT)); - mda->dispofftime = (int)(_dispofftime * (1 << TIMER_SHIFT)); + mda->dispontime = (int64_t)(_dispontime * (1 << TIMER_SHIFT)); + mda->dispofftime = (int64_t)(_dispofftime * (1 << TIMER_SHIFT)); } void mda_poll(void *p) diff --git a/src/video/vid_nv_riva128.c b/src/video/vid_nv_riva128.c index e8919731f..bc7b4a486 100644 --- a/src/video/vid_nv_riva128.c +++ b/src/video/vid_nv_riva128.c @@ -229,10 +229,10 @@ typedef struct riva128_t } edid_rom; } i2c; - int mtime, mfreq; - int nvtime, nvfreq; - int menable; - int nvenable; + int64_t mtime, mfreq; + int64_t nvtime, nvfreq; + int64_t menable; + int64_t nvenable; } riva128_t; //Internally, the RIVA 128 operates in a weird 38-bit color depth, with 10 bits for RGB, and 8 bits for alpha, according to envytools. diff --git a/src/video/vid_olivetti_m24.c b/src/video/vid_olivetti_m24.c index a0bee6c2e..81129b3f7 100644 --- a/src/video/vid_olivetti_m24.c +++ b/src/video/vid_olivetti_m24.c @@ -36,13 +36,14 @@ typedef struct m24_t int linepos, displine; int sc, vc; int con, coff, cursoron, blink; - int vsynctime, vadj; + int64_t vsynctime; + int vadj; int lineff; uint16_t ma, maback; int dispon; - int dispontime, dispofftime; - int vidtime; + int64_t dispontime, dispofftime; + int64_t vidtime; int firstline, lastline; } m24_t; @@ -135,8 +136,8 @@ void m24_recalctimings(m24_t *m24) _dispofftime = disptime - _dispontime; _dispontime *= CGACONST / 2; _dispofftime *= CGACONST / 2; - m24->dispontime = (int)(_dispontime * (1 << TIMER_SHIFT)); - m24->dispofftime = (int)(_dispofftime * (1 << TIMER_SHIFT)); + m24->dispontime = (int64_t)(_dispontime * (1 << TIMER_SHIFT)); + m24->dispofftime = (int64_t)(_dispofftime * (1 << TIMER_SHIFT)); } void m24_poll(void *p) diff --git a/src/video/vid_pc1512.c b/src/video/vid_pc1512.c index 57222148f..20069c7ba 100644 --- a/src/video/vid_pc1512.c +++ b/src/video/vid_pc1512.c @@ -38,13 +38,14 @@ typedef struct pc1512_t int sc, vc; int cgadispon; int con, coff, cursoron, cgablink; - int vsynctime, vadj; + int64_t vsynctime; + int vadj; uint16_t ma, maback; int dispon; int blink; - int dispontime, dispofftime; - int vidtime; + int64_t dispontime, dispofftime; + int64_t vidtime; int firstline, lastline; uint8_t *vram; @@ -158,8 +159,8 @@ static void pc1512_recalctimings(pc1512_t *pc1512) _dispofftime = disptime - _dispontime; _dispontime *= CGACONST; _dispofftime *= CGACONST; - pc1512->dispontime = (int)(_dispontime * (1 << TIMER_SHIFT)); - pc1512->dispofftime = (int)(_dispofftime * (1 << TIMER_SHIFT)); + pc1512->dispontime = (int64_t)(_dispontime * (1 << TIMER_SHIFT)); + pc1512->dispofftime = (int64_t)(_dispofftime * (1 << TIMER_SHIFT)); } static void pc1512_poll(void *p) diff --git a/src/video/vid_pc1640.c b/src/video/vid_pc1640.c index 44eb6970e..2b7290384 100644 --- a/src/video/vid_pc1640.c +++ b/src/video/vid_pc1640.c @@ -31,8 +31,8 @@ typedef struct pc1640_t rom_t bios_rom; int cga_enabled; - int dispontime, dispofftime; - int vidtime; + int64_t dispontime, dispofftime; + int64_t vidtime; } pc1640_t; void pc1640_out(uint16_t addr, uint8_t val, void *p) diff --git a/src/video/vid_pcjr.c b/src/video/vid_pcjr.c index 02b9fd428..44faa9542 100644 --- a/src/video/vid_pcjr.c +++ b/src/video/vid_pcjr.c @@ -39,10 +39,11 @@ typedef struct pcjr_t int sc, vc; int dispon; int con, coff, cursoron, blink; - int vsynctime, vadj; + int64_t vsynctime; + int vadj; uint16_t ma, maback; - int dispontime, dispofftime, vidtime; + int64_t dispontime, dispofftime, vidtime; int firstline, lastline; int composite; @@ -166,8 +167,8 @@ void pcjr_recalctimings(pcjr_t *pcjr) _dispofftime = disptime - _dispontime; _dispontime *= CGACONST; _dispofftime *= CGACONST; - pcjr->dispontime = (int)(_dispontime * (1 << TIMER_SHIFT)); - pcjr->dispofftime = (int)(_dispofftime * (1 << TIMER_SHIFT)); + pcjr->dispontime = (int64_t)(_dispontime * (1 << TIMER_SHIFT)); + pcjr->dispofftime = (int64_t)(_dispofftime * (1 << TIMER_SHIFT)); } diff --git a/src/video/vid_svga.c b/src/video/vid_svga.c index 360934034..1898fe8c6 100644 --- a/src/video/vid_svga.c +++ b/src/video/vid_svga.c @@ -685,8 +685,8 @@ void svga_recalctimings(svga_t *svga) _dispontime *= crtcconst; _dispofftime *= crtcconst; - svga->dispontime = (int)(_dispontime * (1 << TIMER_SHIFT)); - svga->dispofftime = (int)(_dispofftime * (1 << TIMER_SHIFT)); + svga->dispontime = (int64_t)(_dispontime * (1 << TIMER_SHIFT)); + svga->dispofftime = (int64_t)(_dispofftime * (1 << TIMER_SHIFT)); /* printf("SVGA horiz total %i display end %i vidclock %f\n",svga->crtc[0],svga->crtc[1],svga->clock); printf("SVGA vert total %i display end %i max row %i vsync %i\n",svga->vtotal,svga->dispend,(svga->crtc[9]&31)+1,svga->vsyncstart); printf("total %f on %i cycles off %i cycles frame %i sec %i %02X\n",disptime*crtcconst,svga->dispontime,svga->dispofftime,(svga->dispontime+svga->dispofftime)*svga->vtotal,(svga->dispontime+svga->dispofftime)*svga->vtotal*70,svga->seqregs[1]); diff --git a/src/video/vid_svga.h b/src/video/vid_svga.h index d4307dfde..139926ee3 100644 --- a/src/video/vid_svga.h +++ b/src/video/vid_svga.h @@ -70,8 +70,8 @@ typedef struct svga_t uint32_t ma_latch; int bpp; - int dispontime, dispofftime; - int vidtime; + int64_t dispontime, dispofftime; + int64_t vidtime; uint8_t scrblank; diff --git a/src/video/vid_tandy.c b/src/video/vid_tandy.c index 8f4977ae7..cddd6dc92 100644 --- a/src/video/vid_tandy.c +++ b/src/video/vid_tandy.c @@ -40,10 +40,11 @@ typedef struct tandy_t int sc, vc; int dispon; int con, coff, cursoron, blink; - int vsynctime, vadj; + int64_t vsynctime; + int vadj; uint16_t ma, maback; - int dispontime, dispofftime, vidtime; + int64_t dispontime, dispofftime, vidtime; int firstline, lastline; int composite; @@ -184,8 +185,8 @@ void tandy_recalctimings(tandy_t *tandy) _dispofftime = disptime - _dispontime; _dispontime *= CGACONST; _dispofftime *= CGACONST; - tandy->dispontime = (int)(_dispontime * (1 << TIMER_SHIFT)); - tandy->dispofftime = (int)(_dispofftime * (1 << TIMER_SHIFT)); + tandy->dispontime = (int64_t)(_dispontime * (1 << TIMER_SHIFT)); + tandy->dispofftime = (int64_t)(_dispofftime * (1 << TIMER_SHIFT)); } void tandy_poll(void *p) diff --git a/src/video/vid_tandysl.c b/src/video/vid_tandysl.c index fabdb51d3..cfe9f7b79 100644 --- a/src/video/vid_tandysl.c +++ b/src/video/vid_tandysl.c @@ -40,11 +40,12 @@ typedef struct tandysl_t int sc, vc; int dispon; int con, coff, cursoron, blink; - int vsynctime, vadj; + int64_t vsynctime; + int vadj; uint16_t ma, maback; - int dispontime, dispofftime; - int vidtime; + int64_t dispontime, dispofftime; + int64_t vidtime; int firstline, lastline; } tandysl_t; @@ -240,8 +241,8 @@ static void tandysl_recalctimings(tandysl_t *tandy) _dispofftime = disptime - _dispontime; _dispontime *= CGACONST; _dispofftime *= CGACONST; - tandy->dispontime = (int)(_dispontime * (1 << TIMER_SHIFT)); - tandy->dispofftime = (int)(_dispofftime * (1 << TIMER_SHIFT)); + tandy->dispontime = (int64_t)(_dispontime * (1 << TIMER_SHIFT)); + tandy->dispofftime = (int64_t)(_dispofftime * (1 << TIMER_SHIFT)); } diff --git a/src/video/vid_voodoo.c b/src/video/vid_voodoo.c index a572f3a46..62263036d 100644 --- a/src/video/vid_voodoo.c +++ b/src/video/vid_voodoo.c @@ -221,7 +221,7 @@ typedef struct voodoo_t uint16_t dac_pll_regs[16]; float pixel_clock; - int line_time; + int64_t line_time; voodoo_params_t params; @@ -255,7 +255,7 @@ typedef struct voodoo_t int swap_count; int disp_buffer, draw_buffer; - int timer_count; + int64_t timer_count; int line; svga_t *svga; @@ -264,7 +264,7 @@ typedef struct voodoo_t uint32_t videoDimensions; uint32_t hSync, vSync; - int h_total, v_total, v_disp; + int64_t h_total, v_total, v_disp; int h_disp; int v_retrace; @@ -391,9 +391,9 @@ typedef struct voodoo_t int fb_write_buffer, fb_draw_buffer; int buffer_cutoff; - int read_time, write_time, burst_time; + int64_t read_time, write_time, burst_time; - int wake_timer; + int64_t wake_timer; uint8_t thefilter[256][256]; // pixel filter, feeding from one or two uint8_t thefilterg[256][256]; // for green @@ -5766,7 +5766,7 @@ static void voodoo_tex_writel(uint32_t addr, uint32_t val, void *p) *(uint32_t *)(&voodoo->tex_mem[tmu][addr & voodoo->texture_mask]) = val; } -#define WAKE_DELAY (TIMER_USEC * 100) +#define WAKE_DELAY (TIMER_USEC * 100LL) static inline void wake_fifo_thread(voodoo_t *voodoo) { if (!voodoo->wake_timer) @@ -5790,7 +5790,7 @@ static void voodoo_wake_timer(void *p) { voodoo_t *voodoo = (voodoo_t *)p; - voodoo->wake_timer = 0; + voodoo->wake_timer = 0LL; thread_set_event(voodoo->wake_fifo_thread); /*Wake up FIFO thread if moving from idle*/ } @@ -6101,7 +6101,7 @@ static void voodoo_pixelclock_update(voodoo_t *voodoo) int n2 = ((voodoo->dac_pll_regs[0] >> 13) & 0x07); float t = (14318184.0 * ((float)m / (float)n1)) / (float)(1 << n2); double clock_const; - int line_length; + int64_t line_length; if ((voodoo->dac_data[6] & 0xf0) == 0x20 || (voodoo->dac_data[6] & 0xf0) == 0x60 || @@ -6115,7 +6115,7 @@ static void voodoo_pixelclock_update(voodoo_t *voodoo) voodoo->pixel_clock = t; clock_const = cpuclock / t; - voodoo->line_time = (int)((double)line_length * clock_const * (double)(1 << TIMER_SHIFT)); + voodoo->line_time = (int64_t)((double)line_length * clock_const * (double)(1 << TIMER_SHIFT)); } static void voodoo_writel(uint32_t addr, uint32_t val, void *p) @@ -7351,7 +7351,7 @@ skip_draw: if (voodoo->line_time) voodoo->timer_count += voodoo->line_time; else - voodoo->timer_count += TIMER_USEC * 32; + voodoo->timer_count += TIMER_USEC * 32LL; } static void voodoo_add_status_info(char *s, int max_len, void *p) diff --git a/src/video/vid_wy700.c b/src/video/vid_wy700.c index b3a816427..93624c222 100644 --- a/src/video/vid_wy700.c +++ b/src/video/vid_wy700.c @@ -194,13 +194,13 @@ typedef struct wy700_t int enabled; /* Display enabled, 0 or 1 */ int detach; /* Detach cursor, 0 or 1 */ - int dispontime, dispofftime; - int vidtime; + int64_t dispontime, dispofftime; + int64_t vidtime; int linepos, displine; int vc; int dispon, blink; - int vsynctime; + int64_t vsynctime; uint8_t *vram; } wy700_t; @@ -494,8 +494,8 @@ void wy700_recalctimings(wy700_t *wy700) _dispofftime = disptime - _dispontime; _dispontime *= MDACONST; _dispofftime *= MDACONST; - wy700->dispontime = (int)(_dispontime * (1 << TIMER_SHIFT)); - wy700->dispofftime = (int)(_dispofftime * (1 << TIMER_SHIFT)); + wy700->dispontime = (int64_t)(_dispontime * (1 << TIMER_SHIFT)); + wy700->dispofftime = (int64_t)(_dispofftime * (1 << TIMER_SHIFT)); }