Jump to content

hxlnt's Photo

hxlnt

Member Since 23 Nov 2017
OFFLINE Last Active Jul 31 2018 7:15 PM

#4039605 Programming the Bally Arcade/Astrocade

Posted by hxlnt on Fri Jun 1, 2018 3:17 PM

Very cool! I love the idea of an Astrocade port of Bad Apple. :)

 

Regarding the color conversion, the script converts the image to a static color palette of eight colors: red, magenta, blue, cyan, green, yellow, black, and white. This works well for full-color images but will miss grays on grayscale images. I could probably add some kind of grayscale detection to the script someday, but in the meantime, a quick hack would be to recolor your gray pixels to, for example, red (#FF0000) and green (#00FF00) in an image editor. Then you can tweak the palette in the .asm back to grays.

 

On the other hand, you could probably do some nice compression on the Bad Apple graphic data if it's only two-color, as you'd only need one bit per pixel to represent it... 




#4037262 Programming the Bally Arcade/Astrocade

Posted by hxlnt on Tue May 29, 2018 5:43 PM

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:

 
thegif.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/h.../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...
 
Screen Shot 2018-05-28 at 9.17.07 PM.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.
 
Screen Shot 2018-05-29 at 5.52.13 PM.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!  ;)



#4021593 Astrocart: Magical, reflashable 512KB homebrew cart

Posted by hxlnt on Sat May 5, 2018 7:06 AM

You kind of read my mind with that 3D-printed case link! It never occurred to me to check Thingiverse for an existing model... how cool! I love the pink and white shell combo, too.

In case anyones curious, I cut the hole in the Astrocade cart with a regular old X-Acto knife. I was originally going to use it just to score the cart before going in with a Dremel, but the plastic was so soft that I decided to give it a few passes with the X-Acto. It worked great, and the cuts ended up being much straighter than what I could have done freehand with a Dremel. (It was a little sad to deface a real cartridge, but I think it was OK to do one in the name of science.)

I looked a bit at other flashcarts but havent investigated compatibility between those and the Astrocart yet.


#4020435 Astrocart: Magical, reflashable 512KB homebrew cart

Posted by hxlnt on Thu May 3, 2018 11:30 AM

astro-new.gif

 

Since I started getting into Astrocade homebrew dev, I've been thinking about making a little dev cart so I can test my ROMs on real hardware. Well, a few months later, here's the result: Astrocart! It supports a 512KB flash ROM chip, which is bankswitchable with the switches at the left. It's also socketed so you can easily pull it out, reburn, and reseat as needed.

 

As for the magic... well, I believe that beautiful electronics are pleasant to use and share with friends. I designed the board with a galaxy of gold and white stars to help make homebrew development all the more fun and magical. 

 

Many thanks are owed to my friend @batslyadams, who did a fantastic job with all PCB routing and general Eagle wizardry.

 

As of right now, this is the only fully assembled Astrocart in existence, but, y'know, maybe more to come. 

 

astrostill.jpg

 

 

 

 




#3942403 Programming the Bally Arcade/Astrocade

Posted by hxlnt on Mon Jan 22, 2018 9:11 PM

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



#3901006 Programming the Bally Arcade/Astrocade

Posted by hxlnt on Thu Nov 30, 2017 3:46 AM

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.)


#3898192 Programming the Bally Arcade/Astrocade

Posted by hxlnt on Sat Nov 25, 2017 11:05 PM

Ahh, thank you so, so much! This loaded my helloworld.bin homebrew like a charm! 

 

I recently acquired an Astrocade after spending hours reading through the great stories and source code on Bally Alley. I've been blown away by the tech (for its time) and am looking forward to developing for it. I think it would be fun to make a reflashable cart for personal dev testing on real hardware, but I don't have any big plans other than just learning the ins and outs of the CPU and having fun.

 

My background is in making cutesy, girly homebrew games for the NES, so I'll likely be making... cutesy, girly games for the Astrocade. :)

 

Thanks again for the help and for all you do with Bally Alley! It's awesome!




#3897129 Programming the Bally Arcade/Astrocade

Posted by hxlnt on Fri Nov 24, 2017 9:50 AM

 

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.

 

...

 

Does anyone have any tips on getting homebrew to run in the MAME emulator? I compiled an Astrocade ROM from source, added its info to the XML file in the hash folder along with the CRC/SHA-1/ROM size info, and was able to load it MAME. However, I'm just seeing the Astrocade 1-2-3-4 menu, not the actual game.

 

As a test, I made a dupe of Zzzap/Dodgem and added it to the XML software list as described above, and I got the same result: the Astrocade menu (as if no cartridge were inserted). That kind of confounds me, since the entry looks pretty much identical to the working version of Zzzap/Dodgem, only with a different .bin and .zip name (which I changed in the software list to match).

 

I'm trying to get this up and running so I can start in on my own Astrocade homebrew ROMs. Assuming I can get the emulator working, my plan is to write a script that automatically overwrites the SHA-1 every time I recompile the .asm.