From 7913ef2a0a9772d9869cec4309db10b761935df0 Mon Sep 17 00:00:00 2001 From: Jeff Parsons Date: Wed, 10 Feb 2016 17:52:50 -0800 Subject: [PATCH] More build option groundwork --- _includes/build.html | 2 +- disks/pc/os2/misc/football/87058/README.md | 54 ++++++++--------- docs/pcjs/demos/pc-dbg.js | 4 +- docs/pcjs/demos/pc.js | 4 +- modules/markout/lib/markout.js | 2 +- modules/pcbuild/lib/build.js | 70 ++++++++++++++++++++++ modules/pcjs/lib/computer.js | 10 +++- 7 files changed, 111 insertions(+), 35 deletions(-) diff --git a/_includes/build.html b/_includes/build.html index f3ee7c59f..c264b1518 100644 --- a/_includes/build.html +++ b/_includes/build.html @@ -1 +1 @@ -
+
diff --git a/disks/pc/os2/misc/football/87058/README.md b/disks/pc/os2/misc/football/87058/README.md index 39ef3d0b3..44c51659d 100644 --- a/disks/pc/os2/misc/football/87058/README.md +++ b/disks/pc/os2/misc/football/87058/README.md @@ -142,10 +142,10 @@ FOOTBALL Design Document --- The following text is from an email titled "3xBox Design Document" sent to the -*football* alias on Saturday, February 28, 1987, at 5:02pm. - -### Overview +Microsoft *football* alias on Saturday, February 28, 1987, at 5:02pm. + Overview + -------- The goal for this research project was to demonstrate the feasability of supporting multiple virtual DOS 3.x machines on a 286DOS-based kernel running on an 386 personal computer. Each "3xBox" would have its own virtual screen, @@ -174,8 +174,8 @@ The following text is from an email titled "3xBox Design Document" sent to the Unless stated otherwise, most of the concepts extant in 286DOS apply to 386DOS. -### V86 Mode and the 386 - + V86 Mode and the 386 + ---------------------- The 386 CPU has three distinct execution modes: REAL, PROT, and V86. REAL and PROT modes are largely compatible with the corresponding modes of an 286. V86 modes is exactly the same as RING 3 PROT mode, with the following @@ -203,8 +203,8 @@ The following text is from an email titled "3xBox Design Document" sent to the sensitive. This allows the OS to simulate the Interrupt Flag, if desired. -### V86 IRETD Frame - + V86 IRETD Frame + --------------- When any interrupt, trap, exception, or fault occurs in V86 mode, the CPU switches to PROT mode and switches to the TSS Ring 0 Stack and builds the following stack frame: @@ -219,8 +219,8 @@ The following text is from an email titled "3xBox Design Document" sent to the (0) (old CS) (old EIP) <- (SS:SP) -### CPU Mode Determination - + CPU Mode Determination + ---------------------- A new implementation of the WHATMODE macro was written in order to distinguish between the three CPU modes: REAL, PROT, and V86. REAL mode is indicated by a 0 PE bit in CR0 (a.k.a. MSW on a 286). If the PE bit is 1, then the mode @@ -230,8 +230,8 @@ The following text is from an email titled "3xBox Design Document" sent to the be changed. So, we change IOPL and then check to see if it changed. If so, PROT mode, else V86 mode. -### CPU Mode Switching - + CPU Mode Switching + ------------------ The 286DOS kernel relies extensively on switching inbetween REAL and PROT. This functionality is provided by the RealMode and ProtMode routines. In 386DOS, RealMode is no longer needed. As soon as we switch to PROT mode @@ -256,28 +256,28 @@ The following text is from an email titled "3xBox Design Document" sent to the the caller. NOTE: V86 Services is also used for completing the 386 LOADALL used by PhysToVirt to map "high" memory in "REAL" mode. -### Stack Switching - + Stack Switching + --------------- In order to maintain the 286DOS mode switch and stack switch semantics when V86 mode is used, we have a new stack (the V86 Stack) in the 3xBox PTDA. -### 286DOS Modes and Stacks - + 286DOS Modes and Stacks + ----------------------- The RealMode and ProtMode procedures in 286DOS are the only ways to switch the CPU execution mode. These routines both maintain SS:SP, allowing RealMode and ProtMode to be reentrant. The TSS Ring 0 stack is always the current TCB stack in the current PTDA. The only other stacks in the system are the Interrupt Stack and user stack(s). -### 386DOS Modes and Stacks - + 386DOS Modes and Stacks + ----------------------- In 386DOS, any interrupt or exception while in V86 mode causes a switch to PROT mode and the TSS Ring 0 Stack. So we have a new way to mode switch with an incompatible stack semantic. We had to fix this mode switch to make it compatible with 286DOS. -### Observation - + Observation + ----------- In V86 mode, the current stack must not be the TSS Ring 0 Stack. The CPU only leaves V86 mode via an interrupt/exception, which causes a stack switch to the TSS Ring 0 Stack. If the current stack was the same as the TSS Ring 0 @@ -285,8 +285,8 @@ The following text is from an email titled "3xBox Design Document" sent to the the PTDA. Since we run on this stack in V86 mode, we need a new Ring 0 stack when a 3xBox is running. -### Approach - + Approach + -------- 1) When a PMBox is running, the TSS Ring 0 Stack is a PTDA TCB stack. + This is consistent with the 286DOS model. @@ -298,8 +298,8 @@ The following text is from an email titled "3xBox Design Document" sent to the + Otherwise, copy the V86 IRETD frame to the previous stack and switch back to the previous stack. -### Details - + Details + ------- 1) Leaving V86 mode a. V86ToProt (analog of ProtMode) + Issue special V86ToProt software interrupt. If the interrupt @@ -341,8 +341,8 @@ The following text is from an email titled "3xBox Design Document" sent to the + Execute 386 LOADALL with VM bit set in EFLAGS image in loadall buffer. -### Interrupt Management - + Interrupt Management + -------------------- All software interrupts, hardware interrupts, and CPU traps and exceptions are vectored through a common IDT, regardless of whether the CPU is in PROT or V86 mode. @@ -352,8 +352,8 @@ The following text is from an email titled "3xBox Design Document" sent to the keyboard and mouse (since those are implicitly for the foreground box), can be given to background 3xBoxes. -### Passing Hardware Interrupts to the Foreground 3xBox - + Passing Hardware Interrupts to the Foreground 3xBox + --------------------------------------------------- In the interrupt manager: IF a 3xBox is foreground -AND- diff --git a/docs/pcjs/demos/pc-dbg.js b/docs/pcjs/demos/pc-dbg.js index 240b59a0c..56ce9fcc0 100644 --- a/docs/pcjs/demos/pc-dbg.js +++ b/docs/pcjs/demos/pc-dbg.js @@ -1210,10 +1210,10 @@ function lr(a,b,c){for(var d=hb(a.id),e=0;e<=d.length;e++){var f=eir){if(d.load(this.O)){this.R=new bf(this,kr,"failsafe");this.R.load()&&(nr(this,d),a=2,dr(this.R));cf(this.R,"timestamp",ta());er(this.R);var e=this.Oc&&!this.P;if(1==a||Ca("Click OK to restore the previous PCjs machine state, or CANCEL to reset the machine.")){if(c=fr(d)){var f=gr(d,"code"),g=gr(d,"data");f&&("ok"==f?d.load(g):("error"==f&& "no machine state"!=g?(this.Va("Error: "+g),"unable to verify user"==g&&(Ha("user",""),this.A=null)):this.S(f+": "+g),dr(d),d.load()?(c=fr(d),e=!0):c=!1))}e&&mr(this,c?d:null)}else 2==a&&d.clear()}else mr(this);delete this.O;delete this.ia}e=hb(this.id);for(f=0;fa[1];a=a[2];this.ra.hc=!0;var d=this.ya.power;d&&(d.textContent="On");this.tk||(this.S("PCjs v"+kr+"\nCopyright \u00a9 2012-2016 Jeff Parsons \nLicense: GPL version 3 or later "),this.tk=!0);this.M&&(or(this,this.M,b,c,a),Xc(this.M));this.da&&(nr(this,b),b.clear());!c&&this.R&&(this.R.clear(),delete this.R);this.C=0}; +h.Ki=function(a){var b=a[0],c=0>a[1];a=a[2];this.ra.hc=!0;var d=this.ya.power;d&&(d.textContent="Shutdown");this.tk||(this.S("PCjs v"+kr+"\nCopyright \u00a9 2012-2016 Jeff Parsons \nLicense: GPL version 3 or later "),this.tk=!0);this.M&&(or(this,this.M,b,c,a),Xc(this.M));this.da&&(nr(this,b),b.clear());!c&&this.R&&(this.R.clear(),delete this.R);this.C=0}; function nr(a,b){if(Ca("There may be a problem with your PCjs machine.\n\nTo help us diagnose it, click OK to send this PCjs machine state to http://www.pcjs.org.")){var c=a.qa,d=a.ie(),e=b.toString(),f={app:"PCjs"};f.ver=kr;f.url=c;f.user=d;f.type="bug";f.data=e;za("http://www.pcjs.org/api/v1/report",!0,f)}} function br(a,b,c){var d,e="none";if(a.C)return null;a.C--;var f=new bf(a,kr),g=new bf(a,kr,"validate"),k=ta();cf(g,"timestamp",k);cf(f,"timestamp",k);cf(f,"version","1.20.9");cf(f,"url",window?window.location.href:null);cf(f,"browser",window?window.navigator.userAgent:"");a.M&&a.M.kc&&(c&&a.M.bc(),d=a.M.kc(b,c),"object"===typeof d&&cf(f,a.M.id,d),c&&(a.M.ra.hc=!1,!1===d&&(e=null)));for(var k=hb(a.id),q=0;qNm){if(d.load(this.J)){this.F=new Rd(this,Pm,"failsafe");this.F.load()&&(Sm(this,d),a=2,Im(this.F));D(this.F,"timestamp",la());Jm(this.F);var e=this.rc&&!this.H;if(1==a||sa("Click OK to restore the previous PCjs machine state, or CANCEL to reset the machine.")){if(c=Km(d)){var k=Lm(d,"code"),l=Lm(d,"data");k&&("ok"==k?d.load(l):("error"==k&&"no machine state"!= l?(this.Ka("Error: "+l),"unable to verify user"==l&&(wa("user",""),this.B=null)):this.cc(k+": "+l),Im(d),d.load()?(c=Km(d),e=!0):c=!1))}e&&Rm(this,c?d:null)}else 2==a&&d.clear()}else Rm(this);delete this.J;delete this.K}e=Ra(this.id);for(k=0;ka[1];a=a[2];this.ja.Qb=!0;var d=this.qa.power;d&&(d.textContent="On");this.Dh||(this.cc("PCjs v"+Pm+"\nCopyright \u00a9 2012-2016 Jeff Parsons \nLicense: GPL version 3 or later "),this.Dh=!0);this.A&&(Tm(this,this.A,b,c,a),kc(this.A));this.S&&(Sm(this,b),b.clear());!c&&this.F&&(this.F.clear(),delete this.F);this.D=0}; +f.Rh=function(a){var b=a[0],c=0>a[1];a=a[2];this.ja.Qb=!0;var d=this.qa.power;d&&(d.textContent="Shutdown");this.Dh||(this.cc("PCjs v"+Pm+"\nCopyright \u00a9 2012-2016 Jeff Parsons \nLicense: GPL version 3 or later "),this.Dh=!0);this.A&&(Tm(this,this.A,b,c,a),kc(this.A));this.S&&(Sm(this,b),b.clear());!c&&this.F&&(this.F.clear(),delete this.F);this.D=0}; function Sm(a,b){if(sa("There may be a problem with your PCjs machine.\n\nTo help us diagnose it, click OK to send this PCjs machine state to http://www.pcjs.org.")){var c=a.da,d=a.yd(),e=b.toString(),k={app:"PCjs"};k.ver=Pm;k.url=c;k.user=d;k.type="bug";k.data=e;pa("http://www.pcjs.org/api/v1/report",!0,k)}} function Um(a,b,c){var d,e="none";if(a.D)return null;a.D--;var k=new Rd(a,Pm),l=new Rd(a,Pm,"validate"),p=la();D(l,"timestamp",p);D(k,"timestamp",p);D(k,"version","1.20.9");D(k,"url",window?window.location.href:null);D(k,"browser",window?window.navigator.userAgent:"");a.A&&a.A.Sb&&(c&&nc(a.A),d=a.A.Sb(b,c),"object"===typeof d&&D(k,a.A.id,d),c&&(a.A.ja.Qb=!1,!1===d&&(e=null)));for(var p=Ra(a.id),q=0;q'); + sBlock = sBlock.replace(/\{%\s*include\s+build\.html\s+id=(["'])(.*?)\1\s*%}/g, '
'); /* * Start looking for Markdown-style machine links now... diff --git a/modules/pcbuild/lib/build.js b/modules/pcbuild/lib/build.js index 36401a3cd..782fbb938 100644 --- a/modules/pcbuild/lib/build.js +++ b/modules/pcbuild/lib/build.js @@ -36,6 +36,76 @@ * This file provides all the UI options for building a functional PCjs PC. */ +var typeAddress = { + type: "address" +}; + +var typeBoolean = { + type: "boolean" +}; + +var typeNumber = { + type: "number" +}; + +var typePath = { + type: "string" +}; + +var typeString = { + type: "string" +}; + +var machineTypes = { + '5150': "IBM PC (Model 5150)", + '5160': "IBM PC XT (Model 5160)", + '5170': "IBM PC AT (Model 5170)", + 'deskpro386': "COMPAQ DeskPro 386" +}; + +var aMachineElements = { + 'machine': { + choices: machineTypes + }, + 'name': { + desc: "Machine Description" + }, + 'computer': { + desc: "General Computer Features", + 'buswidth': { + type: typeNumber, + values: [20, 24, 32] + }, + 'resume': { + type: typeNumber, + value: [0, 1, 2], + descs: ["Resume Disabled", "Resume Enabled", "Resume with Prompt"] + } + }, + 'ram': { + desc: "Read-Write Memory (Conventional or Extended)", + 'addr': { + type: typeAddress + }, + 'size': { + type: typeNumber + } + }, + 'rom': { + desc: "Read-Only Memory", + 'addr': { + type: typeAddress + }, + 'size': { + type: typeNumber + }, + 'file': { + type: typePath + } + } +}; + + /** * buildPC(idElement) * diff --git a/modules/pcjs/lib/computer.js b/modules/pcjs/lib/computer.js index edb8bf19f..813613e6e 100644 --- a/modules/pcjs/lib/computer.js +++ b/modules/pcjs/lib/computer.js @@ -104,14 +104,20 @@ if (NODE) { * * The parmsMachine object, if provided, may contain any of: * - * url: the location of the machine XML file - * * autoMount: if set, this should override any 'autoMount' property in the FDC's * parmsFDC object. * + * autoPower: if set, this should override any 'autoPower' property in the Computer's + * parmsComputer object. + * + * messages: if set, this should override any 'messages' property in the Debugger's + * parmsDbg object. + * * state: if set, this should override any 'state' property in the Computer's * parmsComputer object. * + * url: the location of the machine XML file + * * If a predefined state is supplied AND it's successfully loaded, then resume behavior * defaults to '1' (ie, resume enabled without prompting). *