Merge branch 'master' into gh-pages

This commit is contained in:
Jeff Parsons 2017-06-30 12:13:08 -07:00
commit ee7bbb3b0d
14 changed files with 1967 additions and 1651 deletions

View file

@ -19,6 +19,7 @@ machines:
path: /disks/pcx86/dos/ibm/1.00/PCDOS100.json
B:
name: None
autoType: $date\rbasica donkey\r
---
IBM PC Running DONKEY.BAS

View file

@ -13,6 +13,7 @@ machines:
path: /disks/pcx86/dos/ibm/1.00/PCDOS100.json
B:
name: None
autoType: $date\rbasica donkey\r
---
IBM PC Running DONKEY.BAS (with Debugger)

View file

@ -18,7 +18,7 @@ machines:
COMPAQ MS-DOS 1.11
------------------
Released in 1983 by COMPAQ Computer Corp, this early version of MS-DOS displays on startup:
Released in 1983 by COMPAQ Computer Corp, this version of MS-DOS reports itself as:
The COMPAQ Personal Computer DOS
Version 1.11
@ -28,7 +28,7 @@ Released in 1983 by COMPAQ Computer Corp, this early version of MS-DOS displays
(C) Copyright Microsoft 1981, 82
To learn more about this double-sided 320Kb diskette, see the
[Directory Listing](#directory-of-compaq-ms-dos-111-diskette) and [Boot Sector](#compaq-ms-dos-110-boot-sector) below.
[Directory Listing](#directory-of-compaq-ms-dos-111-diskette) and [Boot Sector](#compaq-ms-dos-111-boot-sector) below.
{% include machine.html id="ibm5150-compaq111" %}
@ -114,9 +114,200 @@ The boot sector of the COMPAQ MS-DOS 1.11 disk image contains the following byte
000001b0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
000001c0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
000001d0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
000001e0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
000001e0 00 00 00 00 00 00 00 e7 01 00 00 00 00 00 00 00 |................|
000001f0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
Unlike most DOS boot sectors, this boot sector doesn't start with an Intel x86 JMP instruction. Let's take a
look at the code, using the PCjs Debugger to stop at the first instruction:
>> bp 0:7c00
bp &0000:7C00 set
>> g
bp &0000:7C00 hit
stopped (5153504 opcodes, 42808074 cycles, 9014 ms, 4749065 hz)
AX=0000 BX=7C00 CX=0004 DX=0000 SP=0100 BP=E4B7 SI=0000 DI=0044
SS=0030 DS=0040 ES=0000 PS=F296 V0 D0 I1 T0 S1 Z0 A1 P1 C0
&0000:7C00 FA CLI
>> u 7c00
&0000:7C00 FA CLI
&0000:7C01 BCE701 MOV SP,01E7
&0000:7C04 B8C007 MOV AX,07C0
&0000:7C07 8ED0 MOV SS,AX
&0000:7C09 FB STI
;
; At this point, the stack has been set to an unused region INSIDE the boot sector, because
; 07C0:01E7 is the same as 0000:7C00+01E7 or 0000:7DE7. This puts a fairly low limit on stack
; usage: as more stack is used, the COMPAQ copyright string will be trashed first, then boot
; sector data, then boot sector code.
;
; Curiously, the value 01E7 is also stored at 07C0:01E7. Also curious is the choice of an ODD
; address for the stack (although, for the 8088, this presumably didn't affect performance).
;
&0000:7C0A 8ED8 MOV DS,AX
&0000:7C0C 8EC0 MOV ES,AX
;
; All of DS:0, ES:0, and SS:0 now point to the beginning of the boot sector, as does CS:7C00.
;
&0000:7C0E 33C0 XOR AX,AX ; perform a disk reset
&0000:7C10 CD13 INT 13
;
; Read 1 sector (the 4th sector, which is the first sector of the directory) into memory immediately
; above the boot sector (07C0:0200).
;
&0000:7C12 B80102 MOV AX,0201
&0000:7C15 BB0002 MOV BX,0200
&0000:7C18 B90400 MOV CX,0004
&0000:7C1B 33D2 XOR DX,DX
&0000:7C1D E88B00 CALL 7CAB ; call DISK_IO
&0000:7C20 EB1C JMP 7C3E
;
; ERROR: print error message and start over.
;
; Setting DS:BX to 07C0:00DA references the same memory as CS:7CDA:
;
; >> db cs:7cda cs:7d22
; &0000:7CDA 0A 0D 4E 6F 6E 2D 53 79-73 74 65 6D 20 64 69 73 ..Non-System dis
; &0000:7CEA 6B 20 6F 72 20 64 69 73-6B 20 65 72 72 6F 72 0A k or disk error.
; &0000:7CFA 0D 52 65 70 6C 61 63 65-20 61 6E 64 20 73 74 72 .Replace and str
; &0000:7D0A 69 6B 65 20 61 6E 79 20-6B 65 79 20 77 68 65 6E ike any key when
; &0000:7D1A 20 72 65 61 64 79 0A 0D-24 ready..$
;
&0000:7C22 BBDA00 MOV BX,00DA
&0000:7C25 8A07 MOV AL,[BX]
&0000:7C27 3C24 CMP AL,24
&0000:7C29 740C JZ 7C37
&0000:7C2B 53 PUSH BX
&0000:7C2C B40E MOV AH,0E
&0000:7C2E BB0700 MOV BX,0007
&0000:7C31 CD10 INT 10
&0000:7C33 5B POP BX
&0000:7C34 43 INC BX
&0000:7C35 EBEE JMP 7C25
&0000:7C37 33C0 XOR AX,AX
&0000:7C39 CD16 INT 16
&0000:7C3B EBC3 JMP 7C00 ; start over
&0000:7C3D C3 RET ; unreachable RET?
&0000:7C3E FC CLD
&0000:7C3F 8BF3 MOV SI,BX
&0000:7C41 BFC400 MOV DI,00C4 ; ES:DI -> 7C0:C4 (aka 0:7CC4)
&0000:7C44 B90B00 MOV CX,000B
&0000:7C47 F3 REPZ
&0000:7C48 A6 CMPSB
&0000:7C49 75D7 JNZ 7C22 ; if first DIRENTRY was not "IOSYS.COM", jump to ERROR
&0000:7C4B 83C615 ADD SI,0015
&0000:7C4E B90B00 MOV CX,000B
&0000:7C51 F3 REPZ
&0000:7C52 A6 CMPSB
&0000:7C53 75CD JNZ 7C22 ; if second DIRENTRY was not "IOSYS.COM", jump to ERROR
&0000:7C55 B80102 MOV AX,0201
&0000:7C58 BB0002 MOV BX,0200
&0000:7C5B B90200 MOV CX,0002
&0000:7C5E 33D2 XOR DX,DX
&0000:7C60 E84800 CALL 7CAB ; call DISK_IO to read 1st FAT sector
;
; At this point, the directory sector is gone, and all this code did with it was verify the names of
; the first two entries. It did not examine or record their starting cluster numbers. And in the FAT
; sector just read, only one byte (the first byte) will be examined next: the media ID byte.
;
; Further reading will rely on on two hard-coded tables inside the boot sector: one table at DS:126 (CS:7D26)
; if the FAT media ID byte is 0xFE (160Kb diskette), or another table at DS:13C (CS:7D3C) if the FAT media ID
; byte is 0xFF (320Kb diskette). If the FAT media ID byte is neither, off to ERROR we go.
;
; Here's the table for the 160Kb diskette:
;
; >> dw cs:7d26 l11.
; &0000:7D26 0201 0008 0000 0208 0200 0101 0000 0208 ................
; &0000:7D36 1000 0201 0000 ......
;
; and here's the table for the 320Kb diskette:
;
; >> dw cs:7d3c l11.
; &0000:7D3C 0206 0003 0100 0208 0C00 0101 0000 0203 ................
; &0000:7D4C 1000 0101 0100 ......
;
; These tables are then followed by a DWORD jump address:
;
; >> dw cs:7d52 l2
; &0000:7D52 0000 0060 ..`.
;
; which means that the "JMP FAR [0152]" instruction will jump to 60:0 after the reads are complete.
;
&0000:7C63 8A27 MOV AH,[BX]
&0000:7C65 80FCFE CMP AH,FE
&0000:7C68 BE2601 MOV SI,0126
&0000:7C6B 740A JZ 7C77
&0000:7C6D 80FCFF CMP AH,FF
&0000:7C70 7402 JZ 7C74
&0000:7C72 EBAE JMP 7C22
&0000:7C74 BE3C01 MOV SI,013C
&0000:7C77 B86000 MOV AX,0060
&0000:7C7A 50 PUSH AX
&0000:7C7B 07 POP ES
&0000:7C7C 8B04 MOV AX,[SI]
&0000:7C7E 33DB XOR BX,BX
&0000:7C80 8B4C02 MOV CX,[SI+02]
&0000:7C83 8B5404 MOV DX,[SI+04]
&0000:7C86 E82200 CALL 7CAB
&0000:7C89 8B4406 MOV AX,[SI+06]
&0000:7C8C 035C08 ADD BX,[SI+08]
&0000:7C8F 8B4C0A MOV CX,[SI+0A]
&0000:7C92 8B540C MOV DX,[SI+0C]
&0000:7C95 E81300 CALL 7CAB
&0000:7C98 8B440E MOV AX,[SI+0E]
&0000:7C9B 035C10 ADD BX,[SI+10]
&0000:7C9E 8B4C12 MOV CX,[SI+12]
&0000:7CA1 8B5414 MOV DX,[SI+14]
&0000:7CA4 E80400 CALL 7CAB
&0000:7CA7 FF2E5201 JMP FAR [0152]
;
; DISK_IO: read AL sector(s) identified by the CHS values in CX:DX into ES:BX, using DI as a retry counter.
;
&0000:7CAB BF0500 MOV DI,0005
&0000:7CAE 57 PUSH DI
&0000:7CAF 50 PUSH AX
&0000:7CB0 CD13 INT 13
&0000:7CB2 7203 JC 7CB7
&0000:7CB4 58 POP AX
&0000:7CB5 58 POP AX
&0000:7CB6 C3 RET
&0000:7CB7 33C0 XOR AX,AX
&0000:7CB9 CD13 INT 13
&0000:7CBB 58 POP AX
&0000:7CBC 5F POP DI
&0000:7CBD 4F DEC DI
&0000:7CBE 75EE JNZ 7CAE
&0000:7CC0 58 POP AX ; retry count exhausted
&0000:7CC1 E95EFF JMP 7C22 ; jump to PRINT function
>> db 7cc4 l13c
&7CC4 49 4F 53 59 53 20 20 20-43 4F 4D 4D 53 44 4F 53 IOSYS COMMSDOS
&7CD4 20 20 20 43 4F 4D 0A 0D-4E 6F 6E 2D 53 79 73 74 COM..Non-Syst
&7CE4 65 6D 20 64 69 73 6B 20-6F 72 20 64 69 73 6B 20 em disk or disk
&7CF4 65 72 72 6F 72 0A 0D 52-65 70 6C 61 63 65 20 61 error..Replace a
&7D04 6E 64 20 73 74 72 69 6B-65 20 61 6E 79 20 6B 65 nd strike any ke
&7D14 79 20 77 68 65 6E 20 72-65 61 64 79 0A 0D 24 47 y when ready..$G
&7D24 41 53 01 02 08 00 00 00-08 02 00 02 01 01 00 00 AS..............
&7D34 08 02 00 10 01 02 00 00-06 02 03 00 00 01 08 02 ................
&7D44 00 0C 01 01 00 00 03 02-00 10 01 01 00 01 00 00 ................
&7D54 60 00 28 43 29 43 6F 70-79 72 69 67 68 74 20 43 `.(C)Copyright C
&7D64 4F 4D 50 41 51 20 43 6F-6D 70 75 74 65 72 20 43 OMPAQ Computer C
&7D74 6F 72 70 6F 72 61 74 69-6F 6E 20 31 39 38 32 00 orporation 1982.
&7D84 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 ................
&7D94 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 ................
&7DA4 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 ................
&7DB4 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 ................
&7DC4 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 ................
&7DD4 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 ................
&7DE4 00 00 00 E7 01 00 00 00-00 00 00 00 00 00 00 00 ................
&7DF4 00 00 00 00 00 00 00 00-00 00 00 00
In terms of raw code (90 instructions), it's shorter than the PC-DOS 1.00 boot sector (99 instructions),
even though it supports twice as many disk formats. This is because it uses tables to describe both the
different disk formats *and* the discrete read operations, relieving the code from dealing with track boundaries.
### Mounting the COMPAQ MS-DOS 1.11 Diskette
Note that the disk cannot be mounted by a modern operating system (e.g., macOS), because it lacks a proper
BPB at offset 0x000B.
@ -144,7 +335,7 @@ by pointing out that some (newer) ROMs will not boot from a disk if that signatu
However, that evidence is misleading, because those ROMs check only *hard disk* boot sectors for the 0xAA55 signature,
not diskettes. Which makes sense, because hard disk support didn't exist in DOS until version 2.0 -- the same version
of DOS that also introduced BPBs and boot sector signatures.
of DOS that also introduced BPBs and the 0xAA55 boot sector signature.
Here's how you can use [DiskDump](/modules/diskdump/) to a mountable disk. Note that *two* DiskDump commands are
required, because BPB modification only happens when converting an IMG file to a JSON file; the second DiskDump command
@ -153,11 +344,15 @@ converts the modified JSON back into an IMG file.
diskdump --disk=COMPAQ-DOS111.img --format=json --forceBPB --output=COMPAQ-DOS111-BPB.json
warning: BPB has been updated
327680-byte disk image saved to COMPAQ-DOS111-BPB.json
diskdump --disk=COMPAQ-DOS111.json --format=img --output=COMPAQ-DOS111-BPB.img
diskdump --disk=COMPAQ-DOS111-BPB.json --format=img --output=COMPAQ-DOS111-BPB.img
327680-byte disk image saved to COMPAQ-DOS111-BPB.img
The next series of commands make the image read-only (otherwise, macOS may create hidden files inside the image after
mounting it), mount the image as `/Volumes/Untitled`, and then copy the contents of the image to a folder named `Disk`:
chmod -w COMPAQ-DOS111-BPB.img
open COMPAQ-DOS111-BPB.img
mkdir COMPAQ-DOS111
cp -pr /Volumes/Untitled/ COMPAQ-DOS111
cp -pr /Volumes/Untitled Disk
[Return to [COMPAQ MS-DOS Disks](/disks/pcx86/dos/compaq/)]

View file

@ -18,7 +18,7 @@ machines:
COMPAQ MS-DOS 1.12
------------------
Released in 1983 by COMPAQ Computer Corp, this early version of MS-DOS displays the following messages on boot:
Released in 1983 by COMPAQ Computer Corp, this version of MS-DOS reports itself as:
The COMPAQ Personal Computer DOS
Version 1.12
@ -26,7 +26,8 @@ Released in 1983 by COMPAQ Computer Corp, this early version of MS-DOS displays
(C) Copyright COMPAQ Computer Corp. 1982, 83
(C) Copyright Microsoft 1981, 82
A directory listing of the diskette is provided [below](#directory-of-compaq-ms-dos-112-diskette).
To learn more about this double-sided 320Kb diskette, see the
[Directory Listing](#directory-of-compaq-ms-dos-112-diskette) and [Boot Sector](#compaq-ms-dos-112-boot-sector) below.
{% include machine.html id="ibm5150-compaq112" %}
@ -70,4 +71,44 @@ A directory listing of the diskette is provided [below](#directory-of-compaq-ms-
28 file(s) 257402 bytes
52224 bytes free
### COMPAQ MS-DOS 1.12 Boot Sector
The boot sector of the COMPAQ MS-DOS 1.12 disk image contains the following bytes:
00000000 fa bc e7 01 b8 c0 07 8e d0 fb 8e d8 8e c0 33 c0 |..............3.|
00000010 cd 13 b8 01 02 bb 00 02 b9 04 00 33 d2 e8 8b 00 |...........3....|
00000020 eb 1c bb da 00 8a 07 3c 24 74 0c 53 b4 0e bb 07 |.......<$t.S....|
00000030 00 cd 10 5b 43 eb ee 33 c0 cd 16 eb c3 c3 fc 8b |...[C..3........|
00000040 f3 bf c4 00 b9 0b 00 f3 a6 75 d7 83 c6 15 b9 0b |.........u......|
00000050 00 f3 a6 75 cd b8 01 02 bb 00 02 b9 02 00 33 d2 |...u..........3.|
00000060 e8 48 00 8a 27 80 fc fe be 26 01 74 0a 80 fc ff |.H..'....&.t....|
00000070 74 02 eb ae be 3c 01 b8 60 00 50 07 8b 04 33 db |t....<..`.P...3.|
00000080 8b 4c 02 8b 54 04 e8 22 00 8b 44 06 03 5c 08 8b |.L..T.."..D..\..|
00000090 4c 0a 8b 54 0c e8 13 00 8b 44 0e 03 5c 10 8b 4c |L..T.....D..\..L|
000000a0 12 8b 54 14 e8 04 00 ff 2e 52 01 bf 05 00 57 50 |..T......R....WP|
000000b0 cd 13 72 03 58 58 c3 33 c0 cd 13 58 5f 4f 75 ee |..r.XX.3...X_Ou.|
000000c0 58 e9 5e ff 49 4f 53 59 53 20 20 20 43 4f 4d 4d |X.^.IOSYS COMM|
000000d0 53 44 4f 53 20 20 20 43 4f 4d 0a 0d 4e 6f 6e 2d |SDOS COM..Non-|
000000e0 53 79 73 74 65 6d 20 64 69 73 6b 20 6f 72 20 64 |System disk or d|
000000f0 69 73 6b 20 65 72 72 6f 72 0a 0d 52 65 70 6c 61 |isk error..Repla|
00000100 63 65 20 61 6e 64 20 73 74 72 69 6b 65 20 61 6e |ce and strike an|
00000110 79 20 6b 65 79 20 77 68 65 6e 20 72 65 61 64 79 |y key when ready|
00000120 0a 0d 24 47 41 53 01 02 08 00 00 00 08 02 00 02 |..$GAS..........|
00000130 01 01 00 00 08 02 00 10 01 02 00 00 06 02 03 00 |................|
00000140 00 01 08 02 00 0c 01 01 00 00 03 02 00 10 01 01 |................|
00000150 00 01 00 00 60 00 28 43 29 43 6f 70 79 72 69 67 |....`.(C)Copyrig|
00000160 68 74 20 43 4f 4d 50 41 51 20 43 6f 6d 70 75 74 |ht COMPAQ Comput|
00000170 65 72 20 43 6f 72 70 6f 72 61 74 69 6f 6e 20 31 |er Corporation 1|
00000180 39 38 32 00 00 00 00 00 00 00 00 00 00 00 00 00 |982.............|
00000190 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
000001a0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
000001b0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
000001c0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
000001d0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
000001e0 00 00 00 00 00 00 00 e7 01 00 00 00 00 00 00 00 |................|
000001f0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
It is identical to the [COMPAQ MS-DOS 1.11 Boot Sector](../1.11/#compaq-ms-dos-111-boot-sector),
so refer to that page for more information.
[Return to [COMPAQ MS-DOS Disks](/disks/pcx86/dos/compaq/)]

View file

@ -138,7 +138,7 @@ because it includes lots of commentary, allowing the boot sector to more or less
pop ax ; remaining sectors
call add_si_sectors ; bx += si*512
sub ax, si ; remaining -= read
jz done ; none left
jz done ; none left
inc ch ; next track
mov cl, 1 ; start at sector 1
mov si, 8 ; read up to 8 sectors

File diff suppressed because it is too large Load diff

View file

@ -1071,7 +1071,7 @@ class Bus extends Component {
}
if (!fSymbol || fNearest) {
if (bto.obj.idComponent) {
return bto.obj.idComponent + '+' + Str.toHexLong(bto.off + off);
return bto.obj.idComponent + '+' + Str.toHex(bto.off + off, 0, true);
}
}
}

View file

@ -166,9 +166,9 @@ class DebuggerX86 extends Debugger {
* Finally, for TEMPORARY breakpoint addresses, we set fTempBreak to true, so that they can be
* automatically cleared when they're hit.
*/
this.dbgAddrNextCode = this.newAddr();
this.dbgAddrNextData = this.newAddr();
this.dbgAddrAssemble = this.newAddr();
this.dbgAddrNextCode = this.newAddr(0, 0);
this.dbgAddrNextData = this.newAddr(0, 0);
this.dbgAddrAssemble = this.newAddr(0, 0);
/*
* aSymbolTable is an array of SymbolTable objects, one per ROM or other chunk of address space,
@ -1943,7 +1943,7 @@ class DebuggerX86 extends Debugger {
}
/**
* dumpHistory(sPrev, sLines)
* dumpHistory(sPrev, sLines, sComment)
*
* If sLines is not a number, it can be a instruction filter. However, for the moment, the only
* supported filter is "call", which filters the history buffer for all CALL and RET instructions
@ -1952,8 +1952,9 @@ class DebuggerX86 extends Debugger {
* @this {DebuggerX86}
* @param {string} [sPrev] is a (decimal) number of instructions to rewind to (default is 10)
* @param {string} [sLines] is a (decimal) number of instructions to print (default is, again, 10)
* @param {string} [sComment] (should be either "history" or "cycles"; default is "history")
*/
dumpHistory(sPrev, sLines)
dumpHistory(sPrev, sLines, sComment = "history")
{
var sMore = "";
var cHistory = 0;
@ -2021,10 +2022,8 @@ class DebuggerX86 extends Debugger {
*/
var dbgAddrNew = this.newAddr(dbgAddr.off, dbgAddr.sel, dbgAddr.addr, dbgAddr.type, dbgAddr.fData32, dbgAddr.fAddr32);
var sComment = "history";
var nSequence = nPrev--;
if (DEBUG && dbgAddr.cycleCount != null) {
sComment = "cycles";
if (dbgAddr.cycleCount != null && sComment == "cycles") {
nSequence = dbgAddr.cycleCount;
}
@ -2894,9 +2893,11 @@ class DebuggerX86 extends Debugger {
{
var state = new State(this);
state.set(0, this.packAddr(this.dbgAddrNextCode));
state.set(1, this.packAddr(this.dbgAddrAssemble));
state.set(2, [this.aPrevCmds, this.fAssemble, this.bitsMessage]);
state.set(3, this.aSymbolTable);
state.set(1, this.packAddr(this.dbgAddrNextData));
state.set(2, this.packAddr(this.dbgAddrAssemble));
state.set(3, [this.aPrevCmds, this.fAssemble, this.bitsMessage]);
state.set(4, this.aSymbolTable);
state.set(5, [this.aBreakExec, this.aBreakRead, this.aBreakWrite]);
return state.data();
}
@ -2912,15 +2913,27 @@ class DebuggerX86 extends Debugger {
restore(data)
{
var i = 0;
if (data[2] !== undefined) {
this.dbgAddrNextCode = this.unpackAddr(data[i++]);
this.dbgAddrAssemble = this.unpackAddr(data[i++]);
if (data[i]) this.dbgAddrNextCode = this.unpackAddr(data[i++]);
/*
* dbgAddrNextData wasn't saved until there were at least 6 elements, hence the check for data[5] instead of data[i]
*/
if (data[5]) this.dbgAddrNextData = this.unpackAddr(data[i++]);
if (data[i]) this.dbgAddrAssemble = this.unpackAddr(data[i++]);
if (data[i]) {
this.aPrevCmds = data[i][0];
if (typeof this.aPrevCmds == "string") this.aPrevCmds = [this.aPrevCmds];
this.fAssemble = data[i][1];
this.bitsMessage |= data[i][2]; // keep our current message bits set, and simply "add" any extra bits defined by the saved state
i++;
}
if (data[i]) {
this.aSymbolTable = data[i++];
}
if (data[i]) {
this.restoreBreakpoints(this.aBreakExec, data[i][0]);
this.restoreBreakpoints(this.aBreakRead, data[i][1]);
this.restoreBreakpoints(this.aBreakWrite, data[i][2]);
}
if (data[3]) this.aSymbolTable = data[3];
return true;
}
@ -3077,7 +3090,7 @@ class DebuggerX86 extends Debugger {
this.aaOpcodeCounts[bOpcode][1]++;
var dbgAddr = this.aOpcodeHistory[this.iOpcodeHistory];
this.setAddr(dbgAddr, cpu.getIP(), cpu.getCS());
if (DEBUG) dbgAddr.cycleCount = cpu.getCycles();
dbgAddr.cycleCount = cpu.getCycles();
if (++this.iOpcodeHistory == this.aOpcodeHistory.length) this.iOpcodeHistory = 0;
}
}
@ -3208,7 +3221,7 @@ class DebuggerX86 extends Debugger {
}
/**
* addBreakpoint(aBreak, dbgAddr, fTempBreak)
* addBreakpoint(aBreak, dbgAddr, fTempBreak, fQuiet)
*
* In case you haven't already figured this out, all our breakpoint commands use the address
* to identify a breakpoint, not an incrementally assigned breakpoint index like other debuggers;
@ -3232,9 +3245,10 @@ class DebuggerX86 extends Debugger {
* @param {Array} aBreak
* @param {DbgAddrX86} dbgAddr
* @param {boolean} [fTempBreak]
* @param {boolean} [fQuiet]
* @return {boolean} true if breakpoint added, false if already exists
*/
addBreakpoint(aBreak, dbgAddr, fTempBreak)
addBreakpoint(aBreak, dbgAddr, fTempBreak, fQuiet)
{
var fSuccess = true;
@ -3276,7 +3290,7 @@ class DebuggerX86 extends Debugger {
dbgAddr.fTempBreak = true;
}
else {
this.printBreakpoint(aBreak, aBreak.length-1, "set");
if (!fQuiet) this.printBreakpoint(aBreak, aBreak.length-1, "set");
this.historyInit();
}
}
@ -3363,6 +3377,22 @@ class DebuggerX86 extends Debugger {
this.println(aBreak[0] + ' ' + this.toHexAddr(dbgAddr) + (sAction? (' ' + sAction) : (dbgAddr.sCmd? (' "' + dbgAddr.sCmd + '"') : '')));
}
/**
* restoreBreakpoints(aBreak, aDbgAddr)
*
* @this {DebuggerX86}
* @param {Array} aBreak
* @param {Array} aDbgAddr
*/
restoreBreakpoints(aBreak, aDbgAddr)
{
if (aDbgAddr[0] != aBreak[0]) return;
for (var i = 1; i < aDbgAddr.length; i++) {
var dbgAddr = aDbgAddr[i];
this.addBreakpoint(aBreak, dbgAddr, dbgAddr.fTempBreak, true);
}
}
/**
* setTempBreakpoint(dbgAddr)
*
@ -4761,9 +4791,8 @@ class DebuggerX86 extends Debugger {
/**
* doDump(asArgs)
*
* The length parameter is interpreted as a number of bytes, in hex, which we convert to the appropriate number
* of lines, because we always display whole lines. If the length is omitted/undefined, it defaults to 0x80 (128.)
* bytes, which normally translates to 8 lines.
* For memory dumps, the second parameter (sLen) is interpreted as a length (by default, in hex)
* only if it contains an 'l' prefix; otherwise it's interpreted as an ending address (inclusive).
*
* @this {DebuggerX86}
* @param {Array.<string>} asArgs (formerly sCmd, [sAddr], [sLen] and [sBytes])
@ -4878,12 +4907,10 @@ class DebuggerX86 extends Debugger {
}
}
if (!sAddr) sCmd = this.sCmdDumpPrev || "db";
} else {
this.sCmdDumpPrev = sCmd;
}
if (sCmd == "dh") {
this.dumpHistory(sAddr, sLen);
this.dumpHistory(sAddr, sLen, sBytes);
return;
}
@ -4900,16 +4927,27 @@ class DebuggerX86 extends Debugger {
return;
}
if (sCmd[1] && "bwd".indexOf(sCmd[1]) < 0) {
this.println("unrecognized dump command");
return;
}
this.sCmdDumpPrev = sCmd;
var dbgAddr = this.parseAddr(sAddr);
if (!dbgAddr || dbgAddr.sel == null && dbgAddr.addr == null) return;
var len = 0; // 0 is not a default; it triggers the appropriate default below
var len = 0;
if (sLen) {
if (sLen.charAt(0) == 'l') {
sLen = sLen.substr(1) || sBytes;
len = this.parseValue(sLen);
} else {
var dbgAddrEnd = this.parseAddr(sLen);
if (!dbgAddrEnd) return;
len = dbgAddrEnd.off - dbgAddr.off + 1;
}
len = this.parseValue(sLen) >>> 0; // negative lengths not allowed
if (len > 0x10000) len = 0x10000; // prevent bad user (or variable) input from producing excessive output
if (len < 0 || len > 0x10000) len = 0;
}
var sDump = "";
@ -4938,7 +4976,7 @@ class DebuggerX86 extends Debugger {
cb--;
}
if (sDump) sDump += '\n';
sDump += sAddr + " " + sData + ((i == 0)? (' ' + sChars) : "");
sDump += sAddr + " " + sData + Str.pad(sChars, sChars.length + i * 3 + 1, true);
}
if (sDump) this.println(sDump);

View file

@ -177,7 +177,7 @@ DiskAPI.GEOMETRIES = {
};
/*
* Media descriptor bytes for DOS-compatible FAT-formatted disks (stored in the first byte of the FAT)
* Media ID (descriptor) bytes for DOS-compatible FAT-formatted disks (stored in the first byte of the FAT)
*/
DiskAPI.FAT = {
MEDIA_160KB: 0xFE, // 5.25-inch, 1-sided, 8-sector, 40-track

File diff suppressed because it is too large Load diff

File diff suppressed because one or more lines are too long

View file

@ -246,7 +246,7 @@ DiskAPI.GEOMETRIES = {
};
/*
* Media descriptor bytes for DOS-compatible FAT-formatted disks (stored in the first byte of the FAT)
* Media ID (descriptor) bytes for DOS-compatible FAT-formatted disks (stored in the first byte of the FAT)
*/
DiskAPI.FAT = {
MEDIA_160KB: 0xFE, // 5.25-inch, 1-sided, 8-sector, 40-track
@ -9319,7 +9319,7 @@ class Bus extends Component {
}
if (!fSymbol || fNearest) {
if (bto.obj.idComponent) {
return bto.obj.idComponent + '+' + Str.toHexLong(bto.off + off);
return bto.obj.idComponent + '+' + Str.toHex(bto.off + off, 0, true);
}
}
}
@ -66361,9 +66361,9 @@ class DebuggerX86 extends Debugger {
* Finally, for TEMPORARY breakpoint addresses, we set fTempBreak to true, so that they can be
* automatically cleared when they're hit.
*/
this.dbgAddrNextCode = this.newAddr();
this.dbgAddrNextData = this.newAddr();
this.dbgAddrAssemble = this.newAddr();
this.dbgAddrNextCode = this.newAddr(0, 0);
this.dbgAddrNextData = this.newAddr(0, 0);
this.dbgAddrAssemble = this.newAddr(0, 0);
/*
* aSymbolTable is an array of SymbolTable objects, one per ROM or other chunk of address space,
@ -68138,7 +68138,7 @@ class DebuggerX86 extends Debugger {
}
/**
* dumpHistory(sPrev, sLines)
* dumpHistory(sPrev, sLines, sComment)
*
* If sLines is not a number, it can be a instruction filter. However, for the moment, the only
* supported filter is "call", which filters the history buffer for all CALL and RET instructions
@ -68147,8 +68147,9 @@ class DebuggerX86 extends Debugger {
* @this {DebuggerX86}
* @param {string} [sPrev] is a (decimal) number of instructions to rewind to (default is 10)
* @param {string} [sLines] is a (decimal) number of instructions to print (default is, again, 10)
* @param {string} [sComment] (should be either "history" or "cycles"; default is "history")
*/
dumpHistory(sPrev, sLines)
dumpHistory(sPrev, sLines, sComment = "history")
{
var sMore = "";
var cHistory = 0;
@ -68216,10 +68217,8 @@ class DebuggerX86 extends Debugger {
*/
var dbgAddrNew = this.newAddr(dbgAddr.off, dbgAddr.sel, dbgAddr.addr, dbgAddr.type, dbgAddr.fData32, dbgAddr.fAddr32);
var sComment = "history";
var nSequence = nPrev--;
if (DEBUG && dbgAddr.cycleCount != null) {
sComment = "cycles";
if (dbgAddr.cycleCount != null && sComment == "cycles") {
nSequence = dbgAddr.cycleCount;
}
@ -69089,9 +69088,11 @@ class DebuggerX86 extends Debugger {
{
var state = new State(this);
state.set(0, this.packAddr(this.dbgAddrNextCode));
state.set(1, this.packAddr(this.dbgAddrAssemble));
state.set(2, [this.aPrevCmds, this.fAssemble, this.bitsMessage]);
state.set(3, this.aSymbolTable);
state.set(1, this.packAddr(this.dbgAddrNextData));
state.set(2, this.packAddr(this.dbgAddrAssemble));
state.set(3, [this.aPrevCmds, this.fAssemble, this.bitsMessage]);
state.set(4, this.aSymbolTable);
state.set(5, [this.aBreakExec, this.aBreakRead, this.aBreakWrite]);
return state.data();
}
@ -69107,15 +69108,27 @@ class DebuggerX86 extends Debugger {
restore(data)
{
var i = 0;
if (data[2] !== undefined) {
this.dbgAddrNextCode = this.unpackAddr(data[i++]);
this.dbgAddrAssemble = this.unpackAddr(data[i++]);
if (data[i]) this.dbgAddrNextCode = this.unpackAddr(data[i++]);
/*
* dbgAddrNextData wasn't saved until there were at least 6 elements, hence the check for data[5] instead of data[i]
*/
if (data[5]) this.dbgAddrNextData = this.unpackAddr(data[i++]);
if (data[i]) this.dbgAddrAssemble = this.unpackAddr(data[i++]);
if (data[i]) {
this.aPrevCmds = data[i][0];
if (typeof this.aPrevCmds == "string") this.aPrevCmds = [this.aPrevCmds];
this.fAssemble = data[i][1];
this.bitsMessage |= data[i][2]; // keep our current message bits set, and simply "add" any extra bits defined by the saved state
i++;
}
if (data[i]) {
this.aSymbolTable = data[i++];
}
if (data[i]) {
this.restoreBreakpoints(this.aBreakExec, data[i][0]);
this.restoreBreakpoints(this.aBreakRead, data[i][1]);
this.restoreBreakpoints(this.aBreakWrite, data[i][2]);
}
if (data[3]) this.aSymbolTable = data[3];
return true;
}
@ -69272,7 +69285,7 @@ class DebuggerX86 extends Debugger {
this.aaOpcodeCounts[bOpcode][1]++;
var dbgAddr = this.aOpcodeHistory[this.iOpcodeHistory];
this.setAddr(dbgAddr, cpu.getIP(), cpu.getCS());
if (DEBUG) dbgAddr.cycleCount = cpu.getCycles();
dbgAddr.cycleCount = cpu.getCycles();
if (++this.iOpcodeHistory == this.aOpcodeHistory.length) this.iOpcodeHistory = 0;
}
}
@ -69403,7 +69416,7 @@ class DebuggerX86 extends Debugger {
}
/**
* addBreakpoint(aBreak, dbgAddr, fTempBreak)
* addBreakpoint(aBreak, dbgAddr, fTempBreak, fQuiet)
*
* In case you haven't already figured this out, all our breakpoint commands use the address
* to identify a breakpoint, not an incrementally assigned breakpoint index like other debuggers;
@ -69427,9 +69440,10 @@ class DebuggerX86 extends Debugger {
* @param {Array} aBreak
* @param {DbgAddrX86} dbgAddr
* @param {boolean} [fTempBreak]
* @param {boolean} [fQuiet]
* @return {boolean} true if breakpoint added, false if already exists
*/
addBreakpoint(aBreak, dbgAddr, fTempBreak)
addBreakpoint(aBreak, dbgAddr, fTempBreak, fQuiet)
{
var fSuccess = true;
@ -69471,7 +69485,7 @@ class DebuggerX86 extends Debugger {
dbgAddr.fTempBreak = true;
}
else {
this.printBreakpoint(aBreak, aBreak.length-1, "set");
if (!fQuiet) this.printBreakpoint(aBreak, aBreak.length-1, "set");
this.historyInit();
}
}
@ -69558,6 +69572,22 @@ class DebuggerX86 extends Debugger {
this.println(aBreak[0] + ' ' + this.toHexAddr(dbgAddr) + (sAction? (' ' + sAction) : (dbgAddr.sCmd? (' "' + dbgAddr.sCmd + '"') : '')));
}
/**
* restoreBreakpoints(aBreak, aDbgAddr)
*
* @this {DebuggerX86}
* @param {Array} aBreak
* @param {Array} aDbgAddr
*/
restoreBreakpoints(aBreak, aDbgAddr)
{
if (aDbgAddr[0] != aBreak[0]) return;
for (var i = 1; i < aDbgAddr.length; i++) {
var dbgAddr = aDbgAddr[i];
this.addBreakpoint(aBreak, dbgAddr, dbgAddr.fTempBreak, true);
}
}
/**
* setTempBreakpoint(dbgAddr)
*
@ -70956,9 +70986,8 @@ class DebuggerX86 extends Debugger {
/**
* doDump(asArgs)
*
* The length parameter is interpreted as a number of bytes, in hex, which we convert to the appropriate number
* of lines, because we always display whole lines. If the length is omitted/undefined, it defaults to 0x80 (128.)
* bytes, which normally translates to 8 lines.
* For memory dumps, the second parameter (sLen) is interpreted as a length (by default, in hex)
* only if it contains an 'l' prefix; otherwise it's interpreted as an ending address (inclusive).
*
* @this {DebuggerX86}
* @param {Array.<string>} asArgs (formerly sCmd, [sAddr], [sLen] and [sBytes])
@ -71073,12 +71102,10 @@ class DebuggerX86 extends Debugger {
}
}
if (!sAddr) sCmd = this.sCmdDumpPrev || "db";
} else {
this.sCmdDumpPrev = sCmd;
}
if (sCmd == "dh") {
this.dumpHistory(sAddr, sLen);
this.dumpHistory(sAddr, sLen, sBytes);
return;
}
@ -71095,16 +71122,27 @@ class DebuggerX86 extends Debugger {
return;
}
if (sCmd[1] && "bwd".indexOf(sCmd[1]) < 0) {
this.println("unrecognized dump command");
return;
}
this.sCmdDumpPrev = sCmd;
var dbgAddr = this.parseAddr(sAddr);
if (!dbgAddr || dbgAddr.sel == null && dbgAddr.addr == null) return;
var len = 0; // 0 is not a default; it triggers the appropriate default below
var len = 0;
if (sLen) {
if (sLen.charAt(0) == 'l') {
sLen = sLen.substr(1) || sBytes;
len = this.parseValue(sLen);
} else {
var dbgAddrEnd = this.parseAddr(sLen);
if (!dbgAddrEnd) return;
len = dbgAddrEnd.off - dbgAddr.off + 1;
}
len = this.parseValue(sLen) >>> 0; // negative lengths not allowed
if (len > 0x10000) len = 0x10000; // prevent bad user (or variable) input from producing excessive output
if (len < 0 || len > 0x10000) len = 0;
}
var sDump = "";
@ -71133,7 +71171,7 @@ class DebuggerX86 extends Debugger {
cb--;
}
if (sDump) sDump += '\n';
sDump += sAddr + " " + sData + ((i == 0)? (' ' + sChars) : "");
sDump += sAddr + " " + sData + Str.pad(sChars, sChars.length + i * 3 + 1, true);
}
if (sDump) this.println(sDump);

File diff suppressed because one or more lines are too long

View file

@ -246,7 +246,7 @@ DiskAPI.GEOMETRIES = {
};
/*
* Media descriptor bytes for DOS-compatible FAT-formatted disks (stored in the first byte of the FAT)
* Media ID (descriptor) bytes for DOS-compatible FAT-formatted disks (stored in the first byte of the FAT)
*/
DiskAPI.FAT = {
MEDIA_160KB: 0xFE, // 5.25-inch, 1-sided, 8-sector, 40-track