mirror of
https://github.com/wwarthen/RomWBW.git
synced 2026-02-06 22:13:13 -06:00
SN76489: Added support for BF_SNDQ_DEV/SN7_QUERY_DEV query
And updated some driver docs
This commit is contained in:
@@ -1331,6 +1331,9 @@ chip provides.
|
||||
| C: Audio Device Unit ID
|
||||
| HL: Pitch (0000=lowest note, FFFF=highest note)
|
||||
|
||||
| _Returned Values_
|
||||
| A: Status (0=OK, else error)
|
||||
|
||||
This function sets the sound chip pitch parameter. The pitch will
|
||||
be applied when the next SNDPLAY function is invoked.
|
||||
|
||||
@@ -1344,14 +1347,17 @@ notes, use the SNDNOTE function.
|
||||
| C: Audio Device Unit ID
|
||||
| L: Note (0 to 255 quarter notes)
|
||||
|
||||
| _Returned Values_
|
||||
| A: Status (0=OK, else error)
|
||||
|
||||
This function sets the sound chip pitch parameter according to
|
||||
standardized notes.
|
||||
|
||||
The value corresponds to standard musical notes. The value allows
|
||||
for selection of a quarter of a semitone by giving a value between 0
|
||||
The value corresponds to standard musical notes. The value allows
|
||||
for selection of a quarter of a semitone by giving a value between 0
|
||||
and up to the drivers maximum supported value. The lowest note is (0).
|
||||
|
||||
For the SN76490 chip, 0 corresponds to note A1# and the value 249 is
|
||||
For the SN76490 chip, 0 corresponds to note A1# and the value 249 is
|
||||
the maximum supported value, and it corresponds to note C7.
|
||||
|
||||
### Function 0x54 -- Sound Play (SNDPLAY)
|
||||
@@ -1359,7 +1365,10 @@ the maximum supported value, and it corresponds to note C7.
|
||||
| _Entry Parameters_
|
||||
| B: 0x54
|
||||
| C: Audio Device Unit ID
|
||||
| D: Channel
|
||||
| E: Channel
|
||||
|
||||
| _Returned Values_
|
||||
| A: Status (0=OK, else error)
|
||||
|
||||
This function applies the previously specified volume and pitch by
|
||||
programming the sound chip with the appropriate values. The values
|
||||
@@ -1374,6 +1383,81 @@ HBIOS B=53 C=00 L=69 ; Select Middle C (C4) assuming SN76489
|
||||
HBIOS B=54 C=00 D=01 ; Play note on Channel 1
|
||||
```
|
||||
|
||||
### Function 0x55 -- Sound Play (SNDQUERY)
|
||||
|
||||
| _Entry Parameters_
|
||||
| B: 0x54
|
||||
| C: Audio Device Unit ID
|
||||
| E: Subfunction
|
||||
|
||||
| _Returned Values_
|
||||
| A: Status (0=OK, else error)
|
||||
|
||||
This function will return the status of current pending command or
|
||||
key aspects of the specific Audio Device.
|
||||
|
||||
#### SNDQUERY Subfunction 0x01 -- Get count of audio channels supported (SNDQ_CHCNT)
|
||||
|
||||
| _Entry Parameters_
|
||||
| B: 0x54
|
||||
| E: 0x01
|
||||
|
||||
| _Returned Values_
|
||||
| A: Status (0=OK, else error)
|
||||
| B: Count of standard tone channels
|
||||
| C: Count of noise tone channels
|
||||
|
||||
#### SNDQUERY Subfunction 0x01 -- Get current volume setting (SNDQ_VOL)
|
||||
|
||||
| _Entry Parameters_
|
||||
| B: 0x54
|
||||
| E: 0x02
|
||||
|
||||
| _Returned Values_
|
||||
| A: Status (0=OK, else error)
|
||||
| H: 0
|
||||
| L: Current volume setting
|
||||
|
||||
#### SNDQUERY Subfunction 0x03 -- Get current pitch setting (SNDQ_PITCH)
|
||||
|
||||
| _Entry Parameters_
|
||||
| B: 0x54
|
||||
| E: 0x03
|
||||
|
||||
| _Returned Values_
|
||||
| A: Status (0=OK, else error)
|
||||
| HL: Current pitch setting
|
||||
|
||||
#### SNDQUERY Subfunction 0x04 -- Get device details (SNDQ_DEV)
|
||||
|
||||
| _Entry Parameters_
|
||||
| B: 0x54
|
||||
| E: 0x04
|
||||
|
||||
| _Returned Values_
|
||||
| A: Status (0=OK, else error)
|
||||
| B: Driver identity
|
||||
| HL: Driver specific port settings
|
||||
| DE: Driver specific port settings
|
||||
|
||||
Reports information about the audio device unit specified.
|
||||
|
||||
At this stage, only one driver type is supported (SN76489), but is
|
||||
envisage that more will be added in the future.
|
||||
|
||||
Register B reports the audio device type (see below).
|
||||
|
||||
Registers HL and DE contain relevant port address for the hardware
|
||||
as such are specific to each device type.
|
||||
|
||||
The currently defined audio device types are:
|
||||
|
||||
AUDIO ID | Value | Device | Returned registers
|
||||
-------------- | ----- | ---------- | --------------------------------------------
|
||||
SND_SN76489 | 0x01 | SN76489 | E: Left channel port, L: Right channel port
|
||||
SND_SNAY38910 | 0x02 | AY-3-8910 | D: Address port, E: Data port
|
||||
|
||||
|
||||
`\clearpage`{=latex}
|
||||
|
||||
System (SYS)
|
||||
|
||||
@@ -58,13 +58,19 @@ BF_SNDVOL .EQU BF_SND + 1 ; REQUEST SOUND VOL - L CONTAINS VOLUME (255 MAX, 0 SI
|
||||
BF_SNDPIT .EQU BF_SND + 2 ; REQUEST SOUND PITCH - HL CONTAINS PITCH DRIVER SPECIFIC VALUE
|
||||
BF_SNDNOTE .EQU BF_SND + 3 ; REQUEST NOTE - L CONTAINS NOTE - EACH VALUE IS QUARTER NOTE
|
||||
BF_SNDPLAY .EQU BF_SND + 4 ; INITIATE THE REQUESTED SOUND COMMAND
|
||||
BF_SNDQUERY .EQU BF_SND + 5 ; D IS CHANNEL, E IS SUBCOMMAND
|
||||
BF_SNDQUERY .EQU BF_SND + 5 ; E IS SUBFUNCTION
|
||||
;
|
||||
; BF_SNDQUERY SUBCOMMANDS
|
||||
BF_SNDQ_STATUS .EQU 0
|
||||
BF_SNDQ_CHCNT .EQU BF_SNDQ_STATUS + 1 ; RETURN COUNT OF CHANNELS
|
||||
BF_SNDQ_SVOLUME .EQU BF_SNDQ_STATUS + 2 ; 8 BIT NUMBER
|
||||
BF_SNDQ_SPITCH .EQU BF_SNDQ_STATUS + 3 ; 16 BIT NUMBER
|
||||
BF_SNDQ_VOLUME .EQU BF_SNDQ_STATUS + 2 ; 8 BIT NUMBER
|
||||
BF_SNDQ_PITCH .EQU BF_SNDQ_STATUS + 3 ; 16 BIT NUMBER
|
||||
BF_SNDQ_DEV .EQU BF_SNDQ_STATUS + 4 ; RETURN DEVICE TYPE CODE AND IO PORTS - TYPE IN B, PORTS IN DE, HL
|
||||
|
||||
BF_SNDDEV .EQU 0 ; TYPES OF SOUND DRIVERS
|
||||
BF_SND_SN76489 .EQU BF_SNDDEV + 1
|
||||
BF_SND_SNAY38910 .EQU BF_SNDDEV + 2
|
||||
|
||||
;
|
||||
BF_SYS .EQU $F0
|
||||
BF_SYSRESET .EQU BF_SYS + 0 ; SOFT RESET HBIOS
|
||||
|
||||
@@ -168,12 +168,15 @@ SN7_QUERY:
|
||||
CP BF_SNDQ_CHCNT
|
||||
JR Z, SN7_QUERY_CHCNT
|
||||
|
||||
CP BF_SNDQ_SPITCH
|
||||
CP BF_SNDQ_PITCH
|
||||
JR Z, SN7_QUERY_PITCH
|
||||
|
||||
CP BF_SNDQ_SVOLUME
|
||||
CP BF_SNDQ_VOLUME
|
||||
JR Z, SN7_QUERY_VOLUME
|
||||
|
||||
CP BF_SNDQ_DEV
|
||||
JR Z, SN7_QUERY_DEV
|
||||
|
||||
OR $FF ; SIGNAL FAILURE
|
||||
RET
|
||||
|
||||
@@ -197,6 +200,14 @@ SN7_QUERY_VOLUME:
|
||||
XOR A
|
||||
RET
|
||||
|
||||
SN7_QUERY_DEV:
|
||||
|
||||
LD B, BF_SND_SN76489
|
||||
LD DE, SN76489_PORT_LEFT ; E WITH LEFT PORT
|
||||
LD HL, SN76489_PORT_RIGHT ; L WITH RIGHT PORT
|
||||
|
||||
XOR A
|
||||
RET
|
||||
;
|
||||
; UTIL FUNCTIONS
|
||||
;
|
||||
|
||||
Reference in New Issue
Block a user