Jump to content

Photo

Programming the Bally Arcade/Astrocade


13 replies to this topic

#1 ballyalley OFFLINE  

ballyalley

    Stargunner

  • 1,372 posts
  • Location:Albuquerque, NM

Posted Tue Apr 12, 2016 12:46 PM

This post would ideally fit into an Astrocade programming sub-forum, but since such a forum doesn't exist, it will live here in the main Astrocade forum on AtariAge.com.  I posted a similar thread to the Bally Alley discussion group on Yahoo just a little while ago.  While this is a re-post (of sorts), it is actually my hope that this thread catches on and can become a focus area for people interested in programming the Astrocade.  If that happens, then I'll pin this thread in the forum so that it doesn't disappear in just a few weeks.

 

I wrote an article called "Programming the Bally Arcade/Astrocade," mostly to completion, back in 2012.  It wasn't until the Astrocade High Score Club peaked my interest again in programming the Bally Arcade system that I decided that it was time to finish and polish the article so that others could use it.  I finished it up today and posted it to BallyAlley.com.

 

Programming the Bally Arcade-Astrocade_tn.jpg

 

You can read "Programing the Bally Arcade/Astrocade," here:

http://www.ballyalle...rcade-Astrocade

 

The article explains how to set up the "PS Pad" text editor so that it will automatically assemble the source code of a program that runs on the Zilog Z80 CPU of the Bally Arcade/Astrocade. We'll be using the "Zmac" z80 cross-assembler, which is a command line-only program.

More specifically, you'll be guided through the process required to make "Zmac" the default editor for assembling Bally Arcade/Astrocade programs. Once these step-by-step directions are completed, "PS Pad" will be more than just a text editor; it will become a nearly complete Integrated Development Environment (IDE).

Here is what is covered in this article:

  1. Introduction
  2. Astrocade Programming Using the "Nutting Manual"
  3. Download the "Zmac" Assembler
  4. Download "PS Pad" and z80.ini
  5. Download the "Home Video-Game Library" Equates (HVGLIB.H)
  6. Set Up "PS Pad" for Use with the "Zmac" Assembler
  7. Test "PS Pad" by Assembling Z80 Source Code
  8. Summary

My friend Chris, who isn't an assembly language programmer, was this article's test subject (i.e. guinea pig).  He followed all of the steps in the article.  When he was done, he was able to assemble the cartridge "Treasure Cove" from its source code.  Hooray!  Then, because he is awesome (!), he edited the article to make sure it was easy enough for a beginner to follow.  Thanks for the help, Chris.  You rule!

I am especially interested in hearing feedback from anyone who follows these directions.  If you have any questions about programming the Bally Arcade/Astrocade console, then consider this the thread to express your thoughts and comments on the matter.

Enjoy the article!

Adam



#2 ballyalley OFFLINE  

ballyalley

    Stargunner

  • Topic Starter
  • 1,372 posts
  • Location:Albuquerque, NM

Posted Tue Apr 12, 2016 1:53 PM

I have added Software and Hardware for the Bally Arcade - A Technical Description (unofficially, but commonly, called the "Nutting Manual") to archive.org.  This is a 179MB grayscale version of the manual that has had the large red watermark removed from all of the pages.  The manual describes the Bally Home Video-Game System. The description begins with a discussion of the major sub-sections of the system. Following this, each sub-section is presented in greater detail. The particulars include sequence-calling and resource use.


The major sub-sections of the system are:

  1. The User Program Interface - Allows cartridges to reference the system routines through a standard interface. Includes an interpreter.
  2. The Screen Handler - A complex set of routines for creating
    screen images. Includes facilities for initialization, pattern and
    character display, coordinate conversion, and object vectoring.
  3. The Interrupt Processor - Decrements timers, plays music and produces sounds.
  4. The Human Interface - Reads keyboard and control handles, and inputs game selection and options.
  5. Math Routines - A package of routines for manipulating floating BCD numbers.

Also included in the "Nutting manual" are the complete source-code listings for the console's four built-in programs (Calculator, Checkmate, Gunfight and Scribbling).

 

The manual can be downloaded here:

 

https://archive.org/...ttingAssociates

 

I expected there to be a preview of the manual available after I uploaded it to Archive.org, but one doesn't exist yet (Jason Scott tells me it can take several hours for this to appear).  In the meantime, even if you can't preview the document, you can download the pdf from there and use it on your computer.

 

Adam



#3 5-11under OFFLINE  

5-11under

    River Patroller

  • 3,202 posts
  • Location:Ontario, Canada

Posted Tue Apr 12, 2016 3:56 PM

Now all I need is a Bally.



#4 ballyalley OFFLINE  

ballyalley

    Stargunner

  • Topic Starter
  • 1,372 posts
  • Location:Albuquerque, NM

Posted Tue Apr 12, 2016 4:50 PM

Now all I need is a Bally.

 

Nah, you don't need a Bally console to program for it.  Just like you don't need an a Atari 2600 to write for that system.  That's the beauty of emulation.

 

You can program the Bally Arcade using the Astrocade emulator included in MAME.  This actually works well.  Heck, if you use MAME, then technically you can make use of the Astrocade chipset in hi-res mode (204x320 pixels) rather than the standard low-res mode (102x160 pixels).  Of course, anything that uses hi-res mode won't work on a real Astrocade.  The arcade games "Wizard of Wor," "Gorf" and others use the Astrocade chipset.

 

Programming in hi-res mode would require one of the arcade emulators in MAME, rather than the Astrocade emulator.  I can't think of any examples of anyone doing this, but there is no reason it couldn't be done.  As an example, David Turner hacked his original "Gorf" to say some amusing phrases back in 2008:
 

 

For a complete list of the arcade games that use the Astrocade chipset, see this document:
 
http://www.ballyalle...rcade_games.txt

 

If anyone knows of any arcade chipset games that have been hacked, then I'd be interested in reading about them (or even trying them out, if possible).

 

Adam



#5 nitrofurano OFFLINE  

nitrofurano

    Moonsweeper

  • 260 posts
  • meditating
  • Location:porto

Posted Fri Mar 3, 2017 11:53 AM

instead of Zmac, i’m really interested about how to use Pasmo only for that (alone, without whatever library)

if anyone know where can we find, it would be really great! (or if anyone can convert those Zmac-based .asm files into Pasmo-based, please do and share to us!)

thanks a lot in advance! :) 



#6 nitrofurano OFFLINE  

nitrofurano

    Moonsweeper

  • 260 posts
  • meditating
  • Location:porto

Posted Fri Mar 3, 2017 12:08 PM

i’m trying this code now, i really have no idea why this is not working....

http://pastebin.com/raw/NyXsm2uv



#7 nitrofurano OFFLINE  

nitrofurano

    Moonsweeper

  • 260 posts
  • meditating
  • Location:porto

Posted Fri Mar 3, 2017 2:16 PM

finally i got one example working: http://pastebin.com/raw/kK8y2e7a

soon i’m going to have something working from Boriel’s ZX-Basic Compiler



#8 nitrofurano OFFLINE  

nitrofurano

    Moonsweeper

  • 260 posts
  • meditating
  • Location:porto

Posted Sat Mar 4, 2017 5:05 AM

started something on Boriel’s ZX-Basic Compiled: http://www.boriel.co...cade#first_test

(it was far simpler that i could imagine, i guess that there are no excuses for not developing something for this really interesting game console! :D )



#9 ballyalley OFFLINE  

ballyalley

    Stargunner

  • Topic Starter
  • 1,372 posts
  • Location:Albuquerque, NM

Posted Tue Mar 7, 2017 9:40 AM

instead of Zmac, i’m really interested about how to use Pasmo only for that (alone, without whatever library)

if anyone know where can we find, it would be really great! (or if anyone can convert those Zmac-based .asm files into Pasmo-based, please do and share to us!)

 

I'm not familiar with the Pasmo assembler.  I did find this link for it:

 

http://pasmo.speccy.org/#docu

 

Is this the assembler that you're using?

 

Adam



#10 ballyalley OFFLINE  

ballyalley

    Stargunner

  • Topic Starter
  • 1,372 posts
  • Location:Albuquerque, NM

Posted Tue Mar 7, 2017 9:49 AM

started something on Boriel’s ZX-Basic Compiled: http://www.boriel.co...cade#first_test

(it was far simpler that i could imagine, i guess that there are no excuses for not developing something for this really interesting game console! :D )

 

Hmm.  I'm confused by this.  I'm not overly familiar with the ZX Spectrum, although as a semi-regular reader of Retro Gamer magazine, I am familiar with it, but certainly not on an intimate level.  Did you use the ZX-BASIC compiler to somehow create a binary file for the Astrocade that executes as a cartridge?

 

In one of your previous posts, you wrote that you'd rather not use "Zmac [...] without whatever library]"  By this statement, I think that you mean that you don't want to use any of the on-board subroutines using the HVGLIB.H (Home Video Game Library).  If that's the case, then be aware that if you make any direct calls to the systems ROM (without going through the on-board system subroutines) then you can run into some compatibility issues between the three ROM versions that were released for the Bally Arcade/Bally Home Library Computer and the Bally Astrocade.

 

Adam



#11 ballyalley OFFLINE  

ballyalley

    Stargunner

  • Topic Starter
  • 1,372 posts
  • Location:Albuquerque, NM

Posted Wed Mar 8, 2017 8:58 PM

I have added Michael Matte's hand-written Z80 source code and instructions for his High-Res "Test Rotate" Routine to BallyAlley.com.  He sent this to me in the mail yesterday.  Michael just wrote this routine this year.

The "Rotate" routine rotates a 4x4 pixel pattern that resides in the Astrocade's user RAM. This routine was written for use on a modified high resolution Astrocade, but (this is the cool part), this routine can be modified for use on a normal Astrocade.

For those unaware how cool this is, the "Nutting Manual" (sort of the Astrocade's programming Bible) says that the rotate function of the Magic System does not function on a low-res Astrocade console. Specifically, page 98 of the manual says, "the rotator can only be used in commercial [hi-res] mode." However, Michael discovered that it is just a case that the on-board graphic subroutines in the Astrocade's ROM do not support the Rotate function. The Astrocade's hardware does support the rotate function, but the user has to write the routine to tell the hardware to rotate the pattern. The documentation included with this hand-written Z80 source code provides the needed changes to use the rotate function on a low-res Astrocade unit.
 

The routine, as written, does the following:

 

  1. Sets a high-res Astrocade screen map to "High-Res" mode.
  2. Clears the top 10 lines on screen.
  3. Outputs "Rotate" bit to Magic Register.
  4. Sets Magic address to display rotated pattern midway at top of screen.
  5. Writes the initial pattern a second time at the same exact Magic address.
  6. The Astrocade hardware then rotates the initial pattern 90 degrees.
  7. The Z80 halts and continues executing NOP's until the Astrocade Reset button is pressed.
     

I haven't tested this code, but Michael used it in both hi-res and low-res modes of his modified Astroacade.

You can download the hand-written source code here:
 

http://www.ballyalle...stRotateRoutine

 

I've already re-typed this entire rotate document and source code (including all the documentation and comments) and assembled it using Zmac with no errors.  However, I have not yet compared the output code against the hand-written listing.  I'll do this over the next few days.  After that, I'll modify the source code to try the routine on a low-res system, then it's off to test the routine under the Astrocade emulator, and (eventually) under the Machine Language Manager cartridge.  Maybe by the weekend, or possibly next week, I'll have this done.


For all those Z80 programmers out there, I'd say this is pretty awesome!

Adam



#12 nitrofurano OFFLINE  

nitrofurano

    Moonsweeper

  • 260 posts
  • meditating
  • Location:porto

Posted Tue Mar 14, 2017 2:28 PM

yes, that is the Pasmo, a quite simple cross-compiler, it is multiplatform, and available by default from Debian and Ubuntu repositories (perhaps on most of the other GNU/Linux distributions as well - since i use GNU/Linux over 99% of the time, having a cross-compiler like this easily and natively available is really important and useful for me )

 

and yes, i were using an ansi-basic cross-compiler designed for ZX-Spectrum, and it is really great for creating z80 binaries for most of all other z80-based hardware, Bally-Astrocade included - for the “patchwork”, we just need to know the particularities of each hardware, and make the needed adaptations, like adding specific functions and routines, avoiding those related to ZX-Spectrum, etc. - for doing such “patchwork” automatically i were using bash scripts, but i think similar scripting can be done on other non-bash cli-based tools (like dos-prompt used on ReactOS and ms-Windows)

 

the situation about Zmac and HVGLIB.H is that they “scares” newbies like me! :D - it was difficult to find simple and pure code (without includes) which we could start almost from scratch - it was a great “luck” for me having some stuff working, but it took a few years (almost 5, i guess! :D ) for figuring out how Bally-Astrocade works (almost the same time i were trying to do something for Bandai RX78, a quite rare japanese z80-based home computer) - but see that i’m not misregretting HVGLIB.H at all, for sure it has really great information, and i have it saved as a very valid reference documentation

 

and thanks also for all information you’re sharing! :) 



#13 Komb' OFFLINE  

Komb'

    Combat Commando

  • 7 posts
  • Location:Scarborough, Ontario, Canada

Posted Tue May 23, 2017 6:11 PM

Never heard of Pasmo before.

 

Yep, it's there in my repository...

 

Moved my latest code plus HVGLIB.H to a new folder/directory and gave it a try.

 

OK, I Have to specify 'file.asm file.bin'. I'm used to only specifying  code file and having .bin and .lst generated automaticly.

 

Resulting .bin runs in MESS. :)

 

I'm happy.



#14 ballyalley OFFLINE  

ballyalley

    Stargunner

  • Topic Starter
  • 1,372 posts
  • Location:Albuquerque, NM

Posted Sat May 27, 2017 2:35 PM

I have added Michael Matte's Bally Arcade/Astrocade Gunfight Assembly Language Breakdown to BallyAlley.com.
 

http://www.ballyalle...ownMichaelMatte

 

I wrote an overview for the document, which I'm including here: 
 
The breakdown includes:
 
1) Overview and Q&A - An introduction and overview of the Z80 machine language breakdown of Gunfight.  Also included is some background material asked of Michael Matte in a Q&A format.
 
2) Gunfight Breakdown (Typed) - The first two pages of the breakdown have been typed and are included to make the pdf document friendlier to Internet search engines.
 
3) Handwritten Gunfight Breakdown - Michael Matte's complete, 42-page breakdown of the Astrocade game Gunfight.  This breakdown will be most useful if used with the source code for the Bally's 8K system ROM, which is available in the "Nutting Manual."
 
4) Errata Sheet - Two pages of corrections for errors and/or omissions made in the handwritten document.
  
Overview
 

The Bally Arcade/Astrocade game system was released in January 1978 by Bally.  It was re-released in 1981 by Astrovision, Inc.  The system has an 8K ROM with four built-in programs: Gunfight, Checkmate, Calculator and ScribblingGunfight is a home port of the B&W arcade game Gunfight, released by Midway in November 1975.  The original release of the game was called Western Gun: it was released by Taito in Japan and used, as was the convention at the time, discrete logic (i.e. the system didn't use a CPU).  The North American arcade version of Gunfight moved away from the original design.  It is usually credited as the first arcade game to use a microprocessor (the Intel 8080 CPU).  The Midway arcade version of Gunfight was programmed by Tom McHugh.

 

The Astrocade version of Gunfight is probably the most sophisticated of the four programs built into the Astrocade.  The Software and Hardware for the Bally Arcade - A Technical Description (aka "Nutting Manual" and/or "The Handbook of Hardware & Software") has the complete Z80 assembling language source listing for the game.  Many people used this manual, which could be purchased through the Arcadian newsletter, to learn to program the Bally Arcade/Astrocade.

 
In the 1980s, Michael Matte, a passionate Astrocade user, used the source listing for the 8K ROM as a basis for his detailed breakdown of Gunfight.  Michael created the breakdown "to provide beginner assembly or machine language programmers an inside look at the game Gunfight.  The documentation will reveal how on-board subroutines in the System ROM can be used to execute particular tasks.  The 'special routines' listing can be used as a reference source for programming demos or games."
 
Michael Matte: Questions & Answers
 
In May of 2017, Michael Matte sent me his 42-page handwritten Gunfight breakdown so that it could be archived on BallyAlley.com.  The following are a few questions, asked via email, about the creation of the intriguing document.
 
Adam: When did you write the breakdown of Gunfight?  How long did it take you?

Michael: "Wrote this breakdown back in the 80's.  Don't recall what year I wrote it or how long it took.  Must have rewritten it because the breakdown is well organized.  Had no word processor or printer at that time."

Adam: Did you ever share it with anyone before now?

Michael: "I wrote it for myself for future reference.  I did not share it with anyone.  It does provide insight as to how one can use the on-board subroutines to create a demo or game.  I feel it does a better job with comments then what I have seen so far in Gunfight documentation.  I also plan this style of documentation when I breakdown The Incredible Wizard with a greater emphasis on comments and details on the many routines utilized to create all that wonderful graphics and animation.  The intent of my IW breakdown will be to open the door for those interested in developing skills in programming graphics in assembly or machine language and for future reference."
 
Adam: What was your experience with Z80 machine language when you began the project?
 

Michael: "I developed my skills prior to writing my Gunfight breakdown by attacking the on-board subroutines.  I first broke down the UPI [User Program Interface] instruction by instruction using the Nutting Manual's ROM documentation, then broke down a bunch of the on-board sub's with an emphasis on the graphics routines.  I documented that effort for future reference and learned a lot.  I also broke down some of Andy Guevara's ML work and learned a great deal.  Having Bit Fiddler's MLM [Machine Language Manager cartridge] was great because it allowed me to experiment and write ML routines and then eventually come up with high-res MLM."

 
Adam: What tools did you use to examine the game's code (i.e. the MLM)?

Michael: "I have 2 books covering Z80 machine and assembly language which provide detailed info on using the Z80 instructions and other goodies.  Having the MLM breakdown as part of the MLM User Manual plus my previous ML experience allowed me to figure out how MLM worked."
 
Adam: I presume that you based your breakdown on the ROM's Z80 source code that was included with the "Nutting Manual."  Is that correct?

Michael: "I did use the Nutting Manual's breakdown on Gunfight as a guide and then expanded that info documenting it with a non-traditional style for future reference in creating or breaking down an Astrocade game.  After looking at my Gunfight breakdown recently, I could have spent more time on it with regard to comments because there are some parts of the breakdown that are vague.  However, when I get to the advanced programming examples in my 'In-Depth Look At..' series, I will be presenting a bunch of ML examples using my Gunfight breakdown as a guide and could add some more comments (for my use) to it then."
 

Enjoy Michael's very detailed breakdown of Gunfight!

Adam






0 user(s) are browsing this forum

0 members, 0 guests, 0 anonymous users