mirror of
https://github.com/edmccard/twoapple-reboot.git
synced 2024-06-02 22:41:33 +00:00
Whitespace cleanup
This commit is contained in:
parent
fdfb1b1415
commit
da5742c1cc
|
@ -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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -237,4 +237,3 @@ class Cmos : Cpu
|
||||||
flag.zero_ = accumulator & readVal;
|
flag.zero_ = accumulator & readVal;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -350,4 +350,3 @@ class NmosUndoc : NmosBase
|
||||||
else hex_subWithCarry(readVal);
|
else hex_subWithCarry(readVal);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -409,4 +409,3 @@ class Keyboard_IIe : Keyboard
|
||||||
"W", "clearKeystrobe"))
|
"W", "clearKeystrobe"))
|
||||||
]));
|
]));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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()
|
||||||
|
|
|
@ -309,4 +309,3 @@ class IOMem_IIe : IOMem
|
||||||
intStrobeMem.debugName = "Internal ROM";
|
intStrobeMem.debugName = "Internal ROM";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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;
|
||||||
|
|
|
@ -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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -213,4 +213,3 @@ class LazEngine : Screen
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -171,4 +171,3 @@ ushort screenOffset(vState* vSt, hState* hSt, Mode mode)
|
||||||
|
|
||||||
return offset;
|
return offset;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -486,4 +486,3 @@ class HiresPatternGenerator_Revision0 : HiresPatternGenerator
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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
Block a user