From 60e8bc35949cfce0a0a81afd9173efa2c55d67c3 Mon Sep 17 00:00:00 2001 From: paul Date: Thu, 21 Jun 2012 04:05:10 +0000 Subject: [PATCH] Commit DCMCP transcription and emulator WIP as of 2012-06-20. --- SYMBOL/DCMCP.esp_m | 105 ++++++++++++++++++++++++++++++++ emulator/B5500CentralControl.js | 22 +++---- emulator/B5500Processor.js | 4 +- webUI/B5500Console.html | 6 ++ webUI/B5500DDPanel.js | 54 ++++++++++++++-- webUI/B5500ProcessorPanel.html | 44 ++++++++++--- webUI/B5500ProcessorPanel.js | 9 ++- 7 files changed, 216 insertions(+), 28 deletions(-) diff --git a/SYMBOL/DCMCP.esp_m b/SYMBOL/DCMCP.esp_m index 77671f1..6d445f3 100644 --- a/SYMBOL/DCMCP.esp_m +++ b/SYMBOL/DCMCP.esp_m @@ -4096,3 +4096,108 @@ EXIT: 04687550 % THIS SITUATION MAY NEVER OCCUR, BUT JUST IN CASE 04688000 WRITEPARITYREELSWITCH ~ UNIT[U] & MODE[5:40:8]; 04688050 END WRITEPARITYREELSWITCH; 04688100 +REAL PROCEDURE PLACEFINDER(S, A, L); 04700000 + VALUE S, A; 04701000 + REAL S, A, L; 04702000 + BEGIN INTEGER I; ARRAY B[*]; 04703000 + REAL T, W, E, J, AA; 04704000 + LABEL NULL, FOUND, EXIT; 04705000 + LABEL SANDA; REAL SS; 04705500 + W ~ -1; 04706000 + B ~ [M[T ~ SPACE(30)]]&30[8:38:10]; 04707000 + SS:=S; 04707500 + IF S=0 THEN 04708000 +NULL: BEGIN STREAM(T); DS:=20 LIT " "; GO EXIT; END; 04709000 + DISKWAIT(-T,30,JAR[P1MIX,10]); 04710000 + IF (JAR[P1MIX,10]=0) OR (AA~B[0].[FF])=0 THEN 04711000 +SANDA: BEGIN STREAM(S:=SS,A,K:=M[PRT[P1MIX,8]].[10:2],T); 04712000 + BEGIN DS~5 LIT ", S ="; 04713000 + SI~LOC S; DS~4 DEC; 04714000 + DS~5 LIT ", A ="; 04715000 + DS~4 DEC; 04716000 + DS:=LIT ":"; SI:=SI+7; DS:=CHR; 04716100 + DI~T; DI~DI+5; DS~3 FILL; 04717000 + DI~T; DI~DI+14; DS~3 FILL; 04718000 + END STREAM; 04719000 + GO EXIT; 04720000 + END; 04721000 + DISKWAIT(-T,30,I:=JAR[P1MIX,AA DIV JAR[P1MIX,8]+10+ 04722000 + AA MOD JAR[P1MIX,8]+S DIV 30); 04723000 + IF (J~B[S MOD 30])<0 THEN GO TO NULL; 04725000 + AA ~ I ~ JAR[P1MIX,J.[CF] DIV JAR[P1MIX,8]+10]+ 04726000 + J.[CF] MOD JAR[P1MIX,8]; 04727000 + I~0; J~J.[FF]; 04728000 + DO BEGIN S~(I+J).[36:11]; 04729000 + IF W!(W:=S DIV 30) THEN DISKWAIT(-T,30,AA+W); 04731000 + IF (E ~ B[S-W|30].[38:10])=A THEN GO TO FOUND; 04732000 + IF E0 THEN SLEEP([Z],-0); Z~-Z; 05703500 + $ SET OMIT = NOT(SHAREDISK) 05703699 + DISKWAIT(-B,30,Z); 05704000 +IF (I~A[0])+6+N}(J~A[1]) THEN BEGIN I~0; K~1 END %WRAP AROUND 05705000 +ELSE IF I+N+100 GEQ J THEN 05706000 + BEGIN INDEPENDTRUNNER(P(.LOGOUT),1,128); 05706100 + K:=2; 05706200 + END 05706300 +ELSE IF I1020 THEN 1020 ELSE K,Z+I); 05728180 + J:=J+1020; 05728200 + I:=I+34; 05728220 + END UNTIL (K:=K-1020) LEQ 0; 05728240 + END; 05728260 diff --git a/emulator/B5500CentralControl.js b/emulator/B5500CentralControl.js index 4d62682..293ebd3 100644 --- a/emulator/B5500CentralControl.js +++ b/emulator/B5500CentralControl.js @@ -49,9 +49,9 @@ function B5500CentralControl() { /**************************************/ /* Global constants */ -B5500CentralControl.prototype.rtcTick = 1000/60; // Real-time clock period, milliseconds +B5500CentralControl.rtcTick = 1000/60; // Real-time clock period, milliseconds -B5500CentralControl.prototype.pow2 = [ // powers of 2 from 0 to 52 +B5500CentralControl.pow2 = [ // powers of 2 from 0 to 52 1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, @@ -67,7 +67,7 @@ B5500CentralControl.prototype.pow2 = [ // powers of 2 from 0 to 52 281474976710656, 562949953421312, 1125899906842624, 2251799813685248, 4503599627370496]; -B5500CentralControl.prototype.mask2 = [ // (2**n)-1 for n from 0 to 52 +B5500CentralControl.mask2 = [ // (2**n)-1 for n from 0 to 52 0, 1, 3, 7, 15, 31, 63, 127, 255, 511, 1023, 2047, @@ -91,8 +91,8 @@ B5500CentralControl.prototype.clear = function() { clearTimeout(this.timer); } - this.nextTimeStamp = new Date().getTime() + this.rtcTick; - this.timer = setTimeout(this.tock, this.rtcTick); + this.nextTimeStamp = new Date().getTime() + B5500CentralControl.rtcTick; + this.timer = setTimeout(this.tock, B5500CentralControl.rtcTick); this.IAR = 0; // Interrupt address register this.TM = 0; // Real-time clock (6 bits, 60 ticks per second) @@ -148,7 +148,7 @@ B5500CentralControl.prototype.bit = function(word, bit) { /* Extracts and returns the specified bit from the word */ var e = 47-bit; - return (e > 0 ? Math.floor(word/this.pow2[e]) : word) % 2; + return (e > 0 ? Math.floor(word/B5500CentralControl.pow2[e]) : word) % 2; } /**************************************/ @@ -171,7 +171,7 @@ B5500CentralControl.prototype.fieldIsolate = function(word, start, width) { var ue = 48-start; // upper power exponent var le = ue-width; // lower power exponent - return (le > 0 ? Math.floor(word/this.pow2[le]) : word) % this.pow2[width]; + return (le > 0 ? Math.floor(word/B5500CentralControl.pow2[le]) : word) % B5500CentralControl.pow2[width]; } /**************************************/ @@ -184,13 +184,13 @@ B5500CentralControl.prototype.fieldInsert = function(word, start, width, value) var top = 0; // unaffected top portion of word if (start > 0) { - top = word - (word % this.pow2[ue]); + top = word - (word % B5500CentralControl.pow2[ue]); } if (le > 0) { - bpower = this.pow2[le]; + bpower = B5500CentralControl.pow2[le]; bottom = word % bpower; } - return (value % this.pow2[width])*bpower + top + bottom; + return (value % B5500CentralControl.pow2[width])*bpower + top + bottom; } /**************************************/ @@ -430,7 +430,7 @@ B5500CentralControl.prototype.tock = function tock() { that.CCI03F = 1; // set timer interrupt // inhibit for now // that.signalInterrupt(); } - that.nextTimeStamp += that.rtcTick; + that.nextTimeStamp += B5500CentralControl.rtcTick; that.timer = setTimeout(function() {that.tock()}, (that.nextTimeStamp < thisTime ? 0 : that.nextTimeStamp-thisTime)); } diff --git a/emulator/B5500Processor.js b/emulator/B5500Processor.js index 61ac426..965eb7b 100644 --- a/emulator/B5500Processor.js +++ b/emulator/B5500Processor.js @@ -29,7 +29,7 @@ function B5500Processor() { /**************************************/ -B5500Processor.prototype.timeSlice = 5000; // Standard run() timeslice, about 5ms (we hope) +B5500Processor.timeSlice = 5000; // Standard run() timeslice, about 5ms (we hope) /**************************************/ B5500Processor.prototype.clear = function() { @@ -1172,7 +1172,7 @@ B5500Processor.prototype.schedule = function schedule() { var that = schedule.that; that.scheduler = null; - that.cycleLimit = that.timeSlice; + that.cycleLimit = B5500Processor.timeSlice; that.cycleCount = 0; that.run(); diff --git a/webUI/B5500Console.html b/webUI/B5500Console.html index fb92b5f..f7201be 100644 --- a/webUI/B5500Console.html +++ b/webUI/B5500Console.html @@ -5,6 +5,12 @@ + + diff --git a/webUI/B5500DDPanel.js b/webUI/B5500DDPanel.js index ab04d43..010a1bd 100644 --- a/webUI/B5500DDPanel.js +++ b/webUI/B5500DDPanel.js @@ -1,4 +1,4 @@ -/*********************************************************************** + /*********************************************************************** * retro-b5500/emulator B5500DDPanel.js ************************************************************************ * Copyright (c) 2012, Nigel Williams and Paul Kimpel. @@ -39,7 +39,7 @@ B5500DDLamp.prototype.set = function(v) { var newState = v & 1; if (this.state ^ newState) { // the state has changed - this.element.backgroundColor = (newState ? B5500DDLamp.onColor : B5500DDLamp.offColor); + this.element.style.backgroundColor = (newState ? B5500DDLamp.onColor : B5500DDLamp.offColor); this.state = newState; } } @@ -49,7 +49,7 @@ B5500DDLamp.prototype.flip = function() { /* Complements the visible state of the lamp */ var newState = this.state ^ 1; - this.element.backgroundColor = (newState ? B5500DDLamp.onColor : B5500DDLamp.offColor); + this.element.style.backgroundColor = (newState ? B5500DDLamp.onColor : B5500DDLamp.offColor); this.state = newState; } @@ -133,7 +133,21 @@ B5500DDRegister.vSpacing = 24; // vertical lamp spacing, pixels B5500DDRegister.vOffset = 5; // vertical lamp offset within container /**************************************/ -B5500DDRegister.prototype.update = function(value) { +B5500DDRegister.prototype.xCoord = function(col) { + /* Returns the horizontal lamp coordinate in "px" format */ + + return String((col-1)*B5500DDRegister.hSpacing + B5500DDRegister.hOffset) + "px"; +} + +/**************************************/ +B5500DDRegister.prototype.yCoord = function(row) { + /* Returns the vertical lamp coordinate in "px" format */ + + return String((row-1)*B5500DDRegister.vSpacing + B5500DDRegister.vOffset) + "px"; +} + +/**************************************/ +B5500DDRegister.prototype.YYupdate = function(value) { /* Update the register lamps from the value of the parameter */ var bitNr = 0; var low = (this.lastValue % 0x1000000) ^ (value % 0x1000000); @@ -155,4 +169,34 @@ B5500DDRegister.prototype.update = function(value) { high >>>= 1; } this.lastValue = value; -} \ No newline at end of file +} + +/**************************************/ +B5500DDRegister.prototype.XXupdate = function(value) { + /* Update the register lamps from the value of the parameter */ + var bitNr = 0; + var bit; + var mask = value % 0x1000000000000; + + while (mask) { + bitNr++; + bit = mask % 2; + this.lamps[bitNr].set(bit); + mask = (mask-bit)/2; + } +} + +/**************************************/ +B5500DDRegister.prototype.update = function(value) { + /* Update the register lamps from the value of the parameter */ + var bitNr = 0; + var bit; + var mask = value % 0x1000000000000; + + while (mask) { + bitNr++; + bit = mask % 2; + this.lamps[bitNr].element.style.backgroundColor = (bit ? B5500DDLamp.onColor : B5500DDLamp.offColor); + mask = (mask-bit)/2; + } +} diff --git a/webUI/B5500ProcessorPanel.html b/webUI/B5500ProcessorPanel.html index ec3080f..6090ac4 100644 --- a/webUI/B5500ProcessorPanel.html +++ b/webUI/B5500ProcessorPanel.html @@ -10,34 +10,60 @@