[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
New feature coming: Thunderclock Pro support
- Subject: New feature coming: Thunderclock Pro support
- From: BLuRry <brendan.robert@gmail.com>
- Date: Wed, 12 Dec 2012 17:53:49 -0800 (PST)
- Complaints-to: groups-abuse@google.com
- Injection-date: Thu, 13 Dec 2012 01:53:49 +0000
- Injection-info: glegroupsg2000goo.googlegroups.com; posting-host=70.113.3.156; posting-account=HyIOQgoAAAAfAUGOevdCSBhPYcDSPtM9
- Newsgroups: comp.sys.apple2
- User-agent: G2/1.0
I have successfully implemented Thunderclock Pro support for Jace. The sourceforge build doesn't have this yet, but I have checked in the source code for the impatient armed with java compilers.
Just clock support wasn't sufficient (I'm really picky), I have also written a patcher for that darn Prodos year issue that everyone always complains about:
private void performProdosPatch() {
PagedMemory ram = Computer.getComputer().getMemory().activeRead;
if (patchLoc > 0) {
// We've already patched, just validate
if (ram.readByte(patchLoc) == (byte) MOS65C02.OPCODE.LDA_IMM.getCode()) {
return;
}
}
int match = 0;
int matchStart = 0;
for (int addr = 0x08000; addr < 0x010000; addr++) {
if (ram.readByte(addr) == DRIVER_PATTERN[match]) {
match++;
if (match == DRIVER_PATTERN.length) break;
} else {
match = 0;
matchStart = addr;
}
}
if (match != DRIVER_PATTERN.length) {
return;
}
patchLoc = matchStart + DRIVER_OFFSET;
ram.writeByte(patchLoc, (byte) MOS65C02.OPCODE.LDA_IMM.getCode());
int year = Calendar.getInstance().get(Calendar.YEAR) % 100;
ram.writeByte(patchLoc+1, (byte) year);
ram.writeByte(patchLoc+2, (byte) MOS65C02.OPCODE.NOP.getCode());
ram.writeByte(patchLoc+3, (byte) MOS65C02.OPCODE.NOP.getCode());
}
This patch scans the active memory of the emulator for a very obvious signature of data found in the prodos clock driver which has never changed. The driver itself moves around in the prodos kernel, so scanning for a signature seemed the most prudent way to find it. Once I find the driver code, I patch the part that loads the year from a lookup table with:
LDA #year%100
NOP
NOP
This will work until the end of time. Or at least for the next 9 days. At least the Apple calendar won't run out of time anymore (silly Mayans.)
-B