Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
hardware:music_processor [2016/06/13 23:33]
ex_writer [MUZCPU Instruction Set]
hardware:music_processor [2016/06/14 09:01] (current)
ex_writer [Port Summary]
Line 15: Line 15:
 ===== MUZCPU Instruction Set ===== ===== MUZCPU Instruction Set =====
  
-^ # of Bytes ^ Instruction ^ Comment ^ +^ # of Bytes ^ Instruction ​^ Argument(s) ​^ Comment ^ 
-| 2 | VOICES,​(data) ​Sets VOICES ​(data) | +| 2 | VOICES/​VOICEM ​M | Load VOICES ​status register with mask data (M) | 
-| 2 | MASTER,​(data) ​| Sets master oscillator TONMO (data) | +| 2 | MASTER ​| F | Sets master oscillator ​(TONMO) frequency ​(F) | 
-| 3 | CALL,​(address) ​| (SP) = (PC+3) ​(PC = address+| 3 | CALL | A | Music CALL subroutine: ​(SP) = (PC+3)PC = address | 
-| 1 | RET | PC = (SP++) | +| 1 | RET | | Music RETurn: ​PC = (SP++) | 
-| 3 | JP,​(address) ​| PC = address | +| 3 | JP | A | Music JumP: PC = address | 
-| 2 | NOTE1 | Duration, note or data (D1) | +| 2 | NOTE1 | D,D1 | Duration, note or data (D1) | 
-| 3 | NOTE2 | Duration, D1,D2 | +| 3 | NOTE2 | D,D1,D2| Duration, D1,D2 | 
-| 4 | NOTE3 | Duration, D1,D2,D3 | +| 4 | NOTE3 | Duration, D1,D2,D3 | 
-| 5 | NOTE4 | Duration, D1,D2,D3,D4 | +| 5 | NOTE4 | Duration, D1,D2,D3,D4 | 
-| 6 | NOTE5 | Duration, D1,​D2,​D3,​D4,​D5 | +| 6 | NOTE5 | Duration, D1,​D2,​D3,​D4,​D5 | 
-| 2 | REST | Pauses silently for //n// 60<​sup>​th</​sup>​s of a second (except in LEGATO mode) | +| 2 | REST | n | Pauses silently for //n// 60<​sup>​th</​sup>​s of a second (except in LEGATO mode) | 
-| 1 | QUIET | Stops music and sets volume = 0 | +| 1 | QUIET | Stops music and sets volume = 0 | 
-| 2 | OUTPUT | Port #, Data | +| 2 | OUTPUT ​| p,d | Port #(0–7), Data | 
-| 9 | OUTPUT | SNDBX,DATA10,​D11,​D12,​D13,​D14,​D15,​D16,​D17 | +| 9 | OUTPUT | SNDBX,D10,​D11,​D12,​D13,​D14,​D15,​D16,​D17 ​| Sound block transfer for all 8 output ports via SNDBX ($18) 
-| 3 | VOLUME | Sets volume for (VOLAB)(VOLMC) ​+| 3 | VOLUME | VOLAB, ​VOLC | Sets volume Tones A–C 
-| 1 | PUSHN | Push # between 1-16 onto the stack | +| 1 | PUSHN | Push # between 1-16 onto the stack | 
-| 1 | CREL | Call relative to next instruction | +| 1 | CREL | Call relative to next instruction | 
-| 3 | DSJNZ | Decrement stack top and jump if not 0, else pop stack | +| 3 | DSJNZ | A | Decrement stack top and jump to address (a) if not 0, else pop stack | 
-| 1 | LEGSTA | Flips between STACATO (notes clipped 1/​60<​sup>​th</​sup>​ of a second before end) and LEGATO (notes flow smoothly from one to the next) modes |+| 1 | LEGSTA ​| Flips between STACATO (notes clipped 1/​60<​sup>​th</​sup>​ of a second before end) and LEGATO (notes flow smoothly from one to the next) modes |
  
 Note: All note durations are limited to a maximum of 127 (i.e., 2.1 seconds) Note: All note durations are limited to a maximum of 127 (i.e., 2.1 seconds)
  
-<WRAP round help>​Testing:​\\ * PUSHN creates a loop index that DSJNZ decrements until zero (for looping music sections)?​\\ * What does CREL do?\\ * Why NOTE4 and NOTE5?</​WRAP>​+<WRAP round info>The port numbers (0–7) passed to OUTPUT assume that output port $10 (VOLMO) is the "​base"​ port (i.e., port $0). Port numbers are offset from that base. For example, to set Tone B's frequency to $82, one would call OUTPUT $02,$82. This would store the value $82 in output port $12 (TONEB).</​WRAP>​ 
 + 
 +<WRAP round help>​Testing:​\\ * PUSHN creates a loop index that DSJNZ decrements until zero (for looping music sections)?​\\ * What does CREL do?\\ * Why NOTE4 and NOTE5? ​(Dogpatch uses NOTE4)</​WRAP>​
 ===== Master Oscillator ===== ===== Master Oscillator =====
  
Line 63: Line 65:
 The tone volumes are controlled by output ports $15 (VOLC) and $16 (VOLAB). The lower 4 bits of port $16 set Tone A volume, the upper 4 bits set Tone B volume. The lower 4 bits of port $15 set Tone C volume. Noise can be mixed with the tones by setting bit 5 of port $15 to 1. In this case, the noise volume is given by the upper 4 bits of port $17 (VOLN). In all cases, a volume of 0 is silence and a volume of all 1's is loudest. The tone volumes are controlled by output ports $15 (VOLC) and $16 (VOLAB). The lower 4 bits of port $16 set Tone A volume, the upper 4 bits set Tone B volume. The lower 4 bits of port $15 set Tone C volume. Noise can be mixed with the tones by setting bit 5 of port $15 to 1. In this case, the noise volume is given by the upper 4 bits of port $17 (VOLN). In all cases, a volume of 0 is silence and a volume of all 1's is loudest.
  
-=== Port Summary ===+=== Music Processor ​Port Summary ===
  
 <​code>​ <​code>​
Line 119: Line 121:
  
 <code z80> <code z80>
-          VOICES ​    ​11010100B ​    ;​ABC=Data 1 +          VOICES ​    ​11010100B ​    ; ABC = Data 1 
-          MASTER ​    ​0A1H ​         ;ABC=1/2 +          MASTER ​    ​0A1H ​         ; ABC = 1/2 [???] 
-          VOLUME ​    ​88H,​08H +          VOLUME ​    ​88H,​08H ​      ; Tones ABC set to volume 8 
-          NOTE1      12,A1+          NOTE1      12,A1         ; Duration, Tone A
           NOTE1      12,C2           NOTE1      12,C2
           NOTE1      24,E2           NOTE1      24,E2
           NOTE1      12,C2           NOTE1      12,C2
           NOTE1      12,E2           NOTE1      12,E2
-          REST       6 +          REST       ​6 ​            ; Pause 1/10th of a second 
-          VOICES ​    ​11110110B ​    ;Suck in Vibrato, AB and C bytes +          VOICES ​    ​11110110B ​    ; Suck in Vibrato, AB and C bytes 
-          NOTE3      12,14,A2,E2+          NOTE3      12,​14,​A2,​E2 ​  ; Duration, Tone A, B, C
           QUIET           QUIET
 </​code>​ </​code>​
  
 +<WRAP alert>​Example seems wrong (or at least unclear)?</​WRAP>​
 <WRAP todo>​Make audio clip</​WRAP>​ <WRAP todo>​Make audio clip</​WRAP>​
 ---- ----
  
-==== Example: Football Anthem & Cheer ====+==== Example: Football ​National ​Anthem & Cheer ====
  
 <code z80> <code z80>
Line 179: Line 182:
          ​LEGSTA          ​LEGSTA
          QUIET          QUIET
 +
 +</​code>​
 +
 +----
 +
 +==== Example: Astro Battle Base Explosion ====
 +
 +<code z80>
 +MUSSTK ​ EQU   ​$4F12 ​    ; Music Stack Pointer
 +
 +; [...]
 +
 +; Begin Music system routine
 +        SYSSUK ​ BMUSIC ​         ; UPI Begin playing MUSIC
 +        DW      MUSSTK ​         ; ... Music Stack = $4F12
 +        DB      $FC             ; Setup Voices, Use Tones A, B, and C
 +        DW      L28A9           ; Score Address of "Base Exploding"​
 +        ​
 +; [...]
 +
 +; Sound Effect of "Base Exploding"​
 +L28A9: ​ MASTER ​ 255             ; Set Tone of Master Oscillator to $FF
 +        VOLUME ​ $FF,​$1F ​        ; Sets Volumes Tone A = 15, Tone B = 15, Tone C = 15, [and NM = 1]
 +        LEGSTA ​                 ; Flip to LEGato from STAccato
 +        OUTPUT ​ $07,​$F0 ​        ; Noise Volume = 15 
 +        NOTE3   ​50,​$88,​$D4,​$F8 ​ ; Duration = 50/​60'​th of a sec, TC= TB= TA=
 +        VOLUME ​ $CA,​$1C ​        ; Sets Volumes Tone A = 10, Tone B = 12, Tone C = 12, [and NM = 1]
 +        OUTPUT ​ $07,​$B8 ​        ; Noise Volume = 184
 +        NOTE3   ​30,​$88,​$D2,​$FA ​ ; Duration = 30/​60'​th of a Sec, TC= TB= TA=
 +        VOLUME ​ $BA,​$1B ​        ; Sets Volumes Tone A = 10, Tone B = 11, Tone C = 11, [and NM = 1]
 +        OUTPUT ​ $07,​$80 ​        ; Noise Volume = 8
 +        NOTE3   ​30,​$8E,​$DD,​$FF ​ ; Duration = 30/​60'​th of a Sec, TC= TB= TA=
 +        VOLUME ​ $86,​$16 ​        ; Sets Volumes Tone A = 6, Tone B = 8, Tone C = 6, [and NM = 0]
 +        OUTPUT ​ $07,​$00 ​        ; Noise Volume = 0
 +        NOTE3   ​25,​$90,​$E0,​$FF ​ ; Duration = 25/​60'​th of a Sec, TC= TB= TA=
 +        QUIET
  
 </​code>​ </​code>​