Finally got rid of the AT and PCI global variables.

This commit is contained in:
OBattler
2021-12-19 20:00:27 +01:00
parent 9ec4fd3bdd
commit bc90f99350
21 changed files with 104 additions and 92 deletions

View File

@@ -82,6 +82,8 @@
#include <86box/plat.h>
#include <86box/isamem.h>
#include "cpu.h"
#define ISAMEM_DEBUG 0
@@ -455,7 +457,7 @@ dev->frame_addr = 0xE0000;
isamem_log(")\n");
/* Force (back to) 8-bit bus if needed. */
if ((!AT) && (dev->flags & FLAG_WIDE)) {
if ((!is286) && (dev->flags & FLAG_WIDE)) {
isamem_log("ISAMEM: not AT+ system, forcing 8-bit mode!\n");
dev->flags &= ~FLAG_WIDE;
}
@@ -559,7 +561,7 @@ dev->frame_addr = 0xE0000;
* real mode (so, not by DOS, for example) but it can be used in
* protected mode.
*/
if (AT && addr > 0 && tot > 0) {
if (is286 && addr > 0 && tot > 0) {
t = tot;
isamem_log("ISAMEM: RAM at %05iKB (%iKB)\n", addr>>10, t>>10);

View File

@@ -26,6 +26,8 @@
#include <86box/machine.h>
#include <86box/keyboard.h>
#include "cpu.h"
int keyboard_scan;
void (*keyboard_send)(uint16_t val);
@@ -103,7 +105,8 @@ key_process(uint16_t scan, int down)
if (!down && codes[scan].brk[0] == 0)
return;
if (AT && ((keyboard_mode & 3) == 3)) {
/* TODO: The keyboard controller needs to report the AT flag to us here. */
if (is286 && ((keyboard_mode & 3) == 3)) {
if (!keyboard_set3_all_break && !down && !(keyboard_set3_flags[codes[scan].mk[0]] & 2))
return;
}
@@ -212,7 +215,8 @@ keyboard_do_break(uint16_t scan)
{
scancode *codes = scan_table;
if (AT && ((keyboard_mode & 3) == 3)) {
/* TODO: The keyboard controller needs to report the AT flag to us here. */
if (is286 && ((keyboard_mode & 3) == 3)) {
if (!keyboard_set3_all_break &&
!recv_key[scan] &&
!(keyboard_set3_flags[codes[scan].mk[0]] & 2))

View File

@@ -1464,7 +1464,7 @@ write64_ami(void *priv, uint8_t val)
case 0xb0: case 0xb1: case 0xb2: case 0xb3:
/* set KBC lines P10-P13 (input port bits 0-3) low */
kbd_log("ATkbc: set KBC lines P10-P13 (input port bits 0-3) low\n");
if (!PCI || (val > 0xb1))
if (!(dev->flags & DEVICE_PCI) || (val > 0xb1))
dev->input_port &= ~(1 << (val & 0x03));
add_data(dev, 0x00);
return 0;
@@ -1472,7 +1472,7 @@ write64_ami(void *priv, uint8_t val)
case 0xb4: case 0xb5:
/* set KBC lines P22-P23 (output port bits 2-3) low */
kbd_log("ATkbc: set KBC lines P22-P23 (output port bits 2-3) low\n");
if (! PCI)
if (! (dev->flags & DEVICE_PCI))
write_output(dev, dev->output_port & ~(4 << (val & 0x01)));
add_data(dev, 0x00);
return 0;
@@ -1480,7 +1480,7 @@ write64_ami(void *priv, uint8_t val)
case 0xb8: case 0xb9: case 0xba: case 0xbb:
/* set KBC lines P10-P13 (input port bits 0-3) high */
kbd_log("ATkbc: set KBC lines P10-P13 (input port bits 0-3) high\n");
if (!PCI || (val > 0xb9)) {
if (!(dev->flags & DEVICE_PCI) || (val > 0xb9)) {
dev->input_port |= (1 << (val & 0x03));
add_data(dev, 0x00);
}
@@ -1489,7 +1489,7 @@ write64_ami(void *priv, uint8_t val)
case 0xbc: case 0xbd:
/* set KBC lines P22-P23 (output port bits 2-3) high */
kbd_log("ATkbc: set KBC lines P22-P23 (output port bits 2-3) high\n");
if (! PCI)
if (! (dev->flags & DEVICE_PCI))
write_output(dev, dev->output_port | (4 << (val & 0x01)));
add_data(dev, 0x00);
return 0;