Skip to content

Instantly share code, notes, and snippets.

@ovalenti
Created January 27, 2023 10:50
Show Gist options
  • Save ovalenti/842560b8db40239257748d9016620a51 to your computer and use it in GitHub Desktop.
Save ovalenti/842560b8db40239257748d9016620a51 to your computer and use it in GitHub Desktop.
Template for Mattel Aquarius extension ROM (with header signature)
; Basic template of a Mattel Aquarius extension ROM
; build: z80asm -o aq_romext.bin aq_romext.asm
; run: mame aquariusp -bp . -cart1 aq_romext.bin
; uncomment the following block to create a 16K ROM
;org 0xc000
; ...
; ### lower part of a 16K ROM ###
; ...
; ds 0xe000 - $
; ### Header ###
; can be customized
H0: equ 0
H1: equ 0
H2: equ 0
H3: equ 0
H4: equ 0
H6: equ 0
H8: equ 0
HA: equ 0
HC: equ 0
; signature: fixed values
H5: equ 0x9c
H7: equ 0xb0
H9: equ 0x6c
HB: equ 0x64
HD: equ 0xA8
HF: equ 0x70
HE: equ (HF - 0x4e - (H3 + H4 + H5 + H6 + H7 + H8 + H9 + HA + HB + HC + HD)) & 0xff
if H3 == 0xf7
error
endif
org 0xe000
; ROM signature
db H0
db H1
db H2
db H3
db H4
db H5
db H6
db H7
db H8
db H9
db HA
db HB
db HC
db HD
db HE
db HF
; ### high part of the ROM ###
PRNCHR: equ 0x1d94
start:
ld a,'@'
call PRNCHR
hang:
jp hang
ds 0x10000 - $ ; pad to the ROM size
@bushy555
Copy link

Thanks.
Trying to port over some ZX Speccy 1-bit tunes to the Aquarius and couldn't work out how to create a normal binary or a cartridge binary.
This should work fine.

@ovalenti
Copy link
Author

@bushy555, if you want to ship raw content, then I think incbin might be interesting.

Trying to port over some ZX Speccy 1-bit tunes to the Aquarius

I would love to hear about the result 😃

@bushy555
Copy link

bushy555 commented Feb 2, 2023

I would love to hear about the result

Weirdly, I managed to get "Huby" up and working in absolute raw form, as in, it is an assembled cartridge-area executable binary, but yet, it didn't require a cartridge header at all. (In MAME and VirtualAquarius emus). It just worked. Every other 1-bit engine I tried, of course, just failed, and your code is what I need to get them running.
Anyway, the Huby engine is a very basic 2-channel engine; roughly 100 bytes in length.
I dont have a youtube for the Aquarius, however, it sounds exactly like this : https://www.youtube.com/watch?v=rYspaBVw0tk

I am wanting to get the more sophisticated engines working, such as : https://www.youtube.com/watch?v=Jil6W1oLxzo&t=49s
Cheers

@ovalenti
Copy link
Author

ovalenti commented Feb 3, 2023

Thanks for the examples ! I really like it and I hope that you can have the more sophisticated one working 🤞

It does sound a lot more sophisticated indeed, since the voices overlap instead of being sliced in time, if I am not mistaken.

One question, @bushy555 : do these synthesizers require a clock source ? or do they rely solely on the CPU execution speed ?

@bushy555
Copy link

bushy555 commented Feb 6, 2023

Typically based purely on CPU speed. Porting the code to different Z80 platforms with differing CPU speeds, the outputting sound is faster or slower, with a different pitch. However most 1-bit player engines have some sort of speed controlling loop.
Out of interest, BinTracker Windows version was released two days ago by Utz. https://github.com/bintracker/bintracker/releases
Outputs ZX Spectrum asm, change the sound port, re-assemble, and essentially you have a music sound tracker for the Aquarius.

@bushy555
Copy link

bushy555 commented Feb 8, 2023

Hi
Using your header, Ive managed to get another three working that previously didn't work with the previous hacked header that I was attempting to use. So thanks heaps.
Ive been using the old VirtualAquarius and MESS emulators, since I can't get anything else to work (MAME, Aqualite). However, I can only get players that are under 8k working (Assembled to $E000). Anything to $C000 just fails unfortunately. Aquarius stuff just seems very very 'finicky' to me.

Various stuff is here if interested: https://github.com/bushy555/Aquarius_1-bit_music

@ovalenti
Copy link
Author

ovalenti commented Feb 9, 2023

Hi @bushy555, briefly looking at your work to port to Aquarius, I could notice a few things:

  • in order to be accepted by mame, ROM files have to be exactly 8K or 16K
  • some engines (at least juston) rely on modifying the code (inject delay values or addresses). This is not possible when the code executes from ROM. 2K of RAM are available at 0x3800 if you need to store values.

@bushy555
Copy link

Thanks. Makes so much more sense.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment