Thursday, July 13, 2017

Cannonball Blitz for the Apple 2 driving me crazy

I remembered this old Apple 2 game called Cannonball Blitz and how impossible it was.



So why not try to fiddle with the mame debugger to get some extra lives. The game gives you a measly 3 lives.

./mame64 apple2e canbbltz -debug


It draws the number of lives in the upper left corner of the graphics screen, so let's set a watchpoint for address $2000.

wpset $2000,1,w

let it run and then do

history

and if you read the list of instructions you'll see a

lda $6f12



and if you open a memory window and change memory location $6f12 to something else, say $7F, you'll have 127 lives.

I tried $FF for 255 lives, but the code does a

9c01 dec $6f12
9c04 bmi $9c17

so anything larger than 127 seems to trigger the branch.

Setting up watchpoints on $6f12 with wpset $6f12,1,rw leads me to the code that initializes the number of lives:

868b lda #$02
868d sta $6f12






So let's just open up a memory window to 868b:



and change that 02 to a 7F:




So now at least I can keep trying to get past level 2... it only displays one character for the number of lives, so you'll only see the lower nibble of the number of lives.

Hey! I finally beat level 2 for the first time ever!



On to level 3!




Finally finished level 3!

I had to use the save state feature of mame, LEFT SHIFT+F7 and then 1 to save state into position 1, F7 to load state.

I saved it right at this spot and must've loaded it about 50 times.



You have to pause and then run under at two spots.



Seriously hard...but finished that level.




More silly fun, let's find where the score is stored.



In the mame debugger, we'll use the f command

So I didn't know exactly how to use it, so I typed "help memory".



One nasty side effect is that reading the memory where the soft switches that control the screen display will put you into text mode, which is easily fixed by restoring the save state with F7 (you did save a state, didn't you?)

So first I tried converting 32760 into hexadecimal for $7ff8, but I couldn't find that in memory, so I decided it must be stored as BCD, for 03 27 60.



It stores it in 9153 and 9156, 9153 seems to be a temporary shadow, 9156 seems to be the "real score".

Setting to FFFFFF gives you this crazy score.

Saturday, July 8, 2017

Fiddling with coco2 graphics

It's interesting to figure out how the coco2 does its graphics.

I got a book on Extended Color Basic to get me started. It's a pretty cool tutorial.

http://www.colorcomputerarchive.com/coco/Documents/Manuals/Hardware/Getting%20Started%20With%20Extended%20Color%20Basic%20(Tandy).pdf


I wrote a little basic program to investigate how it works.


Some stuff I learned:

For some reason, mame gets the shift key stuck and I end up having to hold down SHIFT to invert the shift. I don't understand it exactly.
edit: Actually, I found that SHIFT+0 toggles CAPS lock.

The color basic EDIT command drives me completely insane, especially when the SHIFT key is doing strange things. I've gone to editing programs in a text editor then using paste to paste them into mame (UI Paste seems to be bound to SCROLL LOCK+SHIFT which is less than ideal, I think I'll change it).


INSTR matches an empty string at position 1, I would think that INSTR shouldn't match the empty string at all, giving 0.

You can change the PMODE for the graphics mode, but the screen display doesn't change until you execute a SCREEN command.

If you're in graphics mode and you PRINT anything to the screen, it reverts to text mode and sets the 0 background colors, basically executing a SCREEN 0,0.

Coco 2 graphics memory starts at 0xD00 or 14*256. With Disk Basic it starts at 0xD00, cassette basic starts graphics at 0x600. I wanted to poke into memory and see what happens.

The coordinates for the graphics depend upon the PMODE, and will adjust for the screen mode, where 0,0 is the upper left, and 255,191 is the lower right.




So my program just pokes some random data into the start of graphics memory page 1.

S will toggle to the alternate color set (either 0 or 1)
G will toggle from text to graphics (either 0 text or 1 graphics)
01234 will set the PMODE to that number
QWERTYUI will set the color to 01234567 and draw a rectangle
C will clear the screen
A will draw a line from 0,0 to 255,191 in a random color
Z will print a line of text automatically returning you to text mode



starts up in PMODE 4,1 (256x192 2 colors), note that going to graphics mode doesn't clear the screen



same screen in PMODE 3,1 (128x192 4 colors)


same screen in PMODE 0,1 (128x96, 2 colors)


now if you type C to clear the screen in PMODE 0,1 it will only clear what is visible, and hitting A to draw a diagonal line across:



then switching to PMODE 4,1 gives you:

Tuesday, July 4, 2017

Coco3 easter egg

I'm having fun fiddling with the coco emulation and I read about the easter egg in the coco3. Hold CTRL+ALT at bootup and you get a picture of "the coco 3".


http://www.cocopedia.com/wiki/index.php/CoCo3_Easter_Egg


So I'm late to the coco party (I'm sure all coco owners know about it).


Launch mame with

./mame64 coco3

and hold down CTRL+ALT before the mame info screen, and hit space to continue past the info screen:



You have to hold CTRL+ALT before the info screen comes up, because pressing CTRL or ALT will send you past the screen.

Sunday, July 2, 2017

Olympic Decathlon for the Coco

Have you ever played a game that is just incredibly infuriating but you want to beat it so you keep on playing?

I came across this Olympic Decathlon game for the tandy coco and it is most difficult because it doesn't let you continue unless you "qualify" for each event. If you don't measure up, you have to start over again.

It's written by L. Curtis Boyle and you can find it at his website.

http://www.lcurtisboyle.com/nitros9/olympicdecathlon.html




It starts up with a blank screen so you have to hit "C" for continue.






and hit C to continue past the rings screen.














and it's written in BASIC so you can see how it was made. Pretty clever. I want to fix it so I can see all of the events. I can't keep doing the 100 meter dash.




So to get printing to work with mame, use the -printout option like so:

./mame64 coco2 -flop1 curtisboyle.zip -printout printout.txt

and do an LLIST command: (and be prepared to wait a few minutes to get the cursor back since it takes a while)



and you get the file, but first it needs to be cleaned up, there's an FF at the beginning and ^M at the end of every line.

To fix the printout file for linux, use this sed command:

sed -i -e 's/\r/\n/g' printout.txt

that changes \r return characters to \n newline characters.