Program P7_AVRcade.txt, is a little arcade / console style menu to select and run games or other programs which have been pre loaded into available program spaces.

The menu works by calling the selected program as a subroutine and a return instruction is added to each program in place of an end statement.

The idea behind the menu is to operate the system using only joystick and button controls with no need for an attached keyboard, in the manner of an arcade machine or games console. I have placed the menu program in location P7 and set the system to autorun P7 on startup.

The only issue is the menu is really only necessary for joystick use. To use it with the CB2 Micro it would be easy enough to make up a joystick cable, connected to the parallel input contacts but I thought it might be easier to draw up a little interface PCB which would add a parallel printer connection as well as an Atari / C64 style joystick port. 

I have drawn a simple PCB which should line up exactly with the header contacts on the CB2 Micro (but haven't built or tested it as I don't have a CB2 Micro PCB). It should be possible to use stacking header connectors (or just tinned copper wire with short pieces of heatshrink as spacers) and locate the interface board under the CB2 Micro PCB.


Programs need to be adapted to work with joystick controls (and the menu program).

Adapting the programs to operate with joystick controls is quite straightforward, substituting IN( ) instructions in place of KEY( ) ones.

To make them work with the joystick driven menu adds some extra complication; by using the CALL - RETURN function in the menu I found that this instruction doesn't work correctly when nested with GOSUB - RETURN instructions in the called program.

I think the first RETURN instruction encountered returns the program to the main menu rather than the return point of the last GOSUB instruction.

So as a workaround I have changed the GOSUB instructions within the game programs to simple GOTOs, setting the return line number into a spare variable where necessary.

Each program also needs to initialise its variables correctly as they may not be zero values when the program is CALLed by the menu. The menu program only stores its volume and credit amounts, in the internal EEPROM so these values are retained from one game selection to the next.




Attached is a collection of programs which I have adapted so far to run with the AVRcade frontend / menu program.

Although the AVRcade program is mainly intended for joystick use with no keyboard attached I recently added the ability to navigate its menu using either keyboard or joystick input so the program can still be tested without the joystick extension.

Unfortunately I haven't found space within my game or test pattern programs as yet to include both sets of control inputs so the adapted versions included here are for joystick only. The edited versions of 'Racer' and your 'Setfree' will work with either joystick or keyboard input.

I added a little feature to 'Racer' to give 3 lives, on the third crash pressing start or enter will return to the menu program.

The 'credit' function in the menu is obviously just for fun and not intended for commercial use, to add a credit press the coin / select button on the joystick input or 'insert' key on the keyboard - or select 'no' for credits on startup and the menu will display 'Free Play'.

The menu program stores its music volume and credit balance to the internal EEPROM also 'Racer', 'Blocky' and 'Skinny Vaders' store high scores. There is a secret function to clear high scores using Joystick Right and Start button or keyboard F12 from the menu screen -  that is mentioned in comments in the AVRcade program listing.

Anyway, someone might enjoy playing or even writing games for joystick controls. I may write some new ones or adapt some other examples and have left two program spaces free for now. At present if Program 5 or 6 are selected from the menu those will redirect to program 8, the test pattern menu but that can easily be edited if additional programs are included in the menu.

Selecting Test patterns is effectively a menu within a menu so to exit from the test patterns and return to the main menu - first select the button/ sound test then press start button which will RETURN to the AVRcade program...

 As all of my programs including the AVRcade menu are written in basic people may like to experiment with them and anyone can freely change the button combinations or other functions however they like however I obviously can't offer software support for altered versions.
 
 