Disassembly cleanup

This commit is contained in:
Jeff Parsons 2015-06-03 12:02:22 -07:00
commit 95b7e80c4b
4 changed files with 567 additions and 823 deletions

File diff suppressed because it is too large Load diff

View file

@ -24,30 +24,29 @@
mov [0x10e],cs ; 00000083 8C0E0E01 '....'
sti ; 00000087 FB '.'
mov byte [0x489],0x11 ; 00000088 C606890411 '.....'
;
; Initialize the ROM BIOS Video Mode Options byte @40:0087 (default to color and 256Kb of RAM)
;
;
; Initialize the ROM BIOS Video Mode Options byte @40:0087 (default to color and 256Kb of RAM)
;
mov byte [0x487],0x60 ; 0000008D
;
; The x100 subroutine alternately enables port 0x3B? and 0x3D? decoding, verifying that there is
; no response on opposing ports 0x3D? and 0x3B?, respectively; otherwise, it assumes that another
; video card must exist and attempts to select co-existing settings for the VGA. For example, if
; there is an unexpected response on the color ports, the VGA ROM will default to mono operation.
;
;
; The x100 subroutine alternately enables port 0x3B? and 0x3D? decoding, verifying that there is
; no response on opposing ports 0x3D? and 0x3B?, respectively; otherwise, it assumes that another
; video card must exist and attempts to select co-existing settings for the VGA. For example, if
; there is an unexpected response on the color ports, the VGA ROM will default to mono operation.
;
call x100 ; 00000092
;
; From the "IBM Personal System/2 Model 50 and 60 Technical Reference: I/O Controllers, Video Subsystem", p.4-29:
;
; When in setup mode (I/O address hex 0094, bit 5 equals 0), the VGA responds to a single option select byte
; at I/O address hex 0102 and treats the LSB (bit 0) of that byte as the VGA sleep bit. When the LSB equals 0,
; the VGA does not respond to commands, addresses, or data, on the data bus. When the LSB equals 1, the VGA
; responds. If the VGA was set up and is generating video output when the LSB is set to 0, the output is still
; generated.
; When in setup mode (I/O address hex 0094, bit 5 equals 0), the VGA responds to a single option select byte
; at I/O address hex 0102 and treats the LSB (bit 0) of that byte as the VGA sleep bit. When the LSB equals 0,
; the VGA does not respond to commands, addresses, or data, on the data bus. When the LSB equals 1, the VGA
; responds. If the VGA was set up and is generating video output when the LSB is set to 0, the output is still
; generated.
;
; The VGA responds only to address hex 0102 when in the setup mode. No other addresses are valid at that time.
; Conversely, the VGA ignores address hex 0102 when in the enabled mode (I/O address hex 0094, bit 5 equals 1),
; and decodes normal I/O and memory addresses.
; The VGA responds only to address hex 0102 when in the setup mode. No other addresses are valid at that time.
; Conversely, the VGA ignores address hex 0102 when in the enabled mode (I/O address hex 0094, bit 5 equals 1),
; and decodes normal I/O and memory addresses.
;
cli ; 00000095 FA '.'
mov dx,0x46e8 ; 00000096 BAE846 '..F'
@ -65,33 +64,28 @@
sti ; 000000B1 FB '.'
push cs ; 000000B2 0E '.'
pop es ; 000000B3 07 '.'
;
; Default to mono settings
;
;
; Default to mono settings
;
mov di,0x3b4 ; 000000B4 BFB403 '...'
mov bx,0x1602 ; 000000B7 BB0216 '...'
;
; Test bit 1 of ROM BIOS Video Mode Options byte @40:0087 (set if mono, clear if color)
;
;
; Test bit 1 of ROM BIOS Video Mode Options byte @40:0087 (set if mono, clear if color)
;
test byte [0x487],0x2 ; 000000BA F606870402 '.....'
jnz xc7 ; 000000BF 7506 'u.'
;
; Choose color settings
;
;
; Choose color settings
;
mov di,0x3d4 ; 000000C1 BFD403 '...'
mov bx,0x1642 ; 000000C4 BB4216 '.B.'
;
; Set the CRTC base port address (0x3B4 for mono, 0x3D4 for color)
;
;
; Set the CRTC base port address (0x3B4 for mono, 0x3D4 for color)
;
xc7: mov [0x463],di ; 000000C7 893E6304 '.>c.'
;
; Program the card for a default mode
;
;
; Program the card for a default mode
;
call x1127 ; 000000CB E85910 '.Y.'
xor al,al ; 000000CE 32C0 '2.'
@ -6906,10 +6900,9 @@ x3765: dec ax ; 00003765 48 'H'
dw font_8x14_supp ; 00003787 8D4D '.M'
dw font_8x16 ; 0000378A BA4E '.N'
dw font_8x16_supp ; 0000378B BA5E '.^'
;
; 8x8 font (8 bytes per row, one row per character)
;
;
; 8x8 font (8 bytes per row, one row per character)
;
font_8x8:
db 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 ; 0x0000378D ........
db 0x7E,0x81,0xA5,0x81,0xBD,0x99,0x81,0x7E ; 0x00003795 ~......~
@ -7168,10 +7161,9 @@ font_8x8_hi:
db 0x70,0x18,0x30,0x60,0x78,0x00,0x00,0x00 ; 0x00003F75 p.0`x...
db 0x00,0x00,0x3C,0x3C,0x3C,0x3C,0x00,0x00 ; 0x00003F7D ........
db 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 ; 0x00003F85 ........
;
; 8x14 font (14 bytes per row, one row per character)
;
;
; 8x14 font (14 bytes per row, one row per character)
;
font_8x14:
db 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 ; 0x00003F8D ..............
db 0x00,0x00,0x7E,0x81,0xA5,0x81,0x81,0xBD,0x99,0x81,0x7E,0x00,0x00,0x00 ; 0x00003F9B ..~.......~...
@ -7429,10 +7421,9 @@ font_8x14:
db 0x00,0x70,0xD8,0x30,0x60,0xC8,0xF8,0x00,0x00,0x00,0x00,0x00,0x00,0x00 ; 0x00004D63 .p.0`.........
db 0x00,0x00,0x00,0x00,0x7C,0x7C,0x7C,0x7C,0x7C,0x7C,0x00,0x00,0x00,0x00 ; 0x00004D71 ....||||||....
db 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 ; 0x00004D7F ..............
;
; 8x14 supplemental
;
;
; 8x14 supplemental
;
font_8x14_supp:
db 0x1D,0x00,0x00,0x00,0x00,0x24,0x66,0xFF,0x66,0x24,0x00,0x00,0x00,0x00,0x00 ; 0x00004D8D .....$f.f$.....
db 0x22,0x00,0x63,0x63,0x63,0x22,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 ; 0x00004D9C ".ccc".........
@ -7455,10 +7446,9 @@ font_8x14_supp:
db 0xF1,0x00,0x00,0x18,0x18,0x18,0xFF,0x18,0x18,0x18,0x00,0xFF,0x00,0x00,0x00 ; 0x00004E9B ...............
db 0xF6,0x00,0x00,0x18,0x18,0x00,0x00,0xFF,0x00,0x00,0x18,0x18,0x00,0x00,0x00 ; 0x00004EAA ...............
db 0x00 ; end-of-supplemental terminator
;
; 8x16 font (16 bytes per row, one row per character)
;
;
; 8x16 font (16 bytes per row, one row per character)
;
font_8x16:
db 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 ; 0x00004EBA ................
db 0x00,0x00,0x7E,0x81,0xA5,0x81,0x81,0xBD,0x99,0x81,0x81,0x7E,0x00,0x00,0x00,0x00 ; 0x00004ECA ..~........~....
@ -7716,10 +7706,9 @@ font_8x16:
db 0x00,0x70,0xD8,0x30,0x60,0xC8,0xF8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 ; 0x00005E8A .p.0`...........
db 0x00,0x00,0x00,0x00,0x7C,0x7C,0x7C,0x7C,0x7C,0x7C,0x7C,0x00,0x00,0x00,0x00,0x00 ; 0x00005E9A ....|||||||.....
db 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 ; 0x00005EAA ................
;
; 8x16 supplemental
;
;
; 8x16 supplemental
;
font_8x16_supp:
db 0x1D,0x00,0x00,0x00,0x00,0x00,0x24,0x66,0xFF,0x66,0x24,0x00,0x00,0x00,0x00,0x00,0x00 ; 0x00005EBA ......$f.f$......
db 0x30,0x00,0x00,0x3C,0x66,0xC3,0xC3,0xDB,0xDB,0xC3,0xC3,0x66,0x3C,0x00,0x00,0x00,0x00 ; 0x00005ECB 0...f......f.....

View file

@ -605,11 +605,11 @@ ChipSet.TIMER_TICKS_PER_SEC = 1193181;
* I'm guessing that's just part of some "diagnostic mode", because all it writes to PPI_A.PORT are a series
* of "checkpoint" values (ie, 0x01, 0x02, and 0x03) before updating PPI_CTRL.PORT with the usual 0x99.
*/
ChipSet.PPI_A = { // this.bPPIA
ChipSet.PPI_A = { // this.bPPIA (port 0x60)
PORT: 0x60 // INPUT: keyboard scan code (PPI_B.CLEAR_KBD must be clear)
};
ChipSet.PPI_B = { // this.bPPIB
ChipSet.PPI_B = { // this.bPPIB (port 0x61)
PORT: 0x61, // OUTPUT (although it has to be treated as INPUT, too: the keyboard interrupt handler reads it, OR's PPI_B.CLEAR_KBD, writes it, and then rewrites the original read value)
CLK_TIMER2: 0x01, // ALL: set to enable clock to TIMER2
SPK_TIMER2: 0x02, // ALL: set to connect output of TIMER2 to speaker (MODEL_5150: clear for cassette)
@ -622,7 +622,7 @@ ChipSet.PPI_B = { // this.bPPIB
CLEAR_KBD: 0x80 // ALL: clear to enable keyboard scan codes (MODEL_5150: set to enable SW1 through PPI_A.PORT)
};
ChipSet.PPI_C = { // this.bPPIC
ChipSet.PPI_C = { // this.bPPIC (port 0x62)
PORT: 0x62, // INPUT (see below)
SW: 0x0F, // MODEL_5150: SW2[1-4] or SW2[5], depending on whether PPI_B.ENABLE_SW2 is set or clear; MODEL_5160: SW1[1-4] or SW1[5-8], depending on whether PPI_B.ENABLE_SW_HI is clear or set
CASS_DATA_IN: 0x10,
@ -631,7 +631,7 @@ ChipSet.PPI_C = { // this.bPPIC
RW_PARITY_CHK: 0x80 // used by NMI handler to detect R/W memory parity errors
};
ChipSet.PPI_CTRL = { // this.bPPICtrl
ChipSet.PPI_CTRL = { // this.bPPICtrl (port 0x63)
PORT: 0x63, // OUTPUT: initialized to 0x99, defining PPI_A and PPI_C as INPUT and PPI_B as OUTPUT
A_IN: 0x10,
B_IN: 0x02,

176
notes.md
View file

@ -70,178 +70,14 @@ Node "Cheat Sheet"
Installing Node (and NPM)
---
I downloaded the latest Node installation package for my MacBook from [nodejs.org](http://nodejs.org/),
which provided the usual `node` and `npm` commands. Here are the versions they reported:
I downloaded and installed Node v0.11.11 [node-v0.11.11.pkg](http://nodejs.org/dist/v0.11.11/node-v0.11.11.pkg),
which appears to be the newest version of Node that does *not* suffer from a [serious regression](https://github.com/joyent/node/issues/9310)
on OS X. In newer versions of Node, the REPL blocks execution of the application until keys are typed.
[~/Sites/pcjs] node -v
v0.10.26
[~/Sites/pcjs] npm -v
1.4.3
I also installed a Node helper on my MacBook called `n` that makes it easy to keep Node up-to-date, per this tip on
[stackoverflow](http://stackoverflow.com/questions/8191459/how-to-update-node-js-npm-and-all-other-dependencies):
That Node package came bundled with its own version of NPM as well: v1.3.25.
1) Clear NPM's cache:
[~/Sites/pcjs] sudo npm cache clean -f
2) Install a little helper called 'n':
[~/Sites/pcjs] sudo npm install -g n
3) Install latest stable NodeJS version:
[~/Sites/pcjs] sudo n stable
Alternatively pick a specific version and install like so:
[~/Sites/pcjs] sudo n 0.8.20
I'm not sure I like the generic name for this command ("n"); what would have been wrong with "node-update"
or "update-node"? Oh well.
Next, I wanted to make sure `npm` was up-to-date. According to
[FAQ on npmjs.org](https://npmjs.org/doc/faq.html#How-do-I-update-npm), that's as easy as:
[~/Sites/pcjs] sudo npm update npm -g
although occasionally `npm` won't be able to update itself, in which case the fallback is:
[~/Sites/pcjs] curl https://npmjs.org/install.sh | sh
So, I made sure `npm` itself, along with `n` and all my other globally installed packages, were up-to-date,
and then I used `n` to make sure I was running the latest stable version of Node:
[~/Sites/pcjs] sudo npm update -g
[~/Sites/pcjs] sudo n stable
[~/Sites/pcjs] node -v
v0.10.26
I've also seen suggestions to run this command before the preceding commands, but I don't know how often this is
recommended:
[~/Sites/pcjs] sudo npm cache clean -f
Next, I ran `npm init`:
[~/Sites/pcjs] npm adduser
Username: jeffpar
Password:
Email: (this IS public) jeff@pcjs.org
npm http PUT http://registry.npmjs.org/-/user/org.couchdb.user:jeffpar
npm http 201 http://registry.npmjs.org/-/user/org.couchdb.user:jeffpar
[~/Sites/pcjs] npm init
This utility will walk you through creating a package.json file.
It only covers the most common items, and tries to guess sane defaults.
See `npm help json` for definitive documentation on these fields
and exactly what they do.
Use `npm install <pkg> --save` afterwards to install a package and
save it as a dependency in the package.json file.
Press ^C at any time to quit.
name: (pcjs)
version: (0.0.0) 0.1.0
description: Node-enabled version of PCjs
entry point: (server.js)
test command:
git repository: (git://github.com/jeffpar/pcjs.git)
keywords: pcjs,ibm pc,emulator
author: Jeff Parsons <Jeff@pcjs.org>
license: (ISC)
About to write to /Users/Jeff/Sites/pcjs/package.json:
{
"name": "pcjs",
"version": "0.1.0",
"description": "Node-enabled version of PCjs",
"main": "server.js",
"directories": {
"doc": "docs",
"test": "tests"
},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"repository": {
"type": "git",
"url": "git://github.com/jeffpar/pcjs.git"
},
"keywords": [
"pcjs",
"ibm",
"pc",
"emulator"
],
"author": "Jeff Parsons <Jeff@pcjs.org>",
"license": "ISC",
"bugs": {
"url": "https://github.com/jeffpar/pcjs/issues"
},
"homepage": "http://www.pcjs.org/"
}
Is this ok? (yes)
Next, I installed `express` using `npm install --save express`:
[~/Sites/pcjs] npm install --save express
npm http GET http://registry.npmjs.org/express
...
express@3.4.8 node_modules/express
├── methods@0.1.0
├── merge-descriptors@0.0.1
├── range-parser@0.0.4
├── cookie-signature@1.0.1
├── fresh@0.2.0
├── debug@0.7.4
├── buffer-crc32@0.2.1
├── cookie@0.1.0
├── mkdirp@0.3.5
├── commander@1.3.2 (keypress@0.1.0)
├── send@0.1.4 (mime@1.2.11)
└── connect@2.12.0 (uid2@0.0.3, pause@0.0.1, qs@0.6.6, bytes@0.2.1, raw-body@1.1.2, batch@0.5.0, negotiator@0.3.0, multiparty@2.2.0)
This added the following lines to my "package.json" file:
"dependencies": {
"express": "~3.4.8"
}
Then I created a test "server.js" in the root of the project:
var http = require("http");
var express = require("express");
var app = express();
app.get("/", function(req, res) {
res.end("Testing");
});
http.createServer(app).listen(3000);
and ran `node server.js` and verified that all was working as expected.
Updating Node (and NPM)
---
So as per above, I ran:
[~/Sites/pcjs] sudo n stable
which reported:
install : v0.12.1
mkdir : /usr/local/n/versions/0.12.1
fetch : http://nodejs.org/dist/v0.12.1/node-v0.12.1-darwin-x64.tar.gz
installed : v0.12.1
Unfortunately, I ran into a [regression](https://github.com/joyent/node/issues/9310) on OS X with Node v0.12.x
that affects the command-line version of PCjs (specifically, the Node REPL), so I had to revert to v0.11.11.
Next, to update NPM:
[~/Sites/pcjs] sudo npm -g install npm@latest
Miscellaneous Tips
===
Connecting to a VMware Fusion Serial Port
---