More VT100 groundwork

This commit is contained in:
Jeff Parsons 2016-07-27 12:03:12 -07:00 committed by Jeff Parsons
commit c8f5357689
11 changed files with 162 additions and 14 deletions

View file

@ -52,6 +52,8 @@ if (NODE) {
* 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)
* bufferRAM: true to use existing RAM (default is false)
* bufferFormat: can be set to anything, but the only recognized format is currently "vt100"
* 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)
@ -96,6 +98,8 @@ function Video(parmsVideo, canvas, context, textarea, container)
this.cyScreen = parmsVideo['screenHeight'];
this.addrBuffer = parmsVideo['bufferAddr'];
this.fUseRAM = parmsVideo['bufferRAM'];
this.sFormat = parmsVideo['bufferFormat'];
this.cxBuffer = parmsVideo['bufferCols'];
this.cyBuffer = parmsVideo['bufferRows'];
this.nBitsPerPixel = parmsVideo['bufferBits'] || 1;
@ -212,6 +216,10 @@ function Video(parmsVideo, canvas, context, textarea, container)
Component.subclass(Video);
/*
* TODO: Use of these overlay colors should be limited to machine's that require/request them (ie, Space Invaders),
* using an additional parmsVideo property.
*/
Video.COLORS = {
OVERLAY_TOP: 0,
OVERLAY_BOTTOM: 1,
@ -237,14 +245,18 @@ Video.prototype.initBus = function(cmp, bus, cpu, dbg)
/*
* Compute the size of the frame buffer and allocate.
*/
this.sizeBuffer = ((this.cxBuffer * this.nBitsPerPixel) >> 3) * this.cyBuffer;
if (this.bus.addMemory(this.addrBuffer, this.sizeBuffer, Memory.TYPE.VIDEO)) {
/*
* Compute the number of cells and initialize the cell cache.
*/
this.nCellCache = this.sizeBuffer >> 1;
this.nPixelsPerCell = (16 / this.nBitsPerPixel)|0;
this.initCache();
if (!this.fUseRAM) {
this.sizeBuffer = ((this.cxBuffer * this.nBitsPerPixel) >> 3) * this.cyBuffer;
if (this.bus.addMemory(this.addrBuffer, this.sizeBuffer, Memory.TYPE.VIDEO)) {
/*
* Compute the number of cells and initialize the cell cache; note that sizeBuffer is a number of
* bytes, whereas nCellCache is a number of 16-bit words (aka shorts) because we fetch memory 16 bits
* at a time during screen updates.
*/
this.nCellCache = this.sizeBuffer >> 1;
this.nPixelsPerCell = (16 / this.nBitsPerPixel)|0;
this.initCache();
}
}
/*

View file

@ -1003,6 +1003,18 @@
<xsl:otherwise>0</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:variable name="bufferRAM">
<xsl:choose>
<xsl:when test="@bufferRAM"><xsl:value-of select="@bufferRAM"/></xsl:when>
<xsl:otherwise>false</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:variable name="bufferFormat">
<xsl:choose>
<xsl:when test="@bufferFormat"><xsl:value-of select="@bufferFormat"/></xsl:when>
<xsl:otherwise>1bpp</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:variable name="bufferCols">
<xsl:choose>
<xsl:when test="@bufferCols"><xsl:value-of select="@bufferCols"/></xsl:when>
@ -1120,7 +1132,7 @@
<xsl:call-template name="component">
<xsl:with-param name="machine" select="$machine"/>
<xsl:with-param name="class">video</xsl:with-param>
<xsl:with-param name="parms">,model:'<xsl:value-of select="$model"/>',mode:<xsl:value-of select="$mode"/>,screenWidth:<xsl:value-of select="$screenWidth"/>,screenHeight:<xsl:value-of select="$screenHeight"/>,screenColor:'<xsl:value-of select="$screenColor"/>',screenRotate:<xsl:value-of select="$screenRotate"/>,bufferAddr:<xsl:value-of select="$bufferAddr"/>,bufferCols:<xsl:value-of select="$bufferCols"/>,bufferRows:<xsl:value-of select="$bufferRows"/>,bufferBits:<xsl:value-of select="$bufferBits"/>,bufferLeft:<xsl:value-of select="$bufferLeft"/>,bufferRotate:<xsl:value-of select="$bufferRotate"/>,memory:<xsl:value-of select="$memory"/>,switches:'<xsl:value-of select="$switches"/>',scale:<xsl:value-of select="$scale"/>,charCols:<xsl:value-of select="$charCols"/>,charRows:<xsl:value-of select="$charRows"/>,fontROM:'<xsl:value-of select="$fontROM"/>',touchScreen:'<xsl:value-of select="$touchScreen"/>',autoLock:<xsl:value-of select="$autoLock"/>,aspectRatio:<xsl:value-of select="$aspectRatio"/>,smoothing:<xsl:value-of select="$smoothing"/>,interruptRate:<xsl:value-of select="$interruptRate"/>,refreshRate:<xsl:value-of select="$refreshRate"/></xsl:with-param>
<xsl:with-param name="parms">,model:'<xsl:value-of select="$model"/>',mode:<xsl:value-of select="$mode"/>,screenWidth:<xsl:value-of select="$screenWidth"/>,screenHeight:<xsl:value-of select="$screenHeight"/>,screenColor:'<xsl:value-of select="$screenColor"/>',screenRotate:<xsl:value-of select="$screenRotate"/>,bufferAddr:<xsl:value-of select="$bufferAddr"/>,bufferRAM:<xsl:value-of select="$bufferRAM"/>,bufferFormat:'<xsl:value-of select="$bufferFormat"/>',bufferCols:<xsl:value-of select="$bufferCols"/>,bufferRows:<xsl:value-of select="$bufferRows"/>,bufferBits:<xsl:value-of select="$bufferBits"/>,bufferLeft:<xsl:value-of select="$bufferLeft"/>,bufferRotate:<xsl:value-of select="$bufferRotate"/>,memory:<xsl:value-of select="$memory"/>,switches:'<xsl:value-of select="$switches"/>',scale:<xsl:value-of select="$scale"/>,charCols:<xsl:value-of select="$charCols"/>,charRows:<xsl:value-of select="$charRows"/>,fontROM:'<xsl:value-of select="$fontROM"/>',touchScreen:'<xsl:value-of select="$touchScreen"/>',autoLock:<xsl:value-of select="$autoLock"/>,aspectRatio:<xsl:value-of select="$aspectRatio"/>,smoothing:<xsl:value-of select="$smoothing"/>,interruptRate:<xsl:value-of select="$interruptRate"/>,refreshRate:<xsl:value-of select="$refreshRate"/></xsl:with-param>
</xsl:call-template>
</xsl:template>