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/23 01:21]
ex_writer [MUZCPU Instruction Set]
— (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}} 
- 
-[NM:56] 
- 
-===== Music System Routines ===== 
- 
-^ Name ^ Description ^ 
-| [[music processor#​bmusic|BMUSIC]] | Begin playing music | 
-| [[music processor#​emusic|EMUSIC]] | Stop music | 
- 
-===== Music System Routine Descriptions ===== 
- 
-==== BMUSIC ==== 
- 
-BEGIN PLAYING MUSIC 
- 
-| Calling Sequence: | <code z80>​SYSTEM ​   BMUSIC</​code>​ or <code z80>​SYSSUK ​   BMUSIC 
-DW        (music stack) 
-DB        (voices byte) 
-DW        (score)</​code>​| 
-| Arguments: | A = voices to start with\\ HL = music program counter (score)\\ IX = music stack pointer | 
-| Notes: | None | 
-| Description:​ | Quiets any previous music, then interprets specified "​score."​ | 
-| Restrictions:​ | None | 
-==== EMUSIC ==== 
- 
-STOP MUSIC 
- 
-| Calling Sequence: | <code z80>​SYSTEM ​   EMUSIC</​code>​ or <code z80>​SYSSUK ​   EMUSIC</​code>​| 
-| Arguments: | None | 
-| Notes: | None | 
-| Description:​ | Outputs 0 to volume ports and halt music processor. | 
-| Restrictions:​ | None | 
-===== 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 
- 
-[NM:57] 
- 
-===== 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:58]