Whitespace cleanup

This commit is contained in:
Ed McCardell 2012-03-15 02:45:30 -04:00
parent fdfb1b1415
commit da5742c1cc
30 changed files with 259 additions and 283 deletions

View File

@ -137,4 +137,3 @@ class CpuBase
abstract void nmiLow(bool signalLow);
abstract void irqLow(bool signalLow);
}

View File

@ -237,4 +237,3 @@ class Cmos : Cpu
flag.zero_ = accumulator & readVal;
}
}

View File

@ -350,4 +350,3 @@ class NmosUndoc : NmosBase
else hex_subWithCarry(readVal);
}
}

View File

@ -409,4 +409,3 @@ class Keyboard_IIe : Keyboard
"W", "clearKeystrobe"))
]));
}

View File

@ -102,7 +102,7 @@ class Delay
if (timeCompare(&timeShould, &timeNow, &timeDiff))
{
usleep(cast(uint)timeDiff.tv_usec);
}
}
}
void reset()

View File

@ -309,4 +309,3 @@ class IOMem_IIe : IOMem
intStrobeMem.debugName = "Internal ROM";
}
}

View File

@ -404,4 +404,3 @@ class Extended80ColumnCard : AuxiliaryCard
void reset() {}
}

View File

@ -24,24 +24,24 @@ import std.conv;
class Memory
{
ushort baseAddress;
uint blockSize;
ushort baseAddress;
uint blockSize;
string debugName;
this(ushort baseAddr, uint size)
{
assert(baseAddr + size <= 0x10000,
"Memory block larger than 64K");
assert((baseAddr % 0x0100) == 0,
"Memory block does not start on page boundary");
assert((size % 0x0100) == 0,
"Memory block does not end on page boundary");
baseAddress = baseAddr;
blockSize = size;
}
this(ushort baseAddr, uint size)
{
assert(baseAddr + size <= 0x10000,
"Memory block larger than 64K");
assert((baseAddr % 0x0100) == 0,
"Memory block does not start on page boundary");
assert((size % 0x0100) == 0,
"Memory block does not end on page boundary");
baseAddress = baseAddr;
blockSize = size;
}
abstract ubyte read(ushort addr);
abstract void write(ushort addr, ubyte val);
abstract ubyte read(ushort addr);
abstract void write(ushort addr, ubyte val);
void reboot() {}
}
@ -58,36 +58,36 @@ class ZeroMem : Memory
class DataMem : Memory
{
ubyte* data;
ubyte data_[];
ubyte* data;
ubyte data_[];
this(ushort baseAddr, uint size)
{
super(baseAddr, size);
}
this(ushort baseAddr, uint size)
{
super(baseAddr, size);
}
ubyte read(ushort addr)
{
return data[addr - baseAddress];
}
ubyte read(ushort addr)
{
return data[addr - baseAddress];
}
void write(ushort addr, ubyte val)
{
data[addr - baseAddress] = val;
}
void write(ushort addr, ubyte val)
{
data[addr - baseAddress] = val;
}
}
class PrimaryMem : DataMem
{
this(ushort baseAddr, uint size)
{
super(baseAddr, size);
}
this(ushort baseAddr, uint size)
{
super(baseAddr, size);
}
void reboot()
{
data_ = new ubyte[blockSize];
data = data_.ptr;
data_ = new ubyte[blockSize];
data = data_.ptr;
}
}
@ -107,12 +107,12 @@ class SliceMem : DataMem
{
DataMem otherMem;
this(ushort baseAddr, uint size, DataMem other)
{
super(baseAddr, size);
this(ushort baseAddr, uint size, DataMem other)
{
super(baseAddr, size);
otherMem = other;
debugName = otherMem.debugName;
}
}
void reboot()
{
@ -121,7 +121,7 @@ class SliceMem : DataMem
assert((otherStart >= 0) && (otherEnd <= otherMem.blockSize),
"Memory slice out of range");
data_ = otherMem.data_[otherStart..otherEnd];
data = data_.ptr;
data = data_.ptr;
}
}
@ -130,7 +130,7 @@ class BankMem : DataMem
ubyte[][] banks;
string[] debugNames;
this(ushort baseAddr, uint size, uint numBanks)
this(ushort baseAddr, uint size, uint numBanks)
{
super(baseAddr, size);
banks.length = numBanks;
@ -236,12 +236,12 @@ alias void delegate(ushort, ubyte) WriteFunc;
class AddressDecoder
{
ReadFunc readPages[256];
WriteFunc writePages[256];
ReadFunc readPages[256];
WriteFunc writePages[256];
Memory readResponders[256];
Memory writeResponders[256];
void nullWrite(ushort addr, ubyte val) {}
void nullWrite(ushort addr, ubyte val) {}
public:
@ -249,47 +249,47 @@ class AddressDecoder
void installSwitches(SoftSwitchPage switches)
{
readPages[0xC0] = &switches.read;
writePages[0xC0] = &switches.write;
readPages[0xC0] = &switches.read;
writePages[0xC0] = &switches.write;
}
ubyte read(ushort addr)
{
return readPages[addr >> 8](addr);
}
ubyte read(ushort addr)
{
return readPages[addr >> 8](addr);
}
void write(ushort addr, ubyte val)
{
writePages[addr >> 8](addr, val);
}
void write(ushort addr, ubyte val)
{
writePages[addr >> 8](addr, val);
}
// XXX address read only/write only code
void install(Memory block, bool forRead = true, bool forWrite = true)
{
uint base = block.baseAddress >> 8;
uint size = block.blockSize >> 8;
void install(Memory block, bool forRead = true, bool forWrite = true)
{
uint base = block.baseAddress >> 8;
uint size = block.blockSize >> 8;
for (uint pg = base; pg < base + size; ++pg)
{
if (pg == 0xC0) continue;
if (forRead)
if (forRead)
{
readPages[pg] = &block.read;
readResponders[pg] = block;
}
if (forWrite)
if (forWrite)
{
writePages[pg] = &block.write;
writeResponders[pg] = block;
}
}
}
}
void installNull(uint baseAddress, uint blockSize, bool forRead = true,
bool forWrite = true)
{
uint base = baseAddress >> 8;
uint size = blockSize >> 8;
uint base = baseAddress >> 8;
uint size = blockSize >> 8;
for (uint pg = base; pg < base + size; ++pg)
{
if (pg == 0xC0) continue;
@ -306,15 +306,15 @@ class AddressDecoder
}
}
void installRead(Memory block)
{
install(block, true, false);
}
void installRead(Memory block)
{
install(block, true, false);
}
void installWrite(Memory block)
{
install(block, false, true);
}
void installWrite(Memory block)
{
install(block, false, true);
}
string memoryReadName(ushort addr)
{
@ -338,25 +338,25 @@ class SoftSwitchPage : Memory
{
private:
ReadFunc[256] readSwitches;
ReadFunc[256] readSwitches;
ubyte[256] bitsReturned;
WriteFunc[256] writeSwitches;
WriteFunc[256] writeSwitches;
ubyte nullRead(ushort addr) { return 0; }
void nullWrite(ushort addr, ubyte val) {}
void nullWrite(ushort addr, ubyte val) {}
public:
ReadFunc floatingBus;
this()
{
this()
{
super(0xC000, 0x0100);
for (int addr = 0xC000; addr < 0xC100; ++addr)
{
writeSwitches[addr & 0xFF] = &nullWrite;
}
}
for (int addr = 0xC000; addr < 0xC100; ++addr)
{
writeSwitches[addr & 0xFF] = &nullWrite;
}
}
void setFloatingBus(ReadFunc floatingBus_)
{
@ -368,11 +368,11 @@ class SoftSwitchPage : Memory
}
}
void setReadSwitch(ushort addr, ReadFunc read_, ubyte bitsReturned_)
{
readSwitches[addr - 0xC000] = read_;
void setReadSwitch(ushort addr, ReadFunc read_, ubyte bitsReturned_)
{
readSwitches[addr - 0xC000] = read_;
bitsReturned[addr - 0xC000] = bitsReturned_;
}
}
void setR0Switch(ushort addr, ReadFunc read_)
{
@ -389,13 +389,13 @@ class SoftSwitchPage : Memory
setReadSwitch(addr, read_, 0xFF);
}
void setWSwitch(ushort addr, WriteFunc write_)
{
writeSwitches[addr - 0xC000] = write_;
}
void setWSwitch(ushort addr, WriteFunc write_)
{
writeSwitches[addr - 0xC000] = write_;
}
final ubyte read(ushort addr)
{
final ubyte read(ushort addr)
{
ubyte ret = readSwitches[addr - 0xC000](addr);
ubyte mask = bitsReturned[addr - 0xC000];
if (mask < 0xFF)
@ -403,11 +403,10 @@ class SoftSwitchPage : Memory
ret = (ret & mask) | (floatingBus(addr) & (mask ^ 0xFF));
}
return ret;
}
}
final void write(ushort addr, ubyte val)
{
writeSwitches[addr - 0xC000](addr, val);
}
final void write(ushort addr, ubyte val)
{
writeSwitches[addr - 0xC000](addr, val);
}
}

View File

@ -56,4 +56,3 @@ class Peripheral
mixin(EmptyInitSwitches());
}

View File

@ -1141,4 +1141,3 @@ class NIBImage : ExternalImage
}
}
}

View File

@ -123,8 +123,8 @@ class HighRam
{
AddressDecoder decoder;
ReadFunc origRead;
WriteFunc origWrite;
ReadFunc origRead;
WriteFunc origWrite;
Memory lowerChunk, upperChunk;

View File

@ -61,8 +61,8 @@ class Saturn128 : Peripheral
{
AddressDecoder decoder;
ReadFunc origRead;
WriteFunc origWrite;
ReadFunc origRead;
WriteFunc origWrite;
bool preWrite;
bool readEn, writeEn;
BankMem e000ffff;

View File

@ -302,4 +302,3 @@ class IIe : System
mmu.initIO(video_.scanner, &io_.kbd.peekLatch);
}
}

View File

@ -155,4 +155,3 @@ class IO_IIe : IO
return new Paddles();
}
}

View File

@ -84,4 +84,3 @@ class Peripherals_IIe : Peripherals
cards[6] = diskController; // XXX
}
}

View File

@ -121,4 +121,3 @@ class Video_IIe : Video
return new Signal_IIe();
}
}

View File

@ -24,67 +24,67 @@ module timer;
class Timer
{
class Cycle
{
int delta;
uint rollOver;
class Cycle
{
int delta;
uint rollOver;
this(uint maxVal)
{
rollOver = maxVal;
this(uint maxVal)
{
rollOver = maxVal;
restart();
}
}
void restart()
{
delta = 0 - currentCounter.elapsed();
delta = 0 - currentCounter.elapsed();
}
uint currentVal()
{
return (currentCounter.elapsed() + delta) % rollOver;
}
uint currentVal()
{
return (currentCounter.elapsed() + delta) % rollOver;
}
void update()
{
delta = currentVal();
}
}
void update()
{
delta = currentVal();
}
}
class Counter
{
bool delegate() expiry;
uint startLength, currentLength;
int ticks;
class Counter
{
bool delegate() expiry;
uint startLength, currentLength;
int ticks;
bool shouldContinue;
this(uint start)
{
this(uint start)
{
shouldContinue = true;
startLength = currentLength = ticks = start;
startLength = currentLength = ticks = start;
addCounter(this);
}
}
this(uint start, bool delegate() expiration)
{
this(start);
this(uint start, bool delegate() expiration)
{
this(start);
initCounter(this);
expiry = expiration;
}
expiry = expiration;
}
final uint elapsed()
{
return currentLength - ticks;
}
final uint elapsed()
{
return currentLength - ticks;
}
final void tick()
{
--ticks;
if (ticks == 0)
{
reset();
}
}
final void tick()
{
--ticks;
if (ticks == 0)
{
reset();
}
}
final void forceExpire()
{
@ -98,73 +98,73 @@ class Timer
forceExpire();
}
private final void resume()
{
currentLength = ticks;
}
private final void resume()
{
currentLength = ticks;
}
private final bool expire()
{
ticks = currentLength = startLength;
return expiry();
}
private final bool expire()
{
ticks = currentLength = startLength;
return expiry();
}
private bool nullExpiry() { return false; }
}
}
class DelayedCounter : Counter
{
class DelayedCounter : Counter
{
uint realStart;
bool delegate() realExpiry;
this(uint start, bool delegate() expiration, uint delay)
{
realStart = start;
this(uint start, bool delegate() expiration, uint delay)
{
realStart = start;
realExpiry = expiration;
super(delay, &becomeReal);
}
}
private bool becomeReal()
{
ticks = currentLength = startLength = realStart;
expiry = realExpiry;
bool retval = expiry();
initCounter(this);
private bool becomeReal()
{
ticks = currentLength = startLength = realStart;
expiry = realExpiry;
bool retval = expiry();
initCounter(this);
return retval;
}
}
}
}
Cycle[] cycles;
Counter[] counters;
Counter primaryCounter, currentCounter;
Cycle[] cycles;
Counter[] counters;
Counter primaryCounter, currentCounter;
uint hertz;
this(uint primaryStart, uint hz)
{
this(uint primaryStart, uint hz)
{
hertz = hz;
cycles.length = 10;
counters.length = 10;
cycles.length = 0;
counters.length = 0;
currentCounter = primaryCounter = new Counter(primaryStart);
}
cycles.length = 10;
counters.length = 10;
cycles.length = 0;
counters.length = 0;
currentCounter = primaryCounter = new Counter(primaryStart);
}
final void onPrimaryStop(bool delegate() expiration)
{
primaryCounter.expiry = expiration;
}
final void onPrimaryStop(bool delegate() expiration)
{
primaryCounter.expiry = expiration;
}
Cycle startCycle(uint maxVal)
{
cycles.length = cycles.length + 1;
cycles[$-1] = new Cycle(maxVal);
return cycles[$-1];
}
{
cycles.length = cycles.length + 1;
cycles[$-1] = new Cycle(maxVal);
return cycles[$-1];
}
void tick()
{
currentCounter.tick();
}
void tick()
{
currentCounter.tick();
}
private void deleteCounters()
{
@ -186,26 +186,26 @@ main: for (int counter = 0; counter < counters.length; ++counter)
}
}
private void addCounter(Counter newCounter)
{
counters.length = counters.length + 1;
counters[$-1] = newCounter;
}
private void addCounter(Counter newCounter)
{
counters.length = counters.length + 1;
counters[$-1] = newCounter;
}
private void initCounter(Counter newCounter)
{
if (newCounter.ticks < currentCounter.ticks)
{
reset(newCounter);
}
else
{
newCounter.ticks += currentCounter.elapsed();
}
}
private void initCounter(Counter newCounter)
{
if (newCounter.ticks < currentCounter.ticks)
{
reset(newCounter);
}
else
{
newCounter.ticks += currentCounter.elapsed();
}
}
private void reset(Counter newCounter = null)
{
private void reset(Counter newCounter = null)
{
// update cycle counts
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)
currentCounter = counters[counter];
}
}
}
}

View File

@ -67,8 +67,8 @@ void main(string[] args)
{
// Init GTK
Thread.init(null);
Main.init(args);
GLdInit.init(args);
Main.init(args);
GLdInit.init(args);
// open config
@ -112,4 +112,3 @@ string checkRomFile(TwoappleFile checkFile)
else
return "Invalid ROM file";
}

View File

@ -278,4 +278,3 @@ class Input
return true;
}
}

View File

@ -38,16 +38,16 @@ Monitor monitor;
class Monitor : DrawingArea
{
mixin GLCapability;
mixin GLCapability;
Screen screen;
this()
{
setGLCapability(new GLConfig(
GLConfigMode.MODE_RGB | GLConfigMode.MODE_DOUBLE,
GLConfigMode.MODE_RGB));
}
this()
{
setGLCapability(new GLConfig(
GLConfigMode.MODE_RGB | GLConfigMode.MODE_DOUBLE,
GLConfigMode.MODE_RGB));
}
void installScreen(Screen screen_)
{
@ -55,9 +55,9 @@ class Monitor : DrawingArea
setSizeRequest(screen.width, screen.height * 2);
}
bool initGL()
{
resizeGL(null);
bool initGL()
{
resizeGL(null);
glDisable(GL_ALPHA_TEST);
glDisable(GL_BLEND);
@ -71,26 +71,25 @@ class Monitor : DrawingArea
glPixelZoom(1.0, -2.0);
return true;
}
return true;
}
bool drawGL(GdkEventExpose* event = null)
{
bool drawGL(GdkEventExpose* event = null)
{
glRasterPos2i(-1, 1);
glDrawPixels(screen.width, screen.height, GL_RGB,
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);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
return true;
}
return true;
}
}

View File

@ -209,4 +209,3 @@ extern(C) void audioCallback(void* userdata, Uint8* stream, int len)
{
(cast(SoundCardYes)userdata).fillAudio(stream, len);
}

View File

@ -95,4 +95,3 @@ struct VideoPages
hires2.reboot();
}
}

View File

@ -213,4 +213,3 @@ class LazEngine : Screen
}
}
}

View File

@ -171,4 +171,3 @@ ushort screenOffset(vState* vSt, hState* hSt, Mode mode)
return offset;
}

View File

@ -486,4 +486,3 @@ class HiresPatternGenerator_Revision0 : HiresPatternGenerator
}
}
}

View File

@ -294,4 +294,3 @@ class Scanner_IIe : Scanner
mixin(MakeSwitch([0xC01B], "R", "readMixed"))
]));
}

View File

@ -206,4 +206,3 @@ class Signal_IIe : Signal
mixin(MakeSwitch([0xC01F], "R", "readCol80Switch"))
]));
}