Jump to content
IGNORED

Programming the Bally Arcade/Astrocade


ballyalley

Recommended Posts

A few updates with tips and tricks I learned along the way...

 

I made a simple .bat file that compiles the source code, copies the ROM into the proper MAME folder, and opens the ROM in MAME all at once. It makes the dev/test cycle quite easy!

 

zmac -o mygame.bin mygame.asm
copy mygame.bin "C:\<your-path-to>\mame\roms\astrocde\" 
cd "C:\<your-path-to>\mame\"
mame64.exe astrocde -cart "C:\<your-path-to>\mame\roms\astrocde\mygame.bin"

I wanted to try full-screen graphics for the Astrocade, but after hand-coding 100 bytes or so of pixels, I realized it'd be nicer to write a web app to convert a BMP for me. So, I whipped up some Javascript that accepts a locally-stored 160x102 BMP and displays the byte codes row by row like this:

 

; ASTROCADE GRAPHICS

; Row 1
DB $0, $0, $0, $6, $aa, $aa, $aa, $aa, $aa, $aa, $aa, $aa, $aa, $aa, $aa, $a0, $0, $0, $0, $0, $0, $0, $0, $6, $aa, $aa, $aa, $aa, $aa, $aa, $aa, $aa, $aa, $aa, $aa, $aa, $c0, $0, $0, $0
; Row 2
DB $0, $0, $0, $a, $aa, $aa, $aa, $aa, $aa, $aa, $aa, $aa, $aa, $aa, $aa, $aa, $a8, $0, $0, $0, $0, $0, $0, $a, $aa, $aa, $aa, $aa, $aa, $aa, $aa, $aa, $aa, $aa, $aa, $aa, $aa, $b0, $0, $0
; Row 3
DB $0, $0, $0, $a, $aa, $aa, $aa, $aa, $aa, $aa, $aa, $aa, $aa, $aa, $aa, $aa, $aa, $aa, $0, $0, $0, $0, $0, $a, $aa, $aa, $aa, $aa, $aa, $aa, $aa, $aa, $aa, $aa, $aa, $aa, $aa, $aa, $a0, $0
...

The code is on GitHub, though it's suuuuper hacky and unfinished, as I made it as quickly as possible and just to convert my specific BMP rather than the full range of different BMP color depths, byte orders, etc. Right now, it's also hardcoded to accept just four colors. However, I'll continue working on it in December and host it on my site so it can actually be useful to other people! :)

 

Here's the result from my BMP conversion as seen in the MAME Astrocade emulator:

 

0000.png

 

OK, this is too fun...

 

(P.S. Adam, you can see some of my NES projects such as ConnectedNES on my website, nobadmemories.com.)

 

 

perhaps later, you might want to try the compression/decompression methods Daniel Bienvenu shared somewhere in this forum (Colecovision development)

Link to comment
Share on other sites

 

A Snake game. Where is your "Astrocade stuff." Is it online someplace?

 

Adam

 

i shared here above in this thread - http://www.boriel.com/wiki/en/index.php/ZX_BASIC:Released_Programs_-_BallyAstrocade- it might look like nothing, but they provide some experimental interaction - as soon i start to try coding some more stuff for Astrocade (like games), they will be placed there - as well, sorry about my huge laziness on uploading all my stuff in places like github (lots of examples for lots of hardware that i didn’t organize decently enough yet)

Edited by nitrofurano
Link to comment
Share on other sites

Dev update: Still making demos :). About to get into animation and sound. The UPI concept is pretty interesting.

 

Speaking of sound, I noticed a request on the Bally Alley website to clean up some of the notes in the Happy Birthday music demo, so I took a shot at it. Here's my version:

; Title - Happy Birthday Music

MUSSTK  EQU     $4F12            ; Music Stack Pointer

        INCLUDE "HVGLIB.H"

        ORG     $2000            ; First byte of Cartridge

        DB      "U"              ; User System Sentinel

        DW      MENUST           ; Next menu link
        DW      PRGNAM           ; Address of title for program
        DW      PRGST            ; Jump here if prog is selected

; Main Program
PRGST:  DI
        SYSTEM  (INTPC)
        ;
        DO      (SETOUT)         ; UPI - Set Display Ports 
        DB      90*2             ; ... Vertical Blanking Line (Line 90)
        DB      44               ; ... Left/Right Color Boundary
        DB      $08              ; ... Interrupt Mode
        ;
        DO      (COLSET)         ; UPI - Set Color Registers
        DW      COLTAB           ; ... Color Table
        ;
        DO      (FILL)           ; UPI - Screen Fill
        DW      NORMEM           ; ... Destination
        DW      4000D            ; ... Bytes to move
        DB      $00              ; ... Background color
        ;
        DO      (STRDIS)         ; UPI - Display String
        DB      10               ; ... X coordinate
        DB      30               ; ... Y coordinate
        DB      01101000B        ; ... Options (2x X-OR Write in Color 2)
        DW      STRING           ; ... Address of string to display
        ;
        DO     (ACTINT)          ; UPI - ACTivate sub timer INTerrupts
        ;
        DO      (BMUSIC)         ; UPI - Begin Playing "Happy Birthday" Music
        DW      MUSSTK           ; ... Music Stack
        DB      11000000B        ; ... Setup Voices, Use Tone A
        DW      BDAY             ; ... Music Score for "Happy Birthday"
        ;
        EXIT

LOOP:   NOP
        JP      LOOP             ; Infinite loop

; Color Table #1
COLTAB: DB      $00              ; Color 3 Left  - Black
        DB      $5A              ; Color 2 Left  - Red
        DB      $77              ; Color 1 Left  - Yellow
        DB      $07              ; Color 0 Left  - White
        DB      $00              ; Color 3 Right - Black
        DB      $5A              ; Color 2 Right - Red
        DB      $77              ; Color 1 Right - Yellow
        DB      $07              ; Color 0 Right - White

PRGNAM: DB      "HAPPY BIRTHDAY      (120 BPM)",0

STRING: DB      "  HAPPY    BIRTHDAY!",0

; "Happy Birthday" Music Score 
; 1/8 Note = 15          1/2 Note  = 60
; 1/4 Note = 30          Full Note = 120
BDAY:   
        ; Happy birthday to you      
        MASTER  OA1              ; Master Oscillator (User HVGLIB.H Note Value)
        VOLUME  $0A, $00         ; Set Volumes TONE A = 10, Tone B = 0, and Tone C = 0
        NOTE1   15,G5            ; 1/8 Note
        LEGSTA                   ; Turn on LEGATO
        NOTE1   15,G5            ; 1/8 Note 
        NOTE1   30,A5            ; 1/4 Note
        NOTE1   30,G5            ; 1/4 Note 
        MASTER  OA3              
        NOTE1   30,C4            ; 1/4 Note
        NOTE1   30,B3            ; 1/2 Note
        LEGSTA                   ; Turn off LEGATO
        MASTER  OA2
        VOICEM  11110000B        ; Set Voices, Use Tones A and B
        VOLUME  $AA,$00          ; Set Volumes, Tone A = 10, Tone B = 10, and Tone C = 0
        NOTE2   30,F4,G4         ; 1/4 Note

        ; Happy birthday to you
        VOICEM  11000000B        ; Set Voices, Use Tone A
        VOLUME  $0A, $00         ; Set Volumes
        MASTER  OA1              
        NOTE1   15,G5            ; 1/8 Note
        LEGSTA                   ; Turn on LEGATO
        NOTE1   15,G5            ; 1/8 Note
        NOTE1   30,A5            ; 1/4 Note          
        NOTE1   30,G5            ; 1/4 Note
        MASTER  OA3
        NOTE1   30,D4            ; 1/4 Note
        MASTER  OA2
        NOTE1   30,C5            ; 1/4 Note
        LEGSTA                   ; Turn off LEGATO
        VOICEM  11110000B        ; Set Voices, Use Tones A and B
        VOLUME  $AA,$00          ; Set Volumes, Tone A = 10, Tone B = 10, and Tone C = 0
        NOTE2   30,E4,G4         ; 1/4 Note

        ; Happy birthday, dear _____
        VOICEM  11000000B        ; Set Voices, Use Tone A
        VOLUME  $0A, $00         ; Set Volumes, TONE A = 10, Tone B = 0, and Tone C = 0
        MASTER  OA1
        NOTE1   15,G5            ; 1/8 Note
        LEGSTA                   ; Turn on LEGATO
        NOTE1   15,G5            ; 1/8 Note
        MASTER  OA3
        NOTE1   30,G4            ; 1/4 Note               
        NOTE1   30,E4            ; 1/4 Note
        MASTER  OA2
        NOTE1   30,C5            ; 1/4 Note
        MASTER  OA3             
        NOTE1   30,B3            ; 1/4 Note
        NOTE1   30,A3            ; 1/4 Note
        LEGSTA                   ; Turn off LEGATO

        ; Happy birthday to you
        VOICEM  11110000B        ; Set Voices, Use Tones A and B
        VOLUME  $AA,$00          ; Set Volumes, Tone A = 10, Tone B = 10, and Tone C = 0
        NOTE2   15,F4,A4         ; 1/8 Notes
        VOICEM  11000000B        ; Set Voices, Use Tone A
        VOLUME  $0A,$00          ; Set Volumes, TONE A = 10, Tone B = 0, and Tone C = 0
        NOTE1   15,F4            ; 1/8 Note
        LEGSTA                   ; Turn on LEGATO
        VOICEM  11110000B        
        VOLUME  $AA,$00          
        NOTE2   30,E4,G4         
        NOTE2   30,C4,G4        
        NOTE2   30,B3,D2         
        MASTER  OA2              
        VOICEM  11000000B        
        VOLUME  $0A,$00          
        NOTE1   30,C5            
        VOLUME  $AA,$00          
        VOICEM  11110000B        
        NOTE2   15,E4,G4         

        QUIET
  • Like 2
Link to comment
Share on other sites

btw, sorry about the snake game, i’m seeing that (as far as i can remember) Astrocade only has 4kb ram, which 3.75kb is for display, remaining 256 bytes for variables and everything else (not bad for the time it was manufactured, Atari 2600 only had 128 bytes of ram for everything! :D ), so having the snake no much larger than 64 tiles might be not that fun (i think that on Minivaders (testing arcade machine board from Taito) version i needed to limit it to 256 tiles - anyway, i’m about publishing it, but it would be almost unplayable! :D

Link to comment
Share on other sites

 

Dev update: Still making demos :). About to get into animation and sound. The UPI concept is pretty interesting.

 

Speaking of sound, I noticed a request on the Bally Alley website to clean up some of the notes in the Happy Birthday music demo, so I took a shot at it. Here's my version:

 

(...)

 

sorry my laziness... do you have the compiled version hosted somewhere? (it’s because it seems to be non-Pasmo, plenty of macros, needs hvglib.h, etc...)

 

and interesting that it has 3 channels and volume in each, is it like sn76489? about using 3 channels, one experience i made was on Casio PV1000 console (quite rare game console, only 15 games released, half from Konami), but it has no volume, and the tone precision might provide “disastrous” results! :D -

http://www.boriel.com/wiki/en/index.php/ZX_BASIC:Released_Programs_-_PV1000#Scott_Joplin_-_Maple_Leaf_Rag

(the tune was edited on VortexTracker, runs fine on Wine)

Edited by nitrofurano
  • Like 1
Link to comment
Share on other sites

sorry about the snake game, [...] having the snake no much larger than 64 tiles might be not that fun

 

There are a few Snake-type games written in BASIC for the Astrocade. Here are just two of them:

 

1) Snake Snack, by Ken Lill - Released in 1988 for the Bally Arcade. This program requires Blue RAM BASIC 1.1 and a RAM expansion unit. This version of the program was played from the Ultimulti cartridge, a multicart released by Ken Kill for the Astrocade. Here my video review of Snake Snack:

 

 

2) Caterpillar, by Thadd*Pro (Kevin O'Neill) - This "AstroBASIC" game originally appeared as a type-in program in the newsletter Niagara B.U.G. Bulletin, 1.7 (September 6, 1983): 8-10. It was later reprinted in Arcadian, 6.10 (Aug. 24, 1984): 95. There is a 1986 revised version Caterpillar by Klaus Doerge. It's more colorful and adds a potentially higher score for multiple players. I played both games and I prefer the original version. Here is my video review of Caterpillar:

 

 

The Atari 2600 only had 128 bytes of RAM and it had the (not-so-good) snake-like game called Surround. The Astrocade has Checkmate built-in, so I'm sure a machine language Snake game could be written. I guess that if you're worried about RAM usage, then you could store the used/unused bitmap screen location using bits. I'm sure that some memory-saving scheme could be worked out.

 

Adam

Link to comment
Share on other sites

and interesting that [the Astrocade] has 3 channels and volume in each, is it like sn76489? about using 3 channels

 

The way sound works is decribed in the "Nutting Manual," starting on page 103:

 

https://archive.org/stream/SoftwareAndHardwareForTheBallyArcadeATechnicalDescriptionDaveNuttingAssociates/Software%20and%20Hardware%20for%20the%20Bally%20Arcade%20-%20A%20Technical%20Description%20(Dave%20Nutting%20Associates)#page/n113/mode/2up

 

The Astrocade's sound is generated as part of the I/O chip, which is described in the "Nutting Manual," starting on page 118:

 

https://archive.org/stream/SoftwareAndHardwareForTheBallyArcadeATechnicalDescriptionDaveNuttingAssociates/Software%20and%20Hardware%20for%20the%20Bally%20Arcade%20-%20A%20Technical%20Description%20%28Dave%20Nutting%20Associates%29#page/n129/mode/2up

 

It's interesting that you chose to include a link to the Casio PV1000 playing Scott Joplin's "Maple Leaf Rag." This song was made available on George Moses' 1981 tape release Scott Joplin Ragtime Classics. All of those songs are available here:

 

http://www.ballyalley.com/audio/george_moses/Scott_Joplin_Ragtime_Classics_[Tape_3]/joplin.html

 

Here is a direct link to the mp3 recording of the Astrocade playing Maple Leaf Rag (this song will probably play best if you save it to your computer first and then listen to it from there):

 

http://www.ballyalley.com/audio/george_moses/Scott_Joplin_Ragtime_Classics_[Tape_3]/04%20-%20Maple%20Leaf%20Rag.mp3

 

I love the sound effects that can be created on the Astrocade. For a system that was first made available in January 1978, the Astrocade's sound effects are great. They sound very arcade-like to me. Even upon the Bally Arcade's re-release as the Astrocade in 1981, the sound's that the system could generate were still impressive. For an excellent example, listen to the see sound effects in The Incredible Wizard:

 

 

Pretty fantastic, right?

 

Adam

  • Like 1
Link to comment
Share on other sites

thanks, @ballyalley ! :)

 

btw, i uploaded it right now: http://www.boriel.com/wiki/en/index.php/ZX_BASIC:Released_Programs_-_BallyAstrocade#Just_Another_Snake_Game

 

the problem of the snake version is that i’m assuming the display area as a kind of “text mode” with 40x16 size (using 4x6 tiles - 640 tiles) - what i’ll struggle then is to have the snake larger than using 96 tiles (ram size always unexpanded)

 

anyway, i still need to fix the code - the snake is starting with 4 tiles, and the 5th isn’t yet erasing the tail’s trail, and the game crashes after some while.

 

besides the bug, i think this example can be considered as a kind of humble sneak peek of what can be done for Bally Astrocade using Boriel’s ZX-Basic Compiler

 

-----

 

i used Scott Joplin's Maple Leaf Rag for lots of reasons: it’s public domain, i enjoy ragtime music (as everything related with early jazz), it was the soundtrack of the very best msx1 games i ever played (Skooter - would be great seeing it converted to Colecovision and Sega SG1000 anytime soon), etc.

Edited by nitrofurano
Link to comment
Share on other sites

Speaking of sound, I noticed a request on the Bally Alley website to clean up some of the notes in the Happy Birthday music demo, so I took a shot at it. Here's my version:

Thanks for improving my terrible version of the Happy birthday song. I just assembled the code and tried it out in MAME. It does sound better to me. I wish I understood the first thing about music. Well, I guess I understand the first thing... just not the second or third thing (and on and on). Here is a link to both the original version and to the improved version:

 

http://www.ballyalley.com/ml/ml_homebrew/ml_homebrew.html#HappyBirthdayAstrocade

 

It's always nice to add new Z80 code to the Bally Alley website. Thanks!

 

Adam

  • Like 1
Link to comment
Share on other sites

  • 3 weeks later...

I'm also throwing Astrocade dev stuff on Github at https://github.com/hxlnt/astrocade. There, you'll find a few things I've made:

  • Demos (compiled and source).
  • Compile and launch batch script.
  • Astropaint, a browser-based tool for drawing Astrocade screens. It outputs a .gfx Z80 file that can be INCLUDEd in your source. Demo it here.

Here's an example of something I made with Astropaint. As you can see, it incorporates the Astrocade color palette and movable color boundary.

 

post-62680-0-90311400-1519542165_thumb.jpeg

 

If anyone ends up using anything here, let me know!

Link to comment
Share on other sites

you'll find a few things I've made [...] Astropaint, a browser-based tool for drawing Astrocade screens. It outputs a .gfx Z80 file that can be INCLUDEd in your source. Demo it here.

 

I tried the online demo of Astropaint and I could not use it. I'm using the 64-bit version of Windows 7. In Firefox, Astropaint looks like this:

 

post-4925-0-62270400-1519582480_thumb.gif

 

I can click and choose colors. I can turn on and off the gridlines (although there is quite some delay between the click and it happening). I can't draw. Do I have to enter a special mode to draw? I'm using the latest version of Firefox (58.0.2).

 

Since Firefox didn't work for me, I tried Internet Explorer 11 (version 11.0.50). The screen doesn't look right at all:

 

post-4925-0-14894900-1519582602_thumb.gif

 

Is there a preferred version of broswer that I should use with Astropaint?

 

I actually programmed for the Astrocade for the first time in quite a while just a few days ago. This programming tool is coming at just the right time for me to explore it. I'll look into it and the demos later in the week. It's great the this tool exists... if only I had some artistic talent. ;-)

 

Adam

  • Like 1
Link to comment
Share on other sites

whoooaaa, very strange! but thanks for the feedback--obviously i should work on fixing that! i've tested the app in chrome on mac osx and in chrome and edge on windows 10. i just pulled it up on safari, and i'm seeing the "not able to draw" issue in mac osx as well. i'll try to push out a fix for that soon.

Link to comment
Share on other sites

i just pushed a quick fix that should get it partially working on safari and firefox now. you can click to draw, but you can't click and drag to draw just yet.

 

use this link going forward; the old one was just good for that specific build. oops. https://rawgit.com/hxlnt/astrocade/master/tools/astropaint/index.html

 

i'll try to finish up the fix this week. thanks again for the heads up!

 

it might also be good to zoom out on the page a bit (Ctrl + -) until I can put in a fix the scaling issue. :P

Link to comment
Share on other sites

  • 2 weeks later...
  • 2 months later...

Just wanted to throw in some updates on Astrocade dev tools I've been working on...

 

I've released the first version of astroimg, a little Python script that takes any image and converts it to ready-to-compile Astrocade source code. The script actually produces two files--the ROM itself, which simply displays the graphic, and a separate .gfx file that contains the raw graphic data. One cool feature is that it optimizes for the Astrocade's 8-color palette by determining the best place to position the horizontal color boundary, creating separate palettes for each half of the image, then putting that boundary and palette into the resulting ROM. Here's an example:

post-62680-0-26718400-1527636087.gif
This image isn't the best, in part because I used a webcam photo with poor lighting and a messy studio behind me. And in the real world, you would probably choose a softer color palette than the bright red and magenta shown here. But hopefully you get the idea. You can also dither the image by passing in a --dither flag at the command line. If you're comfortable running Python scripts without an accompanying instruction guide, you can grab the tool at https://github.com/hxlnt/astrocade/tree/master/tools/astroimg. The code works OK, but it's in serious need of some refactoring, so that's what's next for me. I wrote it all in about 2 nights, so it definitely looks like frenzied-girl-at-a-hackathon code. I may also try to do some smart resizing/cropping, as right now the script just squashes everything to 160x102 regardless of the image's original aspect ratio.
I'd like to eventually make astroimg interoperable with my astropaint tool so that you can convert an image, upload it into astropaint, and tweak it by hand. Instead of doing that useful work this weekend, I used astropaint to sketch out an adventure game title screen instead...
post-62680-0-38773900-1527636823_thumb.png
Additionally, I posted another demo on GitHub. You may recognize it as a shameless ripoff of tribute to the COLOR PICK demo, but refactored to dynamically adjust the horizontal color boundary.
post-62680-0-10462000-1527636800_thumb.png
I've been thinking about making a music composition tool next. Or a Bally BASIC WAV generator. (Does such a thing exist already?)
OK, that's all for now. Let me know if you end up finding any of this stuff useful! ;)
  • Like 1
Link to comment
Share on other sites

I've released the first version of astroimg, a little Python script that takes any image and converts it to ready-to-compile Astrocade source code.

 

It looks like I'll have to install Python. There is an Astrocade tape archiving tool that I use Python for, but my version of Python is outdated and it doesn't work good anymore. I'll have to look into this and download the language in the next couple of days. I want to try Astroimg-- it looks very fun. What size does the input image need to be in for this program?

 

This image isn't the best [...] But hopefully you get the idea.

 

The image looks very cool to me! About ten years or so ago I tried to get Lynn Minmay (from Robotech) to display as an image on the Astrocade. I was trying to do this by hand (ugh!) and the work was, let's just say, less than stellar. Now I want to really see the Astrocade display that cute little singer who made even the Zentraedi fall for her.

 

The code works OK, but it's in serious need of some refactoring, so that's what's next for me.

I had never heard the term refactoring before now; I had to look it up. I like learning new words, especially in this case when it's a word that replaces a tired-old phrase like, "The code sucks, but it works good-- damn, I need to improve it!"

 

I'd like to eventually make astroimg interoperable with my [...] astropaint

 

That would be very cool! The last time I tried Astropaint it was very slow to respond to me. I need to try it again.

 

Instead of doing that useful work this weekend, I used astropaint to sketch out an adventure game title screen instead...

Crystal of Amparah. That sounds very interesting. The title screen reminds me of something I might see on the Spectrum. I presume these screens aren't compressed, so they eat up lots of memory. Is that right?

 

I've been thinking about making a music composition tool next.

 

I don't think there is a music tool for the Bally, at least not one like I think you have in mind. There are tools written for the Astrocade that allow you to create music on it. Some examples of this are:

  1. The Music Maker cartridge - The user places notes on the screen.
  2. Some simple BASIC programs - These are rather limited, but a few do allow all three voices to be used.
  3. Programs that use the music format (called MUZCPU) as set forth in the "Nutting Manual."

I presume that you've got in mind a program that runs under Windows/Linux/Mac that outputs data that can be used by the Astrocade. There are some very advanced software like this for other Z80 platforms. Maybe something could be ported to the Astrocade? There are some "beeper" programs that create music that sound incredible on machines with only once sound channel.

 

[i've been thinking about making] a Bally BASIC WAV generator. (Does such a thing exist already?)

It depends on what you mean by a Bally BASIC WAV generator. There certainly are tools that do this to some extent, but they are awkward. A great "AstroBASIC" tool would be one that allowed you to type in Bally's version of ASCII and then just click a button and then, POW!, the output would be in a loadable BASIC program. There are lots of tweaks that I'd love to see added to that too. One example would be to allow machine code to be placed into screen RAM and run from there. That can be done from "AstroBASIC," but it isn't a pretty sight. However, this is rather limited anyway, so it's more like a wouldn't-it-be-cool-if idea that probably wouldn't get much use.

 

OK, that's all for now. Let me know if you end up finding any of this stuff useful! ;)

 

Thanks for sharing all this cool stuff. You're inspirational!

Adam

Link to comment
Share on other sites

If you're comfortable running Python scripts without an accompanying instruction guide, you can grab the tool [...] The code works OK

 

I tried the Astroimg Python script. Since I didn't have Python, I installed Python 3.6.5 under Windows 7 64-bit. When I ran the script I got an error about PIL. I looked that error up and then I installed Pillow. This is all new to me, so I'm wading through this as best as I can. The script worked after this, well, it works a little bit anyway. I typed the following line:

 

python astroimg.py Minmei.png

 

These are the results:

 

Building Z80 ASM for MINMEI...

 

Traceback (most recent call last):

File "astroimg.py", line 456, in <module>

z80Exporter(newimg)

File "astroimg.py", line 341, in z80Exporter

newFile.write(z80)

TypeError: a bytes-like object is required, not 'str'

 

Do you have any idea what I'm doing wrong? Maybe my starting image is the wrong resolution or uses too many colors. Certainly, the image is huge by Astrocade standards. I can easily dumb it down to less colors and whatever resolution is required. I'm only expecting to get a fuzzy picture on the Astrocade that looks nothing like the original image. I know that I have to assemble z80 output source code from the python script and then run it in MAME. Here's the PNG file that I'm starting with for input:

 

post-4925-0-46234900-1527652434_thumb.png

 

It's probably worth noting that the python script does create a file called MINMEI.gfx. However, the file is empty. Any help that you can offer to get the script working is much appreciated.

 

Adam

Link to comment
Share on other sites

Oh my god, 80s Robotech!! YES!! <3

 

You are most certainly not doing anything wrong. In fact, kudos for giving it a shot while it's still a work in progress! It's hard to find beta testers for niche software for niche hardware. Haha...

 

In the future, if you have `pip` (Python's package manager, which often installs alongside Python), you can run `pip install -r requirements.txt` from within the directory, and it will install all the necessary packages such as PIL. You can check if you have pip installed by typing `pip --version` and seeing if a version number comes up. `pip install -r requirements.txt` is a common pattern for setting up Python script dependencies--just a tip if you come across a requirements.txt file in the future! I'll be sure to add that to the forthcoming readme.

 

Anyway, I think I tracked down the issue you were having with the script... not your fault at all. I may have forgotten to push a change after testing on my PC. On lines 340 and 397 of astroimg, try changing the "wb" to "w", then save the file and retry the script. If that works, I'll make the corresponding change in the GitHub repo.

 

Regarding your previous question about image size, the script squishes everything to 160 x 102 regardless of the size of the input image. So for best results, you should start with an image that has the right aspect ratio (eg., 1600 x 1020, 800 x 510, and so on). The generated .gfx will comment out the last line, and VBLANK fires at line 101.

 

OK, let me know if that does or doesn't work for you! I have tried to test in lots of different versions of Python and on different platforms, but Python seems to behave differently on each. (And I'm fairly new to the language myself.) Thanks, Adam!

Link to comment
Share on other sites

Oh my god, 80s Robotech!! YES!! <3

 

Yes, Robotech is awesome!

 

kudos for giving it a shot while it's still a work in progress! It's hard to find beta testers for niche software for niche hardware. Haha...

 

I find that playing around with these programs is fun.

 

Who says that this is niche software for little-know hardware? I'm not sure where you're from, but in this dimension, the Astrocade ruled the 70s, 80s and 90s. It wasn't until the introduction of the Playstation that Bally got knocked around a bit. Remember the 80s when Bally put that little-remembered company, Nintendo, went out of business? Nintendo is probably best remembered for a game in the early 80s called, if I remember right, Donkey Pong (a clever play-on-words of the 1972 classic). Nintendo's only home system, the NES, floundered in the marketplace next to the mega-competition of the Astrocade III. You don't remember it that way? That's strange, as that's how it was in my neighborhood. Or, well, maybe not.

 

I installed PIP last night in order to install Pillow. I did use your command-line recommendation:

 

pip install -r requirements.txt

 

These were the results:

 

Requirement already satisfied: Pillow in c:\users\atrionfo\appdata\local\program

s\python\python36-32\lib\site-packages (from -r requirements.txt (line 1)) (5.1.

0)

 

So, I guess I'm okay. I mean, I know that I'm okay, as your image converter eventually worked for me.

 

 

On lines 340 and 397 of astroimg, try changing the "wb" to "w", then save the file and retry the script. If that works, I'll make the corresponding change in the GitHub repo.

 

Making these changed allowed astroimg.py to finish and create the two files (the Z80 code and the graphics data). I followed your tips, and with some tweaking to the machine language code that your program generates, I did get a binary that ran in MAME.

 

To start off with, I made a 300dpi 160x102 image of Lynn Minmay's eye. Here is the original RGB close-up of the eye in PNG format:

 

post-4925-0-26882000-1527707809.png

 

Here is the same picture saved as an 8-color GIF and then re-saved that as a PNG:

 

post-4925-0-63049200-1527707808.gif

 

Then I ran Astroimg on the 8-color PNG and got results that worked with some tweaking. Here is the final result of the eye as seen from the Astrocade emulator in MAME:

 

post-4925-0-73860400-1527707809.gif

 

So, there is good news and semi-bad news. First the good news:

 

It works; hooray!

 

The downside is the Z80 code generated doesn't work as-is. First, both the assembly code and graphics file require a blank line at the end of each file before the Zmac assembler works on them. I'm not sure why this is, but I've run into this issue before and this simple "fix" is a nice work-around. I don't think it should be needed, but none of my programs ever assemble fully without adding a blank line. This might be a Windows-particular issue.

 

Also, I had to add quotes around the display string on the line labeled PRGNAME. After I made these small changes, the program assembled and I was able to run the program in MAME for Windows (I'm using version mame0177b_debug_32bit). The program sorta-works. The standard menu displays. I can choose to run program one, which displays the picture-- but only for the briefest moment before the system returns to the menu. In order to get the screenshot of the eye, I had to take many screenshots. I see that you have a loop in the Z80 assembly language to keep the picture on-screen, but it doesn't work for me.

 

So, there you have it. Now there are two people in the world who have used Astroimg with success! Does anyone else care to try it out?

 

Adam

Link to comment
Share on other sites

I know exactly why you're having this issue. It's because I uploaded an old version of my code. (Source control is great if you REMEMBER. TO. USE. IT. Argggh!)

 

The laptop with the final version has a dead battery, and someone has my charger, so it might be a day or so before I can upload the corrected version of the script.

 

The reason that the ROM exiting quickly is that it can't write all 4,080 bytes that are in the graphics file. I believe the final version of the code comments out the last 40 bytes of graphics, sets VBLANK to the 101st line instead of 102nd, and MOVEs 101 lines of pixel data instead of 102. You can try altering your .asm and .gfx files accordingly if you like, but there may be other fixes that I can't remember off the top of my head.

 

Sheesh, rookie mistake uploading the unfinished code. (That "wb" and PRGNAME string fix is part of the final version, too.) Haha. Oh, well--it happens to the best of us! Will post here when I get my laptop powered on again and upload the final version.

Link to comment
Share on other sites

OK, I got a laptop charger and pushed the correct version to GitHub. Please see the updated script at https://github.com/hxlnt/astrocade/tree/master/tools/astroimg.


(You'll notice that it says the file was last updated 3 days ago, but it is indeed the new version. It's just showing the "last edited" date, which was indeed 3 days ago.)


I just checked this on my Windows 10 PC, and the code compiles straight away with no need to edit anything. Famous last words, but it SHOULD be fixed now. :) Looking forward to seeing some more Robotech goodness...


EDIT: You will probably get best results by hand-tweaking and downsampling the colors in the image in advance, as you did, but it is not necessary. You can give it a full-color image, too. Add --dither at the end to dither the image. I tested JPG, PNG, and even PSD! They all worked. Sometimes the results of passing in a full-color image are kinda bad. But sometimes they are pretty cool. It's fun to experiment with different methods.

Edited by hxlnt
Link to comment
Share on other sites

 

OK, I got a laptop charger and pushed the correct version to GitHub. Please see the updated script at https://github.com/hxlnt/astrocade/tree/master/tools/astroimg.

 

I have used the new version of AstroImg and I can confirm that it works without any issues at all on 160x101 images that I've downsized. I'm using Windows 7 and Python 3.6.5. The final Z80/Gfx combination assembles perfectly and the results work great in the Astrocade emulator in MAME. Great work!

 

I'm currently trying AstroImg with various images to see what I can come up with to get the best results, where "best" must keep in mind the Astrocade's 4-color (or 8-color, with left/right color boundaries) limitations. I'm having fun with this program!

 

Do you plan to make additional features to AstroImg? For instance, I'd like to see the graphics file output in, if I choose, hexadecimal rather than decimal. Also, it would be useful to have each of the 101 lines of graphics labeled in the graphics file. Will AstroImg be able to handle bitmaps of various sizes (for "sprite" creation) at some point?

 

Do you have a personal wish list for AstroImg?

 

Adam

Link to comment
Share on other sites

The "Bad Apple" demo has never be ported to the Bally Arcade/Astrocade, and it's completely beyond my means, but I thought that it would be fun to take some screenshots from the demo as it looks running on a Sega Genesis. If you've never seen the "Bad Apple" demo running, then it's a real treat to see on real hardware. Here's the version as running on the Genesis (I took the Astrocade screenshots from this video):

 

https://www.youtube.com/watch?v=2vPe452cegU

 

I used AstroImg to convert eight images from the video to binaries that I ran in the Astrocade MAME emulator. These are unedited screenshots from MAME:

 

Here are the eight "Bad Apple" screenshots as taken from eight different programs that run from MAME's Astrocade emulator:

 

post-4925-0-58045900-1527798000.pngpost-4925-0-21103700-1527798001.png

 

post-4925-0-98102700-1527798001.pngpost-4925-0-76983800-1527798002.png

 

post-4925-0-46552300-1527798003.pngpost-4925-0-19880200-1527798004.png

 

post-4925-0-96332100-1527798004.pngpost-4925-0-71535500-1527798005.png

 

I took these eight screenshots and made a simple 8-frame GIF animation with 0.5 seconds between each frame:

 

post-4925-0-65716600-1527798075.gif

 

If you'd like to see these pictures running in MAME, then here are the eight 4K binary files ("cartridges"). These have been zipped into one file:

 

Bad Apple (Astrocade Frames).zip

 

These pictures on the Astrocade seem to be in only two colors. I was hoping that there could be black, white and two different grays to make the image a little smoother, but for whatever reason Pillow, as used by AstroImg, didn't provide this in the final picture. Too, bad, this might have looked much better.

 

Here is an overview of the way I created each Astrocade image:

  1. Took a screenshot of "Bad Apple" running under VLC.
  2. Cropped the screenshot with Photoshop CS2 to 160x101 pixels (w=1.666, H=1.052 and Resolution=96.12)
  3. Saved the cropped image as an RGB PNG. I did NOT reduce the colors manually.
  4. Converted the PNG to a Z80/Gfx using AstroImg.
  5. Assembled the resulting z80 source code using the Zmac assembler.
  6. Ran the resulting binary as a cartridge in MAME.

I'd love to see what other users can create using the new AstroImg utility for the Astrocade! Maybe we can start a new thread with our image results. Let's see what a system that can only push 160x101 pixels can do nearly automatically when using AstroImg!

 

Adam

  • Like 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...