Thursday, 13 April 2017

RetroChallenge 2017: Tackle Penguin

Someone besides myself finds it interesting to browse through old Japanese Basic computer magazines looking for code to convert to an 8-bit computer with a Motorola MC6847.

Emerson Costa shared the following post on facebook:
A video of mine describing my odyssey in converting a type-in BASIC program found in an old Japanese magazine (1988), originally for Fujitsu FM-7/77, to my Brazilian CCE MC1000, based on CPU Z80 & VDG MC6847 & PSG AY-3-8910.
It's in Portuguese, but here is an abstract:
I describe the game mechanics and rant about some of the FM-7/77 BASIC instructions that write text and stamp images on the graphic screen.
I talk about how game logic is mixed with interface logic, and give an example of how I separated those things in my conversion (reading keys from the keyboard vs getting commands from the player).
I show a first version in text mode, and then go on to make it graphic (using MC6847's Resolution Graphics 6, which is set by MC1000's HGR instruction). Machine language comes into stage with routines to draw 8x8 characters/sprites on graphic mode, and remove keyboard beeping. A final section of the BASIC program is added to POKE the corresponding bytes into memory.
Sound is still lacking. The original program uses the PLAY instruction, MC1000 has TEMPO & SOUND instead. I studied them all instructions and came up with an HTML page with JavaScript code that translated PLAY strings into a series of SOUND commands.
Then the conversion is complete. Oof! 😅It should be easy to adapt the program to MC-10?
Emerson was very generous to provide some further conversion advice:
Some machine-specific info:
CALL 49158 -- Waits for a key to be pressed and released.
POKE 910,0 -- Avoids an annoying behavior of PRINT, just ignore it.

PEEK(483) -- ASCII code of last key pressed.
PEEK(485) -- 255 if a key is pressed; 0 if none.
POKEs after HOME -- Makes cursor invisible. Ignore.
POKEs at the end of program -- Machine code routine related to keyboard reading. Ignore.
The CCE MC-1000 is an interesting machine. It's got the screen of a Coco, the keyboard of an MC-10, and the Basic of an Apple II. It's a totally unique hybrid. The Brazilian government really fostered some interesting creativity in 8-bit computers with its protectionist policies. Anyway, with Ensjo's help I was able to get a version working for the MC-10.
Your penguin is an A
It's able to jump in the following ways:
                       A  to here
It can jump from here  A  up through the block (using the W key jumps straight up).
It can jump up and left or right using the Q and E keys.
             A to here using the E key         A  to here using the Q key
from here  A ■               or                ■  A  from here
You can also push blocks left and right if there is only one and there is open space for it to move into. Blocks don't fall if you push them off other blocks. But you will fall if you jump off a block.  Some weird physics, but it makes for a neat puzzle. I still haven't solved puzzle 1 yet, so the game has yet to be fully bug checked. If there are any puzzle fanatics out there who solve it, let me know.  You can play the game online here:

The following is an update of my original attempt, with improved handling of the move sound and music interludes (I hope):

And here are some further updates to messaging and a demonstration of the Win music routine:

The magazine is "mycom-basic-magazine-1988-04".

No comments:

Post a Comment