diff --git a/includes/private/cpu/x86.h b/includes/private/cpu/x86.h index 789dfd26..37671dd9 100644 --- a/includes/private/cpu/x86.h +++ b/includes/private/cpu/x86.h @@ -262,7 +262,7 @@ enum { ABRT_NONE = 0, ABRT_GEN, ABRT_TS = 0xA, ABRT_NP = 0xB, ABRT_SS = 0xC, ABR This distinction is used by the dynarec; a block that hits an 'expected' exception would be compiled, a block that hits an 'unexpected' exception would be rejected so that we don't end up with an unnecessarily short block*/ -#define ABRT_EXPECTED 0x80 +#define ABRT_EXPECTED ((int8_t)0x80) extern uint32_t abrt_error; void x86_doabrt(int x86_abrt); diff --git a/includes/private/models/pit.h b/includes/private/models/pit.h index eceb10c3..8c35e5e0 100644 --- a/includes/private/models/pit.h +++ b/includes/private/models/pit.h @@ -3,7 +3,7 @@ extern uint64_t PITCONST; void pit_init(); void pit_ps2_init(); -void pit_reset(); +void pit_reset(PIT *pit); void pit_set_gate(PIT *pit, int channel, int gate); void pit_set_using_timer(PIT *pit, int t, int using_timer); void pit_set_out_func(PIT *pit, int t, void (*func)(int new_out, int old_out)); diff --git a/src/codegen/codegen_timing_p6.c b/src/codegen/codegen_timing_p6.c index aa7e9744..63779d09 100644 --- a/src/codegen/codegen_timing_p6.c +++ b/src/codegen/codegen_timing_p6.c @@ -53,7 +53,7 @@ static const p6_instruction_t alu6_op = {.nr_uops = 6, .uop[5] = {.type = UOP_ALU01, .throughput = 1, .latency = 1}}; static const p6_instruction_t aluc_op = {.nr_uops = 2, .uop[0] = {.type = UOP_ALU01, .throughput = 1, .latency = 1}, - .uop[0] = {.type = UOP_ALU01, .throughput = 1, .latency = 1}}; + .uop[1] = {.type = UOP_ALU01, .throughput = 1, .latency = 1}}; static const p6_instruction_t load_alu_op = {.nr_uops = 2, .uop[0] = {.type = UOP_LOAD, .throughput = 1, .latency = 2}, .uop[1] = {.type = UOP_ALU01, .throughput = 1, .latency = 1}}; @@ -89,7 +89,7 @@ static const p6_instruction_t store_op = {.nr_uops = 2, static const p6_instruction_t bswap_op = {.nr_uops = 2, .uop[0] = {.type = UOP_ALU0, .throughput = 1, .latency = 1}, - .uop[0] = {.type = UOP_ALU01, .throughput = 1, .latency = 1}}; + .uop[1] = {.type = UOP_ALU01, .throughput = 1, .latency = 1}}; static const p6_instruction_t leave_op = {.nr_uops = 3, .uop[0] = {.type = UOP_LOAD, .throughput = 1, .latency = 2}, .uop[1] = {.type = UOP_ALU01, .throughput = 1, .latency = 1}, @@ -349,18 +349,18 @@ static const p6_instruction_t div16_op = {.nr_uops = 3, .uop[2] = {.type = UOP_ALU01, .throughput = 1, .latency = 1}}; static const p6_instruction_t div16_mem_op = {.nr_uops = 4, .uop[0] = {.type = UOP_LOAD, .throughput = 1, .latency = 2}, - .uop[0] = {.type = UOP_ALU0, .throughput = 21, .latency = 21}, - .uop[1] = {.type = UOP_ALU0, .throughput = 1, .latency = 1}, - .uop[2] = {.type = UOP_ALU01, .throughput = 1, .latency = 1}}; + .uop[1] = {.type = UOP_ALU0, .throughput = 21, .latency = 21}, + .uop[2] = {.type = UOP_ALU0, .throughput = 1, .latency = 1}, + .uop[3] = {.type = UOP_ALU01, .throughput = 1, .latency = 1}}; static const p6_instruction_t div32_op = {.nr_uops = 3, .uop[0] = {.type = UOP_ALU0, .throughput = 35, .latency = 35}, .uop[1] = {.type = UOP_ALU0, .throughput = 1, .latency = 1}, .uop[2] = {.type = UOP_ALU01, .throughput = 1, .latency = 1}}; static const p6_instruction_t div32_mem_op = {.nr_uops = 4, .uop[0] = {.type = UOP_LOAD, .throughput = 1, .latency = 2}, - .uop[0] = {.type = UOP_ALU0, .throughput = 35, .latency = 35}, - .uop[1] = {.type = UOP_ALU0, .throughput = 1, .latency = 1}, - .uop[2] = {.type = UOP_ALU01, .throughput = 1, .latency = 1}}; + .uop[1] = {.type = UOP_ALU0, .throughput = 35, .latency = 35}, + .uop[2] = {.type = UOP_ALU0, .throughput = 1, .latency = 1}, + .uop[3] = {.type = UOP_ALU01, .throughput = 1, .latency = 1}}; static const p6_instruction_t emms_op = {.nr_uops = 11, .uop[0] = {.type = UOP_ALU0, .throughput = 1, .latency = 1}, .uop[1] = {.type = UOP_ALU0, .throughput = 1, .latency = 1}, @@ -393,7 +393,7 @@ static const p6_instruction_t ins_op = {.nr_uops = 4, .uop[0] = {.type = UOP_ALU0, .throughput = 18, .latency = 18}, .uop[1] = {.type = UOP_STOREADDR, .throughput = 1, .latency = 1}, .uop[2] = {.type = UOP_STOREDATA, .throughput = 1, .latency = 1}, - .uop[2] = {.type = UOP_ALU01, .throughput = 1, .latency = 1}}; + .uop[3] = {.type = UOP_ALU01, .throughput = 1, .latency = 1}}; static const p6_instruction_t int_op = { .nr_uops = 7, .uop[0] = {.type = UOP_ALU0, .throughput = 20, .latency = 20}, diff --git a/src/disc/disc.c b/src/disc/disc.c index 95652aa4..30720586 100644 --- a/src/disc/disc.c +++ b/src/disc/disc.c @@ -251,7 +251,7 @@ void disc_stop(int drive) { drive ^= fdd_swap; if (drive < 2 && drives[drive].stop) - drives[drive].stop(drive); + drives[drive].stop(); } void disc_set_drivesel(int drive) { diff --git a/src/pc.c b/src/pc.c index e074f394..4f30a527 100644 --- a/src/pc.c +++ b/src/pc.c @@ -60,10 +60,10 @@ #include "hdd.h" #include "x86.h" #include "paths.h" +#include "plugin.h" #ifdef USE_NETWORKING #include "nethandler.h" -#include "plugin.h" #include "wx-utils.h" #define NE2000 1 uint8_t ethif; @@ -369,7 +369,7 @@ void resetpchard() { network_card_init(network_card_current); #endif - sound_card_init(sound_card_current); + sound_card_init(); if (GUS) device_add(&gus_device); if (GAMEBLASTER) diff --git a/src/rtc_tc8521.c b/src/rtc_tc8521.c index 92650903..52bb21ff 100644 --- a/src/rtc_tc8521.c +++ b/src/rtc_tc8521.c @@ -149,8 +149,10 @@ static void tc8521_set_nvrram(uint8_t *nvrram, struct tm *cur_time_tm) { nvrram[TC8521_HOUR1] = cur_time_tm->tm_hour % 10; nvrram[TC8521_HOUR10] = cur_time_tm->tm_hour / 10; } else { - nvrram[TC8521_HOUR1] = (cur_time_tm->tm_hour % 12) % 10; - nvrram[TC8521_HOUR10] = ((cur_time_tm->tm_hour % 12) / 10) | (cur_time_tm->tm_hour >= 12) ? 2 : 0; + int hour12 = (cur_time_tm->tm_hour % 12); + if (hour12 == 0) hour12 = 12; + nvrram[TC8521_HOUR1] = hour12 % 10; + nvrram[TC8521_HOUR10] = hour12 / 10; } nvrram[TC8521_WEEKDAY] = cur_time_tm->tm_wday; nvrram[TC8521_DAY1] = cur_time_tm->tm_mday % 10; diff --git a/src/sound/sound.c b/src/sound/sound.c index 63acb913..ab3b5cd3 100644 --- a/src/sound/sound.c +++ b/src/sound/sound.c @@ -81,6 +81,7 @@ int sound_card_has_config(int card) { char *sound_card_get_internal_name(int card) { if (sound_cards[card] != NULL) return sound_cards[card]->internal_name; + return "error-no-name"; } int sound_card_get_from_internal_name(char *s) { diff --git a/src/sound/sound_adlibgold.c b/src/sound/sound_adlibgold.c index 88d3ea9b..cde65785 100644 --- a/src/sound/sound_adlibgold.c +++ b/src/sound/sound_adlibgold.c @@ -106,7 +106,6 @@ static int treble_cut[6] = { (int)(0.354 * 16384) /*-3 dB - filter output is at +6 dB*/ }; -void adgold_timer_poll(); void adgold_update(adgold_t *adgold); void adgold_update_irq_status(adgold_t *adgold) { diff --git a/src/video/vid_s3.c b/src/video/vid_s3.c index 0719643b..d94022e3 100644 --- a/src/video/vid_s3.c +++ b/src/video/vid_s3.c @@ -140,7 +140,7 @@ typedef struct s3_t { #define INT_FIFO_EMP (1 << 3) #define INT_MASK 0xf -void s3_updatemapping(); +void s3_updatemapping(s3_t *s3); void s3_accel_write(uint32_t addr, uint8_t val, void *p); void s3_accel_write_w(uint32_t addr, uint16_t val, void *p); diff --git a/src/video/vid_t1000.c b/src/video/vid_t1000.c index 34b38cb3..3cfb8b75 100644 --- a/src/video/vid_t1000.c +++ b/src/video/vid_t1000.c @@ -16,6 +16,9 @@ /*Very rough estimate*/ #define VID_CLOCK (double)(651 * 216 * 60) +#define T1000_OUTPUT_DISPLAY_INTERNAL 1u +#define T1000_OUTPUT_DISPLAY_EXTERNAL 0u +#define T1000_OUTPUT_DISPLAY_UNSET 255u /* Mapping of attributes to colours */ static uint32_t blue, grey; static uint8_t boldcols[256]; /* Which attributes use the bold font */ @@ -31,7 +34,7 @@ static uint8_t language; */ static uint8_t st_video_options; static uint8_t st_enabled = 1; -static uint8_t st_display_internal = -1; +static uint8_t st_display_internal = T1000_OUTPUT_DISPLAY_UNSET; void t1000_video_options_set(uint8_t options) { st_video_options = options & 1; @@ -385,7 +388,7 @@ static void t1000_poll(void *p) { mem_mapping_disable(&t1000->mapping); } /* Switch between internal plasma and external CRT display. */ - if (st_display_internal != -1 && st_display_internal != t1000->internal) { + if (st_display_internal != T1000_OUTPUT_DISPLAY_UNSET && st_display_internal != t1000->internal) { t1000->internal = st_display_internal; t1000_recalctimings(t1000); } diff --git a/src/video/vid_t3100e.c b/src/video/vid_t3100e.c index b66cca46..9527dc2a 100644 --- a/src/video/vid_t3100e.c +++ b/src/video/vid_t3100e.c @@ -13,6 +13,10 @@ #define T3100E_XSIZE 640 #define T3100E_YSIZE 400 +#define T3100E_OUTPUT_DISPLAY_INTERNAL 1u +#define T3100E_OUTPUT_DISPLAY_EXTERNAL 0u +#define T3100E_OUTPUT_DISPLAY_UNSET 255u + /*Very rough estimate*/ #define VID_CLOCK (double)(651 * 416 * 60) @@ -45,7 +49,7 @@ static uint32_t normcols[256][2]; * Bits 0,1: Font set (not currently implemented) */ static uint8_t st_video_options; -static uint8_t st_display_internal = -1; +static uint8_t st_display_internal = T3100E_OUTPUT_DISPLAY_UNSET; void t3100e_video_options_set(uint8_t options) { st_video_options = options; } @@ -402,7 +406,7 @@ void t3100e_poll(void *p) { t3100e->cga.fontbase = (512 * (t3100e->video_options & 3)) + ((t3100e->video_options & 4) ? 256 : 0); } /* Switch between internal plasma and external CRT display. */ - if (st_display_internal != -1 && st_display_internal != t3100e->internal) { + if (st_display_internal != T3100E_OUTPUT_DISPLAY_UNSET && st_display_internal != t3100e->internal) { t3100e->internal = st_display_internal; t3100e_recalctimings(t3100e); } diff --git a/src/wx-ui/wx-sdl2-display-win.c b/src/wx-ui/wx-sdl2-display-win.c index e26478a5..23fe3c22 100644 --- a/src/wx-ui/wx-sdl2-display-win.c +++ b/src/wx-ui/wx-sdl2-display-win.c @@ -555,7 +555,7 @@ int window_create() { info.cch = 256; info.dwTypeData = label; if (GetMenuItemInfo(native_menu, i, 1, &info)) - AppendMenu(menu, MF_STRING | MF_POPUP, (UINT)GetSubMenu(native_menu, i), info.dwTypeData); + AppendMenu(menu, MF_STRING | MF_POPUP, (UINT_PTR)GetSubMenu(native_menu, i), info.dwTypeData); } /* The class is registered, let's create the program*/ diff --git a/src/wx-ui/wx-status.cc b/src/wx-ui/wx-status.cc index 257979df..4351b060 100644 --- a/src/wx-ui/wx-status.cc +++ b/src/wx-ui/wx-status.cc @@ -138,18 +138,20 @@ void StatusPane::Render(wxDC &dc) { if (emulation_state != EMULATION_STOPPED) { // draw status text if (show_status) { + char charMac = statusMachineText[0]; + char charDev = statusDeviceText[0]; if (updatestatus) { updatestatus = 0; get_status(statusMachineText, statusDeviceText); } - if (statusMachineText) { + if (charMac != 0 || statusMachineText[0] != charMac) { int statusX = 5; int statusY = height + 5; wxSize size = dc.GetMultiLineTextExtent(statusMachineText); dc.DrawText(statusMachineText, statusX, statusY); width = MAX(width, statusX + size.GetWidth()); height = MAX(height, statusY + size.GetHeight()); - if (statusDeviceText) { + if (charDev != 0 || statusDeviceText[0] != charDev) { wxSize dSize = dc.GetMultiLineTextExtent(statusDeviceText); dc.DrawText(statusDeviceText, statusX + ceil((size.GetWidth() + 50) / 100.0) * 100, statusY);