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

@ -41,7 +41,7 @@ final class StatusRegister
ubyte toByte()
{
return (carry ? 0x01 : 0) |
((zero_ == 0) ? 0x02 : 0) |
((zero_ == 0) ? 0x02 : 0) |
(interrupt ? 0x04 : 0) |
(decimal ? 0x08 : 0) |
0x30 | // break and reserved both set
@ -137,4 +137,3 @@ class CpuBase
abstract void nmiLow(bool signalLow);
abstract void irqLow(bool signalLow);
}

View File

@ -219,7 +219,7 @@ class Cmos : Cpu
programCounter = readWord(vector, cast(ushort)(vector + 1));
version(CumulativeCycles) ticks(totalCycles);
}
/* JMP ($$$$,X) */
void opcode7C()
{
@ -237,4 +237,3 @@ class Cmos : Cpu
flag.zero_ = accumulator & readVal;
}
}

View File

@ -295,7 +295,7 @@ class Cpu : CpuBase
programCounter = tryShortcut(false,
cast(ushort)(programCounter + offset));
}
final void addrZeropage()
{
primaryAddress = readByteOperand();

View File

@ -199,7 +199,7 @@ class NmosUndoc : NmosBase
readVal = operand1 = readFinal(programCounter);
flag.zero_ = flag.negative_ = (accumulator = readVal);
flag.carry = (flag.negative_ > 0x7F);
}
}
/* ANC #$$ */
override void opcode2B()
@ -350,4 +350,3 @@ class NmosUndoc : NmosBase
else hex_subWithCarry(readVal);
}
}

View File

@ -156,7 +156,7 @@ class Keyboard
void processPresses()
{
if (!presses.canRead()) return;
anyKeyDown = true;
keyStrobe = true;
@ -409,4 +409,3 @@ class Keyboard_IIe : Keyboard
"W", "clearKeystrobe"))
]));
}

View File

@ -62,7 +62,7 @@ class Speaker
uint processExtraBuffer(uint elapsed)
{
uint newElapsed = elapsed;
if (extraIndex != 0)
{
for (; extraIndex < extraBuffer.length; ++extraIndex)
@ -106,7 +106,7 @@ class Speaker
uint elapsedSinceToggle = cycle.currentVal() - lastToggleTick;
lastToggleTick = cycle.currentVal();
elapsedSinceToggle = processExtraBuffer(elapsedSinceToggle);
uint samples = elapsedSinceToggle / sampleTicks;
uint extraTicks = elapsedSinceToggle % sampleTicks;
@ -126,7 +126,7 @@ class Speaker
{
toggled = true;
update();
sample = ~sample;
sample = ~sample;
}
void clearBuffer()

View File

@ -45,7 +45,7 @@ static this()
}
if (SDL_Init(0) == -1)
{
writefln("%s", to!string(SDL_GetError()));
writefln("%s", to!string(SDL_GetError()));
return;
}
SDL = true;
@ -78,7 +78,7 @@ class Delay
{
while (soundCardHasEnoughData())
{
usleep(1000);
usleep(1000);
}
}
@ -102,7 +102,7 @@ class Delay
if (timeCompare(&timeShould, &timeNow, &timeDiff))
{
usleep(cast(uint)timeDiff.tv_usec);
}
}
}
void reset()

View File

@ -197,7 +197,7 @@ class IOMem_IIe : IOMem
void reset()
{
deactivateStrobeMem();
deactivateStrobeMem();
resetIntCXROM();
resetSlotC3ROM();
}
@ -210,7 +210,7 @@ class IOMem_IIe : IOMem
// $C3XX cannot be configured for slot response if
// INTCXROM is set.
if (intCXROM) return;
if (selectMem[3] !is null)
{
decoder.install(selectMem[3]);
@ -309,4 +309,3 @@ class IOMem_IIe : IOMem
intStrobeMem.debugName = "Internal ROM";
}
}

View File

@ -68,7 +68,7 @@ class IOU
{
io_.annun.ann_1_Off();
}
void resetAn2()
{
io_.annun.ann_2_Off();
@ -90,7 +90,7 @@ class IOU
{
io_.annun.ann_1_On();
}
void setAn2()
{
io_.annun.ann_2_On();
@ -131,7 +131,7 @@ class IOU
class MMU
{
LanguageCard_IIe himemManager;
LanguageCard_IIe himemManager;
AddressDecoder decoder;
AuxiliaryCard auxCard;
IOMem_IIe ioMem;
@ -169,7 +169,7 @@ class MMU
&mainRom.write);
initMem(mainRam);
initSwitches(switches);
ioMem.initSwitches(switches);
}
@ -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

@ -487,7 +487,7 @@ class Drive
imgFile = ExternalImage.loadImage(file);
assert(imgFile !is null);
imgData = imgFile.imgData;
return true;
}
@ -868,7 +868,7 @@ class DSKImage : ExternalImage
int x = 0x55;
ubyte y = 2;
uint val;
// Translate 256 bytes of data into 342 6-bit index values
while(true)
@ -1053,7 +1053,7 @@ class DSKImage : ExternalImage
ubyte[] dskData = saveData[dskOffset..dskOffset+SECTOR_LENGTH];
// Translate the 342 disk bytes into 6-bit index values
ubyte[] indexData = new ubyte[DATA_FIELD_LENGTH];
int lastByte = 0;
@ -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;
@ -149,7 +149,7 @@ class Saturn128 : Peripheral
}
mixin(MakeSaturnSwitches());
mixin(InitSwitches("", [
mixin(MakeSwitch([0xC080], "R0W", "accessC080")),
mixin(MakeSwitch([0xC081], "R0W", "accessC081")),

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

@ -342,7 +342,7 @@ class TwoappleFilePicker
fcd.hide();
fcd.destroy();
host.delay.reset();
soundCard.resume();

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

@ -137,7 +137,7 @@ class LazEngine : Screen
uint prevBit, nextBit;
uint nextBitTest = 0b00010000;
uint nextBitShift = 4;
ubyte bits = bitmap[bitmapPtr];
if (scanStart == 0)
@ -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

@ -174,7 +174,7 @@ class TextPatternGenerator_II : TextPatternGenerator
~ import("charset_upper_ii"));
mixin("static ubyte[256] charsetSymbol_II = "
~ import("charset_symbol_ii"));
void initPatterns()
{
ubyte[][] segments = new ubyte[][8];
@ -385,7 +385,7 @@ class LoresPatternGenerator : PatternGenerator
ubyte* data = scanner.getData(scanLine, startCol + 25);
ubyte* auxData = scanner.getData80(scanLine, startCol + 25);
uint memNybble;
for (uint offset = 0; offset < len; ++offset)
{
memNybble = (auxData[offset] >> shiftAmt) & 0x0F;
@ -486,4 +486,3 @@ class HiresPatternGenerator_Revision0 : HiresPatternGenerator
}
}
}

View File

@ -49,7 +49,7 @@ class Scanner : ScannerBase
int frameLen = 262 * 65; // XXX PAL: 312 * 65
vidCycle = timer.startCycle(frameLen);
graphicsTime = true;
timer.new Counter(frameLen, &graphicsTimeOn);
timer.new DelayedCounter(frameLen, &frameComplete, frameLen - 1);
timer.new DelayedCounter(frameLen, &graphicsTimeOff, 160 * 65);
@ -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"))
]));
}