d<n>: Used to denote individual bits. E.g. d7 for bit 7. MMIO: Memory-mapped I/O r8: 8-bit general purpose CPU register r16: 16-bit general purpose CPU register r32: 32-bit general purpose CPU register T900: TLCS-900/H uDMA: microDMA |
Target audience |
Overview |
Sound chip access |
Tone channels |
Noise channel |
-> [0|0|0|0|0|0|0|0|0|0|0|0|0|0|1] -> output | | | | | | | <--/ | \------------------ XOR <------/
DAC |
Shared RAM |
TLCS-900/H <-> Z80 communication |
Interrupts |
Bit Expl. 0-5 Unknown 6 Enable HBlank interrupts 7 Enable VBlank interrupts |
Timers |
Bit Expl. 0 Timer0 on/off (0=off, 1=on) 1 Timer1 on/off 2 Timer2 on/off 3 Timer3 on/off 4-6 Unknown* 7 Prescaler on/off** |
* None of these bits appear to have any effect on normal interval timing.
** Disabling the prescaler will effectively stop the timer count-up process. The exception to this is when HINT is used as the source for Timer0, as it doesn't rely on the prescaler counter. |
Bit Expl. 0-1 Timer0 clock source (0=HINT, 1=T1, 2=T4, 3=T16) 2-3 Timer1 clock source (0=Timer0, 1=T1, 2=T16, 3=T256) 4-5 PWM cycle generation 6-7 Operation mode (0=two 8-bit timers, 1=one 16-bit timer, 2=PPG 8-bit, 3=PWM 8-bit) |
Bit Expl. 0-1 Timer2 clock source (0=Prohibited*, 1=T1, 2=T4, 3=T16) 2-3 Timer3 clock source (0=Timer2, 1=T1, 2=T16, 3=T256) 4-5 PWM cycle generation 6-7 Operation mode (0=two 8-bit timers, 1=one 16-bit timer, 2=PPG 8-bit, 3=PWM 8-bit) |
T1 48 kHz T4 12 kHz T16 3 kHz T256 187.5 Hz |
* There's a document from SNK which mentions in passing that it's possible to set a 384 kHz clock source for Timer2 (which would mean the input clock for the prescaler, aka T0). The 8-bit timer reference manual however only lists T1, T4 and T16 as valid clocks for Timer2, and I haven't found any way of getting Timer2 to run at 384 kHz. It's possible that using T0 was intended to be allowed at first and that this decision was later changed. Or perhaps it was a feature specific to the K1 Sound Simulation card (a piece of development hardware that added NGP(C) sound capabilities to a PC without the need for software emulation). |
uDMA |
ldc DMAS0,r32 * ldc r32,DMAS0 *
Bit Expl. 0-23 Source address |
ldc DMAD0,r32 * ldc r32,DMAD0 *
Bit Expl. 0-23 Destination address |
ldc DMAC0,r16 ldc r16,DMAC0
Bit Expl. 0-15 Transfer count (A setting of 0 means 65536) |
ldc DMAM0,r8 ldc r8,DMAM0
Bit Expl. 0-1 Transfer size (0=one byte, 1=two bytes, 2=four bytes, 3=prohibited) 2-4 Source/destination address control 5-7 Should Be Zero |
0 Increase destination address after each transfer 1 Decrease destination address after each transfer 2 Increase source address after each transfer 3 Decrease source address after each transfer 4 Fixed source/destination address 5 Counter mode. No data is transfered, but DMASn is increased by 1 after each transfer |
* The DMAS/DMAD registers are 32-bit, but only the lower 24 bits are used. ** Using an address control mode other than the ones listed will cause the system to shut down. |
Bit Expl. 0-4 Interrupt source that will trigger uDMA transfers on this channel 5-7 Should Be Zero |
0x0A RTC Alarm 0x0B VBlank 0x0C Z80-triggered interrupt 0x10 Timer0 0x11 Timer1 0x12 Timer2 0x13 Timer3 |
; stop all timers ldb (TRUN),0 ; set up timer0 to generate IRQs at 16000 Hz ldb (TMOD01),1 ldb (TREG0),3 ; flip-flop / double-buffering isn't used here ldb (TFFCR),0 ldb (TRDC),0 ; set the timer0 interrupt level to 0 (disable timer0 interrupts, but ; still allow it to trigger uDMA transfers), and the uDMA0 transfer ; completion interrupt level to 5. ldb (INTET01),0 ldb (INTETC01),5 ldl xwa,sampleData ldc DMAS0,xwa ldl xwa,DACL ldc DMAD0,xwa ; set each transfer to 2 bytes (i.e. both DACL and DACR are written to), ; and increase the source address after each transfer. ldb w,9 ldc DMAM0,w ; perform 65536 transfers (one per timer0 expiration) ldw wa,0 ldc DMAC0,wa ; set this uDMA channel to be triggered by timer0 IRQs ldb (DMA0V),0x10 ; start timer 0 ldb (TRUN),0x81 |
About this document |