Startup/status message tweaks
This commit is contained in:
parent
b7639abcec
commit
db5db398fb
7 changed files with 58 additions and 44 deletions
|
|
@ -9,7 +9,7 @@
|
|||
<rom id="romF" addr="0x1000" size="0x0800" file="/devices/pc8080/rom/invaders/INVADERS-F.json"/>
|
||||
<rom id="romE" addr="0x1800" size="0x0800" file="/devices/pc8080/rom/invaders/INVADERS-E.json"/>
|
||||
<ram id="ram" addr="0x2000" size="0x0400"/>
|
||||
<video id="video" screenWidth="896" screenHeight="1024" screenRotate="90" smoothing="false" bufferAddr="0x2400" bufferCols="256" bufferRows="224" bufferBits="1" bufferLeft="0" interruptRate="120" width="40%" pos="left" padding="8px">
|
||||
<video id="video" screenWidth="896" screenHeight="1024" bufferRotate="-90" smoothing="false" bufferAddr="0x2400" bufferCols="256" bufferRows="224" bufferBits="1" bufferLeft="0" interruptRate="120" width="40%" pos="left" padding="8px">
|
||||
<menu>
|
||||
<title>224x256 Screen (Rotated)</title>
|
||||
<control type="container" pos="right">
|
||||
|
|
|
|||
|
|
@ -290,49 +290,53 @@ Bus.prototype.powerUp = function(data, fRepower)
|
|||
*/
|
||||
Bus.prototype.addMemory = function(addr, size, type)
|
||||
{
|
||||
var iBlock = addr >>> this.nBlockShift;
|
||||
while (size > 0 && iBlock < this.aMemBlocks.length) {
|
||||
var addrNext = addr;
|
||||
var sizeLeft = size;
|
||||
var iBlock = addrNext >>> this.nBlockShift;
|
||||
|
||||
while (sizeLeft > 0 && iBlock < this.aMemBlocks.length) {
|
||||
|
||||
var block = this.aMemBlocks[iBlock];
|
||||
var addrBlock = iBlock * this.nBlockSize;
|
||||
var sizeBlock = this.nBlockSize - (addr - addrBlock);
|
||||
if (sizeBlock > size) sizeBlock = size;
|
||||
var sizeBlock = this.nBlockSize - (addrNext - addrBlock);
|
||||
if (sizeBlock > sizeLeft) sizeBlock = sizeLeft;
|
||||
|
||||
if (block && block.size) {
|
||||
if (block.type == type) {
|
||||
/*
|
||||
* Where there is already a similar block with a non-zero size, we allow the allocation only if:
|
||||
*
|
||||
* 1) addr + size <= block.addr (the request precedes the used portion of the current block), or
|
||||
* 2) addr >= block.addr + block.used (the request follows the used portion of the current block)
|
||||
* 1) addrNext + sizeLeft <= block.addr (the request precedes the used portion of the current block), or
|
||||
* 2) addrNext >= block.addr + block.used (the request follows the used portion of the current block)
|
||||
*/
|
||||
if (addr + size <= block.addr) {
|
||||
block.used += (block.addr - addr);
|
||||
block.addr = addr;
|
||||
if (addrNext + sizeLeft <= block.addr) {
|
||||
block.used += (block.addr - addrNext);
|
||||
block.addr = addrNext;
|
||||
return true;
|
||||
}
|
||||
if (addr >= block.addr + block.used) {
|
||||
var sizeAvail = block.size - (addr - addrBlock);
|
||||
if (sizeAvail > size) sizeAvail = size;
|
||||
block.used = addr - block.addr + sizeAvail;
|
||||
addr = addrBlock + this.nBlockSize;
|
||||
size -= sizeAvail;
|
||||
if (addrNext >= block.addr + block.used) {
|
||||
var sizeAvail = block.size - (addrNext - addrBlock);
|
||||
if (sizeAvail > sizeLeft) sizeAvail = sizeLeft;
|
||||
block.used = addrNext - block.addr + sizeAvail;
|
||||
addrNext = addrBlock + this.nBlockSize;
|
||||
sizeLeft -= sizeAvail;
|
||||
iBlock++;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
return this.reportError(Bus.ERROR.ADD_MEM_INUSE, addr, size);
|
||||
return this.reportError(Bus.ERROR.ADD_MEM_INUSE, addrNext, sizeLeft);
|
||||
}
|
||||
|
||||
var blockNew = new Memory(addr, sizeBlock, this.nBlockSize, type);
|
||||
var blockNew = new Memory(addrNext, sizeBlock, this.nBlockSize, type);
|
||||
blockNew.copyBreakpoints(this.dbg, block);
|
||||
this.aMemBlocks[iBlock++] = blockNew;
|
||||
|
||||
addr = addrBlock + this.nBlockSize;
|
||||
size -= sizeBlock;
|
||||
addrNext = addrBlock + this.nBlockSize;
|
||||
sizeLeft -= sizeBlock;
|
||||
}
|
||||
|
||||
if (size <= 0) {
|
||||
if (sizeLeft <= 0) {
|
||||
this.status(Math.floor(size / 1024) + "Kb " + Memory.TYPE.NAMES[type] + " at " + str.toHexWord(addr));
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -189,6 +189,8 @@ function Computer(parmsComputer, parmsMachine, fSuspended) {
|
|||
}
|
||||
}
|
||||
|
||||
this.println(Computer.APPNAME + " v" + Computer.APPVERSION + "\n" + Computer.COPYRIGHT + "\n" + Computer.LICENSE);
|
||||
|
||||
if (DEBUG && this.messageEnabled()) this.printMessage("TYPEDARRAYS: " + TYPEDARRAYS);
|
||||
|
||||
/*
|
||||
|
|
@ -743,15 +745,11 @@ Computer.prototype.donePowerOn = function(aParms)
|
|||
this.printMessage("Computer.donePowerOn(): redundant");
|
||||
}
|
||||
|
||||
this.fInitialized = true;
|
||||
this.flags.fPowered = true;
|
||||
var controlPower = this.bindings["power"];
|
||||
if (controlPower) controlPower.textContent = "Shutdown";
|
||||
|
||||
if (!this.fInitialized) {
|
||||
this.println(Computer.APPNAME + " v" + Computer.APPVERSION + "\n" + Computer.COPYRIGHT + "\n" + Computer.LICENSE);
|
||||
this.fInitialized = true;
|
||||
}
|
||||
|
||||
/*
|
||||
* Once we get to this point, we're guaranteed that all components are ready, so it's safe to power the CPU;
|
||||
* the CPU should begin executing immediately, unless a debugger is attached.
|
||||
|
|
|
|||
|
|
@ -193,8 +193,8 @@ Memory.TYPE = {
|
|||
ROM: 2,
|
||||
VIDEO: 3,
|
||||
CTRL: 4,
|
||||
NAMES: ["NONE", "RAM", "ROM", "VIDEO", "H/W"],
|
||||
COLORS: ["black", "blue", "green", "cyan"]
|
||||
COLORS: ["black", "blue", "green", "cyan"],
|
||||
NAMES: ["N/A", "RAM", "ROM", "VID", "H/W"]
|
||||
};
|
||||
|
||||
/*
|
||||
|
|
|
|||
|
|
@ -136,7 +136,6 @@ RAM.prototype.reset = function()
|
|||
if (!this.fAllocated && this.sizeRAM) {
|
||||
if (this.bus.addMemory(this.addrRAM, this.sizeRAM, Memory.TYPE.RAM)) {
|
||||
this.fAllocated = true;
|
||||
this.status(Math.floor(this.sizeRAM / 1024) + "Kb allocated");
|
||||
}
|
||||
}
|
||||
if (!this.fAllocated) {
|
||||
|
|
|
|||
|
|
@ -50,14 +50,14 @@ if (NODE) {
|
|||
* screenWidth: width of the screen canvas, in pixels
|
||||
* screenHeight: height of the screen canvas, in pixels
|
||||
* screenColor: background color of the screen canvas (default is black)
|
||||
* screenRotate: the amount of counter-clockwise screen rotation required (eg, 90)
|
||||
* screenRotate: the amount of counter-clockwise screen rotation required (eg, -90 or 270)
|
||||
* aspectRatio (eg, 1.33)
|
||||
* bufferAddr: the starting address of the frame buffer (eg, 0x2400)
|
||||
* bufferCols: the width of a single frame buffer row, in pixels (eg, 256)
|
||||
* bufferRows: the number of frame buffer rows (eg, 224)
|
||||
* bufferBits: the number of bits per column (default is 1)
|
||||
* bufferLeft: the bit position of the left-most pixel in a byte (default is 0; CGA uses 7)
|
||||
* bufferRotate: the amount of counter-clockwise buffer rotation required (eg, 90)
|
||||
* bufferRotate: the amount of counter-clockwise buffer rotation required (eg, -90 or 270)
|
||||
* interruptRate: normally the same as (or some multiple of) refreshRate (eg, 120)
|
||||
* refreshRate: how many times updateScreen() should be performed per second (eg, 60)
|
||||
*
|
||||
|
|
@ -72,10 +72,10 @@ if (NODE) {
|
|||
* been redrawn), so we need an interrupt rate of 120Hz. We pass the higher rate on to the CPU, so that
|
||||
* it will call updateScreen() more frequently, but we still limit our screen updates to every *other* call.
|
||||
*
|
||||
* bufferRotate is an alternative to screenRotate; you may set one or the other (but not both) to 90 to
|
||||
* enable different approaches to 90-degree image rotation. screenRotate uses canvas transformation methods
|
||||
* (ie, translate(), rotate(), and scale()), while bufferRotate inverts the dimensions of the off-screen
|
||||
* buffer and then relies on setPixel() to rotate the data into it.
|
||||
* bufferRotate is an alternative to screenRotate; you may set one or the other (but not both) to -90 to
|
||||
* enable different approaches to counter-clockwise 90-degree image rotation. screenRotate uses canvas
|
||||
* transformation methods (translate(), rotate(), and scale()), while bufferRotate inverts the dimensions
|
||||
* of the off-screen buffer and then relies on setPixel() to rotate the data into it.
|
||||
*
|
||||
* @constructor
|
||||
* @extends Component
|
||||
|
|
@ -102,6 +102,14 @@ function Video(parmsVideo, canvas, context, textarea, container)
|
|||
this.nBitsPerPixel = parmsVideo['bufferBits'] || 1;
|
||||
this.iBitFirstPixel = parmsVideo['bufferLeft'] || 0;
|
||||
this.rotateBuffer = parmsVideo['bufferRotate'];
|
||||
if (this.rotateBuffer) {
|
||||
this.rotateBuffer = this.rotateBuffer % 360;
|
||||
if (this.rotateBuffer > 0) this.rotateBuffer -= 360;
|
||||
if (this.rotateBuffer != -90) {
|
||||
this.notice("unsupported buffer rotation: " + this.rotateBuffer);
|
||||
this.rotateBuffer = 0;
|
||||
}
|
||||
}
|
||||
|
||||
this.interruptRate = parmsVideo['interruptRate'];
|
||||
this.refreshRate = parmsVideo['refreshRate'] || 60;
|
||||
|
|
@ -134,10 +142,17 @@ function Video(parmsVideo, canvas, context, textarea, container)
|
|||
}
|
||||
|
||||
this.rotateScreen = parmsVideo['screenRotate'];
|
||||
if (this.rotateScreen == 90) {
|
||||
this.contextScreen.translate(0, this.cyScreen);
|
||||
this.contextScreen.rotate((-this.rotateScreen * Math.PI)/180);
|
||||
this.contextScreen.scale(this.cyScreen/this.cxScreen, this.cxScreen/this.cyScreen);
|
||||
if (this.rotateScreen) {
|
||||
this.rotateScreen = this.rotateScreen % 360;
|
||||
if (this.rotateScreen > 0) this.rotateScreen -= 360;
|
||||
if (this.rotateScreen != -90) {
|
||||
this.notice("unsupported screen rotation: " + this.rotateScreen);
|
||||
this.rotateScreen = 0;
|
||||
} else {
|
||||
this.contextScreen.translate(0, this.cyScreen);
|
||||
this.contextScreen.rotate((this.rotateScreen * Math.PI)/180);
|
||||
this.contextScreen.scale(this.cyScreen/this.cxScreen, this.cxScreen/this.cyScreen);
|
||||
}
|
||||
}
|
||||
|
||||
this.initColors();
|
||||
|
|
|
|||
|
|
@ -218,6 +218,8 @@ function Computer(parmsComputer, parmsMachine, fSuspended) {
|
|||
}
|
||||
}
|
||||
|
||||
this.println(Computer.APPNAME + " v" + Computer.APPVERSION + "\n" + Computer.COPYRIGHT + "\n" + Computer.LICENSE);
|
||||
|
||||
if (DEBUG && this.messageEnabled()) this.printMessage("PREFETCH: " + PREFETCH + ", TYPEDARRAYS: " + TYPEDARRAYS);
|
||||
|
||||
/*
|
||||
|
|
@ -778,15 +780,11 @@ Computer.prototype.donePowerOn = function(aParms)
|
|||
this.printMessage("Computer.donePowerOn(): redundant");
|
||||
}
|
||||
|
||||
this.fInitialized = true;
|
||||
this.flags.fPowered = true;
|
||||
var controlPower = this.bindings["power"];
|
||||
if (controlPower) controlPower.textContent = "Shutdown";
|
||||
|
||||
if (!this.fInitialized) {
|
||||
this.println(Computer.APPNAME + " v" + Computer.APPVERSION + "\n" + Computer.COPYRIGHT + "\n" + Computer.LICENSE);
|
||||
this.fInitialized = true;
|
||||
}
|
||||
|
||||
/*
|
||||
* Once we get to this point, we're guaranteed that all components are ready, so it's safe to power the CPU;
|
||||
* the CPU should begin executing immediately, unless a debugger is attached.
|
||||
|
|
|
|||
Loading…
Reference in a new issue