Dottori-Kun Hacking

[general overview] [schematic] [Dottori-Kun disassembly]
[getting colour] [my own code/romhack]

So, what is this Dottori-Kun thing, anyway?

Well, other websites have covered the basic release info of this SEGA arcade PCB more thoroughly.  In a nutshell, this was a tiny, technologically simple, and especially low-cost PCB that Sega manufactured from 1990 onwards.  It was made basically to comply with a new Japanese government regulation stipulating that arcade cabinets could not be sold bare: they had to contain a working game.  Thus, several companies whipped up such "games" to go along with their popular arcade cabinets.  The PCBs that came with them, such as Dottori-Kun, were meant to be tossed by the arcade owner upon delivery.

That's rather sad.

Yes, if you sympathize with machinery (like I do, crazy me), you'll feel sorry for a proper computer, consisting of a Z80 CPU, 2K of RAM, a 2-colour display (from 8 selectable colours), meant simply to be disposable.  Of course by the 1990s, it's imaginable that technology had reached such a point, but in say the mid-1970s, a 2K Z80 computer still filled the unattainable dreams of many a young teenager or tinkerer of the time.

Programming for it, though?

Well, I think that every piece of hardware needs some attention devoted to it (just ask Jeff Minter.)  I wanted to give the Dottori-Kun hardware some fresh code to run, beyond the one demonstration game that came with it.  Even old CPUs could be making themselves useful in some capacity, basically.

OK, so the hardware is quite primitive: a bare Z80, 2K of RAM, up to 16K of program ROM, and a video generator made out of 74-series logic ICs.  The display HW feeds the screen with a 128x96 1-bit bitmap taken from the first 1.5K of RAM.  The single input port to the CPU reads the JAMMA-connected 1P joystick, and the single output port from the CPU sets the entire background colour and foreground colour from a choice of only 8 colours: BLACK, RED, GREEN, YELLOW, BLUE, MAGENTA, CYAN, and WHITEThe hardware has no capability to set different colours for different regions/pixels of the screen; if you want more colours, you'll have to time the CPU to change the colours mid-display.  There is no hardware provision for sound, sprites, or screen scrolling.  The included Dottori-Kun game usually has its display set to Black and White all the time, with the 1st version having an all-white screen with black pixels, and the 2nd (new) version having a black screen with white pixels.

Dottori-Kun (New) through a CHR tile viewer

The video memory is "pixel-doubled" on output to form a 256x192 active display on the video screen as a perfect square.  The aspect ratio of the pixels are, therefore, 3:4, tall pixels rather than the wider 4:3 ones in most 80s game systems.  The clock speed of the Z80 is 4Mhz, but in order for the video hardware to read from RAM during active display, it halts the CPU for 1/4 of that time.  Dottori-Kun is emulated in MAME, but with a constant emulated clock speed of 4.00Mhz and 62Hz framerate compared to the real hardware's 3/4 Mhz and 61Hz, screen-synchronized video effects don't come out right in MAME.

CLICK ABOVE for a full schematic of the Dottori-Kun board, provided by Kentaro, creator of this page.
Connect to the video output the signal that halts the CPU clock, and we can see exacly where and for how long the CPU gets halted (in green).

Dottori-Kun (new version) Disassembly Just like it says, I did a mostly complete (commented) disassembly of the Dottori-Kun program.

So, screen-synchronized effects...

Although the graphics hardware is quite primitive, it still allows you to change the background and foreground colours anywhere on the screen.  So, I did a few tests, with the CPU brute-forcing writes to the colour latches as the screen is drawn.  Well, it's not much, but you can stably get around 4 different colour updates per scanline, along with a final write to darken the background colour in the HBlank area (my TV and other RGB hardware really don't like any of the borders to be anything but black during any of the blanking periods, but arcade monitors are evidently more lenient.)  This means that you could in theory get 8 different colours on each scanline... you just need to create some pictures that make clever use out of them.

An example:

start with a monochrome bitmap
change the palette 4 times per scanline

It does kinda have an Atari 2600 look to it, seeing as how colour transitions appear sudden and horizontally lengthened, but it's rather more pleasing than straight black and white.  So, with proper pixel and colour arrangement, I made some other game mock-ups on the Dottori-Kun hardware (writing my own program onto an EEPROM.)

My own code for the Dottori-Kun PCB:

DOTTORI-MAN Jr. 「ドットリマンJr.」 for the Dottori-Kun hardware

Download ROM Patch

For now, I've done a ROM hack / game improvement to Dottori-Kun (new), changing around its map layout, characters, and a few rules.  You'll need to provide your own ROM ("dotrikun" in the MAME ROMset; "14779a.mpr" as a filename) and apply the included IPS patch to it.  Alternately, you can rename the original to "in14779a.mpr" and assemble my included Z80 code using WLAZ80.

Some features of this new version:

You can run the patched game by burning it to an 8K / 16K / 32K EPROM or EEPROM and placing it in the ROM socket of the Dottori arcade PCB.  Or if you don't have that, the game can be run in MAME by placing the patched ROM in its appropriate directory and having MAME point to it; or more easily, by replacing the old ROM in "" with the newly patched one and putting it in your MAME ROMs folder.  Beware, though, that since MAME has inaccurate timing/emulation of this CPU/hardware, the raster colour effects will be incorrect.  The game is still playable, however.

correct timing on real hardware
incorrect timing in MAME.  MAME is lame.

Finally, I've included the Z80 source code for my patch, as well as a conversion program written in C that'll take a 1BPP CHR file (editable in YY-CHR) and build the wall/dot map that the Dottori-Kun game & hack use.  That's about all for now!

<-- BACK to MAIN | e-Mail Chris!