From 35d3e99c06e0a51ef3b12bb257c46646fd967461 Mon Sep 17 00:00:00 2001 From: Jeff Parsons Date: Mon, 6 Apr 2015 16:25:48 -0700 Subject: [PATCH] Details regarding use of NDISASM --- .../pc/bios/compaq/deskpro386/1988-01-28.nasm | 8 +++++-- devices/pc/bios/compaq/deskpro386/README.md | 24 +++++++++++++++---- modules/htmlout/lib/htmlout.js | 1 + 3 files changed, 27 insertions(+), 6 deletions(-) diff --git a/devices/pc/bios/compaq/deskpro386/1988-01-28.nasm b/devices/pc/bios/compaq/deskpro386/1988-01-28.nasm index 56ff69727..64e733fb4 100644 --- a/devices/pc/bios/compaq/deskpro386/1988-01-28.nasm +++ b/devices/pc/bios/compaq/deskpro386/1988-01-28.nasm @@ -1,3 +1,5 @@ + org 0x8000 + xchg bh,bl ; 00008000 86FB '..' xor bh,bh ; 00008002 32FF '2.' shl bx,1 ; 00008004 D1E3 '..' @@ -10604,15 +10606,17 @@ xdfee: lea di,[si+0x10] ; 0000DFEE 8D7C10 '.|.' db 0xFF ; 0000DFFE FF '.' db 0xFF ; 0000DFFF FF '.' jmp short xe05e ; 0000E000 EB5C '.\' + db 'AUTHORS CAB93GLB93RWS93DJC93NPB(C)Copyright COMPAQ Computer Corporation 1982,83,84,85,86' sub al,0xe9 ; 0000E05A 2CE9 ',.' dec cx ; 0000E05C 49 'I' db 0xDA ; 0000E05D DA '.' xe05e: jmp 0xf000:0x8e31 ; 0000E05E EA318E00F0 '.1...' - db '((CC))CCooppyyrriigghhtt CCOOMMPPAAQQ CCoommppuutteerr CCoorrppoorraattiioonn 11998822,,8833,,8844,,8855,,8866,,8877--AAllll rriigghhttss rreesseerrvveedd..' - mov al,0xd ; 0000E105 B00D '.',0x0D 0x0D + db '((CC))CCooppyyrriigghhtt CCOOMMPPAAQQ CCoommppuutteerr CCoorrppoorraattiioonn 11998822,,8833,,8844,,8855,,8866,,8877--AAllll rriigghhttss rreesseerrvveedd..' + + mov al,0xd ; 0000E105 B00D '.',0x0D 0x0D out 0x84,al ; 0000E107 E684 '..' mov al,0x12 ; 0000E109 B012 '..' out 0x4b,al ; 0000E10B E64B '.K' diff --git a/devices/pc/bios/compaq/deskpro386/README.md b/devices/pc/bios/compaq/deskpro386/README.md index 708c09bc3..6bed0ee82 100644 --- a/devices/pc/bios/compaq/deskpro386/README.md +++ b/devices/pc/bios/compaq/deskpro386/README.md @@ -63,17 +63,33 @@ while the /PGM should be connected to INPUT HIGH VOLTAGE. So I wired pin 27 (/P worked perfectly. The NYC Resistor article implied that every *active low* pin should be connected to GND, but apparently there are exceptions to that general rule. -Producing Source Code with NDISASM +Producing BIOS Source Code --- -From the current directory, I ran: +In the current directory, I ran NDISASM (the disassembler included with NASM): ndisasm -o0x8000 -se105h -se05ah -se6ffh -sf025h -sf8aah private/1988-01-28.rom > 1988-01-28.nasm -Then I ran the TextOut command, with the *--nasm* option, to clean up the code: +The `-o0x8000` argument is required to "org" the file at the proper starting address, but the `-s` arguments +are optional; they simply establish a few sync points within the ROM image that save a little cleanup effort, by +preventing disassembly in the middle of instructions. + +Then I ran the PCjs [TextOut](/modules/textout/lib/) command, with the *--nasm* option, to prepare the code for reassembly: node ~/Sites/pcjs/modules/textout/bin/textout --file=1988-01-28.nasm --nasm > t.nasm mv t.nasm 1988-01-28.nasm -The result, [1988-01-28.nasm](1988-01-28.nasm), can then be reassembled: +The result, [1988-01-28.nasm](1988-01-28.nasm), after a small amount of manual cleanup, can now be successfully reassembled: nasm -f bin 1988-01-28.nasm -l 1988-01-28.lst -o 1988-01-28.rom + +However, it does NOT produce a binary identical to the original ROM, in part because of instruction ambiguities (ie, +instructions that can be assembled multiple ways). + +It's possible that reassembled ROM may still work, but more research is required. + +One interesting section of the Compaq DeskPro ROM is this string at offset 0xE002: + + db 'AUTHORS CAB93GLB93RWS93DJC93NPB(C)Copyright COMPAQ Computer Corporation 1982,83,84,85,86' + +Anyone care to take a stab at what `CAB93GLB93RWS93DJC93NPB` means? I've already confirmed that +[Google](https://www.google.com/?gws_rd=ssl#q=CAB93GLB93RWS93DJC93NPB) doesn't know. diff --git a/modules/htmlout/lib/htmlout.js b/modules/htmlout/lib/htmlout.js index a198c0b49..ac37059fe 100644 --- a/modules/htmlout/lib/htmlout.js +++ b/modules/htmlout/lib/htmlout.js @@ -175,6 +175,7 @@ var asExtsPlainText = [ "bas", "hex", "map", + "nasm", "txt" ];