pcjs/modules/pcjs/lib
Repository files (latest commit first)
Filename Latest commit message Latest commit date
2015-09-10 15:18:20 -07:00
..
.jshintrc More 80386 instructions 2015-03-29 15:57:57 -07:00
bus.js v1.19.5 checkpoint (includes a fix to the "pop mem" instruction) 2015-09-10 15:18:20 -07:00
chipset.js Revamped dump extensions to accept argument arrays, added probeDesc() for Debugger-safe segment descriptor loading 2015-09-03 09:07:40 -07:00
computer.js Fixed save/restore (hopefully) when A20 is off, as well as when HDC I/O is in progress (although the latter needs more testing) 2015-08-29 15:22:36 -07:00
cpu.js Improved the Debugger edit command 2015-08-28 23:17:21 -07:00
debugger.js v1.19.5 checkpoint (includes a fix to the "pop mem" instruction) 2015-09-10 15:18:20 -07:00
defines.js Added support for user-defined Debugger variables (see 'let' and 'print' commands) 2015-08-12 14:25:45 -07:00
disk.js Added WDEB386 service simulation (INT 0x41) 2015-08-27 16:23:12 -07:00
fdc.js v1.19.4: I/O bug fixes (16-bit input could trash EAX, and support for true 16-bit/32-bit I/O was lacking) 2015-09-08 21:19:18 -07:00
hdc.js v1.19.4: I/O bug fixes (16-bit input could trash EAX, and support for true 16-bit/32-bit I/O was lacking) 2015-09-08 21:19:18 -07:00
interrupts.js Added support for Interrupts.WINDBG.LOAD_SEG32 2015-09-04 15:19:37 -07:00
keyboard.js Added WDEB386 service simulation (INT 0x41) 2015-08-27 16:23:12 -07:00
memory.js Halt (for now) on any 80386 GP fault, and prevent SPACE from scrolling the page 2015-08-07 00:15:29 -07:00
messages.js New Debugger command to dump Bus memory allocations 2015-04-08 09:45:13 -07:00
mouse.js Added WDEB386 service simulation (INT 0x41) 2015-08-27 16:23:12 -07:00
nodebugger.js v1.16.5: Getting ready for 2015 2014-12-29 23:06:28 -08:00
panel.js Added WDEB386 service simulation (INT 0x41) 2015-08-27 16:23:12 -07:00
ram.js Added WDEB386 service simulation (INT 0x41) 2015-08-27 16:23:12 -07:00
README.md Last of the link fixes (I hope) 2015-07-19 09:07:50 -07:00
rom.js Started integrating Windows Debugger segment load info with PCjs Debugger symbol tables 2015-09-08 11:05:09 -07:00
serialport.js Added WDEB386 service simulation (INT 0x41) 2015-08-27 16:23:12 -07:00
state.js Compaq DeskPro 386 ROM BIOS boots UNMODIFIED now 2015-04-16 17:31:40 -07:00
video.js Started integrating Windows Debugger segment load info with PCjs Debugger symbol tables 2015-09-08 11:05:09 -07:00
x86.js v1.19.5 checkpoint (includes a fix to the "pop mem" instruction) 2015-09-10 15:18:20 -07:00
x86cpu.js v1.19.5 checkpoint (includes a fix to the "pop mem" instruction) 2015-09-10 15:18:20 -07:00
x86func.js v1.19.5 checkpoint (includes a fix to the "pop mem" instruction) 2015-09-10 15:18:20 -07:00
x86modb.js Updated headers 2015-07-21 09:47:37 -07:00
x86modb16.js Updated headers 2015-07-21 09:47:37 -07:00
x86modb32.js Updated headers 2015-07-21 09:47:37 -07:00
x86modsib.js Fixed SIB decoding and display, and added expression parsing 2015-07-23 14:07:44 -07:00
x86modw.js Updated headers 2015-07-21 09:47:37 -07:00
x86modw16.js Fixed ECX corruption in LOOP instructions 2015-08-26 14:54:59 -07:00
x86modw32.js Fixed ECX corruption in LOOP instructions 2015-08-26 14:54:59 -07:00
x86op0f.js v1.19.5 checkpoint (includes a fix to the "pop mem" instruction) 2015-09-10 15:18:20 -07:00
x86ops.js v1.19.5 checkpoint (includes a fix to the "pop mem" instruction) 2015-09-10 15:18:20 -07:00
x86seg.js v1.19.5 checkpoint (includes a fix to the "pop mem" instruction) 2015-09-10 15:18:20 -07:00

PCjs Sources

Structure

These JavaScript files divide PCjs functionality into major PC components. Most of the files are device components, implementing a specific device (or set of devices, in the case of chipset.js).

Be aware that component is an overloaded term, since Component is also the name of the shared base class in component.js used by most machine components. A few low-level components (eg, the Memory and State components, the Card class of the Video component, the Color and Rectangle classes of the Panel component, etc) do not extend Component, so don't assume that every PCjs object has access to component.js methods.

Examples of non-device components include UI components like panel.js and debugger.js, and sub-components like x86ops.js and x86func.js that separate the CPU functionality of x86.js into more manageable pieces.

These components should always be loaded or compiled in the order listed by the pcJSFiles property in package.json, which includes all the necessary shared components as well. At the time of this writing, the recommended order is:

Some of the components can be reordered or even omitted (eg, debugger.js or embed.js), but you should observe the following:

  • component.js must be listed before any component that extends Component
  • panel.js should be loaded early to initialize the Control Panel (if any) as soon as possible
  • computer.js should be the last device component, as it supervises and notifies all the other device components

To minimize ordering requirements, the init() handlers and constructors of all components should avoid referencing other components. Device components should define an initBus() notification handler, which the Computer component will call after it has created/initialized the Bus component.

Features

[List of major existing features goes here]

BackTrack Support

The next major feature to be implemented is referred to as BackTrack Support, or simply BackTracks. When BackTracks are enabled, every memory location (at the byte level) and every general-purpose byte register may have an optional link back to its source. These links are called BackTrack indexes.

All the code that a virtual machine initially executes enters the machine either via ROM or disk sectors, and as that code executes, the machine is loading data into registers from memory locations and/or I/O ports and writing the results to other memory locations and/or I/O ports. BackTracks keep track of that data flow, allowing us to examine the history of any piece of data at any time, down to the byte level; while this feature could be extended to the bit level, it would make the feature dramatically more expensive, both in terms of size and speed.

A BackTrack index is encoded as a 32-bit value with three parts:

  • Bits 0-8: 9-bit BackTrack object offset (0-511)
  • Bits 9-15: 7-bit type and access info
  • Bits 16-30: 15-bit BackTrack object number (1-32767, 0 reserved for dynamic data)

This represents a total of 31 bits, with bit 31 reserved.

For example, look at one of the last things a ROM does during boot: loading a disk sector into RAM. It will be up to the disk controller (or DMA controller, if used) to create a BackTrack object representing the sector that was read, adding that object to the global BackTrack object array, and then associating the corresponding BackTrack index with the first byte of RAM where the sector was loaded. Subsequent bytes of RAM containing the rest of the sector will refer to the same BackTrack object, using BackTrack indexes containing offsets 1-511.