Timers are now 64-bit.

This commit is contained in:
OBattler
2017-10-09 01:48:36 +02:00
parent 08bf9109d7
commit 02bbfb26eb
67 changed files with 508 additions and 499 deletions

View File

@@ -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)

View File

@@ -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;

View File

@@ -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);

View File

@@ -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;

View File

@@ -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));
}

View File

@@ -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)

View File

@@ -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));
}

View File

@@ -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));
}

View File

@@ -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)

View File

@@ -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.

View File

@@ -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)

View File

@@ -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)

View File

@@ -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)

View File

@@ -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));
}

View File

@@ -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]);

View File

@@ -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;

View File

@@ -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)

View File

@@ -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));
}

View File

@@ -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)

View File

@@ -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));
}