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
music_processor [2016/05/25 00:39]
ex_writer [Sound Block Transfer]
— (current)
Line 1: Line 1:
-====== Music Processor ====== 
- 
-The music processor can be thought of as an independent CPU handling all output to the music/noise ports. The MUZCPU has 4 registers: 
- 
-| MPC | Like all program counters, points to the next data byte to fetch. | 
-| MSP | Like a stack pointer, points to return addresses on the stack. | 
-| DURATION | Loaded at the start of a note, then decremented every 60th of a second. | 
-| VOICES | A status register that tells which voices (tones) to load with what data. | 
- 
-The voices status register is shown below. Execution proceeds right-to-left. Make sure that you always have at least one PC incrementing bit or load on. 
- 
-{{vs_register.png}} 
-===== MUZCPU Instruction Set ===== 
- 
-^ # OF BYTES ^ MNEMONIC ^ COMMENT ^ 
-| 2 | VOICES,​(data) | VOICES=(data) | 
-| 2 | MASTER,​(data) | TONE0=(data) | 
-| 3 | CALL,​(address) | (SP)=(PC+3) PC=address | 
-| 1 | RET | PC=(SP++) | 
-| 3 | JP,​(address) | PC=address | 
-| 2 | NOTE1 | Duration, note or data (D1) | 
-| 3 | NOTE2 | Duration, D1,D2 | 
-| 4 | NOTE3 | Duration, D1,D2,D3 | 
-| 5 | NOTE4 | Duration, D1,D2,D3,D4 | 
-| 6 | NOTE5 | Duration, D1,​D2,​D3,​D4,​D5 | 
-| 2 | REST | Duration in 60ths of a second\\ Pauses silently (except during LEGATO) | 
-| 1 | QUIET | Stops music and sets volume=0 | 
-| 2 | OUTPUT | Port #, Data | 
-| 9 | OUTPUT | SNDBX,​DATA10,​D11,​D12,​D13,​D14,​D15,​D16,​D17 | 
-| 3 | VOLUME | (VOLAB),​(VOLMC) sets volume for notes | 
-| 1 | PUSHN | Push # between 1-16 onto the stack | 
-| 1 | CREL | Call relative to next instruction | 
-| 3 | DSJNZ | Decrement stack top and jump if not 0, else pop stack | 
-| 1 | LEGSTA | Flips between STACATO and LEGATO modes\\ STACATO is clipped 1/60th before the end of each note\\ LEGATO allows one note to run into the next | 
- 
-Note: All durations are limited to a maximum of 127 
- 
-===== Master Oscillator ===== 
- 
-==== Tones ==== 
- 
-==== Sound Block Transfer ==== 
- 
- 
----- 
- 
-[NM:​103–5] 
- 
-===== Technical Detail ===== 
- 
-The music processor can be divided into two sections. The first section generates the Master Oscillator Frequency, and the second section uses the Master Oscillator Frequency to generate ton frequencies and the analog audio output. The contents of all registers in the Music Processor are set by output instructions from the Z80. 
- 
-Master Oscillator Frequency is a square wave whose frequency is determined by the 8 binary inputs to the [[Master Oscillator]]. This 8-bit word is the sum of the contents of the Master Oscillator Register and the output of the MUX. The MUX is controlled by MUX REG. 
- 
-If MUX REG contains 0, then data from the [[Vibrato System]] will be fed through the MUX. The two bits from the Vibrato Frequency Register determine the frequency of the square wave output of the Low Frequency Oscillator. The 6-bit word at the output of the AND gates oscillates between 0 and the contents of the Vibrato Register. The frequency of oscillation is determined by the contents of the Vibrato Frequency Register. The 6-bit word, along with two ground bits, is fed through the MUX to the Adder. This causes the Master Oscillator Frequency to be modulated between two values, producing a vibrato effect. 
- 
-If MUX REG contains 1, then data from the Noise System will be fed through the MUX. The 8-bit word from the Noise Volume Register determines which bits from the Noise Generator will be present at the output of the AND gates. 
- 
-If a bit in the Noise Volume Register is 0, then the corresponding bit at the output of the AND gates will be 0. If a bit in the Noise Volume Register is 1, then the corresponding bit at the output of the AND gates will be noise from the Noise Generator. This 8-bit word is sent through the MUX to the Adder. The Master Oscillator Frequency is modulated by noise. 
- 
-In the second part of the Music Processor, the square wave from the Master Oscillator is fed to three Tone Generator circuits that produce square waves at their outputs. The frequency of their outputs is determined by the contents of their Tone Generator Register and Master Oscillator Frequency. The 4-bit words at the output of the AND gates oscillate between 0 and the contents of the Tone Volume Register. These 4-bit words are sent to D-A Converters whose outputs oscillate between GND and a positive analog voltage determined by the contents of the Tone Volume Register. 
- 
-One Noise bit and four Noise Volume bits from the first section of the Music Processor are fed to a set of AND gates. This set of AND gates operates the same way as the AND gates for the tones, except that the Noise AM Register must contain a 1 for the outputs of the AND gates to oscillate. The analog outputs of the four D-A Converters are summed to produce the single audio output. 
- 
-[NM:​119–20] 
- 
- 
- 
-===== Music Score Example ===== 
- 
-<code z80> 
-          VOICES ​    ​11010100B ​    ;​ABC=Data 1 
-          MASTER ​    ​0A1H ​         ;ABC=1/2 
-          VOLUME ​    ​88H,​08H 
-          NOTE1      12,A1 
-          NOTE1      12,C2 
-          NOTE1      24,E2 
-          NOTE1      12,C2 
-          NOTE1      12,E2 
-          REST       6 
-          VOICES ​    ​11110110B ​    ;Suck in Vibrato, AB and C bytes 
-          NOTE3      12,14,A2,E2 
-          QUIET 
-</​code>​ 
- 
- 
----- 
- 
- 
-[NM:56–8]