Jump to content
Sign in to follow this  

Disassembling Mickey & Donald

Recommended Posts

Early this year, I learned that MAME, which has recently been combined with MESS into one single emulator, also emulates some handhelds now... among those are some I have or had myself, Coleco's Donkey Kong tabletop game, MB's Bigtrak and Nintendo's Mickey & Donald (Game & Watch).


I decided to take a deeper look at Mickey & Donald (after nearly competing the Bigtrak code, but that's off topic here) because I was always curious how such games have been programmed... I started on it in February 2016, about 33 years after I got the actual game. ;-)


Obviously, this is a low-power device powered by two button cells and having an LCD screen. It's using a Sharp SM510 mictrocontroller with a fixed ROM. There is a nice write-up on that CPU here:



This chip has got a built-in LCD driver, and the display is memory-mapped, that is, all memory locations from $60 on are visible (at least if they've got segments connected to it).


Since the disassembler in MAME didn't work quite correctly (don't know if it has been fixed by now), I wrote my own disassembler for the code in VB.net, which is actually not so hard considering the CPU doesn't have that many commands. There are some quirks like 1-byte subroutine calls which are routed through an address table in the first page, though this still only enables certain jump destinations because those addresses still only have 8 bits, but the address range of the CPU is 12 bits.


Well, as I said I was curious how such a game is programmed. Actually it's quite different to what you're used to on video based systems. Normally you would have sprites, which are objects with an X and an Y coordinate, and they move and interact in some fashion. Well, for the most part, it doesn't work this way here.


How it actually works is closer to a shift register, actually several of them. As you may know, a shift register is a stack of bits which get shifted left or right in sync to each other. In this game, there are several lines of bits which work like a shift register. But they're not hardwired, all of this is done in software. There is a subroutine for each possible bit which swaps that bit in a memory location with the carry flag. The actual bits in a line often don't have a real logical position in memory, rather they were seemingly positioned so the lines in the LCD screen are best used. For instance, for an object that has 3 possible positions, one position might be displayed when bit 2 of memory location $62 is on, the second one is on bit 1 of memory location $6D and the third one on bit 2 of memory location $6B. The line is now shifted by starting at the first position, fetching its status to the carry flag. Then you set the memory location for the next bit (by one instruction) and call the respective subroutine to swap the bit you want to access. Now you've got that bit in the carry bit and go on to the next location... and so on until the line is through.


For instance, Mickey on the left has three possible positions, on bottom, in the middle or on top. If the player presses the "up" button, the Mickey line gets shifted upwards, on pressing "down" it gets shifted downwards, only that the last bit in the line gets re-set if it's found to be on after the shifting. The game code generally doesn't "know" the coordinates of any object visible on screen, it's all done by checking if a certain bit in memory is set. And there are more shift "lines"... two for the hose (one for small and one for big blobs), six for drops and fires and one for Donald on top. The fire shifting routine checks for each position if the corresponding drop bit is set, if so, both are cleared, a point is scored and the routine terminates. The routine shifting down the drops does the same. As for game variables, there are only a few controlling if there's one of the possible leaks, which game or demo mode is on, if the alarm is set, and as far as I can tell two counters for keeping the correct speed. But maybe there are some more which I missed because I didn't examine the complete code. Since the objects don't have coordinates in memory, all checks that depend on a certain location to be set or clear, such as collision detections, check the actual bit in memory... for instance, the routine that creates new drops checks all three possible locations of Donald to find out where he is and place a drop there.


That way, they also go around the limitation of the CPU that indexed writes are very hard to do... with this game architecture, none are required, the closest thing to it is actually the routine that converts score digits to the 7 segments that are displayed for each number. This one uses an indirect jump instruction which loads the data byte to the PC. Keep in mind that the PC is not linear, but a pseudo-random shift register, which means that the numbers 0-9 get converted to addresses which are actually all over the place in that page.


Oh, the total ROM in that chip is 2772 bytes (44 pages with 63 bytes each). I guess it's similar for other Game & Watch games, though much later models like Pinball and Super Mario Bros. might use a different chip, as may much earlier models like the Silver Series Ball, Vermin, Fire and Judge... there are more advanced models SM-511 and SM-512 supporting independent sound generation, more segments and more ROM up to 4K while the SM-510 has to generate sound writing 0's and 1's for each wave "by hand". On the other hand, there's a simpler chip with only 2016 bytes of ROM that may have been used on the first games. But still I suppose most Game & Watch games will have been programmed in a similar way, because you see some kinds of shifted strings of segments in all of them, with some of them going only one way and others going both ways.

Edited by Kurt_Woloch
  • Like 1

Share this post

Link to post
Share on other sites


I am very interested in this topic. I have been studying gameplay difficulty curves for a while and the ones in game & watch games are pretty awesome.

When I opened my precious Mickey a while back, I indeed saw only one chip. It's cool that you went into a lot more details.

Did you manage to see how the 'waves' in Mickey are timed?

They start with one egg, then 2 etc then reset at 100 I believe and more eggs start to come and speed up.

Did you see this in the code? I would love to study this. If you have a disassembler I would love to look at that code (I'm a z80 msx guy but I have done GB, Amiga, Genesis...).





Share this post

Link to post
Share on other sites

Actually you are thinking of a different G&W. The one Kurt analyzed is the red double screen game which features Goofy at the water pump, Mickey climbing the hose to tighten holes in it and Donald at the top of the skyscraper putting out fires. The one you're asking about is a single wide screen game only featuring Mickey catching eggs.

Share this post

Link to post
Share on other sites

Indeed you are right, my mistake. Thanks for pointing that out.

There is still the notion of difficulty increase in Mickey&Donald. 

Still wondering if anyone saw data tables about his in the disassembly.



Share this post

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...