diff --git a/src/chipset/stpc.c b/src/chipset/stpc.c index 6d5177be8..30a4ab988 100644 --- a/src/chipset/stpc.c +++ b/src/chipset/stpc.c @@ -626,9 +626,9 @@ stpc_reg_write(uint16_t addr, uint8_t val, void *priv) break; case 0x52: case 0x53: case 0x54: case 0x55: - stpc_log("STPC: Set IRQ routing: INT %c -> %d\n", 0x41 + ((dev->reg_offset & 0x03) ^ 0x02), (val & 0x80) ? (val & 0xf) : -1); + stpc_log("STPC: Set IRQ routing: INT %c -> %d\n", 0x41 + (dev->reg_offset & 0x03), (val & 0x80) ? (val & 0xf) : -1); val &= 0x8f; - pci_set_irq_routing(PCI_INTA + ((dev->reg_offset & 0x03) ^ 0x02), (val & 0x80) ? (val & 0xf) : PCI_IRQ_DISABLED); + pci_set_irq_routing(PCI_INTA + (dev->reg_offset & 0x03), (val & 0x80) ? (val & 0xf) : PCI_IRQ_DISABLED); break; case 0x56: case 0x57: diff --git a/src/include/86box/vid_voodoo_codegen_x86-64.h b/src/include/86box/vid_voodoo_codegen_x86-64.h index cecf3a539..f684176aa 100644 --- a/src/include/86box/vid_voodoo_codegen_x86-64.h +++ b/src/include/86box/vid_voodoo_codegen_x86-64.h @@ -41,7 +41,8 @@ static int last_block[2] = {0, 0}; static int next_block_to_write[2] = {0, 0}; #define addbyte(val) \ - code_block[block_pos++] = val; \ + if (block_pos < BLOCK_SIZE) \ + code_block[block_pos++] = val; \ if (block_pos >= BLOCK_SIZE) \ fatal("Over!\n") diff --git a/src/include/86box/vid_voodoo_codegen_x86.h b/src/include/86box/vid_voodoo_codegen_x86.h index 6cf2562d0..15c9951c1 100644 --- a/src/include/86box/vid_voodoo_codegen_x86.h +++ b/src/include/86box/vid_voodoo_codegen_x86.h @@ -39,7 +39,8 @@ static int last_block[2] = {0, 0}; static int next_block_to_write[2] = {0, 0}; #define addbyte(val) \ - code_block[block_pos++] = val; \ + if (block_pos < BLOCK_SIZE) \ + code_block[block_pos++] = val; \ if (block_pos >= BLOCK_SIZE) \ fatal("Over!\n")