After I built my home brew game pad, I tried it out on all sorts of games. My game pad creation was a success, even though it was not quite showing a full 0 to 255 spectrum in my BASIC test. It worked great on every game I tried it on.
Until I tried it on Burgertime.
Burgertime was a great classic 8-bit platform game by Data East. It was released on many different console and computer systems. I first played it in the arcade version in the Shakeys Pizza Parlor in Chehalis WA as a kid. From the Wikipedia article:
BurgerTime (バーガータイム Bāgātaimu) is a 1982 arcade game created by Data East initially for its DECO Cassette System. The player is chef Peter Pepper, who must walk over hamburger ingredients located across a maze of platforms while avoiding pursuing characters.
No matter what I did, I couldn’t get my game pad to calibrate for this game. Eventually I acquired a SunnCom joystick with another Apple II and thought “Finally, I will be able to play Burgertime!” Wrong! This joystick would not calibrate for Burgertime either. I tried every trick I knew.
A few months went by and I seen a posting on the comp.sys.apple2 Usenet group from the infamous game cracker Qkumba that said he had released a new 6502 port of Burgertime. I believe that his previous port was done on a 65C02 and he has been going back and revising them all to work on the non-enhanced CPU. I thought of my joystick/game pad calibration issues and I figured maybe this was a chance to learn something from one of the truly amazing minds in the Apple II community. I replied to him and told him about my controller frustrations. “What happens when you try it? Does it say that it’s out of range?” Was his answer. I told him yes, that was exactly correct. His next reply was as follows:
Okay, so if you don’t mind a bit of hacking, take 4am’s version, and use a hex editor to make this change:
T17 S05 AE6: B9 21 02 -> 4C 59 FF
then boot the disk, press ‘J’, and try to set the joystick.
It will drop to a monitor prompt.
and tell me the values of xx and yy that are shown.
One of them should ideally be 00 and the other should be at least #$30 more.
A delta between xx and yy of less than #$30 will trigger the error.
I told him that not only did I not mind a bit of hacking, I welcomed the chance to work with the master. “Now”, I asked myself, “how do I do that?” I did a bit of research on Google for “modifying assembly language in hex on OS X” since I was using my iMac for the operation. I ended up downloading 0xED, and the .dsk file from Asimov labeled as “4am Crack.” When I opened the file, all of the addressing was in hexadecimal but I could not figure out how to convert T17 S05 AF1 to hex. I decided to search the assembly language for the string “B9 21 02” and see what I could find. The first result was at address 175E6. In the far right column, just a few addresses above 175E6, was this ascii string:
move the joystick to the upper right and press either button
There were two other places where B9 21 02 existed, but none near that ascii string. I decided that I would make three copies of the file, change the string at each address, one per file, and discover which one it was. I started with the one closest to that ascii string. I moved the files to my ADTDISKS share on my Pi, wrote the image to a floppy and booted it up. So far so good. I performed the test as instructed and the result was as he predicted:
My high was 35 and low was 15, a delta of 25! I reported my results back to Qkumba and got some follow instructions:
The delta is simply too small for the game to accept.
Yes, BurgerTime is set to be very sensitive.
Take 4am’s version, change T17 S05 AF1: 30 -> 20.
That should allow your joystick to work.
I opened the original file, searched for the string ’30’ and found it at address 175E6, just a few addresses after the string I changed for the test. I replaced it with ’20’ and repeated the ADT process. I booted the disk, and when it loaded, I pressed J for joystick and I was at the calibration page. I centered the thumbstick. Click. Pressed up and left. Click. Down and right. Click…
It worked! That first ’30’ that I had found at 175E6 was in fact the correct one! I played a few rounds and actually got to the fourth level! What a fun game. Now I had to get back to my lesson. I replied back to Qkumba and verified that the patch had indeed solved my issue, thanking him again for his unselfishness and his willing to teach me and asked him to clear something up for me. “I need to understand how to really find the address at T17 S05 AF1. I just found a ’30’ near the “press joystick to upper left” string and guessed. I want to truly understand it.” He explained to me that T17 S05 AF1 was Track 17, sector 05, and the last one was the address. Then he gave me the following formula:
(Track * 16 * 256) + (Sector * 256) + Address = byte offset within .DSK image
Track and Sector, that made sense, I should have remembered that from school. I did the math:
(17 * 16 * 256) + (5 * 256) =
69632 + 1280 =
The hex address AE6 converted to decimal is 2790, so 70192 + 2790 = 73702
When converted back to hex, 73702 = 11FE6, not 175E6.
I asked for an explanation on where I went wrong. His reply was this:
Sorry, track $17, sector $05, Address $E6.
All three values were in hex.
That made much more sense. I redid my math and it worked out perfectly! Now, at least I understood what I did to fix the delta threshold in the game.
This experience was really fun and rewarding. I learned how to find hex addresses in .dsk image files by track-sector-address format. I also learned why my controllers would not calibrate for the game. And the reward for my efforts, playing Burgertime!