scene.org File Archive

File download

<root>­/­parties­/­2022­/­vccc22­/­wild/mattpilz_bally_basic_vc3-2022.zip

File size:
405 033 bytes (395.54K)
File date:
2022-12-30 11:32:14
Download count:
all-time: 3

Preview

  • file_id.diz 6.42K
  • result.png 350.21K
  • source.png 21.51K
  • source.txt 391B
  • star.wav 1.59M

file_id.diz

VCCC 2022: Bally Edition

Author: @MattPilz
Category: Wild
System:   Bally Astrocade (1978)
Language: Bally BASIC / Astro BASIC
Len source code: 294 Bytes
Len exe file:    N/A
Len code only:   271 Bytes (Excludes Comment Line)
Instructions:

(==| VIDEO DEMO |==)

	https://www.youtube.com/watch?v=9qi9DUx8HiM

(==| EMULATION INSTRUCTIONS - ASSUMES WINDOWS |==)

	1. Download and extract the latest MAME binaries: 
	
		https://www.mamedev.org/release.html
	
	2. Download the Astrocade ROM collection and copy the contents of "mame" folder to your "mame/roms" directory: 
	
		https://ballyalley.com/emulation/cart_images/ROMs/astrocade_rom_collection.zip
	
	3. Place the star.wav file somewhere accessible, I recommend putting it right in the MAME root folder.
	
	4. Launch mame from command-line:
	
		mame.exe -skip_gameinfo astrocde astrobas -mouse
	
	5. Perform the following key sequence (will result in ":INPUT")
	
		KEYBOARD_. NUMPAD_+ NUMPAD_ENTER KEYBOARD_2 KEYBOARD_C
	
	6. Press <TAB> then FILE MANAGER > Cassette and browse to star.wav to select.
	
	7. Press RETURN TO PREVIOUS MENU then TAPE CONTROL then PLAY. Press TAB to return to BASIC.
	
	8. Wait for playback to complete (can hold INSERT on keyboard to speed it up). you should see red background and green snowflake prompt.
	
		(If you want to LIST the code, press the key combo: NUMPAD_ENTER LETTER_O LETTER_C)
	
	9. Perform the following key sequence (will execute "RUN")
	
		NUMPAD_ENTER KEYPAD_PAGE_DOWN LETTER_C
	
	10. Watch the star generate and evolve endlessly! You can hold in the INSERT key to view the design evolutions in warp speed.
	
	11. To halt program, press KEYPAD_PAGE_DOWN

	12. Press ESC to exit MAME and return to desktop.
	
(==| PHYSICAL HARDWARE INSTRUCTIONS |==)
	
	This process requires that you have a Bally Astrocade and Astro BASIC cassette with integrated audio ports.
	
	1. Transfer the star.wav file to a physical cassette or prepare it for playback in a system that has 3.5mm audio out capabilities.
	
	2. Insert the Astro BASIC cartridge and power up the Bally.
	
	3. With the BASIC overlay on the keypad, press the following sequence (will result in "INPUT")
	
		BLUE_SHIFT : WORD_SHIFT INPUT GO
	
	4. Play the audio file from the device attached to the cassette jack of the cartridge.
	
	5. If successful (within 30 seconds) you should see red background and green snowflake prompt.
	
	6. Press the following sequence (will execute "RUN")
	
		WORD_SHIFT RUN GO
	
	7. Watch the star generate and evolve endlessly!
	
	8. To halt program, press HALT (RUN) key.
	
	9. Power off Bally when done!

Description:

The Bally Astrocade only has 1,800 bytes available for development, and this memory doubles as the screen display! Every byte of data in this range interweaves the BASIC code with the screen data using even/odd bytes and other trickery. It never had an official keyboard peripheral, so all programming had to be completed using an integrated 24-button calculator keyboard with each key behaving up to four different ways depending on the preceding shift key.

To accomodate this limited hardware, a version of Palo Alto Tiny BASIC was produced dubbed Bally BASIC and some tokenized commands are available. The original edition had a 300 baud transfer rate and external cassette adapter, while a later iteration was commonely referred to as Astro BASIC and had an internal 2000 baud cassette interface built into the cartridge among other improvements.

Although minimalistic, Bally BASIC still offered versitile features for the time. You can easily interface with up to four joysticks including their analog potentiometers and use advanced sound-synthesizer commands to control three different voices independently. Many other platforms would require poking and peeking data into memory locations or calling machine language routines for similar functionality.

Bally BASIC supports a LINE command that allows you to draw around the screen. The origin point (0,0) is in the center of the screen and it can extend -80 pixels (left), 79 pixels (right), 43 pixels (top) and -44 pixels (down). Giving the system an effective resolution of 160x88, not bad for the era.

I decided to use the LINE command as the foundation for this star effect, versus the traditional approach of using the built-in asterisk character and text-output. Also because text-mode can only accomodate 11 lines of text, versus the 17 needed for this effect. Using the two available arrays in the BASIC language I essentially map half the star's points, then reverse that to draw the rest. I use variables to create some interesting effects in an endless loop. The LINE command has several different draw modes including using the foreground color, background color, invert or none. This lends itself nicely to creating even more variety in the small routine, which at times can look like snow glistening along the snowflake/ornament.

Comments:

For readability I did not do an excessive amount of optimization. Omiting the spaces would've saved quite a number of bytes, as would combining more code onto one line. Bally BASIC uses several different ASCII characters for what would be the same character in most other languages. The tilde used in the text source code is actually represented by asterisk on Bally that defines one of two built-in arrays, which is distinct from the mulitiplication symbol. Similar concept with forward slash vs. division, they are two different characters so depicting them in plain text is somewhat complicated.

One cool artifact of using screen memory for storage is that whatever the screen depicts gets saved to cassette, along with the code. To add a little flourish, I ran the program until it generated a particular snowflake design. Then I halted the program, adjusted the background and foreground colors to red/green and then printed it to tape. So every time the program loads, this static screen will show up just the way I formatted it.

Bally also supports up to 256 colors, but due to BASIC limitations can only show a single foreground and background color. Even so, I use this for a second flair by smoothly transitioning from the red (load) screen to a sky blue, and the snowflake art from black to white in the initial second or so that it runs. This is more eleagant than a harsh cut to blue from red and one creative use of the BASIC limitations at hand.

- Matt
https://YouTube.com/MattPilz
https://MattPilz.com
https://twitter.com/MattPilz