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