diff --git a/src/dma.c b/src/dma.c index 89edd6e..3c101b4 100644 --- a/src/dma.c +++ b/src/dma.c @@ -734,7 +734,7 @@ dma_channel_write(int channel, uint16_t val) return(DMA_NODATA); if (! dma_c->size) { - _dma_write(dma_c->ac, val); + _dma_write(dma_c->ac, val & 0xff); if (dma_c->mode & 0x20) { if (dma_ps2.is_ps2) @@ -748,7 +748,7 @@ dma_channel_write(int channel, uint16_t val) dma_c->ac = (dma_c->ac & 0xff0000) | ((dma_c->ac + 1) & 0xffff); } } else { - _dma_write(dma_c->ac, val); + _dma_write(dma_c->ac, val & 0xff); _dma_write(dma_c->ac + 1, val >> 8); if (dma_c->mode & 0x20) { @@ -889,7 +889,7 @@ dma_mode(int channel) void DMAPageRead(uint32_t PhysAddress, uint8_t *DataRead, uint32_t TotalSize) { - int i = 0; + uint32_t i = 0; #if 0 memcpy(DataRead, &ram[PhysAddress], TotalSize); @@ -903,7 +903,7 @@ DMAPageRead(uint32_t PhysAddress, uint8_t *DataRead, uint32_t TotalSize) void DMAPageWrite(uint32_t PhysAddress, const uint8_t *DataWrite, uint32_t TotalSize) { - int i = 0; + uint32_t i = 0; #if 0 mem_invalidate_range(PhysAddress, PhysAddress + TotalSize - 1); diff --git a/src/io.c b/src/io.c index 8f6e68d..78ac472 100644 --- a/src/io.c +++ b/src/io.c @@ -348,7 +348,7 @@ outw(uint16_t port, uint16_t val) p = p->next; } - outb(port,val); + outb(port,val & 0xff); outb(port+1,val>>8); } diff --git a/src/keyboard_xt.c b/src/keyboard_xt.c index 892e537..a157e30 100644 --- a/src/keyboard_xt.c +++ b/src/keyboard_xt.c @@ -364,7 +364,7 @@ kbd_poll(void *priv) static void kbd_adddata(uint16_t val) { - key_queue[key_queue_end] = val; + key_queue[key_queue_end] = val & 0xff; #if ENABLE_KEYBOARD_LOG pclog("XTkbd: %02X added to key queue at %i\n", val, key_queue_end); diff --git a/src/pic.c b/src/pic.c index 404b2fa..4e7ca94 100644 --- a/src/pic.c +++ b/src/pic.c @@ -396,7 +396,7 @@ void pic2_init() void clearpic() { - pic.pend=pic.ins=pic_current=0; + pic_current=pic.pend=pic.ins=0; pic_updatepending(); } diff --git a/src/pit.c b/src/pit.c index 03d4c4b..6035849 100644 --- a/src/pit.c +++ b/src/pit.c @@ -76,17 +76,17 @@ int64_t firsttime=1; void setpitclock(float clock) { cpuclock=clock; - PITCONST=clock/(1193181.0 + (2.0 / 3.0)); - CGACONST=(clock/(19687503.0/11.0)); - MDACONST=(clock/2032125.0); - VGACONST1=(clock/25175000.0); - VGACONST2=(clock/28322000.0); - isa_timing = clock/8000000.0; - bus_timing = clock/(double)cpu_busspeed; + PITCONST=clock/(1193181.0f + (2.0f / 3.0f)); + CGACONST=(clock/(19687503.0f/11.0f)); + MDACONST=(clock/2032125.0f); + VGACONST1=(clock/25175000.0f); + VGACONST2=(clock/28322000.0f); + isa_timing = clock/8000000.0f; + bus_timing = clock/(float)cpu_busspeed; video_update_timing(); - xt_cpu_multi = (int64_t)((14318184.0*(double)(1 << TIMER_SHIFT)) / (double)machines[machine].cpu[cpu_manufacturer].cpus[cpu_effective].rspeed); - RTCCONST=clock/32768.0; + xt_cpu_multi = (int)((14318184.0*(double)(1 << TIMER_SHIFT)) / (double)machines[machine].cpu[cpu_manufacturer].cpus[cpu_effective].rspeed); + RTCCONST=clock/32768.0f; TIMER_USEC = (int64_t)((clock / 1000000.0f) * (float)(1 << TIMER_SHIFT)); device_speed_changed(); } @@ -102,9 +102,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] = 0xFFFFLL*PITCONST; - pit->l[1] = 0xFFFF; pit->c[1] = 0xFFFFLL*PITCONST; - pit->l[2] = 0xFFFF; pit->c[2] = 0xFFFFLL*PITCONST; + pit->l[0] = 0xFFFF; pit->c[0] = (int64_t)(0xFFFFLL*PITCONST); + pit->l[1] = 0xFFFF; pit->c[1] = (int64_t)(0xFFFFLL*PITCONST); + pit->l[2] = 0xFFFF; pit->c[2] = (int64_t)(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; @@ -121,9 +121,9 @@ void clearpit() float pit_timer0_freq() { if (pit.l[0]) - return (1193181.0 + (2.0 / 3.0))/(float)pit.l[0]; + return (1193181.0f + (2.0f / 3.0f))/(float)pit.l[0]; else - return (1193181.0 + (2.0 / 3.0))/(float)0x10000; + return (1193181.0f + (2.0f / 3.0f))/(float)0x10000; } static void pit_set_out(PIT *pit, int64_t t, int64_t out) @@ -370,7 +370,7 @@ void pit_write(uint16_t addr, uint8_t val, void *p) { PIT *pit = (PIT *)p; int64_t t; - cycles -= (int64_t)PITCONST; + cycles -= (int)PITCONST; switch (addr&3) { @@ -467,7 +467,7 @@ void pit_write(uint16_t addr, uint8_t val, void *p) pit->wm[t]=0; break; } - speakval=(((float)pit->l[2]/(float)pit->l[0])*0x4000)-0x2000; + speakval=(int)(((float)pit->l[2]/(float)pit->l[0])*0x4000)-0x2000; if (speakval>0x2000) speakval=0x2000; break; } @@ -478,7 +478,7 @@ uint8_t pit_read(uint16_t addr, void *p) PIT *pit = (PIT *)p; int64_t t; uint8_t temp = 0xff; - cycles -= (int64_t)PITCONST; + cycles -= (int)PITCONST; switch (addr&3) { case 0: case 1: case 2: /*Timers*/