ScratchData LogoScratchData
Back to b9e's profile

Bandits at Zero

B9b9e•Created November 4, 2024
Bandits at Zero
48
39
474 views
View on Scratch

Instructions

- - - Shoot 'em up! - - - ----- Except the fuel tanker! Control: arrows + enter or WASD + space Don't be surprised if it gets dark, the game is quite addictive. #game #bandits at zero #plane

Description

Base idea: 30+ years ago there was a game on Commodore 16 / plus 4, named Bandits at Zero, with good music and 3D-like display: http://plus4world.powweb.com/software/Bandits_at_Zero The music is also available separately: http://plus4world.powweb.com/hvtc/Bandits_At_Zero - Only for machine code fanatics: - The begining of the subroutine, invoked 50 times per second . 3E00 E6 20 INC $20 Increase the byte at memory address 0x20 = 32 It stores the length of the currently playing note, between 0 and 0x0F (= 0-15). During this period, 16x1/50 = 0.32 seconds, the note is fixed. . 3E02 A5 20 LDA $20 Load it to "A" processor variable (accumulator) . 3E04 C9 10 CMP #$10 Compare "A" to 0x10 = 16 . 3E06 D0 06 BNE $3E0E If not equals then goto . 3E0E . 3E08 A9 00 LDA #$00 Load 0x00 value to "A" . 3E0A 85 20 STA $20 Store it to memory address 0x20 Okay, the value is between 0-15. . 3E0C E6 21 INC $21 Increase the byte at memory address 0x21 It stores the position of the currently playing note, between 0x00 and 0x7F = 0-127 . 3E0E A5 21 LDA $21 Load it to "A" . 3E10 29 7F AND #$7F Set "A" to "A" AND 0x7F, binary AND operation to keep the value of "A" between 0 and 0x7F (0-127) . 3E12 85 21 STA $21 Store it Playing the lower voice note: . 3E14 4A LSR . 3E15 4A LSR . 3E16 4A LSR Binary shift "A" to left 3x, i.e. division by 8 (2^3 = 8) The lover voice is changed in every 8th beat. . 3E17 A8 TAY Set "Y" processor variable to "A" . 3E18 BE E0 3E LDX $3EE0,Y Set "X" proc. var. to the byte stored at 0x3EE0 + "Y" memory address (see below) These are the lower voice notes. The music uses only 15 notes. . 3E1B BD 40 3E LDA $3E40,X Set "A" to the byte stored at 0x3E40 + "X" These are the real values for the sound processor, lower 8 bits. . 3E1E 8D 0E FF STA $FF0E Store "A" to 0xFF0E memory address, the Voice #1 frequency, bits 0-7 . 3E21 BD 50 3E LDA $3E50,X Set "A" to the byte stored at 0x3E50 + "X" These are the real values for the sound processor, upper bits 8 and 9 . 3E24 8D 12 FF STA $FF12 Store "A" to 0xFF12 memory address, the Voice #1 frequency, bits 8 and 9 Playing the upper voice note: . 3E27 A4 21 LDY $21 Set "Y" to memory address 0x21, the currently playing note. . 3E29 BE 60 3E LDX $3E60,Y Set "X" proc. var. to the byte stored at 0x3E60 + "Y" memory address (see below) These are the upper voice notes. . 3E2C BD 40 3E LDA $3E40,X Set "A" to the byte stored at 0x3E40 + "X" These are the real values for the sound processor, lower 8 bits. . 3E2F 8D 0F FF STA $FF0F Store "A" to 0xFF0F memory address, the Voice #2 frequency, bits 0-7 . 3E32 BD 50 3E LDA $3E50,X Set "A" to the byte stored at 0x3E50 + "X" These are the real values for the sound processor, upper bits 8 and 9 . 3E35 8D 10 FF STA $FF10 Store "A" to 0xFF10 memory address, the Voice #2 frequency, bits 8 and 9 Turn on voice #1 and #2: . 3E38 AD 11 FF LDA $FF11 Set "A" to the byte stored at 0xFF11, bit 4: Voice #1, bit 5: Voice #2 . 3E3B 09 30 ORA #$30 Set "A" to "A" OR 0x30, binary OR operation to set both bits on . 3E3D 8D 11 FF STA $FF11 Store "A" to 0xFF11 . 3E40 60 RTS Return from subroutine Memory: Notes, lower 8 bit: >3E40 60 82 90 96 A2 AC B1 B9 C1 C8 CB B1 64 85 CA 58 Notes, upper 2 bit: >3E50 00 03 03 03 03 03 03 03 03 03 03 00 01 01 01 02 Music upper voice notes: >3E60 05 05 05 05 05 06 05 03 04 04 04 04 04 05 04 02 >3E70 01 01 01 01 01 02 03 06 05 05 05 05 05 02 03 04 >3E80 05 05 05 05 05 04 05 07 08 08 08 08 08 09 0A 08 >3E90 07 07 07 07 07 08 07 05 04 04 04 04 04 02 03 04 >3EA0 05 05 05 05 05 06 07 0A 08 08 08 08 08 03 06 08 >3EB0 09 09 09 09 09 0A 09 07 08 08 08 08 08 05 06 07 >3EC0 05 05 05 05 05 06 05 07 05 05 05 05 05 06 05 07 >3ED0 04 04 04 04 04 06 05 04 03 03 03 03 03 02 03 04 Music lower voice notes: >3EE0 0F 0E 0D 0E 0F 0D 0C 0E 0B 0D 0E 0D 0D 0C 0D 0E Note values and the real note 0382 = 61 A 0390 = 63 B 0396 = 64 C 03a2 = 66 D 03ac = 68 E 03B1 = 69 F 03B9 = 71 G 03C1 = 73 A 03C8 = 75 B 03CB = 76 C 00B1 = 28 C 0164 = 32 E 0185 = 33 F 01ca = 35 G 0258 = 40 C See it in sprite "Music". I had to lower the pitch, it was too high. I had to speed up the playback of notes because the "play note" block couldn't play a note long enough.

Project Details

Project ID1091157685
CreatedNovember 4, 2024
Last ModifiedNovember 12, 2024
SharedNovember 12, 2024
Visibilityvisible
CommentsAllowed