Skip to content

Latest commit

 

History

History
129 lines (106 loc) · 4.89 KB

sound.md

File metadata and controls

129 lines (106 loc) · 4.89 KB

Paula SOUND chipset

JIM Dev no: &D0 (Paula) &D1 (Blitter/cpu)
JIM Base address: $FE FC80

The Dossytronics CPU/Blitter and 1M Paula cards both use new jim space API for access to both the on board ram and the device registers. This saves on using precious FRED space for the device registers.

For full details of the updated JIM spec please see JIM spec

The Hoglet/1M Paula card has 512Kb (and the Blitter 2Mb) of memory accessed through the JIM page-wide system. First the relevant device number should be written to &FCFF (D0 for Paula D1 for Blitter/cpu).

The chip memory for sample data* can then be paged into the FD00-FDFF slot by using the paging registers at &FCFD (most significant) and &FCFE (least significant).

  • on the blitter/cpu card system memory can also be used for samples though this is not recommended due to the fact that it will slow the system down more.

The registers for the sound chipset are accessed also through JIM by accessing the address space range at $FE FC80-FC8F in jim memory i.e. to write the channel select register in BASIC the following sequence should be used.

10DEVNO=&D1:?&EE=DEVNO:?&FCFF=DEVNO:REM - access device and set shadow register
20?&FCFE=80:?&FCFD=&FE: REM - set jim page to $FE FCxx
30?&FD8F=0: REM - select channel 0

The sound processor appears as a 4 channel PCM + mixer device, loosely modelled on the Amiga's Paula chip.

Each channel can be set to output a static value by setting its data register (complex generated sounds can be generated by setting this register in a tight loop) or can be programmed to play a sound sample from memory using DMA techniques

  Address       Purpose
  -------       -------
  BASE + 0      Sound data read/write current sample
  BASE + 1/2/3  Source base address (big endian 24 bit address)
  BASE + 4/5    Sample "period" - see below
  BASE + 6/7    Length - 1
  BASE + 8      Status/Control
  BASE + 9      Volume 
  BASE + 10/11  Repeat offset
  BASE + 12     Peak 
  BASE + F      Channel select, setting this register maps in the lower 0-9 
                registers for the selected channel. When setting this register
                unused bits (2-7) should be 0, when reading this register
                future firmwares may set other bits.

  Control register bits
  ---------------------

  7   -   ACT : (set this bit to 1 to initiate/test for completion)
  6   -   n/a
  5   -   n/a
  4   -   n/a
  3   -   n/a
  2   -   n/a
  1   -   n/a
  0   -   RPT  : Repeat

  [All n/a bits should be set to 0 on write, expect non-zero on read back]

  ACT, setting this bit will initiate playing a sample using DMA
  RPT, setting this bit will cause the sample to repeat, the sample will
       be repeated beginning at the offset in BASE+10/11

The clock for playing samples is a nominal 3,546,895Hz (as on a PAL Amiga). The "period" describes the number of PAL clocks that should pass between each sample being loaded (via DMA)

For example, this program sets up a sample of 32 bytes length in chip RAM and sets channel 0 to repeatedly play the sound

   10 REM BLIT SOUND
   20 DEVNO%=&D0 : REM JIM device number for 1MHz Paula
   30 snd%=&FD80:sndjim%=&FEFC
   40 SL%=32:SR%=1000:SP%=3546895/(SR%*SL%):REM calculate period
   50 BUF%=&FD00:
   60 ?&EE=DEVNO%:?&FCFF=DEVNO%:REM enable JIM for 1m board
   70 ?&FCFD=&01:?&FCFE=&00:REM set jim base addr = $010000
   80 FORI%=0TOSL%-1:BUF%?I%=127*SIN(2*PI*I%/SL%):NEXT:REM sinewave in JIM
   85 REM JIM to point at sound device area
   86 ?&FCFD=sndjim% DIV 256:?&FCFE=sndjim%
   90 snd%?&F=0:snd%?&E=255:REM cha=0,master vol=255
  100 snd%?&1=&01:snd%?&2=&00:snd%?&3=&00:REM sample address $010000
  110 snd%?&4=SP%DIV256:snd%?&5=SP%:REM sound "period"
  120 snd%?&6=(SL%-1)/256:snd%?&7=SL%-1:REM sample len-1
  130 snd%?&9=255:REM channel vol max
  140 snd%?&A=0:snd%?&B=0:REM repeat from start of sample
  150 snd%?&8=&81:REM play, repeat
Line 20..30 : set hardware parameters, for blitter change devno to &D1
Line 40:      calulate SP, number of 3.5ish MHz ticks to make a 32 sample 
              play at 1kHz
Line 60:      set dev no and shadow register (if you don't set this other 
              hardware drivers might interfere) and device select register
Line 70:      point at chip RAM at $010000 - it's best to avoid the 1st 64K
              as this is used by the CPU/blitter card for shadow memory and
              other utility functions
Line 80:      generate the sinewave into chip RAM
Line 86:      point the JIM page at $FE FCxx in the device's space where the
              hardware registers reside
Lines 90-150: Set up the hardware registers to play the sample

To stop a sound playing it is a simple of matter of selecting the channel and setting the control register to 0

  200 REM stop sound
  210 snd%?&F=0:REM select channel 0
  100 snd%?&8=0:REM stop