Whitespace cleanup
This commit is contained in:
parent
fdfb1b1415
commit
da5742c1cc
|
@ -41,7 +41,7 @@ final class StatusRegister
|
||||||
ubyte toByte()
|
ubyte toByte()
|
||||||
{
|
{
|
||||||
return (carry ? 0x01 : 0) |
|
return (carry ? 0x01 : 0) |
|
||||||
((zero_ == 0) ? 0x02 : 0) |
|
((zero_ == 0) ? 0x02 : 0) |
|
||||||
(interrupt ? 0x04 : 0) |
|
(interrupt ? 0x04 : 0) |
|
||||||
(decimal ? 0x08 : 0) |
|
(decimal ? 0x08 : 0) |
|
||||||
0x30 | // break and reserved both set
|
0x30 | // break and reserved both set
|
||||||
|
@ -137,4 +137,3 @@ class CpuBase
|
||||||
abstract void nmiLow(bool signalLow);
|
abstract void nmiLow(bool signalLow);
|
||||||
abstract void irqLow(bool signalLow);
|
abstract void irqLow(bool signalLow);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -219,7 +219,7 @@ class Cmos : Cpu
|
||||||
programCounter = readWord(vector, cast(ushort)(vector + 1));
|
programCounter = readWord(vector, cast(ushort)(vector + 1));
|
||||||
version(CumulativeCycles) ticks(totalCycles);
|
version(CumulativeCycles) ticks(totalCycles);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* JMP ($$$$,X) */
|
/* JMP ($$$$,X) */
|
||||||
void opcode7C()
|
void opcode7C()
|
||||||
{
|
{
|
||||||
|
@ -237,4 +237,3 @@ class Cmos : Cpu
|
||||||
flag.zero_ = accumulator & readVal;
|
flag.zero_ = accumulator & readVal;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -295,7 +295,7 @@ class Cpu : CpuBase
|
||||||
programCounter = tryShortcut(false,
|
programCounter = tryShortcut(false,
|
||||||
cast(ushort)(programCounter + offset));
|
cast(ushort)(programCounter + offset));
|
||||||
}
|
}
|
||||||
|
|
||||||
final void addrZeropage()
|
final void addrZeropage()
|
||||||
{
|
{
|
||||||
primaryAddress = readByteOperand();
|
primaryAddress = readByteOperand();
|
||||||
|
|
|
@ -199,7 +199,7 @@ class NmosUndoc : NmosBase
|
||||||
readVal = operand1 = readFinal(programCounter);
|
readVal = operand1 = readFinal(programCounter);
|
||||||
flag.zero_ = flag.negative_ = (accumulator = readVal);
|
flag.zero_ = flag.negative_ = (accumulator = readVal);
|
||||||
flag.carry = (flag.negative_ > 0x7F);
|
flag.carry = (flag.negative_ > 0x7F);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ANC #$$ */
|
/* ANC #$$ */
|
||||||
override void opcode2B()
|
override void opcode2B()
|
||||||
|
@ -350,4 +350,3 @@ class NmosUndoc : NmosBase
|
||||||
else hex_subWithCarry(readVal);
|
else hex_subWithCarry(readVal);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -156,7 +156,7 @@ class Keyboard
|
||||||
void processPresses()
|
void processPresses()
|
||||||
{
|
{
|
||||||
if (!presses.canRead()) return;
|
if (!presses.canRead()) return;
|
||||||
|
|
||||||
anyKeyDown = true;
|
anyKeyDown = true;
|
||||||
keyStrobe = true;
|
keyStrobe = true;
|
||||||
|
|
||||||
|
@ -409,4 +409,3 @@ class Keyboard_IIe : Keyboard
|
||||||
"W", "clearKeystrobe"))
|
"W", "clearKeystrobe"))
|
||||||
]));
|
]));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -62,7 +62,7 @@ class Speaker
|
||||||
uint processExtraBuffer(uint elapsed)
|
uint processExtraBuffer(uint elapsed)
|
||||||
{
|
{
|
||||||
uint newElapsed = elapsed;
|
uint newElapsed = elapsed;
|
||||||
|
|
||||||
if (extraIndex != 0)
|
if (extraIndex != 0)
|
||||||
{
|
{
|
||||||
for (; extraIndex < extraBuffer.length; ++extraIndex)
|
for (; extraIndex < extraBuffer.length; ++extraIndex)
|
||||||
|
@ -106,7 +106,7 @@ class Speaker
|
||||||
uint elapsedSinceToggle = cycle.currentVal() - lastToggleTick;
|
uint elapsedSinceToggle = cycle.currentVal() - lastToggleTick;
|
||||||
lastToggleTick = cycle.currentVal();
|
lastToggleTick = cycle.currentVal();
|
||||||
elapsedSinceToggle = processExtraBuffer(elapsedSinceToggle);
|
elapsedSinceToggle = processExtraBuffer(elapsedSinceToggle);
|
||||||
|
|
||||||
uint samples = elapsedSinceToggle / sampleTicks;
|
uint samples = elapsedSinceToggle / sampleTicks;
|
||||||
uint extraTicks = elapsedSinceToggle % sampleTicks;
|
uint extraTicks = elapsedSinceToggle % sampleTicks;
|
||||||
|
|
||||||
|
@ -126,7 +126,7 @@ class Speaker
|
||||||
{
|
{
|
||||||
toggled = true;
|
toggled = true;
|
||||||
update();
|
update();
|
||||||
sample = ~sample;
|
sample = ~sample;
|
||||||
}
|
}
|
||||||
|
|
||||||
void clearBuffer()
|
void clearBuffer()
|
||||||
|
|
|
@ -45,7 +45,7 @@ static this()
|
||||||
}
|
}
|
||||||
if (SDL_Init(0) == -1)
|
if (SDL_Init(0) == -1)
|
||||||
{
|
{
|
||||||
writefln("%s", to!string(SDL_GetError()));
|
writefln("%s", to!string(SDL_GetError()));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
SDL = true;
|
SDL = true;
|
||||||
|
@ -78,7 +78,7 @@ class Delay
|
||||||
{
|
{
|
||||||
while (soundCardHasEnoughData())
|
while (soundCardHasEnoughData())
|
||||||
{
|
{
|
||||||
usleep(1000);
|
usleep(1000);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -102,7 +102,7 @@ class Delay
|
||||||
if (timeCompare(&timeShould, &timeNow, &timeDiff))
|
if (timeCompare(&timeShould, &timeNow, &timeDiff))
|
||||||
{
|
{
|
||||||
usleep(cast(uint)timeDiff.tv_usec);
|
usleep(cast(uint)timeDiff.tv_usec);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void reset()
|
void reset()
|
||||||
|
|
|
@ -197,7 +197,7 @@ class IOMem_IIe : IOMem
|
||||||
|
|
||||||
void reset()
|
void reset()
|
||||||
{
|
{
|
||||||
deactivateStrobeMem();
|
deactivateStrobeMem();
|
||||||
resetIntCXROM();
|
resetIntCXROM();
|
||||||
resetSlotC3ROM();
|
resetSlotC3ROM();
|
||||||
}
|
}
|
||||||
|
@ -210,7 +210,7 @@ class IOMem_IIe : IOMem
|
||||||
// $C3XX cannot be configured for slot response if
|
// $C3XX cannot be configured for slot response if
|
||||||
// INTCXROM is set.
|
// INTCXROM is set.
|
||||||
if (intCXROM) return;
|
if (intCXROM) return;
|
||||||
|
|
||||||
if (selectMem[3] !is null)
|
if (selectMem[3] !is null)
|
||||||
{
|
{
|
||||||
decoder.install(selectMem[3]);
|
decoder.install(selectMem[3]);
|
||||||
|
@ -309,4 +309,3 @@ class IOMem_IIe : IOMem
|
||||||
intStrobeMem.debugName = "Internal ROM";
|
intStrobeMem.debugName = "Internal ROM";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -68,7 +68,7 @@ class IOU
|
||||||
{
|
{
|
||||||
io_.annun.ann_1_Off();
|
io_.annun.ann_1_Off();
|
||||||
}
|
}
|
||||||
|
|
||||||
void resetAn2()
|
void resetAn2()
|
||||||
{
|
{
|
||||||
io_.annun.ann_2_Off();
|
io_.annun.ann_2_Off();
|
||||||
|
@ -90,7 +90,7 @@ class IOU
|
||||||
{
|
{
|
||||||
io_.annun.ann_1_On();
|
io_.annun.ann_1_On();
|
||||||
}
|
}
|
||||||
|
|
||||||
void setAn2()
|
void setAn2()
|
||||||
{
|
{
|
||||||
io_.annun.ann_2_On();
|
io_.annun.ann_2_On();
|
||||||
|
@ -131,7 +131,7 @@ class IOU
|
||||||
|
|
||||||
class MMU
|
class MMU
|
||||||
{
|
{
|
||||||
LanguageCard_IIe himemManager;
|
LanguageCard_IIe himemManager;
|
||||||
AddressDecoder decoder;
|
AddressDecoder decoder;
|
||||||
AuxiliaryCard auxCard;
|
AuxiliaryCard auxCard;
|
||||||
IOMem_IIe ioMem;
|
IOMem_IIe ioMem;
|
||||||
|
@ -169,7 +169,7 @@ class MMU
|
||||||
&mainRom.write);
|
&mainRom.write);
|
||||||
|
|
||||||
initMem(mainRam);
|
initMem(mainRam);
|
||||||
|
|
||||||
initSwitches(switches);
|
initSwitches(switches);
|
||||||
ioMem.initSwitches(switches);
|
ioMem.initSwitches(switches);
|
||||||
}
|
}
|
||||||
|
@ -404,4 +404,3 @@ class Extended80ColumnCard : AuxiliaryCard
|
||||||
|
|
||||||
void reset() {}
|
void reset() {}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
193
src/memory.d
193
src/memory.d
|
@ -24,24 +24,24 @@ import std.conv;
|
||||||
|
|
||||||
class Memory
|
class Memory
|
||||||
{
|
{
|
||||||
ushort baseAddress;
|
ushort baseAddress;
|
||||||
uint blockSize;
|
uint blockSize;
|
||||||
string debugName;
|
string debugName;
|
||||||
|
|
||||||
this(ushort baseAddr, uint size)
|
this(ushort baseAddr, uint size)
|
||||||
{
|
{
|
||||||
assert(baseAddr + size <= 0x10000,
|
assert(baseAddr + size <= 0x10000,
|
||||||
"Memory block larger than 64K");
|
"Memory block larger than 64K");
|
||||||
assert((baseAddr % 0x0100) == 0,
|
assert((baseAddr % 0x0100) == 0,
|
||||||
"Memory block does not start on page boundary");
|
"Memory block does not start on page boundary");
|
||||||
assert((size % 0x0100) == 0,
|
assert((size % 0x0100) == 0,
|
||||||
"Memory block does not end on page boundary");
|
"Memory block does not end on page boundary");
|
||||||
baseAddress = baseAddr;
|
baseAddress = baseAddr;
|
||||||
blockSize = size;
|
blockSize = size;
|
||||||
}
|
}
|
||||||
|
|
||||||
abstract ubyte read(ushort addr);
|
abstract ubyte read(ushort addr);
|
||||||
abstract void write(ushort addr, ubyte val);
|
abstract void write(ushort addr, ubyte val);
|
||||||
void reboot() {}
|
void reboot() {}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -58,36 +58,36 @@ class ZeroMem : Memory
|
||||||
|
|
||||||
class DataMem : Memory
|
class DataMem : Memory
|
||||||
{
|
{
|
||||||
ubyte* data;
|
ubyte* data;
|
||||||
ubyte data_[];
|
ubyte data_[];
|
||||||
|
|
||||||
this(ushort baseAddr, uint size)
|
this(ushort baseAddr, uint size)
|
||||||
{
|
{
|
||||||
super(baseAddr, size);
|
super(baseAddr, size);
|
||||||
}
|
}
|
||||||
|
|
||||||
ubyte read(ushort addr)
|
ubyte read(ushort addr)
|
||||||
{
|
{
|
||||||
return data[addr - baseAddress];
|
return data[addr - baseAddress];
|
||||||
}
|
}
|
||||||
|
|
||||||
void write(ushort addr, ubyte val)
|
void write(ushort addr, ubyte val)
|
||||||
{
|
{
|
||||||
data[addr - baseAddress] = val;
|
data[addr - baseAddress] = val;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class PrimaryMem : DataMem
|
class PrimaryMem : DataMem
|
||||||
{
|
{
|
||||||
this(ushort baseAddr, uint size)
|
this(ushort baseAddr, uint size)
|
||||||
{
|
{
|
||||||
super(baseAddr, size);
|
super(baseAddr, size);
|
||||||
}
|
}
|
||||||
|
|
||||||
void reboot()
|
void reboot()
|
||||||
{
|
{
|
||||||
data_ = new ubyte[blockSize];
|
data_ = new ubyte[blockSize];
|
||||||
data = data_.ptr;
|
data = data_.ptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -107,12 +107,12 @@ class SliceMem : DataMem
|
||||||
{
|
{
|
||||||
DataMem otherMem;
|
DataMem otherMem;
|
||||||
|
|
||||||
this(ushort baseAddr, uint size, DataMem other)
|
this(ushort baseAddr, uint size, DataMem other)
|
||||||
{
|
{
|
||||||
super(baseAddr, size);
|
super(baseAddr, size);
|
||||||
otherMem = other;
|
otherMem = other;
|
||||||
debugName = otherMem.debugName;
|
debugName = otherMem.debugName;
|
||||||
}
|
}
|
||||||
|
|
||||||
void reboot()
|
void reboot()
|
||||||
{
|
{
|
||||||
|
@ -121,7 +121,7 @@ class SliceMem : DataMem
|
||||||
assert((otherStart >= 0) && (otherEnd <= otherMem.blockSize),
|
assert((otherStart >= 0) && (otherEnd <= otherMem.blockSize),
|
||||||
"Memory slice out of range");
|
"Memory slice out of range");
|
||||||
data_ = otherMem.data_[otherStart..otherEnd];
|
data_ = otherMem.data_[otherStart..otherEnd];
|
||||||
data = data_.ptr;
|
data = data_.ptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -130,7 +130,7 @@ class BankMem : DataMem
|
||||||
ubyte[][] banks;
|
ubyte[][] banks;
|
||||||
string[] debugNames;
|
string[] debugNames;
|
||||||
|
|
||||||
this(ushort baseAddr, uint size, uint numBanks)
|
this(ushort baseAddr, uint size, uint numBanks)
|
||||||
{
|
{
|
||||||
super(baseAddr, size);
|
super(baseAddr, size);
|
||||||
banks.length = numBanks;
|
banks.length = numBanks;
|
||||||
|
@ -236,12 +236,12 @@ alias void delegate(ushort, ubyte) WriteFunc;
|
||||||
|
|
||||||
class AddressDecoder
|
class AddressDecoder
|
||||||
{
|
{
|
||||||
ReadFunc readPages[256];
|
ReadFunc readPages[256];
|
||||||
WriteFunc writePages[256];
|
WriteFunc writePages[256];
|
||||||
Memory readResponders[256];
|
Memory readResponders[256];
|
||||||
Memory writeResponders[256];
|
Memory writeResponders[256];
|
||||||
|
|
||||||
void nullWrite(ushort addr, ubyte val) {}
|
void nullWrite(ushort addr, ubyte val) {}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
@ -249,47 +249,47 @@ class AddressDecoder
|
||||||
|
|
||||||
void installSwitches(SoftSwitchPage switches)
|
void installSwitches(SoftSwitchPage switches)
|
||||||
{
|
{
|
||||||
readPages[0xC0] = &switches.read;
|
readPages[0xC0] = &switches.read;
|
||||||
writePages[0xC0] = &switches.write;
|
writePages[0xC0] = &switches.write;
|
||||||
}
|
}
|
||||||
|
|
||||||
ubyte read(ushort addr)
|
ubyte read(ushort addr)
|
||||||
{
|
{
|
||||||
return readPages[addr >> 8](addr);
|
return readPages[addr >> 8](addr);
|
||||||
}
|
}
|
||||||
|
|
||||||
void write(ushort addr, ubyte val)
|
void write(ushort addr, ubyte val)
|
||||||
{
|
{
|
||||||
writePages[addr >> 8](addr, val);
|
writePages[addr >> 8](addr, val);
|
||||||
}
|
}
|
||||||
|
|
||||||
// XXX address read only/write only code
|
// XXX address read only/write only code
|
||||||
void install(Memory block, bool forRead = true, bool forWrite = true)
|
void install(Memory block, bool forRead = true, bool forWrite = true)
|
||||||
{
|
{
|
||||||
uint base = block.baseAddress >> 8;
|
uint base = block.baseAddress >> 8;
|
||||||
uint size = block.blockSize >> 8;
|
uint size = block.blockSize >> 8;
|
||||||
for (uint pg = base; pg < base + size; ++pg)
|
for (uint pg = base; pg < base + size; ++pg)
|
||||||
{
|
{
|
||||||
if (pg == 0xC0) continue;
|
if (pg == 0xC0) continue;
|
||||||
|
|
||||||
if (forRead)
|
if (forRead)
|
||||||
{
|
{
|
||||||
readPages[pg] = &block.read;
|
readPages[pg] = &block.read;
|
||||||
readResponders[pg] = block;
|
readResponders[pg] = block;
|
||||||
}
|
}
|
||||||
if (forWrite)
|
if (forWrite)
|
||||||
{
|
{
|
||||||
writePages[pg] = &block.write;
|
writePages[pg] = &block.write;
|
||||||
writeResponders[pg] = block;
|
writeResponders[pg] = block;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void installNull(uint baseAddress, uint blockSize, bool forRead = true,
|
void installNull(uint baseAddress, uint blockSize, bool forRead = true,
|
||||||
bool forWrite = true)
|
bool forWrite = true)
|
||||||
{
|
{
|
||||||
uint base = baseAddress >> 8;
|
uint base = baseAddress >> 8;
|
||||||
uint size = blockSize >> 8;
|
uint size = blockSize >> 8;
|
||||||
for (uint pg = base; pg < base + size; ++pg)
|
for (uint pg = base; pg < base + size; ++pg)
|
||||||
{
|
{
|
||||||
if (pg == 0xC0) continue;
|
if (pg == 0xC0) continue;
|
||||||
|
@ -306,15 +306,15 @@ class AddressDecoder
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void installRead(Memory block)
|
void installRead(Memory block)
|
||||||
{
|
{
|
||||||
install(block, true, false);
|
install(block, true, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void installWrite(Memory block)
|
void installWrite(Memory block)
|
||||||
{
|
{
|
||||||
install(block, false, true);
|
install(block, false, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
string memoryReadName(ushort addr)
|
string memoryReadName(ushort addr)
|
||||||
{
|
{
|
||||||
|
@ -338,25 +338,25 @@ class SoftSwitchPage : Memory
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
|
|
||||||
ReadFunc[256] readSwitches;
|
ReadFunc[256] readSwitches;
|
||||||
ubyte[256] bitsReturned;
|
ubyte[256] bitsReturned;
|
||||||
WriteFunc[256] writeSwitches;
|
WriteFunc[256] writeSwitches;
|
||||||
|
|
||||||
ubyte nullRead(ushort addr) { return 0; }
|
ubyte nullRead(ushort addr) { return 0; }
|
||||||
void nullWrite(ushort addr, ubyte val) {}
|
void nullWrite(ushort addr, ubyte val) {}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
ReadFunc floatingBus;
|
ReadFunc floatingBus;
|
||||||
|
|
||||||
this()
|
this()
|
||||||
{
|
{
|
||||||
super(0xC000, 0x0100);
|
super(0xC000, 0x0100);
|
||||||
for (int addr = 0xC000; addr < 0xC100; ++addr)
|
for (int addr = 0xC000; addr < 0xC100; ++addr)
|
||||||
{
|
{
|
||||||
writeSwitches[addr & 0xFF] = &nullWrite;
|
writeSwitches[addr & 0xFF] = &nullWrite;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void setFloatingBus(ReadFunc floatingBus_)
|
void setFloatingBus(ReadFunc floatingBus_)
|
||||||
{
|
{
|
||||||
|
@ -368,11 +368,11 @@ class SoftSwitchPage : Memory
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void setReadSwitch(ushort addr, ReadFunc read_, ubyte bitsReturned_)
|
void setReadSwitch(ushort addr, ReadFunc read_, ubyte bitsReturned_)
|
||||||
{
|
{
|
||||||
readSwitches[addr - 0xC000] = read_;
|
readSwitches[addr - 0xC000] = read_;
|
||||||
bitsReturned[addr - 0xC000] = bitsReturned_;
|
bitsReturned[addr - 0xC000] = bitsReturned_;
|
||||||
}
|
}
|
||||||
|
|
||||||
void setR0Switch(ushort addr, ReadFunc read_)
|
void setR0Switch(ushort addr, ReadFunc read_)
|
||||||
{
|
{
|
||||||
|
@ -389,13 +389,13 @@ class SoftSwitchPage : Memory
|
||||||
setReadSwitch(addr, read_, 0xFF);
|
setReadSwitch(addr, read_, 0xFF);
|
||||||
}
|
}
|
||||||
|
|
||||||
void setWSwitch(ushort addr, WriteFunc write_)
|
void setWSwitch(ushort addr, WriteFunc write_)
|
||||||
{
|
{
|
||||||
writeSwitches[addr - 0xC000] = write_;
|
writeSwitches[addr - 0xC000] = write_;
|
||||||
}
|
}
|
||||||
|
|
||||||
final ubyte read(ushort addr)
|
final ubyte read(ushort addr)
|
||||||
{
|
{
|
||||||
ubyte ret = readSwitches[addr - 0xC000](addr);
|
ubyte ret = readSwitches[addr - 0xC000](addr);
|
||||||
ubyte mask = bitsReturned[addr - 0xC000];
|
ubyte mask = bitsReturned[addr - 0xC000];
|
||||||
if (mask < 0xFF)
|
if (mask < 0xFF)
|
||||||
|
@ -403,11 +403,10 @@ class SoftSwitchPage : Memory
|
||||||
ret = (ret & mask) | (floatingBus(addr) & (mask ^ 0xFF));
|
ret = (ret & mask) | (floatingBus(addr) & (mask ^ 0xFF));
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
final void write(ushort addr, ubyte val)
|
final void write(ushort addr, ubyte val)
|
||||||
{
|
{
|
||||||
writeSwitches[addr - 0xC000](addr, val);
|
writeSwitches[addr - 0xC000](addr, val);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -56,4 +56,3 @@ class Peripheral
|
||||||
|
|
||||||
mixin(EmptyInitSwitches());
|
mixin(EmptyInitSwitches());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -487,7 +487,7 @@ class Drive
|
||||||
imgFile = ExternalImage.loadImage(file);
|
imgFile = ExternalImage.loadImage(file);
|
||||||
assert(imgFile !is null);
|
assert(imgFile !is null);
|
||||||
imgData = imgFile.imgData;
|
imgData = imgFile.imgData;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -868,7 +868,7 @@ class DSKImage : ExternalImage
|
||||||
int x = 0x55;
|
int x = 0x55;
|
||||||
ubyte y = 2;
|
ubyte y = 2;
|
||||||
uint val;
|
uint val;
|
||||||
|
|
||||||
// Translate 256 bytes of data into 342 6-bit index values
|
// Translate 256 bytes of data into 342 6-bit index values
|
||||||
|
|
||||||
while(true)
|
while(true)
|
||||||
|
@ -1053,7 +1053,7 @@ class DSKImage : ExternalImage
|
||||||
ubyte[] dskData = saveData[dskOffset..dskOffset+SECTOR_LENGTH];
|
ubyte[] dskData = saveData[dskOffset..dskOffset+SECTOR_LENGTH];
|
||||||
|
|
||||||
// Translate the 342 disk bytes into 6-bit index values
|
// Translate the 342 disk bytes into 6-bit index values
|
||||||
|
|
||||||
ubyte[] indexData = new ubyte[DATA_FIELD_LENGTH];
|
ubyte[] indexData = new ubyte[DATA_FIELD_LENGTH];
|
||||||
|
|
||||||
int lastByte = 0;
|
int lastByte = 0;
|
||||||
|
@ -1141,4 +1141,3 @@ class NIBImage : ExternalImage
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -123,8 +123,8 @@ class HighRam
|
||||||
{
|
{
|
||||||
AddressDecoder decoder;
|
AddressDecoder decoder;
|
||||||
|
|
||||||
ReadFunc origRead;
|
ReadFunc origRead;
|
||||||
WriteFunc origWrite;
|
WriteFunc origWrite;
|
||||||
|
|
||||||
Memory lowerChunk, upperChunk;
|
Memory lowerChunk, upperChunk;
|
||||||
|
|
||||||
|
|
|
@ -61,8 +61,8 @@ class Saturn128 : Peripheral
|
||||||
{
|
{
|
||||||
AddressDecoder decoder;
|
AddressDecoder decoder;
|
||||||
|
|
||||||
ReadFunc origRead;
|
ReadFunc origRead;
|
||||||
WriteFunc origWrite;
|
WriteFunc origWrite;
|
||||||
bool preWrite;
|
bool preWrite;
|
||||||
bool readEn, writeEn;
|
bool readEn, writeEn;
|
||||||
BankMem e000ffff;
|
BankMem e000ffff;
|
||||||
|
@ -149,7 +149,7 @@ class Saturn128 : Peripheral
|
||||||
}
|
}
|
||||||
|
|
||||||
mixin(MakeSaturnSwitches());
|
mixin(MakeSaturnSwitches());
|
||||||
|
|
||||||
mixin(InitSwitches("", [
|
mixin(InitSwitches("", [
|
||||||
mixin(MakeSwitch([0xC080], "R0W", "accessC080")),
|
mixin(MakeSwitch([0xC080], "R0W", "accessC080")),
|
||||||
mixin(MakeSwitch([0xC081], "R0W", "accessC081")),
|
mixin(MakeSwitch([0xC081], "R0W", "accessC081")),
|
||||||
|
|
|
@ -302,4 +302,3 @@ class IIe : System
|
||||||
mmu.initIO(video_.scanner, &io_.kbd.peekLatch);
|
mmu.initIO(video_.scanner, &io_.kbd.peekLatch);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -155,4 +155,3 @@ class IO_IIe : IO
|
||||||
return new Paddles();
|
return new Paddles();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -84,4 +84,3 @@ class Peripherals_IIe : Peripherals
|
||||||
cards[6] = diskController; // XXX
|
cards[6] = diskController; // XXX
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -121,4 +121,3 @@ class Video_IIe : Video
|
||||||
return new Signal_IIe();
|
return new Signal_IIe();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
223
src/timer.d
223
src/timer.d
|
@ -24,67 +24,67 @@ module timer;
|
||||||
|
|
||||||
class Timer
|
class Timer
|
||||||
{
|
{
|
||||||
class Cycle
|
class Cycle
|
||||||
{
|
{
|
||||||
int delta;
|
int delta;
|
||||||
uint rollOver;
|
uint rollOver;
|
||||||
|
|
||||||
this(uint maxVal)
|
this(uint maxVal)
|
||||||
{
|
{
|
||||||
rollOver = maxVal;
|
rollOver = maxVal;
|
||||||
restart();
|
restart();
|
||||||
}
|
}
|
||||||
|
|
||||||
void restart()
|
void restart()
|
||||||
{
|
{
|
||||||
delta = 0 - currentCounter.elapsed();
|
delta = 0 - currentCounter.elapsed();
|
||||||
}
|
}
|
||||||
|
|
||||||
uint currentVal()
|
uint currentVal()
|
||||||
{
|
{
|
||||||
return (currentCounter.elapsed() + delta) % rollOver;
|
return (currentCounter.elapsed() + delta) % rollOver;
|
||||||
}
|
}
|
||||||
|
|
||||||
void update()
|
void update()
|
||||||
{
|
{
|
||||||
delta = currentVal();
|
delta = currentVal();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class Counter
|
class Counter
|
||||||
{
|
{
|
||||||
bool delegate() expiry;
|
bool delegate() expiry;
|
||||||
uint startLength, currentLength;
|
uint startLength, currentLength;
|
||||||
int ticks;
|
int ticks;
|
||||||
bool shouldContinue;
|
bool shouldContinue;
|
||||||
|
|
||||||
this(uint start)
|
this(uint start)
|
||||||
{
|
{
|
||||||
shouldContinue = true;
|
shouldContinue = true;
|
||||||
startLength = currentLength = ticks = start;
|
startLength = currentLength = ticks = start;
|
||||||
addCounter(this);
|
addCounter(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
this(uint start, bool delegate() expiration)
|
this(uint start, bool delegate() expiration)
|
||||||
{
|
{
|
||||||
this(start);
|
this(start);
|
||||||
initCounter(this);
|
initCounter(this);
|
||||||
expiry = expiration;
|
expiry = expiration;
|
||||||
}
|
}
|
||||||
|
|
||||||
final uint elapsed()
|
final uint elapsed()
|
||||||
{
|
{
|
||||||
return currentLength - ticks;
|
return currentLength - ticks;
|
||||||
}
|
}
|
||||||
|
|
||||||
final void tick()
|
final void tick()
|
||||||
{
|
{
|
||||||
--ticks;
|
--ticks;
|
||||||
if (ticks == 0)
|
if (ticks == 0)
|
||||||
{
|
{
|
||||||
reset();
|
reset();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
final void forceExpire()
|
final void forceExpire()
|
||||||
{
|
{
|
||||||
|
@ -98,73 +98,73 @@ class Timer
|
||||||
forceExpire();
|
forceExpire();
|
||||||
}
|
}
|
||||||
|
|
||||||
private final void resume()
|
private final void resume()
|
||||||
{
|
{
|
||||||
currentLength = ticks;
|
currentLength = ticks;
|
||||||
}
|
}
|
||||||
|
|
||||||
private final bool expire()
|
private final bool expire()
|
||||||
{
|
{
|
||||||
ticks = currentLength = startLength;
|
ticks = currentLength = startLength;
|
||||||
return expiry();
|
return expiry();
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool nullExpiry() { return false; }
|
private bool nullExpiry() { return false; }
|
||||||
}
|
}
|
||||||
|
|
||||||
class DelayedCounter : Counter
|
class DelayedCounter : Counter
|
||||||
{
|
{
|
||||||
uint realStart;
|
uint realStart;
|
||||||
bool delegate() realExpiry;
|
bool delegate() realExpiry;
|
||||||
|
|
||||||
this(uint start, bool delegate() expiration, uint delay)
|
this(uint start, bool delegate() expiration, uint delay)
|
||||||
{
|
{
|
||||||
realStart = start;
|
realStart = start;
|
||||||
realExpiry = expiration;
|
realExpiry = expiration;
|
||||||
super(delay, &becomeReal);
|
super(delay, &becomeReal);
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool becomeReal()
|
private bool becomeReal()
|
||||||
{
|
{
|
||||||
ticks = currentLength = startLength = realStart;
|
ticks = currentLength = startLength = realStart;
|
||||||
expiry = realExpiry;
|
expiry = realExpiry;
|
||||||
bool retval = expiry();
|
bool retval = expiry();
|
||||||
initCounter(this);
|
initCounter(this);
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Cycle[] cycles;
|
Cycle[] cycles;
|
||||||
Counter[] counters;
|
Counter[] counters;
|
||||||
Counter primaryCounter, currentCounter;
|
Counter primaryCounter, currentCounter;
|
||||||
uint hertz;
|
uint hertz;
|
||||||
|
|
||||||
this(uint primaryStart, uint hz)
|
this(uint primaryStart, uint hz)
|
||||||
{
|
{
|
||||||
hertz = hz;
|
hertz = hz;
|
||||||
cycles.length = 10;
|
cycles.length = 10;
|
||||||
counters.length = 10;
|
counters.length = 10;
|
||||||
cycles.length = 0;
|
cycles.length = 0;
|
||||||
counters.length = 0;
|
counters.length = 0;
|
||||||
currentCounter = primaryCounter = new Counter(primaryStart);
|
currentCounter = primaryCounter = new Counter(primaryStart);
|
||||||
}
|
}
|
||||||
|
|
||||||
final void onPrimaryStop(bool delegate() expiration)
|
final void onPrimaryStop(bool delegate() expiration)
|
||||||
{
|
{
|
||||||
primaryCounter.expiry = expiration;
|
primaryCounter.expiry = expiration;
|
||||||
}
|
}
|
||||||
|
|
||||||
Cycle startCycle(uint maxVal)
|
Cycle startCycle(uint maxVal)
|
||||||
{
|
{
|
||||||
cycles.length = cycles.length + 1;
|
cycles.length = cycles.length + 1;
|
||||||
cycles[$-1] = new Cycle(maxVal);
|
cycles[$-1] = new Cycle(maxVal);
|
||||||
return cycles[$-1];
|
return cycles[$-1];
|
||||||
}
|
}
|
||||||
|
|
||||||
void tick()
|
void tick()
|
||||||
{
|
{
|
||||||
currentCounter.tick();
|
currentCounter.tick();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void deleteCounters()
|
private void deleteCounters()
|
||||||
{
|
{
|
||||||
|
@ -186,26 +186,26 @@ main: for (int counter = 0; counter < counters.length; ++counter)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void addCounter(Counter newCounter)
|
private void addCounter(Counter newCounter)
|
||||||
{
|
{
|
||||||
counters.length = counters.length + 1;
|
counters.length = counters.length + 1;
|
||||||
counters[$-1] = newCounter;
|
counters[$-1] = newCounter;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initCounter(Counter newCounter)
|
private void initCounter(Counter newCounter)
|
||||||
{
|
{
|
||||||
if (newCounter.ticks < currentCounter.ticks)
|
if (newCounter.ticks < currentCounter.ticks)
|
||||||
{
|
{
|
||||||
reset(newCounter);
|
reset(newCounter);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
newCounter.ticks += currentCounter.elapsed();
|
newCounter.ticks += currentCounter.elapsed();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void reset(Counter newCounter = null)
|
private void reset(Counter newCounter = null)
|
||||||
{
|
{
|
||||||
// update cycle counts
|
// update cycle counts
|
||||||
for (int cycle = 0; cycle < cycles.length; ++cycle)
|
for (int cycle = 0; cycle < cycles.length; ++cycle)
|
||||||
{
|
{
|
||||||
|
@ -238,7 +238,6 @@ main: for (int counter = 0; counter < counters.length; ++counter)
|
||||||
if (counters[counter].ticks < currentCounter.ticks)
|
if (counters[counter].ticks < currentCounter.ticks)
|
||||||
currentCounter = counters[counter];
|
currentCounter = counters[counter];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -67,8 +67,8 @@ void main(string[] args)
|
||||||
{
|
{
|
||||||
// Init GTK
|
// Init GTK
|
||||||
Thread.init(null);
|
Thread.init(null);
|
||||||
Main.init(args);
|
Main.init(args);
|
||||||
GLdInit.init(args);
|
GLdInit.init(args);
|
||||||
|
|
||||||
// open config
|
// open config
|
||||||
|
|
||||||
|
@ -112,4 +112,3 @@ string checkRomFile(TwoappleFile checkFile)
|
||||||
else
|
else
|
||||||
return "Invalid ROM file";
|
return "Invalid ROM file";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -278,4 +278,3 @@ class Input
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -342,7 +342,7 @@ class TwoappleFilePicker
|
||||||
|
|
||||||
fcd.hide();
|
fcd.hide();
|
||||||
fcd.destroy();
|
fcd.destroy();
|
||||||
|
|
||||||
host.delay.reset();
|
host.delay.reset();
|
||||||
soundCard.resume();
|
soundCard.resume();
|
||||||
|
|
||||||
|
|
|
@ -38,16 +38,16 @@ Monitor monitor;
|
||||||
|
|
||||||
class Monitor : DrawingArea
|
class Monitor : DrawingArea
|
||||||
{
|
{
|
||||||
mixin GLCapability;
|
mixin GLCapability;
|
||||||
|
|
||||||
Screen screen;
|
Screen screen;
|
||||||
|
|
||||||
this()
|
this()
|
||||||
{
|
{
|
||||||
setGLCapability(new GLConfig(
|
setGLCapability(new GLConfig(
|
||||||
GLConfigMode.MODE_RGB | GLConfigMode.MODE_DOUBLE,
|
GLConfigMode.MODE_RGB | GLConfigMode.MODE_DOUBLE,
|
||||||
GLConfigMode.MODE_RGB));
|
GLConfigMode.MODE_RGB));
|
||||||
}
|
}
|
||||||
|
|
||||||
void installScreen(Screen screen_)
|
void installScreen(Screen screen_)
|
||||||
{
|
{
|
||||||
|
@ -55,9 +55,9 @@ class Monitor : DrawingArea
|
||||||
setSizeRequest(screen.width, screen.height * 2);
|
setSizeRequest(screen.width, screen.height * 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool initGL()
|
bool initGL()
|
||||||
{
|
{
|
||||||
resizeGL(null);
|
resizeGL(null);
|
||||||
|
|
||||||
glDisable(GL_ALPHA_TEST);
|
glDisable(GL_ALPHA_TEST);
|
||||||
glDisable(GL_BLEND);
|
glDisable(GL_BLEND);
|
||||||
|
@ -71,26 +71,25 @@ class Monitor : DrawingArea
|
||||||
|
|
||||||
glPixelZoom(1.0, -2.0);
|
glPixelZoom(1.0, -2.0);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool drawGL(GdkEventExpose* event = null)
|
bool drawGL(GdkEventExpose* event = null)
|
||||||
{
|
{
|
||||||
glRasterPos2i(-1, 1);
|
glRasterPos2i(-1, 1);
|
||||||
glDrawPixels(screen.width, screen.height, GL_RGB,
|
glDrawPixels(screen.width, screen.height, GL_RGB,
|
||||||
GL_UNSIGNED_SHORT_5_6_5, screen.data);
|
GL_UNSIGNED_SHORT_5_6_5, screen.data);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool resizeGL(GdkEventConfigure* event = null)
|
bool resizeGL(GdkEventConfigure* event = null)
|
||||||
{
|
{
|
||||||
glViewport(0, 0, screen.width, screen.height * 2);
|
glViewport(0, 0, screen.width, screen.height * 2);
|
||||||
glMatrixMode(GL_PROJECTION);
|
glMatrixMode(GL_PROJECTION);
|
||||||
glLoadIdentity();
|
glLoadIdentity();
|
||||||
glMatrixMode(GL_MODELVIEW);
|
glMatrixMode(GL_MODELVIEW);
|
||||||
glLoadIdentity();
|
glLoadIdentity();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -209,4 +209,3 @@ extern(C) void audioCallback(void* userdata, Uint8* stream, int len)
|
||||||
{
|
{
|
||||||
(cast(SoundCardYes)userdata).fillAudio(stream, len);
|
(cast(SoundCardYes)userdata).fillAudio(stream, len);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -95,4 +95,3 @@ struct VideoPages
|
||||||
hires2.reboot();
|
hires2.reboot();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -137,7 +137,7 @@ class LazEngine : Screen
|
||||||
uint prevBit, nextBit;
|
uint prevBit, nextBit;
|
||||||
uint nextBitTest = 0b00010000;
|
uint nextBitTest = 0b00010000;
|
||||||
uint nextBitShift = 4;
|
uint nextBitShift = 4;
|
||||||
|
|
||||||
ubyte bits = bitmap[bitmapPtr];
|
ubyte bits = bitmap[bitmapPtr];
|
||||||
|
|
||||||
if (scanStart == 0)
|
if (scanStart == 0)
|
||||||
|
@ -213,4 +213,3 @@ class LazEngine : Screen
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -171,4 +171,3 @@ ushort screenOffset(vState* vSt, hState* hSt, Mode mode)
|
||||||
|
|
||||||
return offset;
|
return offset;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -174,7 +174,7 @@ class TextPatternGenerator_II : TextPatternGenerator
|
||||||
~ import("charset_upper_ii"));
|
~ import("charset_upper_ii"));
|
||||||
mixin("static ubyte[256] charsetSymbol_II = "
|
mixin("static ubyte[256] charsetSymbol_II = "
|
||||||
~ import("charset_symbol_ii"));
|
~ import("charset_symbol_ii"));
|
||||||
|
|
||||||
void initPatterns()
|
void initPatterns()
|
||||||
{
|
{
|
||||||
ubyte[][] segments = new ubyte[][8];
|
ubyte[][] segments = new ubyte[][8];
|
||||||
|
@ -385,7 +385,7 @@ class LoresPatternGenerator : PatternGenerator
|
||||||
ubyte* data = scanner.getData(scanLine, startCol + 25);
|
ubyte* data = scanner.getData(scanLine, startCol + 25);
|
||||||
ubyte* auxData = scanner.getData80(scanLine, startCol + 25);
|
ubyte* auxData = scanner.getData80(scanLine, startCol + 25);
|
||||||
uint memNybble;
|
uint memNybble;
|
||||||
|
|
||||||
for (uint offset = 0; offset < len; ++offset)
|
for (uint offset = 0; offset < len; ++offset)
|
||||||
{
|
{
|
||||||
memNybble = (auxData[offset] >> shiftAmt) & 0x0F;
|
memNybble = (auxData[offset] >> shiftAmt) & 0x0F;
|
||||||
|
@ -486,4 +486,3 @@ class HiresPatternGenerator_Revision0 : HiresPatternGenerator
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -49,7 +49,7 @@ class Scanner : ScannerBase
|
||||||
int frameLen = 262 * 65; // XXX PAL: 312 * 65
|
int frameLen = 262 * 65; // XXX PAL: 312 * 65
|
||||||
vidCycle = timer.startCycle(frameLen);
|
vidCycle = timer.startCycle(frameLen);
|
||||||
graphicsTime = true;
|
graphicsTime = true;
|
||||||
|
|
||||||
timer.new Counter(frameLen, &graphicsTimeOn);
|
timer.new Counter(frameLen, &graphicsTimeOn);
|
||||||
timer.new DelayedCounter(frameLen, &frameComplete, frameLen - 1);
|
timer.new DelayedCounter(frameLen, &frameComplete, frameLen - 1);
|
||||||
timer.new DelayedCounter(frameLen, &graphicsTimeOff, 160 * 65);
|
timer.new DelayedCounter(frameLen, &graphicsTimeOff, 160 * 65);
|
||||||
|
@ -294,4 +294,3 @@ class Scanner_IIe : Scanner
|
||||||
mixin(MakeSwitch([0xC01B], "R", "readMixed"))
|
mixin(MakeSwitch([0xC01B], "R", "readMixed"))
|
||||||
]));
|
]));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -206,4 +206,3 @@ class Signal_IIe : Signal
|
||||||
mixin(MakeSwitch([0xC01F], "R", "readCol80Switch"))
|
mixin(MakeSwitch([0xC01F], "R", "readCol80Switch"))
|
||||||
]));
|
]));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue