ScratchData LogoScratchData
Back to b9e's profile

Trailblazer C16 Music

B9b9e•Created November 3, 2024
Trailblazer C16 Music
20
15
298 views
View on Scratch

Instructions

Music from Trailblazer for Commodore 16 / plus4 using the Music extension Preview of the game without score and time but playable... left - right arrows / A - D jump enter / space Full game: https://scratch.mit.edu/projects/1103889936/

Description

Original Commodore 16 / plus4 game: http://plus4world.powweb.com/software/Trailblazer Developed by Shaun Southern. Music source code: http://plus4world.powweb.com/feat/tedsound/hvtc/musicians/southern_shaun/trailblazer_title.prg - Only for machine code fanatics - Memory: Volume values (for falling sound): >1EE8 08 07 07 06 06 06 05 05 Melody: >1F00 05 05 06 07 00 06 05 07 00 06 05 07 00 06 05 00 >1F10 E6 E6 E5 E6 E0 E5 E0 E6 E0 E6 E0 E6 E6 E0 E5 E0 >1F20 F4 F4 F4 F4 F0 F0 F5 F0 F6 F6 F6 F5 F0 F0 F4 F0 >1F30 05 05 05 05 00 00 06 00 07 07 07 06 00 00 05 00 >1F40 E6 E6 E6 E6 E0 E0 E8 E0 EA E0 EA E9 E0 E0 E8 E0 >1F50 07 07 07 06 00 00 05 00 07 00 07 06 00 00 05 00 >1F60 F6 F6 F6 F5 F0 F0 F4 F0 F4 F4 F4 F3 F0 F0 FC F0 >1F70 03 02 01 02 03 02 03 05 07 05 07 0A 07 0A 07 05 >1F80 E8 E8 E8 E8 E0 E0 E8 E0 EA E0 EA E9 E0 E0 E8 E0 >1F90 07 07 07 07 00 00 07 00 09 00 09 08 00 00 07 00 >1FA0 F6 F6 F6 F5 F0 F0 F5 F0 F4 F4 F4 F5 F0 F0 F6 F0 >1FB0 05 05 05 05 00 00 06 00 07 07 07 08 00 00 0D 00 >1FC0 E8 E6 E3 E8 E6 E3 E8 E6 E3 E8 E6 E3 E8 E6 E3 E8 >1FD0 07 05 03 07 05 03 07 05 03 07 05 03 07 05 03 07 >1FE0 F6 F4 FC F6 F4 FC F6 F4 FC F6 F4 FC F6 F4 FC FC >1FF0 03 02 01 02 03 02 03 05 07 05 07 0A 0B 0A 07 05 Real sound frequency table: >2340 0D D4 04 43 58 6A 73 82 90 9C A2 B5 38 96 CA 08 >2350 01 02 03 03 03 03 03 03 03 03 03 03 03 03 01 02 Subroutine that runs every time when the screen is refreshed (at the 0x40th (64th) pixel row): >d27a0 . 27A0 E6 C8 INC $C8 Increase the memory value at 0xC8, the length and volume of the currently playing note . 27A2 A5 C8 LDA $C8 Set the "A" processor variable to the memory value at 0xC8 . 27A4 29 07 AND #$07 Set the "A" to "A" AND 0x07 (bitwise operator AND), it leaves the lower 3 bits so one beats is 2^3 = 8 frames per seconds = 8/50 = 0,16 s (about 1/6 s) . 27A6 85 C8 STA $C8 Store "A" to the memory 0xC8, write back the new value . 27A8 D0 02 BNE $27AC If "A" is not zero, then jump to 27AC . 27AA E6 C9 INC $C9 Increase 0xC9 memory address. "A" is zero, so step to the next note . 27AC A6 C9 LDX $C9 Set the "X" processor variable to the memory value at 0xC9 This will be the relative position of the next note in the memory at 0x1F00 . 27AE BD 00 1F LDA $1F00,X Set "A" to the memory value at 0x1F00 + X, see at the memory list It reads the note: 05, 05, 06, 07, ... . 27B1 29 0F AND #$0F Set the "A" to "A" AND 0x0F (bitwise AND), it leaves the lower 4 bits . 27B3 F0 04 BEQ $27B9 If it was zero, then jump to 27B9 . 27B5 A9 30 LDA #$30 Set "A" to value 0x30 It wasn't zero, so both voice channel will be used . 27B7 D0 02 BNE $27BB Jump to 27BB . 27B9 A9 20 LDA #$20 Set "A" to value 0x20 It was zero, so only one voice channel will be used . 27BB 85 E0 STA $E0 Store "A" to memory 0xE0 (temporary memory for the voice channel) . 27BD A4 C8 LDY $C8 Set "Y" to memory 0xC8 It is the step number in one note (see at . 27A6) . 27BF B9 E8 1E LDA $1EE8,Y Set "A" to memory 0x1EE8 + Y This is the volume value (for falling sound) . 27C2 05 E0 ORA $E0 Set "A" to "A" OR memory 0xE0 (bitwise OR) . 27C4 8D 11 FF STA $FF11 Store "A" to memory 0xFF11 This is the memory address of the volume (lower 3 bits) and voice channels (bit 4 and 5) . 27C7 BD 00 1F LDA $1F00,X Set "A" to memory 0x1F00 + X It reads the note again (there are only 3 variables: A, X and Y) . 27CA 29 0F AND #$0F Set the "A" to "A" AND 0x0F (bitwise AND), it leaves the lower 4 bits . 27CC A8 TAY Set "Y" to "A" . 27CD B9 40 23 LDA $2340,Y Set "A" to memory 0x2340 + Y These are the real values for the sound processor, lower 8 bits. . 27D0 8D 0E FF STA $FF0E Store "A" to memory 0xFF0E, the Voice #1 frequency, bits 0-7 . 27D3 B9 50 23 LDA $2350,Y Set "A" to memory 0x2350 + Y These are the real values for the sound processor, upper bits 8 and 9 . 27D6 8D 12 FF STA $FF12 Store "A" to 0xFF12 memory address, the Voice #1 frequency, bits 8 and 9 . 27D9 BD 00 1F LDA $1F00,X Set "A" to memory 0x1F00 + X It reads the note again . 27DC 4A LSR . 27DD 4A LSR . 27DE 4A LSR . 27DF 4A LSR Binary shift "A" to left 4x, i.e. division by 16 (2^4 = 16) It shifts the upper 4 bits to the lower 4 bits . 27E0 A8 TAY Set "Y" to "A" . 27E1 B9 40 23 LDA $2340,Y Set "A" to memory 0x2340 + Y These are the real values for the sound processor, lower 8 bits. . 27E4 8D 0F FF STA $FF0F Store "A" to memory 0xFF0F, the Voice #2 frequency, bits 0-7 . 27E7 B9 50 23 LDA $2350,Y Set "A" to memory 0x2350 + Y These are the real values for the sound processor, upper bits 8 and 9 . 27EA 8D 10 FF STA $FF10 Store "A" to 0xFF10 memory address, the Voice #2 frequency, bits 8 and 9 . 27ED 60 RTS Return from subroutine

Project Details

Project ID1090849474
CreatedNovember 3, 2024
Last ModifiedFebruary 19, 2025
SharedNovember 14, 2024
Visibilityvisible
CommentsAllowed