kopia lustrzana https://github.com/maccasoft/z80-tools
Fixed SIO and CF devices detection
rodzic
aa575f1235
commit
f70ae8040e
|
@ -2458,14 +2458,15 @@ public class Application {
|
|||
public int inPort(int port) {
|
||||
switch (port & 0xFF) {
|
||||
case SIOA_C: {
|
||||
int result = 0b00101100; // TX Buffer Empty, DCD and CTS
|
||||
try {
|
||||
if (debugTerminal != null && debugTerminal.getInputStream().available() > 0) {
|
||||
return 0x04 + 0x01;
|
||||
result |= 0x01; // RX Char Available
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return 0x04; // Always return TX buffer empty
|
||||
return result;
|
||||
}
|
||||
case SIOA_D: {
|
||||
try {
|
||||
|
@ -2475,10 +2476,12 @@ public class Application {
|
|||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
break;
|
||||
return 0x00;
|
||||
}
|
||||
case SIOB_C:
|
||||
return 0x04; // Always return TX buffer empty
|
||||
return 0b00101100; // TX Buffer Empty, DCD and CTS
|
||||
case SIOB_D:
|
||||
return 0x00;
|
||||
}
|
||||
|
||||
if ((port & 0xFF) == preferences.getTms9918Ram()) {
|
||||
|
|
|
@ -132,14 +132,15 @@ public class Emulator {
|
|||
public int inPort(int port) {
|
||||
switch (port & 0xFF) {
|
||||
case SIOA_C:
|
||||
int result = 0b00101100; // TX Buffer Empty, DCD and CTS
|
||||
try {
|
||||
if (is.available() > 0) {
|
||||
return 0x04 + 0x01;
|
||||
result |= 0x01; // RX Char Available
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return 0x04; // Always return TX buffer empty
|
||||
return result;
|
||||
case SIOA_D:
|
||||
try {
|
||||
if (is.available() > 0) {
|
||||
|
@ -148,7 +149,11 @@ public class Emulator {
|
|||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
break;
|
||||
return 0x00;
|
||||
case SIOB_C:
|
||||
return 0b00101100; // TX Buffer Empty, DCD and CTS
|
||||
case SIOB_D:
|
||||
return 0x00;
|
||||
}
|
||||
return super.inPort(port);
|
||||
}
|
||||
|
|
|
@ -49,6 +49,7 @@ public class Machine extends MemIoOps {
|
|||
|
||||
byte cfCommand;
|
||||
byte[] cfLBA = new byte[4];
|
||||
byte cfSecCount;
|
||||
File cfFile;
|
||||
RandomAccessFile cf;
|
||||
|
||||
|
@ -198,12 +199,15 @@ public class Machine extends MemIoOps {
|
|||
}
|
||||
}
|
||||
break;
|
||||
case CF_SECCOUNT:
|
||||
return cfSecCount & 0xFF;
|
||||
case CF_STATUS:
|
||||
return 0x40; // CF ready
|
||||
case SIOA_C:
|
||||
return 0x04; // Always return TX buffer empty
|
||||
case SIOB_C:
|
||||
return 0x04; // Always return TX buffer empty
|
||||
if (cfCommand == CF_WRITE_SEC || cfCommand == CF_READ_SEC) {
|
||||
return 0x48; // CF Ready, DRQ
|
||||
}
|
||||
else {
|
||||
return 0x40; // CF Ready
|
||||
}
|
||||
}
|
||||
|
||||
return port;
|
||||
|
@ -259,8 +263,16 @@ public class Machine extends MemIoOps {
|
|||
cfLBA[3] = (byte) value;
|
||||
break;
|
||||
}
|
||||
case CF_SECCOUNT:
|
||||
cfSecCount = (byte) value;
|
||||
break;
|
||||
case 0x38: // ROM page
|
||||
page = !page;
|
||||
if ((value & 0xFF) == 0x01) {
|
||||
page = true;
|
||||
}
|
||||
else {
|
||||
page = false;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
Ładowanie…
Reference in New Issue