SoundStar: Add SuperSoniqs SoundStar support.
M src/Header.asm +7 -1
@@ 120,8 120,14 @@ Header: MACRO
 		dd 0
 	extraHeaderOffset:
 		dd 0
+	wonderSwanClock:
+		dd 0
+	virtualBoyVSUClock:
+		dd 0
+	saa1099Clock:
+		dd 0
 	reserved:
-		dd 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
+		dd 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
 	_size:
 	ENDM
 

          
M src/Player.asm +1 -1
@@ 713,7 713,7 @@ Player_commandsJumpTable:
 	dw Player_Skip3               ; BAH
 	dw Player_Skip3               ; BBH
 	dw Player_Skip3               ; BCH
-	dw Player_Skip3               ; BDH
+	dw SAA1099_instance.ProcessCommand             ; BDH
 	dw Player_Skip3               ; BEH
 	dw Player_Skip3               ; BFH
 	dw Player_Skip4               ; C0H

          
M src/chips/Chips.asm +2 -0
@@ 34,6 34,7 @@ 
 	INCLUDE "K053260.asm"
 	INCLUDE "Pokey.asm"
 	INCLUDE "QSound.asm"
+	INCLUDE "SAA1099.asm"
 
 Chips: MACRO
 	chips:

          
@@ 69,6 70,7 @@ Chips: MACRO
 		StaticFactory K053260_instance, K053260_Construct, K053260_Destruct
 		StaticFactory Pokey_instance, Pokey_Construct, Pokey_Destruct
 		StaticFactory QSound_instance, QSound_Construct, QSound_Destruct
+		StaticFactory SAA1099_instance, SAA1099_Construct, SAA1099_Destruct
 	COUNT: equ ($ - chips) / StaticFactory._size
 	ENDM
 

          
A => src/chips/SAA1099.asm +58 -0
@@ 0,0 1,58 @@ 
+;
+; VGM SAA1099 chip
+;
+SAA1099: MACRO
+	super: Chip SAA1099_name, Header.saa1099Clock, SAA1099_Connect
+
+	; hl' = time remaining
+	; ix = player
+	; iy = reader
+	ProcessCommand: PROC
+		call Reader_ReadWord_IY
+		bit 7,e
+		jp z,System_Return
+	writeRegister: equ $ - 2
+	DualChip:
+		res 7,e
+		jp System_Return
+	writeRegisterDual: equ $ - 2
+		ENDP
+	ENDM
+
+; ix = this
+; iy = header
+SAA1099_Construct: equ Chip_Construct
+;	jp Chip_Construct
+
+; ix = this
+SAA1099_Destruct: equ Chip_Destruct
+;	jp Chip_Destruct
+
+; iy = drivers
+; ix = this
+SAA1099_Connect:
+	call SAA1099_TryCreate
+	ret nc
+	call Chip_SetDriver
+	ld bc,SAA1099.ProcessCommand.writeRegister
+	jp Device_ConnectInterface
+
+; iy = drivers
+; ix = this
+; de <- driver
+; hl <- device interface
+; f <- c: succeeded
+SAA1099_TryCreate:
+	call Drivers_TryCreateSoundStar_IY
+	ld hl,SoundStar_interface
+	ret
+
+;
+	SECTION RAM
+
+SAA1099_instance: SAA1099
+
+	ENDS
+
+SAA1099_name:
+	db "SAA1099",0

          
M src/drivers/Drivers.asm +10 -0
@@ 22,6 22,7 @@ 
 	INCLUDE "OPN.asm"
 	INCLUDE "Makoto.asm"
 	INCLUDE "Neotron.asm"
+	INCLUDE "SoundStar.asm"
 	INCLUDE "emulations/DCSGOnPSG.asm"
 	INCLUDE "emulations/DCSGSegaOnTI.asm"
 	INCLUDE "emulations/DCSGTIOnSega.asm"

          
@@ 77,6 78,8 @@ Drivers: MACRO
 		StaticFactory Makoto_instance, Makoto_Construct, Makoto_Destruct
 	neotron:
 		StaticFactory Neotron_instance, Neotron_Construct, Neotron_Destruct
+	soundStar:
+		StaticFactory SoundStar_instance, SoundStar_Construct, SoundStar_Destruct
 	dcsgOnPSG:
 		StaticFactory DCSGOnPSG_instance, DCSGOnPSG_Construct, DCSGOnPSG_Destruct
 	dcsgSegaOnTI:

          
@@ 308,6 311,13 @@ Drivers_TryCreateNeotron_IY:
 ; iy = this
 ; de <- driver
 ; f <- c: succeeded
+Drivers_TryCreateSoundStar_IY:
+	ld bc,Drivers.soundStar
+	jr Drivers_TryCreate_IY_Trampoline
+
+; iy = this
+; de <- driver
+; f <- c: succeeded
 Drivers_TryCreateDCSGOnPSG_IY:
 	ld bc,Drivers.dcsgOnPSG
 	jr Drivers_TryCreate_IY_Trampoline

          
A => src/drivers/SoundStar.asm +105 -0
@@ 0,0 1,105 @@ 
+;
+; Supersoniqs SoundStar SAA1099 PSG driver
+;
+SoundStar_BASE_PORT: equ 04H
+SoundStar_ADDRESS: equ 01H
+SoundStar_WRITE: equ 00H
+SoundStar_ID_ADDRESS: equ 4010H
+SoundStar_CLOCK: equ 8000000
+
+SoundStar: MACRO ?base, ?name = SoundStar_name
+	super: Driver ?name, SoundStar_CLOCK, Driver_PrintInfoImpl
+
+	; e = register
+	; d = value
+	SafeWriteRegister:
+		ld a,e
+	; a = register
+	; d = value
+	WriteRegister:
+		out (?base + SoundStar_ADDRESS),a
+		ld a,d
+		out (?base + SoundStar_WRITE),a
+		ret
+	ENDM
+
+; ix = this
+; iy = drivers
+SoundStar_Construct:
+	call Driver_Construct
+	call SoundStar_Detect
+	jp nc,Driver_NotFound
+	jr SoundStar_Reset
+
+; ix = this
+SoundStar_Destruct:
+	call Driver_IsFound
+	ret nc
+	jr SoundStar_Reset
+
+; e = register
+; d = value
+; ix = this
+SoundStar_WriteRegister:
+	ld a,e
+	ld bc,SoundStar.WriteRegister
+	jp Utils_JumpIXOffsetBC
+
+; e = register
+; d = value
+; ix = this
+SoundStar_SafeWriteRegister:
+	ld bc,SoundStar.SafeWriteRegister
+	jp Utils_JumpIXOffsetBC
+
+; b = count
+; e = register
+; d = value
+; ix = this
+SoundStar_FillRegisters:
+	push bc
+	push de
+	call SoundStar_SafeWriteRegister
+	pop de
+	pop bc
+	inc e
+	djnz SoundStar_FillRegisters
+	ret
+
+; ix = this
+SoundStar_Reset:
+	ld b,32
+	ld de,0000H
+	jr SoundStar_FillRegisters
+
+; ix = this
+; f <- c: found
+SoundStar_Detect:
+	ld hl,SoundStar_MatchID
+	jp Memory_SearchSlots
+
+; a = slot id
+; f <- c: found
+SoundStar_MatchID:
+	call Utils_IsNotRAMSlot
+	ret nc
+	ld de,SoundStar_id
+	ld hl,SoundStar_ID_ADDRESS
+	ld bc,8
+	jp Memory_MatchSlotString
+
+;
+	SECTION RAM
+
+SoundStar_instance: SoundStar SoundStar_BASE_PORT
+
+	ENDS
+
+SoundStar_interface:
+	InterfaceOffset SoundStar.SafeWriteRegister
+
+SoundStar_name:
+	db "SoundStar",0
+
+SoundStar_id:
+	db "SAA1099",0