Development Page

Technical Info

The purpose of this page is to collect as much technical information about the Doctor PC Junior as possible. Right now, there isn't much, but the page may expand someday.
    Table of Contents
  1. Specifications
  2. Updates & Special Information
  3. Hardware Register Summary
  4. Hardware and Peripheral Details
  5. Thanks
Specifications (Thanks to Martin for the info.)

Updates & Special Information

Oct. 21, 2001: I've updated some of the technical information in this page and in the PCJr Header document. I've also started a new page with patches to get unsupported games to work on the Dr. PC Jr. I'm finally beginning to understand how the PCJr "New Game Mode" works, so we can hopefully get some more mappers supported.

Sept. 9, 2001: I've worked hard and now I've updated the PCJr BIOS! It now supports Game Genie codes on loaded games, as well as a couple of bugfixes. Check it out here!

July 28, 2001: I've split apart my Dev3 page into two, just so that the files aren't buried at the bottom of the page. You can now find all relevant files and goodies HERE. And it is on this new page that I've added a program that I made myself, called CATalogue. Basically, it decodes barcode information. Go on down to the bottom of this page to find out about it.

On the cartridge dumping front, I have had some success. I managed to write a program on the PCJr that dumps cartridge data through the parallel port to a host computer (my Amiga, in this case). I should put up some more information about it in the future, if I ever improve on it. The short story is, it's slow, but it works. I managed to dump a couple of multicart menus with it so far.

June 6, 2001: It's been a looooooong time since I updated this page. In the meantime, I've been mostly devoting my time and attention to university and my girlfriend. I've also tried to turn my Dr. PC Jr. into a cartridge dumper. There are 3 required steps here: 1) Make a program that loads itself into RAM. 2) Have it read the cartridge data. 3) Have it save the data to disk. Step 1 is easy enough, but 2 and 3 are more challenging. On the PC Jr, a program can only read the cartridge data if step 1 is initiated from a) a program that is on cartridge itself or b) code in the PC Jr BIOS. Not easy. Fortunately, I have a dev cartridge, onto which I can put a dumping program. (I have made my program send a hex dump of a cartridge to the printer. I will put my preliminary programs on this page sometime soon.)

Step 3 is the hardest of all, because you have to know low-level Floppy Disk Controller protocols. I don't, really, so I'm mired in ignorance to the finer details of FDD access. My dumping program can get the disk drive motor to spin up and jump to the desired sector, but I can't read it!! Any experts on FDCs, PLEASE e-mail me!

On a brighter note, I have managed to set up a Web-based DISCUSSION BOARD about the Dr. PC Jr. Check it out and I invite you to contribute anything you can to the discussion!

The Doctor PC Jr's BIOS is 32k large, which is divided into eight 4096-byte banks. The last bank is mapped into $F000-$FFFF; the other banks are bankswitched into $E000-$EFFF using a special bankswitch register ($4180)

The Doctor PC Jr's PPU emulation is not completely accurate and is a little quirky. The BG is offset by one horizontal pixel to the left. So, sprites and the BG are slightly misaligned. Also, when the scroll register is 0, one vertical strip of pixels of the adjacent name table is visible on the right side of the screen. Furthermore, when the sprites and BG are turned off in the left border, one vertical strip of BG is visible to the left of this border!

In addition, the 'colour emphasis bits' of $2001 are overly-emphasized in the PC Jr, making the effect of these bits much more visibly pronounced. (This might explain why certain games appear very dark on Famicom Clones: the games have all 3 bits of $2001 set; thus the effect is more apparent on clones (and the Dr. PC Jr.) than on a real NES/FC system.)

Hardware Registers

These are the registers that control various hardware items within the PC Jr. I've just gleaned them from the disassembly of the Dr. PC Jr. BIOS, so many of their functions are unknown at this point. The functions for which there is information are not guaranteed to be accurate. I need your input for this table to grow.
Known Writable RegistersKnown Readable Registers
$4180    BIOS ROM Bankswitch Register*
$4181    Game Mode Control (Same as PCJ header byte $11)
$4182    New Game Mode PPU Config (header byte $12)
$4183    PRG, CHR Address Line Masks (header byte $13)
$4184    Parallel data out*

$4186    Send Parallel data*

$4189    Floppy Disk Drive (FDD) data*

$418E    ?? Unknown, keyboard output port.*
$418F    FDD "handshake"*
$4190    CPU DRAM paging for reading* or PRG ROM ($8000-$xFFF)*
$4191    CPU DRAM paging for writing* or PRG ROM ($A000-$BFFF)*
$4192    PRG-ROM control 3 ($C000-$xFFF)*
$4193    PRG-ROM control 4 ($E000-$FFFF)*
$4194    PPU control 1 (Unknown, may control PPU mirroring.)
$4195    PPU control 2 (Unknown, may control PPU mirroring.)
$4196    PPU control 3 (Unknown, may control PPU mirroring.)
$4197    PPU control 4 (Unknown, may control PPU mirroring.)
$4198    Map 8k CHR DRAM bank to PPU $0000 or CHR-ROM ($0000-$xxFF)*
$4199    CHR-ROM control 3 ($0400-$07FF)*
$419A    CHR-ROM control 4 ($0800-$0xFF)*
$419B    CHR-ROM control 5 ($0C00-$0FFF)*
$419C    CHR-ROM control 6 ($1000-$1xFF)*
$419D    CHR-ROM control 7 ($1400-$17FF)*
$419E    CHR-ROM control 8 ($1800-$1xFF)*
$419F    CHR-ROM control 2 ($1C00-$1FFF)*

$41A4    Counter disable/enable (bit #0)

$42FF    "Old game mode byte"?

$4185    Parallel port ready*

$4188    FDD interface status*
$4189    FDD data*

$418E    ?? Disk, Keyboard Input Port*
$418F    IRQ Status Register, of all IRQ sources?

$41A0    IRQ line counter (W?)

$41A2    CPU counter LB
$41A3    CPU counter HB

$41A9    *Reads get stored in $2007


Hardware and Peripheral Details

$4180: BIOS ROM Bankswitch Register

W: s????xxx: Load page xxx of the BIOS to the page frame at $E000. Also, s may enable SRAM at $6000-$7FFF.

$4190: CPU DRAM Paging Register for Reading

W: ????xxxx: Map 32k DRAM bank (of a possible 512k) to $6000-$DFFF for reading. Reading and writing function independently of each other, which is a Good Thing.

$4191: CPU DRAM Paging Register for Writing

W: ????xxxx: Map 32k DRAM bank to $6000-$DFFF for writing.

$4190-$419F: PRG, PPU, and CHR Page Mapping Registers

W: xxxxxxxx: In "New Game Mode", maps PRG and CHR ROM banks to the NES' address space.
These registers work in a very straightforward way, but their operation varies depending on the paging size for PRG and CHR ROM.

$4190-$4193: Each register controls either 32k, 16k, or 8k PRG banks. If the PRG paging size is 32k, then $4190 controls paging for the entire 32k section of $8000-$FFFF. If the paging size is 16k, then $4190 controls $8000-$BFFF and $4192 controls $C000-$FFFF (hypothetically). If the paging size is 8k, then each of the 4 registers controls an 8k section of PRG-ROM.

For example, to put 16k bank 0 of a game into $8000-$BFFF, simply write 0 to $4190. To put 16k bank 3 of a game into $C000-$FFFF, simply write 3 to $4192.

$4194-$4197: Little is currently known about these registers.

$4198-$419F: These operate in a similar way to the PRG paging registers, except that they control CHR-ROM bank switching in the PPU. CHR pages can be 1k, 2k, 4k, or 8k. Again, $4198 controls the entire PPU $0000-$1FFF region if CHR paging is 8k. At the very smallest CHR paging size, each of the registers controls 1k of CHR ROM at its respective PPU address.

Parallel / Printer port: $4184/$4185/$4186

When a printer is hooked up to the Dr. PC Jr., printing is possible through these three registers. $4185 checks to see if the printer is ready/online; $4184 stores a byte of output data; and $4186 initiates the transfer by writing #$21, then #$20 to it. Here is some example code:

   lda   $4185
   bmi   .PrinterTest

   ldx   #$00
   lda   .TestText,X
   beq   .Done
   sta   $4184
   ldy   #$21
   sty   $4186
   sty   $4186
   jmp   .SendLoop

.TestText dc.b "This is a test of the printer."
             dc.b #$0D,#$0A,#$00

Floppy Disk Drive (FDD) Interface: $4188/$4189/$418F

The FDD interface is apparently a standard interface controller like that found in IBM PCs (8277?), and is accessed in a similar way: through ports. Knowledge of how a FDD controller works is essential, then, to operating the disk drive inside the Dr. PC Jr. The following information could be wrong, however.

$4188 returns the status of the disk drive. If it returns #$C0, the error is "WCM". If it returns #$80, the error is "RDST". #$40 within the $4188 information signifies the data direction. (?)
$4189 is the receptacle for writing a byte to the FDD or the source for reading a byte from the FDD.
$418F is set either to 0/1 for reading/writing.

To write a byte to the FDC, set $418F = 1, BIT/BPL wait on $4188, then error if V is set.
Then write your data to $4189, and set $418F = 0.

To read a byte, set $418F = 0; BIT/BPL wait, error if V is clear.
Then set $418F = 0, and read your data from $4189.

Keyboard Interface: $418E

The DrPCJr uses, from all reports, a standard PC keyboard. What is not evident from these reports is that the CPU-side interface for the keyboard is nothing like the interface on a standard PC. The Dr. PC Jr. is set up to use a direct interface to the PS/2 port in the low two bits of $418E, which is handled by the CPU directly, without the assistance of the coprocessors which the PC relies on. There is, as yet, no evidence of a keyboard IRQ for this system, and I don't expect any.

The relevant part of the port map (note that, for reading, this port has at least two bits of disk data at the high end that are not relevant to this document):

$418E: RW: ??????CD: C is keyboard clock, D is keyboard data.

The clock and data lines are both open-collector, which means a wired AND setup (either the keyboard or the computer can pull a signal to 0). This is useful mainly for the CPU to halt clock generation.

At this point we know everything we need to know about the hardware interface. From here on out it's all software and protocols.
Keyboard interfacing is too complicated to summarize in this document, so you can find the pertinent information here:

A concise explanation of AT and PS/2 keyboard and mouse protocols.
A general PC hardware reference, but has a section on various keyboard commands in the section "Keyboard Commands & Responses".

PC Mouse Adaptor

Included with the Dr. PC Jr. is a short cable adaptor that accepts a standard serial-PS/2 PC mouse, and which plugs into one of the joystick ports of the system. So far, I haven't encountered any PC Jr. programs which make use of the mouse, so I can't say if it works. I haven't figured out yet what signals the adaptor sends to $4016/$4017, but perhaps with the information below, we'll get some mouse stuff working....

I've pulled apart the adaptor and have traced the wires from the Famicom connector to the 9-pin sub-d mouse connector. Inside the sub-d casing is a Hitachi HD74HC368P logic chip and a resistor (with stripes Brown, Black, Orange, Gold or vice-versa). We're looking at the front of both connectors with reference to numbering.
Here are how the lines are all connected (for a larger visual diagram click on the GIF for pin numbering, etc.)
F=Famicom; H=HD74HC368P; M=Mouse
F2-H5 "Blue wire"
F6-H13 "Brown wire"
F8-H8 "Yellow wire"
F9-H16 "Red wire"
F14-H2 "White wire"

TI Voice Chip

Information on the 50C04 voice synthesizer is available here.

Thank-yous go out to:

Bung, for making this neat system.
Nintendo, for, um, suing Bung and not me...
Kevin Horton, for helping me with identifying some chips.
Alastair Bridgewater, author of DarcNES, for all the help with register identification!
Kent Hansen, for some disk images.
John Salter, for the EC/CE dictionary.
Ben Parnell, for iNES2DNES and QND.

Please e-mail me if you have any questions or comments.