Common Source Code Project for Qt (a.k.a for FM-7).
Revision | 223d7b688342ebf4bbba3dfd1f73f3fed53e4da7 (tree) |
---|---|
Zeit | 2022-11-29 00:29:54 |
Autor | K.Ohta <whatisthis.sowhat@gmai...> |
Commiter | K.Ohta |
[UPSTREAM/TAKEDA] 2022-11-20 .
@@ -1,3 +1,8 @@ | ||
1 | +11/20/2022 | |
2 | + | |
3 | +[VM/I8251] fix to make tx ready in reset | |
4 | + | |
5 | + | |
1 | 6 | 11/17/2022 |
2 | 7 | |
3 | 8 | [PC9801/CPUREG] fix A20 mask for 32bit cpu |
@@ -60,7 +60,8 @@ void I8251::reset() | ||
60 | 60 | // dont reset dsr |
61 | 61 | status &= DSR; |
62 | 62 | status |= TXRDY | TXE; |
63 | - txen = rxen = loopback = false; | |
63 | + txen = true; | |
64 | + rxen = loopback = false; | |
64 | 65 | |
65 | 66 | recv_buffer->clear(); |
66 | 67 | send_buffer->clear(); |
@@ -42,12 +42,12 @@ void CPUREG::write_io8(uint32_t addr, uint32_t data) | ||
42 | 42 | case 0x00f0: |
43 | 43 | d_cpu->reset(); |
44 | 44 | d_cpu->set_address_mask(0x000fffff); |
45 | -#if !defined(SUPPORT_HIRESO) | |
45 | +#if defined(HAS_SUB_V30) | |
46 | 46 | d_cpu->write_signal(SIG_CPU_BUSREQ, data, 1); |
47 | 47 | d_v30->reset(); |
48 | 48 | d_v30->write_signal(SIG_CPU_BUSREQ, ~data, 1); |
49 | 49 | cpu_mode = ((data & 1) != 0); |
50 | - d_pio->write_signal(SIG_I8255_PORT_B, data, 2); | |
50 | + d_pio->write_signal(SIG_I8255_PORT_B, data << 1, 2); | |
51 | 51 | #endif |
52 | 52 | break; |
53 | 53 | case 0x00f2: |
@@ -94,10 +94,7 @@ uint32_t CPUREG::read_io8(uint32_t addr) | ||
94 | 94 | // value |= 0x10; // Unknown |
95 | 95 | value |= 0x08; // RAM access, 1 = Internal-standard/External-enhanced RAM, 0 = Internal-enhanced RAM |
96 | 96 | // value |= 0x04; // Refresh mode, 1 = Standard, 0 = High speed |
97 | -#if defined(HAS_I86) || defined(HAS_V30) | |
98 | - value |= 0x02; // CPU mode, 1 = V30, 0 = 80286/80386 | |
99 | -#endif | |
100 | -#if !defined(SUPPORT_HIRESO) | |
97 | +#if defined(HAS_SUB_V30) | |
101 | 98 | if(cpu_mode) { |
102 | 99 | value |= 0x02; // CPU mode, 1 = V30, 0 = 80286/80386 |
103 | 100 | } |
@@ -43,7 +43,7 @@ | ||
43 | 43 | #else |
44 | 44 | #include "../i86.h" |
45 | 45 | #endif |
46 | -#if (defined(SUPPORT_24BIT_ADDRESS) || defined(SUPPORT_32BIT_ADDRESS)) && !defined(SUPPORT_HIRESO) | |
46 | +#if defined(HAS_SUB_V30) | |
47 | 47 | #include "../i86.h" // V30 |
48 | 48 | #endif |
49 | 49 | #include "../io.h" |
@@ -207,7 +207,7 @@ VM::VM(EMU* parent_emu) : VM_TEMPLATE(parent_emu) | ||
207 | 207 | cpu = new I386(this, emu); |
208 | 208 | cpu->device_model = INTEL_I486DX; |
209 | 209 | #endif |
210 | -#if (defined(SUPPORT_24BIT_ADDRESS) || defined(SUPPORT_32BIT_ADDRESS)) && !defined(SUPPORT_HIRESO) | |
210 | +#if defined(HAS_SUB_V30) | |
211 | 211 | v30 = new I86(this, emu); |
212 | 212 | v30->device_model = NEC_V30; |
213 | 213 | #endif |
@@ -375,7 +375,7 @@ VM::VM(EMU* parent_emu) : VM_TEMPLATE(parent_emu) | ||
375 | 375 | |
376 | 376 | // set cpu device contexts |
377 | 377 | event->set_context_cpu(cpu, cpu_clocks); |
378 | -#if (defined(SUPPORT_24BIT_ADDRESS) || defined(SUPPORT_32BIT_ADDRESS)) && !defined(SUPPORT_HIRESO) | |
378 | +#if defined(HAS_SUB_V30) | |
379 | 379 | event->set_context_cpu(v30, v30_clocks); |
380 | 380 | #endif |
381 | 381 | #if defined(SUPPORT_320KB_FDD_IF) |
@@ -504,7 +504,7 @@ VM::VM(EMU* parent_emu) : VM_TEMPLATE(parent_emu) | ||
504 | 504 | |
505 | 505 | #if defined(SUPPORT_24BIT_ADDRESS) || defined(SUPPORT_32BIT_ADDRESS) |
506 | 506 | cpureg->set_context_cpu(cpu); |
507 | -#if !defined(SUPPORT_HIRESO) | |
507 | +#if defined(HAS_SUB_V30) | |
508 | 508 | cpureg->set_context_v30(v30); |
509 | 509 | cpureg->set_context_pio(pio_prn); |
510 | 510 | cpureg->cpu_mode = (config.cpu_type == 2 || config.cpu_type == 3); |
@@ -609,7 +609,7 @@ VM::VM(EMU* parent_emu) : VM_TEMPLATE(parent_emu) | ||
609 | 609 | #ifdef USE_DEBUGGER |
610 | 610 | cpu->set_context_debugger(new DEBUGGER(this, emu)); |
611 | 611 | #endif |
612 | -#if (defined(SUPPORT_24BIT_ADDRESS) || defined(SUPPORT_32BIT_ADDRESS)) && !defined(SUPPORT_HIRESO) | |
612 | +#if defined(HAS_SUB_V30) | |
613 | 613 | v30->set_context_mem(memory); |
614 | 614 | v30->set_context_io(io); |
615 | 615 | v30->set_context_intr(pic); |
@@ -1084,7 +1084,7 @@ VM::VM(EMU* parent_emu) : VM_TEMPLATE(parent_emu) | ||
1084 | 1084 | for(DEVICE* device = first_device; device; device = device->next_device) { |
1085 | 1085 | device->initialize(); |
1086 | 1086 | } |
1087 | -#if (defined(SUPPORT_24BIT_ADDRESS) || defined(SUPPORT_32BIT_ADDRESS)) && !defined(SUPPORT_HIRESO) | |
1087 | +#if defined(HAS_SUB_V30) | |
1088 | 1088 | if(config.cpu_type == 2 || config.cpu_type == 3) { |
1089 | 1089 | cpu->write_signal(SIG_CPU_BUSREQ, 1, 1); |
1090 | 1090 | } else { |
@@ -1201,10 +1201,7 @@ void VM::reset() | ||
1201 | 1201 | #if defined(SUPPORT_HIRESO) |
1202 | 1202 | // port_c |= 0x08; // MODSW, 1 = Normal Mode, 0 = Hireso Mode |
1203 | 1203 | #endif |
1204 | -#if defined(HAS_V30) || defined(HAS_V33) | |
1205 | - port_c |= 0x04; // DIP SW 3-8, 1 = V30, 0 = 80x86 | |
1206 | -#endif | |
1207 | -#if (defined(SUPPORT_24BIT_ADDRESS) || defined(SUPPORT_32BIT_ADDRESS)) && !defined(SUPPORT_HIRESO) | |
1204 | +#if defined(HAS_SUB_V30) | |
1208 | 1205 | if(config.cpu_type == 2 || config.cpu_type == 3) { |
1209 | 1206 | port_c |= 0x04; // DIP SW 3-8, 1 = V30, 0 = 80x86 |
1210 | 1207 | } |
@@ -1277,13 +1274,14 @@ void VM::reset() | ||
1277 | 1274 | port_b |= 0x08; // DIP SW 1-8, 1 = Standard graphic mode, 0 = Enhanced graphic mode |
1278 | 1275 | #endif |
1279 | 1276 | port_b |= 0x04; // Printer BUSY#, 1 = Inactive, 0 = Active (BUSY) |
1280 | -#if defined(HAS_V30) || defined(HAS_V33) | |
1281 | - port_b |= 0x02; // CPUT, 1 = V30/V33, 0 = 80x86 | |
1282 | -#endif | |
1283 | -#if (defined(SUPPORT_24BIT_ADDRESS) || defined(SUPPORT_32BIT_ADDRESS)) && !defined(SUPPORT_HIRESO) | |
1277 | +#if !defined(SUPPORT_HIRESO) | |
1278 | +#if defined(HAS_SUB_V30) | |
1284 | 1279 | if(cpureg->cpu_mode) { |
1285 | 1280 | port_b |= 0x02; // CPUT, 1 = V30/V33, 0 = 80x86 |
1286 | 1281 | } |
1282 | +#elif defined(HAS_V30) || defined(HAS_V33) | |
1283 | + port_b |= 0x02; // CPUT, 1 = V30/V33, 0 = 80x86 | |
1284 | +#endif | |
1287 | 1285 | #endif |
1288 | 1286 | #if defined(_PC9801VF) || defined(_PC9801U) |
1289 | 1287 | port_b |= 0x01; // VF, 1 = PC-9801VF/U |
@@ -1364,10 +1362,18 @@ DEVICE *VM::get_cpu(int index) | ||
1364 | 1362 | } |
1365 | 1363 | #else |
1366 | 1364 | if(index == 0) { |
1365 | +#if defined(HAS_SUB_V30) | |
1366 | + if(cpureg->cpu_mode) { | |
1367 | + return NULL; | |
1368 | + } | |
1369 | +#endif | |
1367 | 1370 | return cpu; |
1368 | 1371 | } else if(index == 1) { |
1369 | -#if (defined(SUPPORT_24BIT_ADDRESS) || defined(SUPPORT_32BIT_ADDRESS)) && !defined(SUPPORT_HIRESO) | |
1370 | - return v30; | |
1372 | +#if defined(HAS_SUB_V30) | |
1373 | + if(cpureg->cpu_mode) { | |
1374 | + return v30; | |
1375 | + } | |
1376 | + return NULL; | |
1371 | 1377 | #elif defined(SUPPORT_320KB_FDD_IF) |
1372 | 1378 | return cpu_sub; |
1373 | 1379 | #endif |
@@ -106,6 +106,7 @@ | ||
106 | 106 | // #define PIT_CLOCK_8MHZ |
107 | 107 | #if defined(_PC9801VX) |
108 | 108 | #define USE_CPU_TYPE 4 |
109 | + #define HAS_SUB_V30 | |
109 | 110 | #else |
110 | 111 | #define USE_CPU_TYPE 2 |
111 | 112 | #endif |
@@ -130,6 +131,7 @@ | ||
130 | 131 | // #define PIT_CLOCK_8MHZ |
131 | 132 | #if defined(_PC9801RA) |
132 | 133 | #define USE_CPU_TYPE 4 |
134 | + #define HAS_SUB_V30 | |
133 | 135 | #else |
134 | 136 | #define USE_CPU_TYPE 2 |
135 | 137 | #endif |
@@ -397,7 +399,7 @@ class I286; | ||
397 | 399 | #else |
398 | 400 | class I86; |
399 | 401 | #endif |
400 | -#if (defined(SUPPORT_24BIT_ADDRESS) || defined(SUPPORT_32BIT_ADDRESS)) && !defined(SUPPORT_HIRESO) | |
402 | +#if defined(HAS_SUB_V30) | |
401 | 403 | class I86; // V30 |
402 | 404 | #endif |
403 | 405 | class IO; |
@@ -498,7 +500,7 @@ protected: | ||
498 | 500 | #else |
499 | 501 | I86* cpu; |
500 | 502 | #endif |
501 | -#if (defined(SUPPORT_24BIT_ADDRESS) || defined(SUPPORT_32BIT_ADDRESS)) && !defined(SUPPORT_HIRESO) | |
503 | +#if defined(HAS_SUB_V30) | |
502 | 504 | I86* v30; |
503 | 505 | #endif |
504 | 506 | IO* io; |