Hopper disassembly ================== Hopper was written by Neil Raine and published by Acornsoft in 1983. It is a conversion of Konami's 1981 arcade game Frogger, in which the player must direct a series of frogs across a busy road and hazardous river. The following disassembly was created by reverse engineering binary images, without access to any source code. It is nevertheless reasonably complete, allowing the technical approaches used to be understood. The author of this disassembly imposes no additional copyright restrictions beyond those already present on the game itself. It is provided for educational purposes only, and it is hoped that the original authors will accept it in the good faith it was intended - as a tribute to their skills. Game-play notes =============== The game's difficulty increases as follows: level 2 : snake appears crocodile appears one of the top turtles submerges level 3 : one of the bottom turtles submerges one of the bottom logs disappears a second set of fast cars appears level 4 : one of the top logs disappears a third set of fast cars appears Traffic density increases every level until it reaches a maximum on level 11. Scoring is as follows: moving up 10 eating dragonfly 200 frog entering home 200 + remaining time all frogs home 200 per frog Interesting pokes ================= &2fa0 = &27 immortality &2ff1 = &80 infinite lives &2c85 = &80 infinite time Technical notes =============== The loader includes code copied from the MOS 0.10 ROM. This code is decrypted and run only on a system running MOS 0.10. Otherwise, the main binary is *RUN. The game is notable for being written in a stack-based bytecode, which is processed using an object-oriented interpreter. Up to 48 objects may be active at any time, updated by functions associated with their sprites. Sprites may be composed of other sprites, and may write to buffers or check for collisions when plotting. The interpreter has a program counter, several registers (accessed by both bytecode and non-bytecode code) and 32 variables (accessed only by the bytecode). It supports up to 7 six digit decimal numbers. Registers: 03 collision_result 04 game_over 05 level_completed 0b key 0c left_clip 0d right_clip 0f object 13 level Decimals: 1 score 2 high score 3 time Opcodes: Opcodes &00 - &1f pull two values, run a subroutine, then push the result: 00 push (pull2 AND pull1)"; 01 push (pull2 OR pull1)"; 02 push (pull2 EOR pull1)"; push result of bitwise operation 03 push (pull2 >= pull1)"; 04 push (pull2 > pull1)"; 05 push (pull2 != pull1)"; 06 push (pull2 <= pull1)"; 07 push (pull2 < pull1)"; 08 push (pull2 == pull1)"; push 0 if condition is true, &ff is condition is false 09 push (pull2 + pull1)"; 0a push (pull2 - pull1)"; 0b push (pull2 * pull1)"; 0c push (pull2 / pull1)"; push result of arithmetic operation 0d push decimal[pull2].digit[pull1]"; push pair of digits of decimal 0e (undefined) (unused) 0f (undefined) (unused) 10 (undefined) (unused) 11 (undefined) (unused) 12 (undefined) (unused) 13 (undefined) (unused) 14 (undefined) (unused) 15 (undefined) (unused) 16 (undefined) (unused) 17 (undefined) (unused) 18 (undefined) (unused) 19 (undefined) (unused) 1a (undefined) (unused) 1b (undefined) (unused) 1c (undefined) (unused) 1d (undefined) (unused) 1e (undefined) (unused) 1f (undefined) (unused) Opcodes &20 - &3f are special functions: 20 push -pull invert topmost value on stack 21 lo hi jump jump to relative address 22 lo hi if(pull) jump pull value; if zero, jump to relative address 23 xx push xx push next byte 24 abort (unused) 25 abort (unused) 26 abort (unused) 27 end stop interpreting bytecode function 28 lo hi activate(...) set list of object types to update in update_game 29 sound(pull4, pull3, pull2, pull1) pull four values to play sound 2a lo write(...) write string of specified length 2b 00 yy decimals[yy] += (pull3, pull2, pull1) pull three values to add to decimal 2b xx yy decimals[yy] += decimals[xx] add two decimals 2c 00 yy decimals[yy] -= (pull3, pull2, pull1) pull three values to subtract from decimal 2c xx yy decimals[yy] -= decimals[xx] subtract two decimals 2d ... command(...) execute CR-terminated command 2e lo hi array(pull) pull value, push corresponding entry in subsequent array 2f call(pull) pull value, call corresponding bytecode function as subroutine 30 replot(type=pull) pull value, replot objects of corresponding type 31 plot(sprite=pull3, x=pull2, y=pull1) pull three values to plot sprite 32 abort (unused) 33 abort (unused) 34 abort (unused) 35 abort (unused) 36 abort (unused) 37 abort (unused) 38 abort (unused) 39 abort (unused) 3a abort (unused) 3b abort (unused) 3c abort (unused) 3d abort (unused) 3e abort (unused) 3f abort Opcodes &40 - &5f run a subroutine and push the result: 40 (undefined) (unused) 41 push registers[&01] (unused) 42 push registers[&02] (unused) 43 push collision_result 44 push game_over (unused) 45 push level_completed (unused) 46 push registers[&06] (unused) 47 push registers[&07] (unused) 48 push registers[&08] (unused) 49 push objects_data_one[object] 4a push objects_data_two[object] 4b push check(key) if key is positive, read key for duration push ASCII value of key if key press, &ff if key not pressed if key is negative, check for specified key (unused) push &ff if key pressed, &00 if key not pressed 4c push left_clip 4d push right_clip 4e push registers[&e] (unused) 4f push object 50 push registers[&10] (unused) 51 push registers[&11] (unused) 52 push rnd() push random byte 53 push level 54 push objects_sprite[object] 55 push objects_velocity_x[object] 56 push objects_velocity_y[object] (unused) 57 push registers[&17] (unused) 58 push objects_x[object] 59 push objects_y[object] 5a push registers[&1a] (unused) 5b (undefined) (unused) 5c (undefined) (unused) 5d (undefined) (unused) 5e (undefined) (unused) 5f (undefined) (unused) Opcodes &60 - &7f push a variable: 60 push variables[&00] (unused) 61 push variables[&01] 62 push variables[&02] 63 push variables[&03] 64 push variables[&04] 65 push variables[&05] 66 push variables[&06] 67 push variables[&07] (unused) 68 push variables[&08] 69 push variables[&09] 6a push variables[&0a] 6b push variables[&0b] 6c push variables[&0c] 6d push variables[&0d] 6e push variables[&0e] 6f push variables[&0f] 70 push variables[&10] 71 push variables[&11] 72 push variables[&12] 73 push variables[&13] 74 push variables[&14] 75 push variables[&15] 76 push variables[&16] 77 push variables[&17] 78 push variables[&18] 79 push variables[&19] 7a push variables[&1a] (unused) 7b push variables[&1b] (unused) 7c push variables[&1c] (unused) 7d push variables[&1d] (unused) 7e push variables[&1e] (unused) 7f push variables[&1f] (unused) Opcodes &80 - &bf push a value: 80 push &00 81 push &01 82 push &02 83 push &03 84 push &04 85 push &05 86 push &06 87 push &07 88 push &08 89 push &09 8a push &0a 8b push &0b 8c push &0c 8d push &0d 8e push &0e 8f push &0f 90 push &10 91 push &11 92 push &12 93 push &13 94 push &14 95 push &15 96 push &16 97 push &17 98 push &18 99 push &19 9a push &1a 9b push &1b 9c push &1c 9d push &1d 9e push &1e 9f push &1f a0 push &20 a1 push &21 a2 push &22 a3 push &23 a4 push &24 a5 push &25 a6 push &26 a7 push &27 a8 push &28 a9 push &29 aa push &2a ab push &2b ac push &2c ad push &2d ae push &2e af push &2f b0 push &30 b1 push &31 b2 push &32 b3 push &33 b4 push &34 b5 push &35 b6 push &36 b7 push &37 b8 push &38 b9 push &39 ba push &3a bb push &3b bc push &3c bd push &3d be push &3e bf push &3f Opcodes &c0 - &df pull a value and run a subroutine: c0 (undefined) (unused) c1 registers[&01] = pull (unused) c2 registers[&02] = pull (unused) c3 collision_result = pull c4 game_over = pull c5 level_completed = pull c6 remove(type=pull) pull value and remove all objects of corresponding type c7 registers[&07] = pull (unused) c8 registers[&08] = pull (unused) c9 objects_data_one[object] = pull ca objects_data_two[object] = pull cb key = pull cc left_clip = pull (unused) cd right_clip = pull (unused) ce pull (unused) pull value and discard cf object = pull d0 registers[&10] = pull (unused) d1 create(type=pull) pull value and create object of corresponding type d2 registers[&12] = pull (unused) d3 level = pull (unused) d4 objects_sprite[object] = pull d5 objects_velocity_x[object] = pull d6 objects_velocity_y[object] = pull (unused) d7 registers[&17] = pull (unused) d8 objects_x[object] = pull d9 objects_y[object] = pull da registers[&1a] = pull (unused) db (undefined) (unused) dc (undefined) (unused) dd (undefined) (unused) de (undefined) (unused) df (undefined) (unused) Opcodes &e0 - &ff pull a value and set a variable: e0 variables[&00] = pull (unused) e1 variables[&01] = pull e2 variables[&02] = pull e3 variables[&03] = pull e4 variables[&04] = pull e5 variables[&05] = pull e6 variables[&06] = pull e7 variables[&07] = pull (unused) e8 variables[&08] = pull e9 variables[&09] = pull ea variables[&0a] = pull eb variables[&0b] = pull ec variables[&0c] = pull ed variables[&0d] = pull ee variables[&0e] = pull ef variables[&0f] = pull f0 variables[&10] = pull f1 variables[&11] = pull f2 variables[&12] = pull f3 variables[&13] = pull f4 variables[&14] = pull f5 variables[&15] = pull f6 variables[&16] = pull f7 variables[&17] = pull f8 variables[&18] = pull f9 variables[&19] = pull fa variables[&1a] = pull (unused) fb variables[&1b] = pull (unused) fc variables[&1c] = pull (unused) fd variables[&1d] = pull (unused) fe variables[&1e] = pull (unused) ff variables[&1f] = pull (unused) Loader disassembly ================== ; HOPPER ; ff0e00 ff8023 000800 &0e00 0d # BASIC &0e01 00 00 1c f4 20 20 20 20 20 20 2f 2f 2f 20 48 6f ; 0REM /// Hopper /// V2 &0e11 70 70 65 72 20 2f 2f 2f 20 56 32 0d &0e1d 00 0a 05 f4 0d ; 10REM &0e22 00 14 22 f4 20 43 6f 70 79 72 69 67 68 74 20 28 ; 20REM Copyright (C) Acornsoft 1983 &0e32 43 29 20 41 63 6f 72 6e 73 6f 66 74 20 31 39 38 &0e42 33 0d &0e44 00 1e 05 f4 0d ; 30REM &0e49 00 28 06 eb 37 0d ; 40MODE7 &0e4f 00 32 14 ef 32 33 3b 31 30 2c 33 32 2c 30 3b 30 ; 50VDU23;10,32,0;0; # Disable cursor &0e5f 3b 30 3b 0d &0e63 00 3c 10 e3 49 25 3d 30 b8 26 34 30 30 88 34 0d ; 60FORI%=0TO&400STEP4 # Copy acornsoft_screen to screen &0e73 00 46 12 49 25 21 26 37 43 30 30 3d 49 25 21 b8 ; 70I%!&7C00=I%!TOP &0e83 50 0d &0e85 00 50 05 ed 0d ; 80NEXT &0e8a 00 5a 2f e2 31 2c 34 2c 20 32 30 2c 2d 31 30 2c ; 90ENVELOPE1,4, 20,-10,5, 2,2,2, 80,-10,-10,-100,80,0 &0e9a 35 2c 20 32 2c 32 2c 32 2c 20 38 30 2c 2d 31 30 &0eaa 2c 2d 31 30 2c 2d 31 30 30 2c 38 30 2c 30 0d &0eb9 00 64 2b e2 32 2c 33 2c 20 32 30 2c 31 30 30 2c ; 100ENVELOPE2,3, 20,100,9,25,1,25, 20,0,0,-10,80,0 &0ec9 39 2c 32 35 2c 31 2c 32 35 2c 20 32 30 2c 30 2c &0ed9 30 2c 2d 31 30 2c 38 30 2c 30 0d &0ee4 00 6e 29 e2 33 2c 32 2c 20 2d 33 2c 31 34 2c 31 ; 110ENVELOPE3,2, -3,14,14,3,10,20, 1,0,0,-1, 1,1 &0ef4 34 2c 33 2c 31 30 2c 32 30 2c 20 31 2c 30 2c 30 &0f04 2c 2d 31 2c 20 31 2c 31 0d &0f0d 00 78 28 e2 34 2c 32 2c 20 30 2c 30 2c 30 2c 31 ; 120ENVELOPE4,2, 0,0,0,1,1,1, 80,-1,0,-4, 80,55 &0f1d 2c 31 2c 31 2c 20 38 30 2c 2d 31 2c 30 2c 2d 34 &0f2d 2c 20 38 30 2c 35 35 0d &0f35 00 82 0a 2a 46 58 34 20 31 0d ; 130*FX4,1 # Cursor keys return ASCII values &0f3f 00 8c 09 2a 46 58 31 31 0d ; 140*FX11 # Disable auto-repeat &0f48 00 96 13 ef 32 38 2c 31 31 2c 32 32 2c 33 30 2c ; 150VDU28,11,22,30,20 # Define text window &0f58 32 30 0d &0f5b 00 a0 17 3f 28 90 2b 26 36 30 31 29 3d 90 20 81 ; 160?(PAGE+&601)=PAGE DIV 256+6 # Set entry_point + 1 &0f6b 20 32 35 36 2b 36 0d &0f72 00 aa 0b d6 90 2b 26 36 30 30 0d ; 170CALLPAGE+&600 # Call entry_point &0f7d ff ; acornsoft_screen # MODE 7 screen data &0f7e 91 9a 20 20 20 7c 34 60 7c 7c 30 20 78 7c 74 20 &0f8e 7c 7c 7c 30 68 74 20 68 34 78 7c 7c 30 20 7e ff &0f9e 34 20 7c 7c 7c 7c 7c 7c 91 9a 20 20 7a ff 35 ff &0fae a7 2b ff 6a 3f a3 6f 35 ff a3 6b 35 6a ff 34 6a &0fbe 35 ff 31 2b 25 6a ff ff ff 20 ff a3 a3 a3 ff a3 &0fce 91 9a 20 68 3f 6b 35 ff 20 20 20 6a 35 20 6a 35 &0fde ff 7c 7e 25 6a 3f ff fa 35 2b ff 7d 30 ff ff ff &0fee ff 35 ff ff ff 20 ff 20 91 9a 60 ff 7d 7e 35 ff &0ffe 30 60 7c 6a 75 20 7a 35 ff ab fd 20 6a 35 6b ff &100e 35 70 20 6b ff 73 73 73 73 31 ff 20 20 20 ff 20 &101e 91 9a 7e 37 20 6a 35 2b ff ff 27 22 6f ff 3f 21 &102e ff 20 6b 75 6a 35 20 ef 35 6f ff ff 25 6f ff ff &103e ff 25 ff 20 20 20 ff 20 91 9a 20 20 20 20 20 20 &104e 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 &105e 20 20 20 20 20 20 22 a3 20 20 20 20 20 20 20 20 &106e 92 9a 20 20 20 7c 34 60 7c 7c 30 20 78 7c 74 20 &107e 7c 7c 7c 30 68 74 20 68 34 78 7c 7c 30 20 7e ff &108e 34 20 7c 7c 7c 7c 7c 7c 92 9a 20 20 7a ff 35 ff &109e a7 2b ff 6a 3f a3 6f 35 ff a3 6b 35 6a ff 34 6a &10ae 35 ff 31 2b 25 6a ff ff ff 20 ff a3 a3 a3 ff a3 &10be 92 9a 20 68 3f 6b 35 ff 20 20 20 6a 35 20 6a 35 &10ce ff 7c 7e 25 6a 3f ff fa 35 2b ff 7d 30 ff ff ff &10de ff 35 ff ff ff 20 ff 20 92 9a 60 ff 7d 7e 35 ff &10ee 30 60 7c 6a 75 20 7a 35 ff ab fd 20 6a 35 6b ff &10fe 35 70 20 6b ff 73 73 73 73 31 ff 20 20 20 ff 20 &110e 92 9a 7e 37 20 6a 35 2b ff ff 27 22 6f ff 3f 20 &111e 20 20 20 20 20 20 20 20 20 20 ff ff 25 6f ff ff &112e ff 25 ff 20 20 20 ff 20 92 9a 20 20 20 20 20 20 &113e 20 20 20 20 20 20 20 87 8d 48 6f 70 70 65 72 8c &114e 92 9a 20 20 20 20 22 a3 20 20 20 20 20 20 20 20 &115e 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 87 &116e 8d 48 6f 70 70 65 72 8c 93 9a 20 20 20 20 20 20 &117e 20 20 20 20 20 20 20 20 93 9a 20 20 20 7c 34 60 &118e 7c 7c 30 20 78 7c 74 20 20 20 20 20 20 20 20 20 &119e 20 20 7c 7c 30 20 7e ff 34 20 7c 7c 7c 7c 7c 7c &11ae 93 9a 20 20 7a ff 35 ff a7 2b ff 6a 3f a3 6f 35 &11be ff a3 6b 35 6a ff 34 6a 35 ff 31 2b 25 6a ff ff &11ce ff 20 ff a3 a3 a3 ff a3 93 9a 20 68 3f 6b 35 ff &11de 20 20 20 6a 35 20 6a 35 ff 7c 7e 25 6a 3f ff fa &11ee 35 2b ff 7d 30 ff ff ff ff 35 ff ff ff 20 ff 20 &11fe 93 9a 60 ff 7d 7e 35 ff 30 60 7c 6a 75 20 7a 35 &120e ff ab fd 20 6a 35 6b ff 35 70 20 6b ff 73 73 73 &121e 73 31 ff 20 20 20 ff 20 93 9a 7e 37 20 6a 35 2b &122e ff ff 27 22 6f ff 3f 21 ff 20 6b 75 6a 35 20 ef &123e 35 6f ff ff 25 6f ff ff ff 25 ff 20 20 20 ff 20 &124e 93 9a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 &125e 20 20 20 20 20 20 20 20 20 20 20 20 20 20 22 a3 &126e 20 20 20 20 20 20 20 20 94 9a 20 20 20 7c 34 60 &127e 7c 7c 30 20 78 7c 74 20 7c 7c 7c 30 68 74 20 68 &128e 34 78 7c 7c 30 20 7e ff 34 20 7c 7c 7c 7c 7c 7c &129e 94 9a 20 20 7a ff 35 ff a7 2b 87 20 20 20 20 20 &12ae 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 94 &12be ff 20 ff a3 a3 a3 ff a3 94 9a 20 68 3f 6b 35 ff &12ce 20 20 87 20 20 20 20 20 20 20 20 20 20 20 20 20 &12de 20 20 20 20 20 20 20 94 ff 35 ff ff ff 20 ff 20 &12ee 94 9a 60 ff 7d 7e 35 ff 30 60 87 20 20 20 20 20 &12fe 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 94 &130e 73 31 ff 20 20 20 ff 20 94 9a 7e 37 20 6a 35 2b &131e ff ff 27 22 6f ff 3f 21 ff 20 6b 75 6a 35 20 ef &132e 35 6f ff ff 25 6f ff ff ff 25 ff 20 20 20 ff 20 &133e 94 9a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 &134e 20 20 20 20 20 20 20 20 20 20 20 20 20 20 22 a3 &135e 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 &136e 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ; unused # Source code fragment &137e 6e 61 63 6f 72 6e 28 b9 29 0d ; ...nacorn(TRUE) &1388 15 e0 1e e7 77 69 6e 64 6f 77 20 ef 32 38 2c 31 ; 5600IFwindow VDU28,10,28,30,26,12 &1398 30 2c 32 38 2c 33 30 2c 32 36 2c 31 32 0d &13a6 16 44 0a 2a 53 50 4f 4f 4c 0d ; 5700*SPOOL &13b0 16 4e 1d e3 49 25 3d 30 b8 26 36 46 46 20 88 34 ; 5710FORI%=0TO&6FF STEP4:I%!free=0:NEXT &13c0 3a 49 25 21 66 72 65 65 3d 30 3a ed 0d &13cd 16 58 1f f2 6f 73 63 6c 69 28 22 4c 2e 53 43 52 ; 5720PROCoscli("L.SCREENX "+STR$~free) &13dd 45 45 4e 58 20 22 2b c3 7e 66 72 65 65 29 0d &13ec 16 62 31 f2 6f 73 63 6c 69 28 22 53 2e 53 43 52 ; 5730PROCoscli("S.SCREENX ... &13fc 45 45 4e 58 ; entry_point &1400 a9 13 LDA #&13 # Code assumes PAGE=&D00 # actually LDA #&14 # &1401 written by line 160 of BASIC &1402 85 8f STA &8f ; code_address_high &1404 a2 00 LDX #&00 &1406 86 8e STX &8e ; code_address_low &1408 a0 25 LDY #&25 &140a 91 8e STA (&8e),Y ; code_address # Set &140a &140c a0 2f LDY #&2f &140e 91 8e STA (&8e),Y ; code_address # Set &140e &1410 18 CLC &1411 69 01 ADC #&01 &1413 a0 32 LDY #&32 &1415 91 8e STA (&8e),Y ; code_address # Set &1416 &1417 a0 3c LDY #&3c &1419 91 8e STA (&8e),Y ; code_address # Set &1419 &141b a9 43 LDA #&43 ; key MOD 256 &141d 85 8e STA &8e ; code_address_low ; decryption_loop # Decrypt &1453 - &15ee to &0400 - &05ab &141f 8a TXA &1420 29 0f AND #&0f &1422 a8 TAY &1423 bd 53 13 LDA &1353,X # actually LDA &1453,X ; encrypted_loader # &1424 changed at &140a &1426 51 8e EOR (&8e),Y ; key_address &1428 9d 00 04 STA &0400,X ; decrypted_loader &142b 61 8e ADC (&8e,X) ; key_address &142d 9d 53 13 STA &1353,X # actually STA &1453,X ; encrypted_loader # &142d changed at &140e &1430 bd 53 14 LDA &1453,X # actually LDA &1553,X ; encrypted_loader + &100 # &1431 changed at &1416 &1433 51 8e EOR (&8e),Y ; key_address &1435 9d 00 05 STA &0500,X ; decypted_code + &100 &1438 e1 8e SBC (&8e,X) ; key_address &143a 9d 53 14 STA &1453,X # actually STA &1553,X ; encrypted_loader + &100 # &143b changed at &1419 &143d e8 INX &143e d0 df BNE &141f ; decryption_loop &1440 4c 00 04 JMP &0400 ; decrypted_loader ; key &1443 28 43 29 41 63 6f 72 6e 73 6f 66 74 20 4c 74 64 ; "(C)Acornsoft Ltd" # &1453 - &15ee is decrypted to &0400 - &05ab at &141f ; decrypted_loader &0400 a9 81 LDA #&81 ; Check machine type &0402 a2 00 LDX #&00 &0404 a0 ff LDY #&ff &0406 20 f4 ff JSR &fff4 ; OSBYTE &0409 e0 00 CPX #&00 ; BBC A/B with OS 0.10 &040b f0 67 BEQ &0474 ; is_os_0.10 ; not_os_0.10 &040d a9 04 LDA #&04 ; *RUN &040f a2 16 LDX #&16 ; &0416 = run_string &0411 a0 04 LDY #&04 &0413 6c 1e 02 JMP (&021e) ; file_system_control_vector ; run_string &0416 0d ; loadFile # &0417 - &042c is a reduced version of &f283 - &f2a7 &0417 20 cb f9 JSR &f9cb ; os_claimSerialSystemForLoadSave # &f283 20 cb f9 JSR &f9cb &041a ad f8 02 LDA &02f8 ; fsExecutionAddressLow # &f286 ad f8 02 LDA &02f8 ... &041d 20 87 04 JSR &0487 ; searchForFile # &f28a 20 b6 f6 JSR &f6b6 &0420 ae f4 02 LDX &02f4 ; fsLoadAddressLow # &f290 ae f4 02 LDX &02f4 ... &0423 ad f5 02 LDA &02f5 ; fsLoadAddressMid1 # &f293 ad f5 02 LDA &02f5 ... ; loadOrRunAX &0426 86 a0 STX &a0 ; loadAddressLow # &f2a1 86 a0 STX &a0 &0428 85 a1 STA &a1 ; loadAddressMid1 # &f2a3 85 a1 STA &a1 &042a 4c 30 04 JMP &0430 ; loadOrRun # &f2a5 4c ab f2 JMP &f2ab ; loadOrRun_block_loop # &042d - &0463 is a copy of &f2a8 - &f2de &042d 20 23 05 JSR &0523 ; readBlockHeader ; loadOrRun &0430 a9 30 LDA #&30 &0432 25 ad AND &ad ; os_tapeCurrentOptionsByte &0434 f0 04 BEQ &043a ; skip_checksum &0436 a5 b3 LDA &b3 ; checksumIsValidFlag &0438 d0 03 BNE &043d ; checksumFail ; skip_checksum &043a 20 de f7 JSR &f7de ; os_setStateForLoadingBlockDataOrReset ; checksumFail &043d 20 59 fa JSR &fa59 ; os_loadBlock &0440 d0 2d BNE &046f ; retryAfterFailure &0442 20 b6 fa JSR &fab6 ; os_saveByteAndIncrementBlockNumbers &0445 d0 28 BNE &046f ; retryAfterFailure &0447 20 b4 fb JSR &fbb4 ; os_incrementBlockNumbers2 &044a 2c 00 03 BIT &0300 ; fsBlockFlagByte &044d 30 12 BMI &0461 ; reached_final_block &044f ad fe 02 LDA &02fe ; fsBlockLengthLow &0452 18 CLC &0453 65 a0 ADC &a0 ; loadAddressLow &0455 85 a0 STA &a0 ; loadAddressLow &0457 ad ff 02 LDA &02ff ; fsBlockLengthHigh &045a 65 a1 ADC &a1 ; loadAddressMid1 &045c 85 a1 STA &a1 ; loadAddressMid1 &045e 4c 2d 04 JMP &042d ; loadOrRun_block_loop ; reached_final_block &0461 20 6f f9 JSR &f96f ; os_beepCancelAndPrintReturn &0464 20 ad ff JSR &ffad ; os_CNTAPE # &f2df 4c ad ff JMP &ffad &0467 a9 81 LDA #&81 # Enable CA2 interrupts &0469 8d 4e fe STA &fe4e ; System VIA interrupt enable register &046c 6c f8 02 JMP (&02f8) ; fsExecutionAddressLow # &f2f2 6c f8 02 JMP (&02f8) ; retryAfterFailure &046f 20 8d 04 JSR &048d ; searchForSpecifiedBlock # &046f - &0473 is a copy of &f2e2 - &f2e6 &0472 d0 bc BNE &0430 ; loadOrRun ; is_os_0.10 &0474 a2 01 LDX #&01 # Disable CA2 interrupts &0476 8e 4e fe STX &fe4e ; System VIA interrupt enable register &0479 ca DEX ; 0 &047a 8e 09 03 STX &0309 ; filenameToSearchFor &047d 20 66 05 JSR &0566 ; move_wipe_memory # Clear memory on break &0480 a9 a1 LDA #&a1 # Retry, short messages &0482 85 b9 STA &b9 ; tapeOptionsByte &0484 4c 17 04 JMP &0417 ; loadFile ; searchForFile # &0487 - &04c1 is a copy of &f6b6 - &f6f0 &0487 a9 00 LDA #&00 &0489 85 a4 STA &a4 ; currentBlockNumberLow &048b 85 a5 STA &a5 ; currentBlockNumberHigh ; searchForSpecifiedBlock &048d a5 a4 LDA &a4 ; currentBlockNumberLow &048f 48 PHA &0490 85 a6 STA &a6 ; nextBlockNumberLow &0492 a5 a5 LDA &a5 ; currentBlockNumberHigh &0494 48 PHA &0495 85 a7 STA &a7 ; nextBlockNumberHigh &0497 20 43 fb JSR &fb43 ; os_safePrintFollowingMessage &049a 53 65 61 72 63 68 69 6e 67 0d 00 ; "Searching\r" &04a5 a9 ff LDA #&ff &04a7 20 c2 04 JSR &04c2 ; searchForBlockCheckFilingSystem &04aa 68 PLA &04ab 85 a5 STA &a5 ; currentBlockNumberHigh &04ad 68 PLA &04ae 85 a4 STA &a4 ; currentBlockNumberLow &04b0 a5 a6 LDA &a6 ; nextBlockNumberLow &04b2 05 a6 ORA &a6 ; nextBlockNumberLow &04b4 d0 09 BNE &04bf ; leave_with_minus_one &04b6 85 a4 STA &a4 ; currentBlockNumberLow &04b8 85 a5 STA &a5 ; currentBlockNumberHigh &04ba a2 e7 LDX #&e7 &04bc 20 d6 fb JSR &fbd6 ; os_copyToSoughtFilename ; leave_with_minus_one &04bf a0 ff LDY #&ff &04c1 60 RTS ; searchForBlockCheckFilingSystem # &04c2 - &0522 is a copy of &f34b - &f3ae &04c2 48 PHA &04c3 20 23 05 JSR &0523 ; readBlockHeader &04c6 ad fc 02 LDA &02fc ; fsBlockNumberLow &04c9 85 a4 STA &a4 ; currentBlockNumberLow &04cb ad fd 02 LDA &02fd ; fsBlockNumberHigh &04ce 85 a5 STA &a5 ; currentBlockNumberHigh &04d0 a2 ff LDX #&ff &04d2 86 ba STX &ba ; fsLastBlockReadFlagsCopy &04d4 e8 INX &04d5 86 ab STX &ab ; currentBlockHasDataErrorFlag &04d7 f0 10 BEQ &04e9 ; skip_reset # Always branches ; resetBlockNumberAndContinue &04d9 a9 ff LDA #&ff &04db 85 ba STA &ba ; fsLastBlockReadFlagsCopy &04dd 8d fc 02 STA &02fc ; fsBlockNumberLow &04e0 8d fd 02 STA &02fd ; fsBlockNumberHigh ; searchForBlockLoop &04e3 20 b4 fb JSR &fbb4 ; os_incrementBlockNumbers2 &04e6 20 23 05 JSR &0523 ; readBlockHeader ; skip_reset &04e9 68 PLA &04ea 48 PHA &04eb f0 1b BEQ &0508 ; finishReadingBlockAndContinue &04ed 20 04 fb JSR &fb04 ; os_compareFilenameToSearchFor &04f0 d0 16 BNE &0508 ; finishReadingBlockAndContinue &04f2 a9 30 LDA #&30 &04f4 25 ad AND &ad ; tapeCurrentOptionsByte &04f6 f0 0e BEQ &0506 ; pullAAndReturn &04f8 ad fc 02 LDA &02fc ; fsBlockNumberLow &04fb c5 a6 CMP &a6 ; nextBlockNumberLow &04fd d0 09 BNE &0508 ; finishReadingBlockAndContinue &04ff ad fd 02 LDA &02fd ; fsBlockNumberHigh &0502 c5 a7 CMP &a7 ; nextBlockNumberHigh &0504 d0 02 BNE &0508 ; finishReadingBlockAndContinue ; pullAAndReturn &0506 68 PLA &0507 60 RTS ; finishReadingBlockAndContinue &0508 50 03 BVC &050d ; skip_set_progress_state &050a 20 da f7 JSR &f7da ; os_setProgressState4 ; skip_set_progress_state &050d 20 db f8 JSR &f8db ; os_generateScreenReports &0510 a2 00 LDX #&00 &0512 20 81 fa JSR &fa81 ; os_checkForChecksumError ; wait_for_state &0515 a5 b4 LDA &b4 ; fsReadProgressState &0517 d0 fc BNE &0515 ; wait_for_state &0519 20 b9 fa JSR &fab9 ; os_incrementBlockNumbers &051c 2c 00 03 BIT &0300 ; fsBlockFlagByte &051f 30 b8 BMI &04d9 ; resetBlockNumberAndContinue &0521 10 c0 BPL &04e3 ; searchForBlockLoop # Always branches ; readBlockHeader # &0523 - &0565 is a reduced copy of &f748 - &f790 &0523 20 c1 f7 JSR &f7c1 ; os_readTapeBlockHeader ; startOfBlock &0526 a0 00 LDY #&00 &0528 84 b0 STY &b0 ; tapeChecksumLow &052a 84 b1 STY &b1 ; tapeChecksumHigh ; read_filename_loop &052c 20 91 f7 JSR &f791 ; os_readByteFromTape1 &052f 50 1c BVC &054d ; reachedEndOfHeader # &f754 50 22 BVC &f778 ... &0531 99 e8 02 STA &02e8,Y ; fsFilename &0534 c9 00 CMP #&00 &0536 f0 06 BEQ &053e ; end_of_filename &0538 c8 INY &0539 c0 0b CPY #&0b &053b d0 ef BNE &052c ; read_filename_loop &053d 88 DEY ; end_of_filename &053e a2 0c LDX #&0c ; readBlockHeaderLoop &0540 20 91 f7 JSR &f791 ; os_readByteFromTape1 &0543 50 08 BVC &054d ; reachedEndOfHeader &0545 9d e8 02 STA &02e8,X ; fsFilename &0548 e8 INX &0549 e0 1f CPX #&1f &054b d0 f3 BNE &0540 ; readBlockHeaderLoop ; reachedEndOfHeader &054d a9 00 LDA #&00 &054f 99 e8 02 STA &02e8,Y ; fsFilename &0552 a5 b0 LDA &b0 ; tapeChecksumLow &0554 05 b1 ORA &b1 ; tapeChecksumHigh &0556 85 b3 STA &b3 ; checksumIsValidFlag &0558 a9 00 LDA #&00 &055a 85 b0 STA &b0 ; tapeChecksumLow &055c 85 b1 STA &b1 ; tapeChecksumHigh &055e 85 b4 STA &b4 ; fsReadProgressState &0560 98 TYA &0561 f0 c0 BEQ &0523 ; readBlockHeader &0563 a0 00 LDY #&00 &0565 60 RTS ; move_wipe_memory &0566 a2 15 LDX #&15 ; move_wipe_memory_loop &0568 bd 85 05 LDA &0585,X ; unrelocated_wipe_memory &056b 9d 00 01 STA &0100,X ; wipe_memory &056e ca DEX &056f 10 f7 BPL &0568 ; move_wipe_memory_loop &0571 a2 78 LDX #&78 ; &0568 = command_string &0573 a0 05 LDY #&05 &0575 4c f7 ff JMP &fff7 ; OSCLI ; command_string # Call &0100 on break &0578 4b 2e 31 30 7c 21 56 32 35 36 7c 4d 0d ; "K.10|!V256|M" # &0585 - &059a is copied to &0100 - &0115 at &0568 ; wipe_memory &0100 a9 0e LDA #&0e &0102 85 71 STA &71 ; wipe_address_low &0104 a0 00 LDY #&00 &0106 84 70 STY &70 ; wipe_address_high ; wipe_memory_loop # Wipe &0e00 - &7fff with &0e &0108 91 70 STA (&70),Y ; wipe_address &010a c8 INY &010b d0 fb BNE &0108 ; wipe_memory_loop &010d e6 71 INC &71 ; wipe_address_high &010f 24 71 BIT &71 ; wipe_address_high &0111 50 f5 BVC &0108 ; wipe_memory_loop &0113 6c fc ff JMP (&fffc) ; os_reset_address_low ; unused # Not meaningful encrypted or decrypted &059b 68 00 6c 54 44 08 63 09 61 2f 2b 33 4e 1a 01 00 &05ab 1b ; unused # Source code fragment &15ef 20 20 20 20 20 20 20 20 4c 44 41 20 69 6e 66 6f ; " LDA info " &15ff 20 Game disassembly ================ ; ? ; 000e00 003500 002800 ; unused &0e00 00 00 0f 1b 00 00 00 00 00 00 00 00 00 00 00 00 ; unused_addresses_low ; 0 1 2 3 4 5 6 7 8 9 a b c d e f &0e10 70 73 d5 37 99 fb 5d bf 21 83 b5 17 29 43 75 b7 ; &00 &0e20 39 53 7d df 35 97 f9 5b 8d ef 19 57 95 a3 cd 2f ; &10 &0e30 91 b3 cd d0 d3 d6 d9 dc df e2 e5 e8 eb ee f1 f4 ; &20 ; unused_addresses_high ; 0 1 2 3 4 5 6 7 8 9 a b c d e f &0e40 11 11 11 12 12 12 13 13 14 14 14 15 15 15 15 15 ; &00 &0e50 16 16 16 16 17 17 17 18 18 18 19 19 19 19 19 1a ; &10 &0e60 1a 1a 1a 1a 1a 1a 1a 1a 1a 1a 1a 1a 1a 1a 1a 1a ; &20 ; sprite_data ; sprite_00 # Unused &0e70 01 01 ; 2 pixels wide, 1 pixels high &0e72 00 ; sprite_01 (SPRITE_FROG_UP) # Used by SPRITE_BUFFER_MASKED_FROG_UP and SPRITE_LIFE &0e73 08 0c ; 8*2 pixels wide, 12 pixels high &0e75 10 10 15 00 00 00 04 04 04 00 04 00 2a 2e 2e 0c &0e85 04 0c 0c 0c 0c 0c 08 00 15 1d 1d 0c 08 0c 0c 0c &0e95 0c 0c 04 00 20 20 2a 00 00 00 08 08 08 00 08 00 &0ea5 2a 00 00 2a 3f 2a 00 00 00 2a 00 2a 00 00 00 00 &0eb5 00 00 00 00 00 00 00 15 00 00 00 00 00 00 00 00 &0ec5 00 00 00 2a 15 00 00 15 3f 15 00 00 00 15 00 15 ; sprite_02 (SPRITE_FROG_LEFT) # Used by SPRITE_BUFFER_MASKED_FROG_LEFT &0ed5 08 0c ; 8*2 pixels wide, 12 pixels high &0ed7 00 35 35 3f 04 04 04 04 3f 35 35 00 00 00 04 0c &0ee7 0c 0c 0c 0c 0c 04 00 00 00 00 08 0c 0c 0c 0c 0c &0ef7 0c 08 00 00 00 00 08 08 00 00 00 00 08 08 00 00 &0f07 2a 00 00 00 00 00 00 00 00 00 00 2a 3f 2a 00 00 &0f17 00 00 00 00 00 00 2a 3f 3f 15 00 00 00 00 00 00 &0f27 00 00 15 3f 3f 15 00 00 15 15 15 15 00 00 15 3f ; sprite_03 (SPRITE_FROG_DOWN) # Used by SPRITE_BUFFER_MASKED_FROG_DOWN &0f37 08 0c ; 8*2 pixels wide, 12 pixels high &0f39 00 04 00 04 04 04 00 00 00 15 10 10 00 08 0c 0c &0f49 0c 0c 0c 04 0c 2e 2e 2a 00 04 0c 0c 0c 0c 0c 08 &0f59 0c 1d 1d 15 00 08 00 08 08 08 00 00 00 2a 20 20 &0f69 2a 00 2a 00 00 00 2a 3f 2a 00 00 2a 15 00 00 00 &0f79 00 00 00 00 00 00 00 00 2a 00 00 00 00 00 00 00 &0f89 00 00 00 00 15 00 15 00 00 00 15 3f 15 00 00 15 ; sprite_04 (SPRITE_FROG_RIGHT) # Used by SPRITE_BUFFER_MASKED_FROG_RIGHT &0f99 08 0c ; 8*2 pixels wide, 12 pixels high &0f9b 00 00 04 04 00 00 00 00 04 04 00 00 00 00 04 0c &0fab 0c 0c 0c 0c 0c 04 00 00 00 00 08 0c 0c 0c 0c 0c &0fbb 0c 08 00 00 00 3a 3a 3f 08 08 08 08 3f 3a 3a 00 &0fcb 3f 2a 00 00 2a 2a 2a 2a 00 00 2a 3f 3f 2a 00 00 &0fdb 00 00 00 00 00 00 2a 3f 3f 15 00 00 00 00 00 00 &0feb 00 00 15 3f 15 00 00 00 00 00 00 00 00 00 00 15 ; sprite_05 (SPRITE_FROG_JUMPING_UP) # Used by SPRITE_BUFFER_MASKED_FROG_JUMPING_UP &0ffb 08 0c ; 8*2 pixels wide, 12 pixels high &0ffd 10 10 15 00 08 0c 00 00 00 00 00 04 2a 2e 2e 0c &100d 04 0c 0c 0c 0c 08 08 08 15 1d 1d 0c 08 0c 0c 0c &101d 0c 04 04 04 20 20 2a 00 04 0c 00 00 00 00 00 08 &102d 2a 00 00 00 00 00 00 2a 2a 2a 2a 00 00 00 00 00 &103d 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 &104d 00 00 00 00 15 00 00 00 00 00 00 15 15 15 15 00 ; sprite_06 (SPRITE_FROG_JUMPING_LEFT) # Used by SPRITE_BUFFER_MASKED_FROG_JUMPING_LEFT &105d 08 0c ; 8*2 pixels wide, 12 pixels high &105f 00 35 35 3f 04 04 04 04 3f 35 35 00 0c 04 04 0c &106f 0c 0c 0c 0c 0c 04 04 0c 00 00 00 0c 0c 0c 0c 0c &107f 0c 00 00 00 00 00 04 0c 00 00 00 00 0c 04 00 00 &108f 2a 00 00 00 00 00 00 00 00 00 00 2a 00 00 00 00 &109f 00 00 00 00 00 00 00 00 15 15 00 00 00 00 00 00 &10af 00 00 15 15 3f 2a 00 00 00 15 15 00 00 00 2a 3f ; sprite_07 (SPRITE_FROG_JUMPING_DOWN) # Used by SPRITE_BUFFER_MASKED_FROG_JUMPING_DOWN &10bf 08 0c ; 8*2 pixels wide, 12 pixels high &10c1 04 00 00 00 00 00 0c 08 00 15 10 10 08 08 08 0c &10d1 0c 0c 0c 04 0c 2e 2e 2a 04 04 04 0c 0c 0c 0c 08 &10e1 0c 1d 1d 15 08 00 00 00 00 00 0c 04 00 2a 20 20 &10f1 00 2a 2a 2a 2a 00 00 00 00 00 00 2a 00 00 00 00 &1101 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 &1111 00 00 00 00 00 15 15 15 15 00 00 00 00 00 00 15 ; sprite_08 (SPRITE_FROG_JUMPING_RIGHT) # Used by SPRITE_BUFFER_MASKED_FROG_JUMPING_RIGHT &1121 08 0c ; 8*2 pixels wide, 12 pixels high &1123 00 00 08 0c 00 00 00 00 0c 08 00 00 00 00 00 0c &1133 0c 0c 0c 0c 0c 00 00 00 0c 08 08 0c 0c 0c 0c 0c &1143 0c 08 08 0c 00 3a 3a 3f 08 08 08 08 3f 3a 3a 00 &1153 3f 15 00 00 00 2a 2a 00 00 00 15 3f 2a 2a 00 00 &1163 00 00 00 00 00 00 2a 2a 00 00 00 00 00 00 00 00 &1173 00 00 00 00 15 00 00 00 00 00 00 00 00 00 00 15 ; sprite_09 (SPRITE_CROCODILE_HALF) # Updated by update_half_crocodile (&2ab0) &1183 03 10 ; 6 pixels wide, 16 pixels high &1185 0c 18 18 30 30 30 30 30 18 04 0c 3a 0c 0c 30 30 &1195 30 30 30 30 30 30 30 30 30 0c 0c 3a 0c 0c 30 30 &11a5 30 30 30 30 30 30 30 30 30 18 0c 3a 0c 18 30 30 ; sprite_0a (SPRITE_CROCODILE_FULL) # Updated by update_full_crocodile (&2add) &11b5 06 10 ; 12 pixels wide, 16 pixels high &11b7 0c 18 18 30 30 30 30 0c 09 0c 0c 0c 0c 0c 30 30 &11c7 30 30 30 30 30 30 30 18 06 06 0c 0c 0c 0c 30 30 &11d7 30 30 30 30 30 30 24 0c 0c 18 3a 35 0c 0c 30 30 &11e7 30 30 30 24 0c 0c 0c 18 3a 30 30 35 0c 0c 30 30 &11f7 30 30 30 0c 04 18 3a 30 30 30 30 35 0c 0c 30 30 &1207 0c 24 24 30 30 30 30 30 30 30 30 30 18 30 30 30 ; sprite_0b (SPRITE_LOG_LEFT) # Used by SPRITE_LOG &1217 02 08 ; 4 pixels wide, 8 pixels high &1219 30 30 30 30 30 30 30 30 21 07 29 16 09 06 03 21 ; sprite_0c (SPRITE_LOG_RIGHT) # Used by SPRITE_LOG &1229 03 08 ; 6 pixels wide, 8 pixels high &122b 0b 07 29 16 09 06 03 03 0b 17 3d 17 1d 17 17 03 &123b 3a 3f 15 15 15 15 3f 3a ; sprite_0d (SPRITE_PLAYER_BUFFER) # Written by SPRITE_BUFFER_MASKED_FROG_* ; # and SPRITE_BUFFER_MASKED_FROG_JUMPING_* &1243 04 0c ; 8 pixels wide, 12 pixels high &1245 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 &1255 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 &1265 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ; sprite_0e (SPRITE_BANK_ONE) # Updated by update_bank_initialisation (&2949) &1275 04 10 ; 8 pixels wide, 16 pixels high &1277 0c 0d 0c 0c 0c 0e 0c 0d 0c 0d 0c 0e 0c 0c 0e 0c &1287 0c 0c 0d 0c 0e 0c 0c 0c 0d 0c 0c 0e 0c 0e 0c 0c &1297 0c 0d 0c 0e 0c 0c 0e 0c 0c 0d 0c 0c 0e 0c 0e 0c &12a7 0c 0c 0d 0c 0e 0c 0d 0c 0c 0c 0d 0c 0c 0e 0c 0c ; sprite_0f (SPRITE_BANK_TWO) &12b7 08 10 ; 16 pixels wide, 16 pixels high &12b9 0e 0c 0d 0e 0c 0d 0c 0d 0c 0c 0d 0c 0c 24 24 30 &12c9 0e 0c 0d 0c 0c 0d 0c 0c 0e 0c 0d 0c 0e 0c 0c 0c &12d9 0e 0d 0c 0e 0c 0c 0d 0c 0e 0c 0c 0e 0c 0c 0e 0c &12e9 0d 0c 0c 0e 0d 0c 0c 0e 0c 0e 0c 0d 0c 0e 0c 0c &12f9 0c 0c 0e 0c 0c 0d 0c 0e 0c 0d 0c 0c 0d 0c 0e 0c &1309 0d 0c 0c 0e 0c 0c 0d 0c 0d 0c 0c 0e 0c 0d 0c 0c &1319 0c 0e 0c 0c 0e 0c 0d 0c 0c 0c 0e 0c 0c 0d 0c 0c &1329 0c 0d 0c 0e 0c 0d 0c 0c 0e 0c 0c 0e 0c 18 18 30 ; sprite_10 (SPRITE_HOME) &1339 06 04 ; 12 pixels wide, 4 pixels high &133b 0c 18 18 30 30 30 30 30 30 30 30 30 30 30 30 30 &134b 30 30 30 30 0c 24 24 30 ; sprite_11 (SPRITE_TURTLE) # Used by SPRITE_TURTLES &1353 05 08 ; 10 pixels wide, 8 pixels high &1355 30 30 30 25 25 30 30 30 65 25 33 33 33 33 25 65 &1365 b0 33 33 33 33 33 33 b0 da 1a 32 33 33 32 1a da &1375 30 30 30 30 30 30 30 30 ; sprite_12 (SPRITE_VEHICLE_LEFT_ONE) # Updated by update_vehicle_left (&2a64) &137d 08 0c ; 16 pixels wide, 12 pixels high &137f 00 00 14 3c 3c 3c 3c 3c 3c 14 00 00 00 00 3c 3c &138f 3c 3c 3c 3c 3c 3c 00 00 00 00 14 1c 1c 1c 1c 1c &139f 1c 14 00 00 00 01 3c 3c 3c 3c 3c 3c 3c 3c 01 00 &13af 00 02 3c 3c 3c 3c 3c 3c 3c 3c 02 00 00 01 3c 3c &13bf 3c 3c 3c 3c 3c 3c 01 00 00 02 3c 3c 3c 3c 3c 3c &13cf 3c 3c 02 00 00 00 00 00 00 00 00 00 00 00 00 00 ; sprite_13 (SPRITE_VEHICLE_RIGHT_ONE) # Used by SPRITE_FAST_VEHICLE ; # Updated by update_vehicle_right (&2a6e) &13df 07 0c ; 14 pixels wide, 12 pixels high &13e1 00 00 00 00 00 00 00 00 00 00 00 00 03 03 03 05 &13f1 0c 0c 0c 0c 05 03 03 03 03 03 03 0a 0c 0c 0c 0c &1401 0a 03 03 03 00 00 00 00 0c 1d 1d 0c 00 00 00 00 &1411 00 00 00 00 0c 30 30 0c 00 00 00 00 00 03 03 05 &1421 0c 0c 0c 0c 05 03 03 00 00 02 02 00 08 0c 0c 08 &1431 00 02 02 00 ; sprite_14 (SPRITE_VEHICLE_LEFT_TWO) # Updated by update_vehicle_left (&2a64) &1435 08 0c ; 16 pixels wide, 12 pixels high &1437 00 0f 05 05 05 05 05 05 05 05 0f 00 00 00 05 0f &1447 05 05 05 05 0f 05 00 00 00 00 0f 0f 30 0f 0f 30 &1457 0f 0f 00 00 09 09 0f 0f 25 0f 0f 25 0f 0f 09 09 &1467 09 09 0f 03 03 03 03 03 03 0f 09 09 09 09 0f 03 &1477 03 03 03 03 03 0f 09 09 00 00 0a 0a 1b 0a 0a 1b &1487 0a 0a 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ; sprite_15 (SPRITE_VEHICLE_RIGHT_TWO) # Updated by update_vehicle_right (&2a6e) &1497 08 0c ; 16 pixels wide, 12 pixels high &1499 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 2b &14a9 2b 01 01 2b 2b 01 00 00 00 3c 03 03 17 17 12 12 &14b9 03 03 3c 00 00 28 03 30 35 30 30 35 30 03 28 00 &14c9 00 00 03 03 07 03 03 07 03 03 00 00 00 3c 03 03 &14d9 0f 03 03 0f 03 03 3c 00 00 28 03 17 03 03 03 03 &14e9 17 03 28 00 00 00 2a 2a 2a 00 00 2a 2a 2a 00 00 ; sprite_16 (SPRITE_SKULL) # Used by SPRITE_MASKED_SKULL &14f9 08 0c ; 8*2 pixels wide, 12 pixels high &14fb 00 15 15 15 00 00 2a 3f 2a 00 00 15 3f 3f 15 15 &150b 3f 3f 15 15 2a 15 2a 00 3f 3f 2a 2a 3f 3f 2a 2a &151b 15 2a 15 00 00 2a 2a 2a 00 00 15 3f 15 00 00 2a &152b 3f 2a 2a 2a 3f 3f 15 00 15 3f 3f 2a 00 00 00 00 &153b 00 00 2a 2a 15 2a 15 3f 00 00 00 00 00 00 15 15 &154b 2a 15 2a 3f 3f 15 15 15 3f 3f 2a 00 2a 3f 3f 15 ; sprite_17 (SPRITE_TRAFFIC_BUFFER) # Written by SPRITE_CREATE_TRAFFIC_BUFFER ; # Used by SPRITE_CHECK_TRAFFIC_BUFFER &155b 04 0c ; 8 pixels wide, 12 pixels high &155d 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 &156d 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 &157d 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ; sprite_18 (SPRITE_FROG_HOME) # Updated by update_frog_in_home (&2f2d) &158d 06 10 ; 12 pixels wide, 16 pixels high &158f 0c 18 18 30 30 30 30 30 24 24 24 24 30 24 24 30 &159f 30 3f 3a 3f 24 24 0c 0d 0d 0c 0c 0d 0d 18 30 30 &15af 30 3a 2e 2e 0c 04 08 0c 0f 0f 0d 0d 0f 0f 30 30 &15bf 30 35 1d 1d 0c 08 04 0c 0f 0f 0e 0e 0f 0f 30 30 &15cf 30 3f 35 3f 18 18 0c 0e 0e 0c 0c 0e 0e 24 30 30 &15df 0c 24 24 30 30 30 30 30 18 18 18 18 30 18 18 30 ; sprite_19 (SPRITE_SNAKE_ONE) # Used by SPRITE_BUFFER_SNAKE_ONE &15ef 04 0a ; 8 pixels wide, 10 pixels high &15f1 09 17 03 06 0c 09 09 0b 0c 0d 06 06 06 06 06 06 &1601 03 03 03 09 0e 09 03 03 03 06 06 06 06 0c 0d 0c &1611 0c 06 07 06 03 03 09 0c ; sprite_1a (SPRITE_SNAKE_TWO) # Used by SPRITE_BUFFER_SNAKE_TWO &1619 06 0a ; 12 pixels wide, 10 pixels high &161b 0d 0c 09 17 03 0d 0c 0e 0c 0c 0c 0d 0c 06 03 03 &162b 09 0c 0e 0c 0c 0c 0e 0c 0c 03 03 03 0c 0e 0c 0e &163b 0c 09 03 03 06 0c 0d 0c 0d 0c 0e 06 03 03 09 0c &164b 0d 0c 0d 0c 0c 0e 0c 03 03 03 0c 0e ; sprite_1b (SPRITE_SNAKE_BUFFER) # Written and used by SPRITE_BUFFER_SNAKE_* &1657 06 0a ; 12 pixels wide, 10 pixels high &1659 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 &1669 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 &1679 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 &1689 00 00 00 00 00 00 00 00 00 00 00 00 ; sprite_1c (SPRITE_LEVEL_COUNTER) &1695 02 06 ; 4 pixels wide, 6 pixels high &1697 04 18 18 04 00 00 00 08 08 00 00 00 ; sprite_1d (SPRITE_SUBMERGING_TURTLE) # Used by SPRITE_TURTLES_SUBMERGING &16a3 05 08 ; 10 pixels wide, 8 pixels high &16a5 30 30 30 25 25 30 30 30 65 25 f3 f3 f3 f3 25 65 &16b5 b0 f3 f3 f3 f3 f3 f3 b0 da 1a b2 f3 f3 b2 1a da &16c5 30 30 30 30 30 30 30 30 ; sprite_1e (SPRITE_VEHICLE_LEFT_THREE) # Updated by update_vehicle_left (&2a64) &16cd 08 0c ; 16 pixels wide, 12 pixels high &16cf 00 00 01 03 02 07 07 02 03 01 00 00 00 03 02 05 &16df 0b 03 03 0b 05 02 03 00 00 02 03 03 07 12 12 07 &16ef 03 03 02 00 00 00 03 30 25 25 30 30 30 03 00 00 &16ff 00 03 03 17 17 03 03 17 17 03 03 00 00 03 03 3f &170f 03 09 06 03 3f 03 03 00 00 00 02 3f 02 08 02 02 &171f 3f 02 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ; sprite_1f (SPRITE_VEHICLE_RIGHT_THREE) # Updated by update_vehicle_right (&2a6e) &172f 08 0c ; 16 pixels wide, 12 pixels high &1731 00 00 00 00 00 00 00 00 00 00 00 00 00 11 11 30 &1741 30 25 25 30 30 11 11 00 00 31 31 30 0f 0f 0f 0f &1751 30 31 31 00 00 31 31 30 30 30 30 30 30 31 31 00 &1761 00 31 31 30 03 03 03 03 30 31 31 00 00 00 00 30 &1771 30 30 30 30 30 00 00 00 00 00 14 14 3c 14 14 3c &1781 14 14 00 00 00 00 28 00 00 00 00 00 00 28 00 00 ; sprite_20 (SPRITE_DRAGONFLY_LEFT) # Updated by update_dragonfly (&2b7a) &1791 04 08 ; 8 pixels wide, 8 pixels high &1793 0b 07 29 16 09 06 03 03 17 2a 2a 00 00 2a 2a 17 &17a3 15 2b 3f 00 00 3f 2b 15 03 07 3f 00 00 3f 03 03 ; sprite_21 (SPRITE_DRAGONFLY_RIGHT) &17b3 03 08 ; 6 pixels wide, 8 pixels high &17b5 0b 07 29 16 09 06 03 03 0b 07 29 16 09 06 03 03 &17c5 0b 07 29 16 09 06 03 03 ; unused &17cd 01 01 00 01 01 00 01 01 00 01 01 00 01 01 00 01 &17dd 01 00 01 01 00 01 01 00 01 01 00 01 01 00 01 01 &17ed 00 01 01 00 01 01 00 01 01 01 00 01 01 00 01 01 &17fd 00 01 01 00 01 01 00 01 01 00 00 01 01 01 01 00 &180d 00 01 01 00 01 01 01 00 01 01 00 00 01 01 00 01 &181d 01 01 01 01 01 00 01 01 00 01 01 00 00 01 01 00 &182d 01 01 00 01 01 00 01 00 01 01 00 01 01 00 01 01 ; unused # Source code fragment &183d 6f 72 0d ; ... or &1840 00 c8 05 20 0d ; 200 &1845 01 2c 13 6d 6f 64 65 25 3d 32 3a 64 3d 38 3a 70 ; 300mode%=2:d=8:p=2 &1855 3d 32 0d &1858 01 90 27 ef 32 33 2c 32 32 34 2c 30 2c 26 33 43 ; 400VDU23,224,0,&3C,&42,&42,&42,&42,&3C,0 # defines an open circle &1868 2c 26 34 32 2c 26 34 32 2c 26 34 32 2c 26 34 32 &1878 2c 26 33 43 2c 30 0d &187f 01 f4 19 d3 3d 26 32 45 30 30 3a 6e 61 6d 65 73 ; 500HIMEM=&2E00:names=HIMEM:ss=10 &188f 3d 93 3a 73 73 3d 31 30 0d &1898 02 58 23 53 64 61 74 61 3d 26 31 31 30 30 3a 6d ; 600Sdata=&1100:maxshape=&1B00:s=48 &18a8 61 78 73 68 61 70 65 3d 26 31 42 30 30 3a 73 3d &18b8 34 38 0d &18bb 02 bc 40 73 68 61 70 65 6c 6f 3d 53 64 61 74 61 ; 700shapelo=Sdata+&10:shapehi=shapelo+s:shdata=shapehi+s:I%=FNnew &18cb 2b 26 31 30 3a 73 68 61 70 65 68 69 3d 73 68 61 &18db 70 65 6c 6f 2b 73 3a 73 68 64 61 74 61 3d 73 68 &18eb 61 70 65 68 69 2b 73 3a 49 25 3d a4 6e 65 77 0d ; 800bx ... &18fb 03 20 28 62 78 ; to_start &1900 4c f5 1d JMP &1df5 ; start ; execute_bytecode_function_Y &1903 b9 70 23 LDA &2370,Y ; bytecode_function_addresses_low &1906 85 78 STA &78 ; vm_pc_address_low &1908 b9 f0 23 LDA &23f0,Y ; bytecode_function_addresses_high &190b 85 79 STA &79 ; vm_pc_address_high &190d 10 07 BPL &1916 ; execute_bytecode_function_loop &190f 29 7f AND #&7f &1911 85 79 STA &79 ; vm_pc_address_high &1913 6c 78 00 JMP (&0078) ; vm_pc_address ; execute_bytecode_function_loop &1916 a5 79 LDA &79 ; vm_pc_address_high &1918 c9 23 CMP #&23 &191a b0 0d BCS &1929 ; not_illegal_pc &191c 00 BRK &191d 00 &191e 49 6c 6c 65 67 61 6c 20 70 63 00 ; "Illegal pc" ; not_illegal_pc &1929 8d 95 04 STA &0495 ; previous_vm_pc_address_high &192c a5 78 LDA &78 ; vm_pc_address_low &192e 8d 94 04 STA &0494 ; previous_vm_pc_address_low &1931 20 66 1b JSR &1b66 ; get_byte_of_bytecode # Get byte of bytecode for opcode &1934 0a ASL A &1935 b0 20 BCS &1957 ; opcode_starts_with_1 ; opcode_starts_with_0 &1937 30 27 BMI &1960 ; opcode_starts_with_01 ; opcode_starts_with_00 &1939 4a LSR A &193a c9 20 CMP #&20 &193c b0 6d BCS &19ab ; opcode_starts_with_001 ; opcode_starts_with_000 # Opcodes &00 - &1f pull two values and run subroutine &193e aa TAX &193f bd 80 21 LDA &2180,X ; opcode_subroutines_000_addresses_low &1942 85 74 STA &74 ; subroutine_address_low &1944 bd a0 21 LDA &21a0,X ; opcode_subroutines_000_addresses_high &1947 85 75 STA &75 ; subroutine_address_high &1949 68 PLA # Pull value from stack (pull1) &194a 85 7a STA &7a ; pull1 &194c 68 PLA # Pull value from stack (pull2) &194d 20 54 19 JSR &1954 ; execute_subroutine &1950 48 PHA # Push result onto stack &1951 4c 16 19 JMP &1916 ; execute_bytecode_function_loop ; execute_subroutine &1954 6c 74 00 JMP (&0074) ; subroutine_address ; opcode_starts_with_1 &1957 4a LSR A &1958 c9 40 CMP #&40 &195a b0 2a BCS &1986 ; opcode_starts_with_11 ; opcode_starts_with_10 # Opcodes &80 - &bf push numbers &00 - &3f &195c 48 PHA # Push number onto stack &195d 4c 16 19 JMP &1916 ; execute_bytecode_function_loop ; opcode_starts_with_01 &1960 0a ASL A &1961 30 17 BMI &197a ; opcode_starts_with_011 ; opcode_starts_with_010 # Opcodes &40 - &5f run subroutine and push value &1963 4a LSR A &1964 4a LSR A &1965 aa TAX # X is &00 - &1f &1966 ac 2f 04 LDY &042f ; vm_object &1969 bd 00 21 LDA &2100,X ; opcode_subroutines_010_addresses_low &196c 85 74 STA &74 ; subroutine_address_low &196e bd 20 21 LDA &2120,X ; opcode_subroutines_010_addresses_high &1971 85 75 STA &75 ; subroutine_address_high &1973 20 54 19 JSR &1954 ; execute_subroutine &1976 48 PHA # Push result onto stack &1977 4c 16 19 JMP &1916 ; execute_bytecode_function_loop ; opcode_starts_with_011 # Opcodes &60 - &7f push variables &00 - &1f &197a 4a LSR A &197b 4a LSR A &197c 29 1f AND #&1f &197e aa TAX &197f bd 40 04 LDA &0440,X ; vm_variables &1982 48 PHA &1983 4c 16 19 JMP &1916 ; execute_bytecode_function_loop ; opcode_starts_with_11 &1986 29 3f AND #&3f &1988 c9 20 CMP #&20 &198a b0 15 BCS &19a1 ; opcode_starts_with_111 ; opcode_starts_with_110 # Opcodes &c0 - &df pull value and run subroutines &198c aa TAX &198d bd 40 21 LDA &2140,X ; opcode_subroutines_110_addresses_low &1990 85 74 STA &74 ; subroutine_address_low &1992 bd 60 21 LDA &2160,X ; opcode_subroutines_110_addresses_high &1995 85 75 STA &75 ; subroutine_address_high &1997 68 PLA # Pull value from stack &1998 ac 2f 04 LDY &042f ; vm_object &199b 20 54 19 JSR &1954 ; execute_subroutine &199e 4c 16 19 JMP &1916 ; execute_bytecode_function_loop ; opcode_starts_with_111 # Opcodes &e0 - &ff pull value, set variables &00 - &1f &19a1 29 1f AND #&1f &19a3 aa TAX &19a4 68 PLA &19a5 9d 40 04 STA &0440,X ; vm_variables &19a8 4c 16 19 JMP &1916 ; execute_bytecode_function_loop ; opcode_starts_with_001 # Opcodes &20 - &3f are handled individually &19ab c9 23 CMP #&23 ; OPCODE_23 &19ad d0 07 BNE &19b6 ; not_opcode_23 ; execute_opcode_23 # Opcode &23 pushes next byte of bytecode &19af 20 66 1b JSR &1b66 ; get_byte_of_bytecode # Get byte of bytecode to push &19b2 48 PHA # Push value to stack &19b3 4c 16 19 JMP &1916 ; execute_bytecode_function_loop ; not_opcode_23 &19b6 c9 20 CMP #&20 ; OPCODE_20 &19b8 d0 0a BNE &19c4 ; not_opcode_20 ; execute_opcode_20 # Opcode &20 inverts value on stack &19ba 68 PLA # Pull value from stack &19bb 49 ff EOR #&ff &19bd 18 CLC &19be 69 01 ADC #&01 &19c0 48 PHA # Push inverted value to stack &19c1 4c 16 19 JMP &1916 ; execute_bytecode_function_loop ; not_opcode_20 &19c4 c9 21 CMP #&21 ; OPCODE_21 &19c6 d0 13 BNE &19db ; not_opcode_21 ; execute_opcode_21 # Opcode &21 jumps &19c8 20 5b 1b JSR &1b5b ; get_two_bytes_of_bytecode # Get two bytes of bytecode for jump offset ; execute_jump &19cb 18 CLC &19cc a5 78 LDA &78 ; vm_pc_address_low &19ce 65 74 ADC &74 ; byte_one &19d0 85 78 STA &78 ; vm_pc_address_low &19d2 a5 79 LDA &79 ; vm_pc_address_high &19d4 65 75 ADC &75 ; byte_two &19d6 85 79 STA &79 ; vm_pc_address_high &19d8 4c 16 19 JMP &1916 ; execute_bytecode_function_loop ; not_opcode_21 &19db c9 22 CMP #&22 ; OPCODE_22 &19dd d0 09 BNE &19e8 ; not_op22 ; execute_opcode_22 # Opcode &22 jumps conditionally &19df 20 5b 1b JSR &1b5b ; get_two_bytes_of_bytecode # Get two bytes of bytecode for jump offset &19e2 68 PLA # Pull value from stack &19e3 f0 e6 BEQ &19cb ; execute_jump # Jump if zero &19e5 4c 16 19 JMP &1916 ; execute_bytecode_function_loop ; not_opcode_22 &19e8 c9 28 CMP #&28 ; OPCODE_28 &19ea d0 13 BNE &19ff ; not_opcode_28 ; execute_opcode_28 # Opcode &28 sets active object types &19ec 20 5b 1b JSR &1b5b ; get_two_bytes_of_bytecode &19ef a5 78 LDA &78 ; vm_pc_address_low &19f1 8d 02 23 STA &2302 ; initial_active_object_types_address_low &19f4 85 7c STA &7c ; active_object_types_address_low &19f6 a5 79 LDA &79 ; vm_pc_address_high &19f8 8d 03 23 STA &2303 ; initial_active_object_types_address_high &19fb 85 7d STA &7d ; active_object_types_address_high &19fd d0 cc BNE &19cb ; execute_jump # Always branches ; not_opcode_28 &19ff c9 29 CMP #&29 ; OPCODE_29 &1a01 d0 22 BNE &1a25 ; not_op29 ; execute_opcode_29 # Opcode &29 plays a sound &1a03 a0 07 LDY #&07 ; populate_sound_block_loop &1a05 68 PLA # Pull four values from stack for sound block &1a06 aa TAX &1a07 0a ASL A &1a08 a9 ff LDA #&ff &1a0a 69 00 ADC #&00 &1a0c 49 ff EOR #&ff &1a0e 99 65 04 STA &0465,Y ; sound_block &1a11 88 DEY &1a12 8a TXA &1a13 99 65 04 STA &0465,Y ; sound_block &1a16 88 DEY &1a17 10 ec BPL &1a05 ; populate_sound_block_loop &1a19 a9 07 LDA #&07 ; Generate a sound (SOUND) &1a1b a2 65 LDX #&65 &1a1d a0 04 LDY #&04 ; &0465 = sound_block &1a1f 20 f1 ff JSR &fff1 ; OSWORD &1a22 4c 16 19 JMP &1916 ; execute_bytecode_function_loop ; not_opcode_29 &1a25 c9 2a CMP #&2a ; OPCODE_2a &1a27 d0 10 BNE &1a39 ; not_opcode_2a ; execute_opcode_2a # Opcode &2a writes a string &1a29 20 66 1b JSR &1b66 ; get_byte_of_bytecode # Get a byte of bytecode for length &1a2c aa TAX ; write_character_loop &1a2d 20 66 1b JSR &1b66 ; get_byte_of_bytecode # Get a byte of bytecode for each character &1a30 20 ee ff JSR &ffee ; OSWRCH &1a33 ca DEX &1a34 d0 f7 BNE &1a2d ; write_character_loop &1a36 4c 16 19 JMP &1916 ; execute_bytecode_function_loop ; not_opcode_2a &1a39 c9 2b CMP #&2b ; OPCODE_2b &1a3b f0 04 BEQ &1a41 ; execute_opcode_2b &1a3d c9 2c CMP #&2c ; OPCODE_2c &1a3f d0 63 BNE &1aa4 ; not_opcode_2c ; execute_opcode_2b # Opcode &2b adds to decimal ; execute_opcode_2c # Opcode &2c subtracts from decimal &1a41 85 74 STA &74 &1a43 20 66 1b JSR &1b66 ; get_byte_of_bytecode # Get a byte of bytecode for decimal to use for value &1a46 aa TAX &1a47 d0 0c BNE &1a55 ; skip_using_stack # If zero, pull three values from the stack &1a49 68 PLA &1a4a 8d 70 04 STA &0470 ; decimals # for low &1a4d 68 PLA &1a4e 8d 78 04 STA &0478 ; decimals + 8 # middle &1a51 68 PLA &1a52 8d 80 04 STA &0480 ; decimals + 16 # and high byte of value, store in decimal 0 ; skip_using_stack &1a55 20 66 1b JSR &1b66 ; get_byte_of_bytecode # Get a byte of bytecode for decimal to use for result &1a58 a8 TAY &1a59 a5 74 LDA &74 &1a5b c9 2b CMP #&2b ; OPCODE_2b &1a5d f0 21 BEQ &1a80 ; add_to_decimal ; subtract_from_decimal &1a5f f8 SED &1a60 38 SEC &1a61 b9 70 04 LDA &0470,Y ; decimals &1a64 fd 70 04 SBC &0470,X ; decimals &1a67 99 70 04 STA &0470,Y ; decimals &1a6a b9 78 04 LDA &0478,Y ; decimals + 8 &1a6d fd 78 04 SBC &0478,X ; decimals + 8 &1a70 99 78 04 STA &0478,Y ; decimals + 8 &1a73 b9 80 04 LDA &0480,Y ; decimals + 16 &1a76 fd 80 04 SBC &0480,X ; decimals + 16 &1a79 99 80 04 STA &0480,Y ; decimals + 16 &1a7c d8 CLD &1a7d 4c 9e 1a JMP &1a9e ; update_decimal ; add_to_decimal &1a80 f8 SED &1a81 18 CLC &1a82 b9 70 04 LDA &0470,Y ; decimals &1a85 7d 70 04 ADC &0470,X ; decimals &1a88 99 70 04 STA &0470,Y ; decimals &1a8b b9 78 04 LDA &0478,Y ; decimals + 8 &1a8e 7d 78 04 ADC &0478,X ; decimals + 8 &1a91 99 78 04 STA &0478,Y ; decimals + 8 &1a94 b9 80 04 LDA &0480,Y ; decimals + 16 &1a97 7d 80 04 ADC &0480,X ; decimals + 16 &1a9a 99 80 04 STA &0480,Y ; decimals + 16 &1a9d d8 CLD &1a9e 20 18 1e JSR &1e18 ; write_decimal &1aa1 4c 16 19 JMP &1916 ; execute_bytecode_function_loop ; not_opcode_2c &1aa4 c9 2d CMP #&2d ; OPCODE_2d &1aa6 d0 11 BNE &1ab9 ; not_opcode_2d ; execute_opcode_2d # Opcode &2d runs command &1aa8 a6 78 LDX &78 ; vm_pc_address_low &1aaa a4 79 LDY &79 ; vm_pc_address_high &1aac 20 f7 ff JSR &fff7 ; OSCLI ; discard_bytes_loop &1aaf 20 66 1b JSR &1b66 ; get_byte_of_bytecode # Skip bytes until end of command &1ab2 c9 0d CMP #&0d ; CR &1ab4 d0 f9 BNE &1aaf ; discard_bytes_loop &1ab6 4c 16 19 JMP &1916 ; execute_bytecode_function_loop ; not_opcode_2d &1ab9 c9 2e CMP #&2e ; OPCODE_2e &1abb d0 0c BNE &1ac9 ; not_opcode_2e ; execute_opcode_2e # Opcode &2e reads a value from an array &1abd 20 5b 1b JSR &1b5b ; get_two_bytes_of_bytecode # Get two bytes of bytecode for length of array &1ac0 68 PLA # Pull value from stack for offset into array &1ac1 a8 TAY &1ac2 88 DEY &1ac3 b1 78 LDA (&78),Y ; vm_pc_address # Get byte from array &1ac5 48 PHA &1ac6 4c cb 19 JMP &19cb ; execute_jump # Skip past contents of array ; not_opcode_2e &1ac9 c9 2f CMP #&2f ; OPCODE_2f &1acb d0 14 BNE &1ae1 ; not_opcode_2f ; execute_opcode_2f # Opcode &2f executes a bytecode function &1acd 68 PLA # Pull function number &1ace a8 TAY &1acf a5 78 LDA &78 ; vm_pc_address_low # Push return address onto stack &1ad1 48 PHA &1ad2 a5 79 LDA &79 ; vm_pc_address_high &1ad4 48 PHA &1ad5 20 03 19 JSR &1903 ; execute_bytecode_function_Y &1ad8 68 PLA # Pull return address from stack &1ad9 85 79 STA &79 ; vm_pc_address_high &1adb 68 PLA &1adc 85 78 STA &78 ; vm_pc_address_low &1ade 4c 16 19 JMP &1916 ; execute_bytecode_function_loop ; not_opcode_2f &1ae1 c9 30 CMP #&30 ; OPCODE_30 &1ae3 d0 47 BNE &1b2c ; not_opcode_30 ; execute_opcode_30 # Opcode &30 replots all objects of a given type &1ae5 68 PLA # Pull type to replot &1ae6 a8 TAY &1ae7 a5 78 LDA &78 ; vm_pc_address_low &1ae9 48 PHA # Push initial PC &1aea a5 79 LDA &79 ; vm_pc_address_high &1aec 48 PHA &1aed b9 31 23 LDA &2331,Y ; object_types_first_slots + 1 &1af0 48 PHA # Push last slot for this type &1af1 b9 30 23 LDA &2330,Y ; object_types_first_slots &1af4 a8 TAY &1af5 88 DEY &1af6 98 TYA &1af7 48 PHA # Push first slot for this type, minus one ; replot_objects_loop &1af8 68 PLA # Pull current slot &1af9 a8 TAY &1afa 68 PLA # Pull last slot for this type &1afb 85 74 STA &74 ; last_slot &1afd 48 PHA # Push last slot for this type &1afe c8 INY &1aff 98 TYA &1b00 48 PHA # Push current slot, incremented by one &1b01 c4 74 CPY &74 ; last_slot &1b03 f0 20 BEQ &1b25 ; finished_replotting &1b05 b1 7e LDA (&7e),Y ; objects_sprite_address &1b07 30 ef BMI &1af8 ; replot_objects_loop # Is there an object in this slot? &1b09 98 TYA &1b0a 20 67 1c JSR &1c67 ; set_vm_object &1b0d 68 PLA # Pull current slot into Y &1b0e a8 TAY &1b0f 68 PLA # Pull last slot for this type into X &1b10 aa TAX &1b11 68 PLA # Pull initial PC &1b12 85 79 STA &79 ; vm_pc_address_high &1b14 68 PLA &1b15 85 78 STA &78 ; vm_pc_address_low &1b17 48 PHA # Push initial PC &1b18 a5 79 LDA &79 ; vm_pc_address_high &1b1a 48 PHA &1b1b 8a TXA &1b1c 48 PHA # Push last slot for this type &1b1d 98 TYA &1b1e 48 PHA # Push current slot &1b1f 20 16 19 JSR &1916 ; execute_bytecode_function_loop &1b22 4c f8 1a JMP &1af8 ; replot_objects_loop ; finished_replotting &1b25 68 PLA # Pull and discard current slot &1b26 68 PLA # Pull and discard last slot for this type &1b27 68 PLA # Pull and discard initial PC &1b28 68 PLA &1b29 4c 16 19 JMP &1916 ; execute_bytecode_function_loop ; not_opcode_30 &1b2c c9 31 CMP #&31 ; OPCODE_31 &1b2e d0 14 BNE &1b44 ; not_opcode_31 ; execute_opcode_31 # Opcode &31 plots a sprite &1b30 a9 ff LDA #&ff # &ff to use temporary object &1b32 20 80 1c JSR &1c80 ; create_object &1b35 ac 2f 04 LDY &042f ; vm_object &1b38 68 PLA # Pull y position from stack (pull1) &1b39 91 82 STA (&82),Y ; objects_y_address &1b3b 68 PLA # Pull x position from stack (pull2) &1b3c 91 80 STA (&80),Y ; objects_x_address &1b3e 68 PLA # Pull sprite from stack (pull3) &1b3f 91 7e STA (&7e),Y ; objects_sprite_address &1b41 4c 16 19 JMP &1916 ; execute_bytecode_function_loop ; not_opcode_31 &1b44 c9 27 CMP #&27 ; OPCODE_27 # Opcode &27 ends bytecode interpretation &1b46 d0 01 BNE &1b49 ; illegal_opcode &1b48 60 RTS ; illegal_opcode # Opcodes &24 - &26 and &31 - &3f abort interpreter &1b49 00 BRK &1b4a 00 &1b4b 49 6c 6c 65 67 61 6c 20 50 72 6f 67 72 61 6d 00 ; "Illegal Program" ; get_two_bytes_of_bytecode &1b5b 20 66 1b JSR &1b66 ; get_byte_of_bytecode &1b5e 85 74 STA &74 ; byte_one &1b60 20 66 1b JSR &1b66 ; get_byte_of_bytecode &1b63 85 75 STA &75 ; byte_two &1b65 60 RTS ; get_byte_of_bytecode &1b66 a0 00 LDY #&00 &1b68 b1 78 LDA (&78),Y ; vm_pc_address &1b6a e6 78 INC &78 ; vm_pc_address_low &1b6c d0 02 BNE &1b70 ; leave &1b6e e6 79 INC &79 ; vm_pc_address_high ; leave &1b70 60 RTS ; execute_opcode_09 # Opcode &09 returns pull2 + pull1 &1b71 18 CLC &1b72 65 7a ADC &7a ; pull1 &1b74 60 RTS ; execute_opcode_0a # Opcode &0a returns pull2 - pull1 &1b75 38 SEC &1b76 e5 7a SBC &7a ; pull1 &1b78 60 RTS ; execute_opcode_0b # Opcode &0b returns pull2 * pull1 &1b79 aa TAX &1b7a f0 16 BEQ &1b92 ; leave &1b7c 10 0c BPL &1b8a ; skip_inversion &1b7e 49 ff EOR #&ff &1b80 aa TAX &1b81 e8 INX &1b82 a5 7a LDA &7a ; pull1 &1b84 49 ff EOR #&ff &1b86 85 7a STA &7a ; pull1 &1b88 e6 7a INC &7a ; pull1 ; skip_inversion &1b8a a9 00 LDA #&00 ; multiplication_loop &1b8c 18 CLC &1b8d 65 7a ADC &7a ; pull1 &1b8f ca DEX &1b90 d0 fa BNE &1b8c ; multiplication_loop ; leave &1b92 60 RTS ; execute_opcode_0c # Opcode &0c returns pull2 / pull1 &1b93 a6 7a LDX &7a ; pull1 &1b95 f0 0a BEQ &1ba1 ; divide_by_zero &1b97 a2 ff LDX #&ff &1b99 38 SEC ; division_loop &1b9a e8 INX &1b9b e5 7a SBC &7a ; pull1 &1b9d b0 fb BCS &1b9a ; division_loop &1b9f 8a TXA &1ba0 60 RTS ; divide_by_zero &1ba1 00 BRK &1ba2 00 &1ba3 44 69 76 69 64 65 20 62 79 20 7a 65 72 6f 00 ; "Divide by zero" ; execute_opcode_0d # Opcode &0d gets decimal[pull2].digit[pull1] &1bb2 06 7a ASL &7a ; pull1 &1bb4 06 7a ASL &7a ; pull1 &1bb6 06 7a ASL &7a ; pull1 &1bb8 65 7a ADC &7a ; pull1 &1bba aa TAX &1bbb bd 70 04 LDA &0470,X ; decimals &1bbe 60 RTS ; execute_opcode_00 # Opcode &00 returns pull2 AND pull1 &1bbf 25 7a AND &7a ; pull1 &1bc1 60 RTS ; execute_opcode_01 # Opcode &01 returns pull2 OR pull1 &1bc2 05 7a ORA &7a ; pull1 &1bc4 60 RTS ; execute_opcode_02 # Opcode &02 returns pull2 EOR pull1 &1bc5 45 7a EOR &7a ; pull1 &1bc7 60 RTS ; execute_opcode_03 # Opcode &03 returns zero if pull2 >= pull1, &ff if not &1bc8 20 fc 1b JSR &1bfc ; compare_pull2_to_pull1 &1bcb 90 0a BCC &1bd7 ; leave_with_minus_one ; leave_with_zero &1bcd a9 00 LDA #&00 &1bcf 60 RTS ; execute_opcode_04 # Opcode &04 returns zero if pull2 > pull1, &ff if not &1bd0 20 fc 1b JSR &1bfc ; compare_pull2_to_pull1 &1bd3 f0 02 BEQ &1bd7 ; leave_with_minus_one &1bd5 b0 f6 BCS &1bcd ; leave_with_zero ; leave_with_minus_one &1bd7 a9 ff LDA #&ff &1bd9 60 RTS ; execute_opcode_05 # Opcode &05 returns zero if pull2 != pull1, &ff if not &1bda 20 fc 1b JSR &1bfc ; compare_pull2_to_pull1 &1bdd f0 f8 BEQ &1bd7 ; leave_with_minus_one &1bdf a9 00 LDA #&00 &1be1 60 RTS ; execute_opcode_06 # Opcode &06 returns zero if pull2 <= pull1, &ff if not &1be2 20 fc 1b JSR &1bfc ; compare_pull2_to_pull1 &1be5 f0 e6 BEQ &1bcd ; leave_with_zero &1be7 90 e4 BCC &1bcd ; leave_with_zero &1be9 a9 ff LDA #&ff &1beb 60 RTS ; execute_opcode_07 # Opcode &07 returns zero if pull2 < pull1, &ff if not &1bec 20 fc 1b JSR &1bfc ; compare_pull2_to_pull1 &1bef b0 e6 BCS &1bd7 ; leave_with_minus_one &1bf1 a9 00 LDA #&00 &1bf3 60 RTS ; execute_opcode_08 # Opcode &08 returns zero if pull2 == pull1, &ff if not &1bf4 20 fc 1b JSR &1bfc ; compare_pull2_to_pull1 &1bf7 f0 d4 BEQ &1bcd ; leave_with_zero &1bf9 a9 ff LDA #&ff &1bfb 60 RTS ; compare_pull2_to_pull1 &1bfc 48 PHA &1bfd a5 7a LDA &7a ; pull1 &1bff 49 80 EOR #&80 # Ensure negative values are smaller &1c01 85 7a STA &7a ; pull1 &1c03 68 PLA &1c04 49 80 EOR #&80 # Ensure negative values are smaller &1c06 c5 7a CMP &7a ; pull1 &1c08 60 RTS ; execute_opcode_41 # Opcode &41 gets register &01 ; execute_opcode_42 # Opcode &42 gets register &02 ; execute_opcode_43 # Opcode &43 gets register &03 (vm_collision_result) ; execute_opcode_44 # Opcode &44 gets register &04 ; execute_opcode_45 # Opcode &45 gets register &05 ; execute_opcode_46 # Opcode &46 gets register &06 (ro) ; execute_opcode_47 # Opcode &47 gets register &07 ; execute_opcode_48 # Opcode &48 gets register &08 ; execute_opcode_4c # Opcode &4c gets register &0c (vm_left_clip) ; execute_opcode_4d # Opcode &4d gets register &0d (vm_right_clip) ; execute_opcode_4e # Opcode &4e gets register &0e (ro) ; execute_opcode_4f # Opcode &4f gets register &0f (vm_object) ; execute_opcode_50 # Opcode &50 gets register &10 ; execute_opcode_51 # Opcode &51 gets register &11 (vm_type_to_update) (ro) ; execute_opcode_53 # Opcode &53 gets register &13 (vm_level) ; execute_opcode_57 # Opcode &57 gets register &17 ; execute_opcode_5a # Opcode &5a gets register &1a &1c09 bd 20 04 LDA &0420,X ; vm_registers # X is opcode & &1f &1c0c 60 RTS ; execute_opcode_c1 # Opcode &c1 sets register &01 ; execute_opcode_c2 # Opcode &c2 sets register &02 ; execute_opcode_c3 # Opcode &c3 sets register &03 (vm_collision_result) ; execute_opcode_c4 # Opcode &c4 sets register &04 (vm_game_over) ; execute_opcode_c5 # Opcode &c5 sets register &05 (vm_level_completed) ; execute_opcode_c7 # Opcode &c7 sets register &07 ; execute_opcode_c8 # Opcode &c8 sets register &08 ; execute_opcode_cb # Opcode &cb sets register &0b (vm_key) (wo) ; execute_opcode_cc # Opcode &cc sets register &0c (vm_left_clip) ; execute_opcode_cd # Opcode &cd sets register &0d (vm_right_clip) ; execute_opcode_d0 # Opcode &d0 sets register &10 ; execute_opcode_d2 # Opcode &d2 sets register &12 (wo) ; execute_opcode_d3 # Opcode &d3 sets register &13 (vm_level) ; execute_opcode_d7 # Opcode &d7 sets register &17 ; execute_opcode_da # Opcode &da sets register &1a &1c0d 9d 20 04 STA &0420,X ; vm_registers # X is opcode & &1f &1c10 60 RTS ; check_for_keypress_or_get_key # If top bit of A is set, use A as INKEY value for check &1c11 aa TAX # If top bit of A is unset, read key within time limit &1c12 0a ASL A &1c13 a9 ff LDA #&ff &1c15 69 00 ADC #&00 &1c17 49 ff EOR #&ff &1c19 a8 TAY # Y is &ff if top bit set, &00 if top bit unset &1c1a a9 81 LDA #&81 ; Read key with time limit / Scan for a particular key &1c1c 20 f4 ff JSR &fff4 ; OSBYTE # Returns Y = &ff if timed out, &1c1f 86 74 STX &74 ; tmp &1c21 98 TYA &1c22 05 74 ORA &74 ; tmp &1c24 c0 1b CPY #&1b ; ESCAPE &1c26 d0 07 BNE &1c2f ; leave &1c28 a9 7e LDA #&7e ; Acknowledge ESCAPE condition &1c2a 20 81 1e JSR &1e81 ; osbyte_with_X_and_Y_zero &1c2d a9 1b LDA #&1b ; ESCAPE ; leave # Leaves with A = &ff if read key timed out, or A = key &1c2f 60 RTS # Leaves with A = &ff if checked key pressed, 0 if not ; execute_opcode_52 # Opcode &52 returns a random number ; rnd &1c30 8a TXA &1c31 48 PHA &1c32 a2 08 LDX #&08 ; rnd_loop &1c34 ad 6d 04 LDA &046d ; rnd_state &1c37 29 48 AND #&48 &1c39 69 38 ADC #&38 &1c3b 0a ASL A &1c3c 0a ASL A &1c3d 2e 6f 04 ROL &046f ; rnd_state + 2 &1c40 2e 6e 04 ROL &046e ; rnd_state + 1 &1c43 2e 6d 04 ROL &046d ; rnd_state &1c46 ca DEX &1c47 d0 eb BNE &1c34 ; rnd_loop &1c49 68 PLA &1c4a aa TAX &1c4b ad 6d 04 LDA &046d ; rnd_state &1c4e 60 RTS ; execute_opcode_c6 # Opcode &c6 removes objects of a given type ; remove_objects_of_type_A &1c4f aa TAX &1c50 bd 30 23 LDA &2330,X ; object_types_first_slots &1c53 9d 00 04 STA &0400,X ; object_types_next_object &1c56 a8 TAY &1c57 bd 31 23 LDA &2331,X ; object_types_first_slots + 1 &1c5a 85 74 STA &74 ; last_slot &1c5c a9 ff LDA #&ff # Set to &ff to indicate no object in slot ; remove_objects_loop &1c5e 91 7e STA (&7e),Y ; objects_sprite_address &1c60 c8 INY &1c61 c4 74 CPY &74 ; last_slot &1c63 d0 f9 BNE &1c5e ; remove_objects_loop &1c65 60 RTS ; execute_opcode_ce # Opcode &ce discards the pulled value &1c66 60 RTS ; execute_opcode_cf # Opcode &cf sets vm_object ; set_vm_object &1c67 48 PHA &1c68 ae 00 23 LDX &2300 ; temporary_object_type &1c6b bd 30 23 LDA &2330,X ; object_types_first_slots &1c6e cd 2f 04 CMP &042f ; vm_object # If the previous object was the temporary object, &1c71 d0 04 BNE &1c77 ; skip_plotting_sprite &1c73 a8 TAY &1c74 20 e7 1e JSR &1ee7 ; plot_object # Plot it ; skip_plotting_sprite &1c77 68 PLA &1c78 8d 2f 04 STA &042f ; vm_object # Set vm_object &1c7b 60 RTS ; break &1c7c 00 BRK ; unused &1c7d 00 51 00 ; execute_opcode_d1 # Opcode &d1 creates an object of a given type ; create_object &1c80 c9 ff CMP #&ff ; OBJECT_TYPE_TEMPORARY # &ff if using temporary object &1c82 f0 47 BEQ &1ccb ; create_temporary_object &1c84 cd 00 23 CMP &2300 ; temporary_object_type &1c87 b0 f3 BCS &1c7c ; break &1c89 aa TAX &1c8a bc 30 23 LDY &2330,X ; object_types_first_slots &1c8d bd 31 23 LDA &2331,X ; object_types_first_slots + 1 &1c90 85 74 STA &74 ; last_slot ; find_free_slot &1c92 b1 7e LDA (&7e),Y ; objects_sprite_address &1c94 c9 ff CMP #&ff ; SPRITE_NONE &1c96 f0 0a BEQ &1ca2 ; found_free_slot &1c98 c8 INY &1c99 c4 74 CPY &74 ; last_slot &1c9b d0 f5 BNE &1c92 ; find_free_slot &1c9d a9 ff LDA #&ff ; OBJECT_NONE &1c9f 4c 67 1c JMP &1c67 ; set_vm_object ; create_object_in_slot &1ca2 84 74 STY &74 ; slot &1ca4 ac 2f 04 LDY &042f ; vm_object &1ca7 b1 80 LDA (&80),Y ; objects_x_address &1ca9 48 PHA &1caa b1 82 LDA (&82),Y ; objects_y_address &1cac 48 PHA &1cad bd 50 23 LDA &2350,X ; object_types_sprites &1cb0 48 PHA &1cb1 a5 74 LDA &74 ; slot &1cb3 20 67 1c JSR &1c67 ; set_vm_object &1cb6 a8 TAY &1cb7 68 PLA &1cb8 91 7e STA (&7e),Y ; objects_sprite_address &1cba 68 PLA &1cbb 91 82 STA (&82),Y ; objects_y_address &1cbd 68 PLA &1cbe 91 80 STA (&80),Y ; objects_x_address &1cc0 a9 00 LDA #&00 &1cc2 91 84 STA (&84),Y ; objects_velocity_x_address &1cc4 91 86 STA (&86),Y ; objects_velocity_y_address &1cc6 91 88 STA (&88),Y ; objects_data_one_address &1cc8 91 8a STA (&8a),Y ; objects_data_two_address &1cca 60 RTS ; create_temporary_object &1ccb ac 2f 04 LDY &042f ; vm_object &1cce b1 7e LDA (&7e),Y ; objects_sprite_address &1cd0 ae 00 23 LDX &2300 ; temporary_object_type &1cd3 9d 50 23 STA &2350,X ; object_types_sprites &1cd6 bc 30 23 LDY &2330,X ; object_types_first_slots &1cd9 4c a2 1c JMP &1ca2 ; create_object_in_slot ; execute_opcode_d4 # Opcode &d4 sets objects_sprite[object] &1cdc ac 2f 04 LDY &042f ; vm_object &1cdf 30 02 BMI &1ce3 ; leave &1ce1 91 7e STA (&7e),Y ; objects_sprite_address ; leave &1ce3 60 RTS ; execute_opcode_d8 # Opcode &d8 sets objects_x[object] &1ce4 ac 2f 04 LDY &042f ; vm_object &1ce7 30 fa BMI &1ce3 ; leave &1ce9 91 80 STA (&80),Y ; objects_x_address &1ceb 60 RTS ; execute_opcode_d9 # Opcode &d9 sets objects_y[object] &1cec ac 2f 04 LDY &042f ; vm_object &1cef 30 f2 BMI &1ce3 ; leave &1cf1 91 82 STA (&82),Y ; objects_y_address &1cf3 60 RTS ; execute_opcode_d5 # Opcode &d5 sets objects_velocity_x[object] &1cf4 ac 2f 04 LDY &042f ; vm_object &1cf7 30 ea BMI &1ce3 ; leave &1cf9 91 84 STA (&84),Y ; objects_velocity_x_address &1cfb 60 RTS ; execute_opcode_d6 # Opcode &d6 sets objects_velocity_y[object] &1cfc ac 2f 04 LDY &042f ; vm_object &1cff 30 e2 BMI &1ce3 ; leave &1d01 91 86 STA (&86),Y ; objects_velocity_y_address &1d03 60 RTS ; execute_opcode_c9 # Opcode &c9 sets objects_data_one[object] &1d04 ac 2f 04 LDY &042f ; vm_object &1d07 30 da BMI &1ce3 ; leave &1d09 91 88 STA (&88),Y ; objects_data_one_address &1d0b 60 RTS ; execute_opcode_ca # Opcode &ca sets objects_data_two[object] &1d0c ac 2f 04 LDY &042f ; vm_object &1d0f 30 d2 BMI &1ce3 ; leave &1d11 91 8a STA (&8a),Y ; objects_data_two_address &1d13 60 RTS ; execute_opcode_54 # Opcode &54 gets objects_sprite[object] &1d14 ac 2f 04 LDY &042f ; vm_object &1d17 b1 7e LDA (&7e),Y ; objects_sprite_address &1d19 60 RTS ; execute_opcode_58 # Opcode &58 gets objects_[object] &1d1a ac 2f 04 LDY &042f ; vm_object &1d1d b1 80 LDA (&80),Y ; objects_x_address &1d1f 60 RTS ; execute_opcode_59 # Opcode &59 gets objects_[object] &1d20 ac 2f 04 LDY &042f ; vm_object &1d23 b1 82 LDA (&82),Y ; objects_y_address &1d25 60 RTS ; execute_opcode_55 # Opcode &55 gets objects_[object] &1d26 ac 2f 04 LDY &042f ; vm_object &1d29 b1 84 LDA (&84),Y ; objects_velocity_x_address &1d2b 60 RTS ; execute_opcode_56 # Opcode &56 gets objects_[object] &1d2c ac 2f 04 LDY &042f ; vm_object &1d2f b1 86 LDA (&86),Y ; objects_velocity_y_address &1d31 60 RTS ; execute_opcode_49 # Opcode &49 gets objects_[object] &1d32 ac 2f 04 LDY &042f ; vm_object &1d35 b1 88 LDA (&88),Y ; objects_data_one_address &1d37 60 RTS ; execute_opcode_4a # Opcode &4a gets objects_[object] &1d38 ac 2f 04 LDY &042f ; vm_object &1d3b b1 8a LDA (&8a),Y ; objects_data_two_address &1d3d 60 RTS ; initialise_variables &1d3e 20 00 0c JSR &0c00 ; wait_for_key_or_fire &1d41 a9 03 LDA #&03 # Enable sound and tune by default &1d43 8d 53 04 STA &0453 ; vm_variables + &13 (sound_enabled) &1d46 a9 ff LDA #&ff &1d48 8d 6e 04 STA &046e ; rnd_state + 1 &1d4b 20 30 1c JSR &1c30 ; rnd &1d4e 20 30 1c JSR &1c30 ; rnd &1d51 20 30 1c JSR &1c30 ; rnd ; initialise_object_variables_addresses &1d54 a9 00 LDA #&00 &1d56 85 70 STA &70 ; address_low &1d58 a9 06 LDA #&06 &1d5a 85 71 STA &71 ; address_high &1d5c ae 00 23 LDX &2300 ; temporary_object_type &1d5f bd 30 23 LDA &2330,X ; object_types_first_slots &1d62 85 74 STA &74 ; size &1d64 e6 74 INC &74 ; size &1d66 a0 00 LDY #&00 ; initialise_object_variables_addresses_loop # &0600 = objects_sprite &1d68 a5 70 LDA &70 ; address_low # &0630 = objects_x &1d6a 99 7e 00 STA &007e,Y ; object_variables_addresses # &0660 = objects_y &1d6d c8 INY # &0690 = objects_velocity_x &1d6e a5 71 LDA &71 ; address_high # &06c0 = objects_velocity_y &1d70 99 7e 00 STA &007e,Y ; object_variables_addresses # &06f0 = objects_data_one &1d73 c8 INY # &0720 = objects_data_two &1d74 18 CLC &1d75 a5 70 LDA &70 ; address_low &1d77 65 74 ADC &74 ; size &1d79 85 70 STA &70 ; address_low &1d7b 90 02 BCC &1d7f ; skip_page &1d7d e6 71 INC &71 ; address_high &1d7f c0 0e CPY #&0e &1d81 d0 e5 BNE &1d68 ; initialise_object_variables_addresses_loop ; wipe_decimals &1d83 a9 00 LDA #&00 &1d85 a0 17 LDY #&17 ; wipe_decimals_loop &1d87 99 70 04 STA &0470,Y ; decimals &1d8a 88 DEY &1d8b 10 fa BPL &1d87 ; wipe_decimals_loop &1d8d 60 RTS ; start_game &1d8e a9 16 LDA #&16 # Change to MODE 2 &1d90 20 ee ff JSR &ffee ; OSWRCH &1d93 a9 02 LDA #&02 &1d95 20 ee ff JSR &ffee ; OSWRCH &1d98 20 d8 09 JSR &09d8 ; initialise_colours &1d9b a9 00 LDA #&00 &1d9d 8d 33 04 STA &0433 ; vm_level &1da0 8d 24 04 STA &0424 ; vm_game_over &1da3 8d 71 04 STA &0471 ; decimals + 1 # Set decimal 1 (score) to 0 &1da6 8d 79 04 STA &0479 ; decimals + 1 + 8 &1da9 8d 81 04 STA &0481 ; decimals + 1 + 16 &1dac ac 00 23 LDY &2300 ; temporary_object_type &1daf 88 DEY ; remove_objects_loop &1db0 98 TYA &1db1 48 PHA &1db2 20 4f 1c JSR &1c4f ; remove_objects_of_type_A &1db5 68 PLA &1db6 a8 TAY &1db7 88 DEY &1db8 10 f6 BPL &1db0 ; remove_objects_loop &1dba ad 00 09 LDA &0900 ; rank_offsets &1dbd 85 70 STA &70 ; high_score_address_low &1dbf a9 09 LDA #&09 &1dc1 85 71 STA &71 ; high_score_address_high &1dc3 a0 00 LDY #&00 # Copy highest score into decimal 2 (high) &1dc5 b1 70 LDA (&70),Y ; high_score_address &1dc7 8d 72 04 STA &0472 ; decimals + 2 &1dca c8 INY &1dcb b1 70 LDA (&70),Y ; high_score_address &1dcd 8d 7a 04 STA &047a ; decimals + 2 + 8 &1dd0 c8 INY &1dd1 b1 70 LDA (&70),Y ; high_score_address &1dd3 8d 82 04 STA &0482 ; decimals + 2 + 16 ; initialise_level &1dd6 ee 33 04 INC &0433 ; vm_level &1dd9 a9 00 LDA #&00 &1ddb 8d 25 04 STA &0425 ; vm_level_completed # Set to zero to indicate level not completed &1dde 8d 2c 04 STA &042c ; vm_left_clip &1de1 a9 50 LDA #&50 &1de3 8d 2d 04 STA &042d ; vm_right_clip &1de6 a9 ff LDA #&ff &1de8 8d 2f 04 STA &042f ; vm_object &1deb a0 00 LDY #&00 # Execute prepare_level_objects bytecode &1ded 20 03 19 JSR &1903 ; execute_bytecode_function_Y &1df0 a9 ff LDA #&ff ; OBJECT_NONE &1df2 4c 67 1c JMP &1c67 ; set_vm_object ; start &1df5 20 3e 1d JSR &1d3e ; initialise_variables ; new_game &1df8 20 8e 1d JSR &1d8e ; start_game ; main_game_loop &1dfb 20 63 20 JSR &2063 ; update_game &1dfe ad 24 04 LDA &0424 ; vm_game_over # &ff at end of game (see &2dab and &2ffc) &1e01 d0 0b BNE &1e0e ; game_over &1e03 ad 25 04 LDA &0425 ; vm_level_completed # &ff if level completed (see &2f9e) &1e06 f0 f3 BEQ &1dfb ; main_game_loop &1e08 20 d6 1d JSR &1dd6 ; initialise_level &1e0b 4c fb 1d JMP &1dfb ; main_game_loop ; game_over &1e0e 20 f2 09 JSR &09f2 ; ; check_for_high_score &1e11 20 00 0c JSR &0c00 ; wait_for_key_or_fire &1e14 4c f8 1d JMP &1df8 ; new_game ; leave &1e17 60 RTS ; write_decimal # Called with Y = decimal &1e18 a9 1f LDA #&1f # TAB(x, y) &1e1a 20 ee ff JSR &ffee ; OSWRCH &1e1d b9 10 23 LDA &2310,Y ; decimal_positions_x &1e20 20 ee ff JSR &ffee ; OSWRCH &1e23 b9 18 23 LDA &2318,Y ; decimal_positions_y &1e26 20 ee ff JSR &ffee ; OSWRCH &1e29 b9 70 04 LDA &0470,Y ; decimals &1e2c 8d 8f 04 STA &048f ; number &1e2f b9 78 04 LDA &0478,Y ; decimals + 8 &1e32 8d 90 04 STA &0490 ; number + 1 &1e35 b9 80 04 LDA &0480,Y ; decimals + 16 &1e38 8d 91 04 STA &0491 ; number + 2 &1e3b b9 08 23 LDA &2308,Y ; decimals_length &1e3e a8 TAY &1e3f f0 d6 BEQ &1e17 ; leave # Leave if length is zero ; write_number &1e41 88 DEY &1e42 ad 8f 04 LDA &048f ; number &1e45 29 f0 AND #&f0 &1e47 0d 90 04 ORA &0490 ; number + 1 &1e4a 0d 91 04 ORA &0491 ; number + 2 &1e4d d0 15 BNE &1e64 ; write_high_nibble_of_number ; write_number_loop &1e4f 88 DEY &1e50 30 08 BMI &1e5a ; write_low_nibble_of_number # Always write last digit ; write_leading_space &1e52 a9 20 LDA #&20 ; " " &1e54 20 ee ff JSR &ffee ; OSWRCH &1e57 4c 4f 1e JMP &1e4f ; write_number_loop ; write_low_nibble_of_number &1e5a ad 8f 04 LDA &048f ; number ; write_low_nibble_as_digit &1e5d 29 0f AND #&0f &1e5f 09 30 ORA #&30 ; "0" &1e61 4c ee ff JMP &ffee ; OSWRCH ; write_high_nibble_of_number &1e64 ad 8f 04 LDA &048f ; number &1e67 48 PHA &1e68 8a TXA &1e69 48 PHA &1e6a a2 04 LDX #&04 # Divide BCD number by ten ; divide_by_ten_loop &1e6c 4e 91 04 LSR &0491 ; number + 2 &1e6f 6e 90 04 ROR &0490 ; number + 1 &1e72 6e 8f 04 ROR &048f ; number &1e75 ca DEX &1e76 d0 f4 BNE &1e6c ; divide_by_ten_loop &1e78 68 PLA &1e79 aa TAX &1e7a 20 41 1e JSR &1e41 ; write_number # Recursive call &1e7d 68 PLA ; number &1e7e 4c 5d 1e JMP &1e5d ; write_low_nibble_as_digit ; osbyte_with_X_and_Y_zero &1e81 a2 00 LDX #&00 ; osbyte_with_Y_zero &1e83 a0 00 LDY #&00 &1e85 4c f4 ff JMP &fff4 ; OSBYTE ; calculate_screen_address &1e88 a9 00 LDA #&00 # Zero to indicate sprite is off top or bottom of screen &1e8a 85 71 STA &71 ; screen_address_high &1e8c 38 SEC &1e8d a9 3f LDA #&3f &1e8f ed 8e 04 SBC &048e ; sprite_y &1e92 90 2a BCC &1ebe ; leave # Leave if sprite is off top or bottom of screen &1e94 85 74 STA &74 ; tmp &1e96 ad 8d 04 LDA &048d ; sprite_x &1e99 46 74 LSR &74 ; tmp &1e9b 2a ROL A &1e9c 90 02 BCC &1ea0 ; skip_page &1e9e c6 71 DEC &71 ; screen_address_high ; skip_page &1ea0 0a ASL A &1ea1 26 71 ROL &71 ; screen_address_high &1ea3 0a ASL A &1ea4 26 71 ROL &71 ; screen_address_high &1ea6 85 70 STA &70 ; screen_address_low &1ea8 a5 74 LDA &74 ; tmp &1eaa 4a LSR A &1eab 48 PHA &1eac a9 00 LDA #&00 &1eae 6a ROR A &1eaf 65 70 ADC &70 ; screen_address_low &1eb1 85 70 STA &70 ; screen_address_low &1eb3 68 PLA &1eb4 26 74 ROL &74 ; tmp &1eb6 65 74 ADC &74 ; tmp &1eb8 69 30 ADC #&30 ; &3000 = screen_memory &1eba 65 71 ADC &71 ; screen_address_high &1ebc 85 71 STA &71 ; screen_address_high ; leave &1ebe 60 RTS ; plotting_code_alternatives # Eight bytes copied into plot_sprite at &1f8c ; plotting_code_overwrite # PLOT_OVERWRITE &1ebf b1 72 LDA (&72),Y ; sprite_address &1ec1 09 00 ORA #&00 &1ec3 09 00 ORA #&00 &1ec5 91 70 STA (&70),Y ; screen_address ; plotting_code_collision_check_or # PLOT_COPY_TO_BUFFER &1ec7 b1 70 LDA (&70),Y ; screen_address &1ec9 91 72 STA (&72),Y ; sprite_address &1ecb 05 75 ORA &75 ; collision_result &1ecd 85 75 STA &75 ; collision_result ; plotting_code_unplot # PLOT_UNPLOT &1ecf a9 00 LDA #&00 # actually LDA unplot_pixel_value &1ed1 09 00 ORA #&00 &1ed3 09 00 ORA #&00 &1ed5 91 70 STA (&70),Y ; screen_address ; plotting_code_masked # PLOT_MASKED &1ed7 b1 70 LDA (&70),Y ; screen_address &1ed9 31 7a AND (&7a),Y ; mask_address &1edb 51 72 EOR (&72),Y ; sprite_address &1edd 91 70 STA (&70),Y ; screen_address ; plotting_code_collision_check # PLOT_COLLISION_CHECK &1edf b1 70 LDA (&70),Y ; screen_address &1ee1 51 72 EOR (&72),Y ; sprite_address &1ee3 05 75 ORA &75 ; collision_result &1ee5 85 75 STA &75 ; collision_result ; plot_object # Called with Y = object &1ee7 98 TYA &1ee8 30 d4 BMI &1ebe ; leave &1eea b1 80 LDA (&80),Y ; objects_x_address &1eec 8d 8d 04 STA &048d ; sprite_x &1eef b1 82 LDA (&82),Y ; objects_y_address &1ef1 8d 8e 04 STA &048e ; sprite_y &1ef4 20 88 1e JSR &1e88 ; calculate_screen_address &1ef7 a5 71 LDA &71 ; screen_address_high &1ef9 f0 c3 BEQ &1ebe ; leave # Leave if sprite is off top or bottom of screen &1efb a9 00 LDA #&00 ; PLOT_OVERWRITE &1efd 8d 8c 04 STA &048c ; plotting_method &1f00 b1 7e LDA (&7e),Y ; objects_sprite_address ; plot_sprite_A &1f02 a8 TAY &1f03 30 b9 BMI &1ebe ; leave # Leave if sprite doesn't have an associated sprite &1f05 b9 70 24 LDA &2470,Y ; sprite_addresses_low &1f08 85 72 STA &72 ; sprite_address_low &1f0a b9 f0 24 LDA &24f0,Y ; sprite_addresses_high &1f0d 85 73 STA &73 ; sprite_address_high &1f0f c9 23 CMP #&23 &1f11 90 67 BCC &1f7a ; plot_sprite # Branch if this is a simple sprite ; plot_multiple_part_sprite_loop &1f13 20 6f 1f JSR &1f6f ; get_byte_of_sprite_data # Get a byte of sprite data for plotting method &1f16 c9 ff CMP #&ff # &ff indicates end of multiple part sprite &1f18 f0 a4 BEQ &1ebe ; leave &1f1a 8d 8c 04 STA &048c ; plotting_method &1f1d c9 02 CMP #&02 ; PLOT_UNPLOT &1f1f f0 30 BEQ &1f51 ; unplot_sprite &1f21 20 6f 1f JSR &1f6f ; get_byte_of_sprite_data # Get a byte of sprite data for sprite part &1f24 48 PHA &1f25 20 6f 1f JSR &1f6f ; get_byte_of_sprite_data # Get a byte of sprite data for x offset &1f28 18 CLC &1f29 6d 8d 04 ADC &048d ; sprite_x &1f2c 8d 8d 04 STA &048d ; sprite_x &1f2f 20 6f 1f JSR &1f6f ; get_byte_of_sprite_data # Get a byte of sprite data for y offset &1f32 18 CLC &1f33 6d 8e 04 ADC &048e ; sprite_y &1f36 8d 8e 04 STA &048e ; sprite_y &1f39 20 88 1e JSR &1e88 ; calculate_screen_address &1f3c 68 PLA &1f3d a8 TAY &1f3e a5 72 LDA &72 ; sprite_address_low &1f40 48 PHA &1f41 a5 73 LDA &73 ; sprite_address_high &1f43 48 PHA &1f44 98 TYA &1f45 20 02 1f JSR &1f02 ; plot_sprite_A &1f48 68 PLA &1f49 85 73 STA &73 ; sprite_address_high &1f4b 68 PLA &1f4c 85 72 STA &72 ; sprite_address_low &1f4e 4c 13 1f JMP &1f13 ; plot_multiple_part_sprite_loop ; unplot_sprite &1f51 20 6f 1f JSR &1f6f ; get_byte_of_sprite_data # Get a byte of sprite data for value to unplot with &1f54 8d d0 1e STA &1ed0 ; unplot_pixel_value &1f57 a5 72 LDA &72 ; sprite_address_low &1f59 48 PHA &1f5a a5 73 LDA &73 ; sprite_address_high &1f5c 48 PHA &1f5d 20 7a 1f JSR &1f7a ; plot_sprite &1f60 68 PLA &1f61 85 73 STA &73 ; sprite_address_high &1f63 68 PLA &1f64 85 72 STA &72 ; sprite_address_low &1f66 20 6f 1f JSR &1f6f ; get_byte_of_sprite_data # Discard two bytes of sprite data &1f69 20 6f 1f JSR &1f6f ; get_byte_of_sprite_data &1f6c 4c 13 1f JMP &1f13 ; plot_multiple_part_sprite_loop ; get_byte_of_sprite_data &1f6f a0 00 LDY #&00 &1f71 b1 72 LDA (&72),Y ; sprite_address &1f73 e6 72 INC &72 ; sprite_address_low &1f75 d0 02 BNE &1f79 ; leave &1f77 e6 73 INC &73 ; sprite_address_high &1f79 60 RTS ; plot_sprite &1f7a ad 8c 04 LDA &048c ; plotting_method &1f7d 0a ASL A &1f7e 0a ASL A &1f7f 0a ASL A &1f80 69 bf ADC #&bf ; &1ebf = plotting_code_alternatives &1f82 85 74 STA &74 ; code_address_low &1f84 a9 1e LDA #&1e &1f86 69 00 ADC #&00 &1f88 85 75 STA &75 ; code_address_high &1f8a a0 07 LDY #&07 ; copy_plotting_code_loop &1f8c b1 74 LDA (&74),Y ; code_address &1f8e 99 04 20 STA &2004,Y ; plotting_code &1f91 88 DEY &1f92 10 f8 BPL &1f8c ; copy_plotting_code_loop &1f94 a5 70 LDA &70 ; screen_address_low # Backup screen address prior to plotting &1f96 48 PHA &1f97 a5 71 LDA &71 ; screen_address_high &1f99 48 PHA &1f9a a0 00 LDY #&00 &1f9c b1 72 LDA (&72),Y ; sprite_address # Get a byte of sprite data for width &1f9e 85 76 STA &76 ; sprite_width &1fa0 c8 INY &1fa1 b1 72 LDA (&72),Y ; sprite_address # Get a byte of sprite data for height &1fa3 8d 8a 04 STA &048a ; sprite_height &1fa6 a5 70 LDA &70 ; screen_address_low &1fa8 09 03 ORA #&03 &1faa a8 TAY &1fab 29 07 AND #&07 &1fad 85 74 STA &74 ; plot_y_half_group &1faf ad 8d 04 LDA &048d ; sprite_x &1fb2 8d 8b 04 STA &048b ; plot_x &1fb5 38 SEC &1fb6 98 TYA &1fb7 ed 8a 04 SBC &048a ; sprite_height &1fba 85 70 STA &70 ; screen_address_low &1fbc b0 02 BCS &1fc0 ; skip_screen_page &1fbe c6 71 DEC &71 ; screen_address_high ; skip_screen_page &1fc0 e6 72 INC &72 ; sprite_address_low &1fc2 d0 02 BNE &1fc6 ; skip_sprite_page &1fc4 e6 73 INC &73 ; sprite_address_high ; skip_sprite_page &1fc6 a9 00 LDA #&00 &1fc8 85 75 STA &75 ; collision_result &1fca ad 8c 04 LDA &048c ; plotting_method &1fcd c9 03 CMP #&03 ; PLOT_MASKED &1fcf d0 1b BNE &1fec ; plot_sprite_column_loop &1fd1 46 76 LSR &76 ; sprite_width &1fd3 a5 72 LDA &72 ; sprite_address_low &1fd5 85 7a STA &7a ; mask_address_low &1fd7 a5 73 LDA &73 ; sprite_address_high &1fd9 85 7b STA &7b ; mask_address_high &1fdb a6 76 LDX &76 ; sprite_width ; loop &1fdd 18 CLC &1fde a5 7a LDA &7a ; mask_address_low &1fe0 6d 8a 04 ADC &048a ; sprite_height &1fe3 85 7a STA &7a ; mask_address_low &1fe5 90 02 BCC &1fe9 ; skip_page &1fe7 e6 7b INC &7b ; mask_address_high ; skip_page &1fe9 ca DEX &1fea d0 f1 BNE &1fdd ; loop ; plot_sprite_column_loop &1fec ac 8a 04 LDY &048a ; sprite_height &1fef a6 74 LDX &74 ; plot_y_half_group &1ff1 a5 71 LDA &71 ; screen_address_high # Backup screen address prior to plotting column &1ff3 48 PHA &1ff4 a5 70 LDA &70 ; screen_address_low &1ff6 48 PHA &1ff7 ad 8b 04 LDA &048b ; plot_x &1ffa cd 2c 04 CMP &042c ; vm_left_clip &1ffd 30 16 BMI &2015 ; skip_plotting_column &1fff cd 2d 04 CMP &042d ; vm_right_clip &2002 10 11 BPL &2015 ; skip_plotting_column ; plot_sprite_row_loop ; plotting_code # &2004 - &200b is overwritten; see &1f8e &2004 b1 72 LDA (&72),Y ; sprite_address &2006 09 00 ORA #&00 &2008 09 00 ORA #&00 &200a 91 70 STA (&70),Y ; screen_address &200c ca DEX &200d 30 43 BMI &2052 ; move_up_a_group ; consider_next_row &200f 88 DEY &2010 d0 f2 BNE &2004 ; plot_sprite_row_loop &2012 ac 8a 04 LDY &048a ; sprite_height ; skip_plotting_column &2015 ee 8b 04 INC &048b ; plot_x &2018 18 CLC &2019 98 TYA &201a 65 72 ADC &72 ; sprite_address_low &201c 85 72 STA &72 ; sprite_address_low &201e 90 02 BCC &2022 ; skip_sprite_page &2020 e6 73 INC &73 ; sprite_address_high ; skip_sprite_page &2022 18 CLC &2023 98 TYA &2024 65 7a ADC &7a ; mask_address_low &2026 85 7a STA &7a ; mask_address_low &2028 90 02 BCC &202c ; skip_mask_page &202a e6 7b INC &7b ; mask_address_high ; skip_mask_page &202c 18 CLC &202d 68 PLA # Restore screen address from prior to plotting column &202e 69 08 ADC #&08 # Move right two pixels &2030 85 70 STA &70 ; screen_address_low &2032 68 PLA &2033 69 00 ADC #&00 &2035 85 71 STA &71 ; screen_address_high &2037 c6 76 DEC &76 ; sprite_width &2039 d0 b1 BNE &1fec ; plot_sprite_column_loop &203b ad 8c 04 LDA &048c ; plotting_method &203e c9 01 CMP #&01 ; PLOT_COPY_TO_BUFFER &2040 f0 04 BEQ &2046 ; set_result &2042 c9 04 CMP #&04 ; PLOT_COLLISION_CHECK &2044 d0 05 BNE &204b ; skip_setting_result ; set_result &2046 a5 75 LDA &75 ; result &2048 8d 23 04 STA &0423 ; vm_collision_result ; skip_setting_result &204b 68 PLA # Restore original screen address &204c 85 71 STA &71 ; screen_address_high &204e 68 PLA &204f 85 70 STA &70 ; screen_address_low &2051 60 RTS ; move_up_a_group &2052 38 SEC &2053 a5 70 LDA &70 ; screen_address_low &2055 e9 78 SBC #&78 # Move up eight pixels &2057 85 70 STA &70 ; screen_address_low &2059 a5 71 LDA &71 ; screen_address_high &205b e9 02 SBC #&02 &205d 85 71 STA &71 ; screen_address_high &205f a2 07 LDX #&07 &2061 d0 ac BNE &200f ; consider_next_row # Always branches ; update_game &2063 ad 02 23 LDA &2302 ; initial_active_object_types_address_low &2066 85 7c STA &7c ; active_object_types_address_low &2068 ad 03 23 LDA &2303 ; initial_active_object_types_address_high &206b 85 7d STA &7d ; active_object_types_address_high ; update_game_loop &206d ad 24 04 LDA &0424 ; vm_game_over # Non-zero if game over &2070 0d 25 04 ORA &0425 ; vm_level_completed # Non-zero if level complete &2073 d0 3d BNE &20b2 ; leave # Stop updating game if game over or level completed &2075 a0 00 LDY #&00 &2077 b1 7c LDA (&7c),Y ; active_object_types_address # Get byte of data for next type to update &2079 e6 7c INC &7c ; active_object_types_address_low &207b d0 02 BNE &207f ; skip_page &207d e6 7d INC &7d ; active_object_types_address_high ; skip_page &207f c9 ff CMP #&ff ; TYPE_END # &ff indicates end of types &2081 f0 2f BEQ &20b2 ; leave &2083 c9 fe CMP #&fe ; TYPE_VSYNC # &fe waits for next vertical retrace &2085 f0 06 BEQ &208d ; wait_for_vsync &2087 20 95 20 JSR &2095 ; update_next_object_of_type # Otherwise, update next object of given type &208a 4c 6d 20 JMP &206d ; update_game_loop ; wait_for_vsync &208d a9 13 LDA #&13 ; Wait for vertical retrace &208f 20 81 1e JSR &1e81 ; osbyte_with_X_and_Y_zero &2092 4c 6d 20 JMP &206d ; update_game_loop ; update_next_object_of_type &2095 8d 31 04 STA &0431 ; vm_type_to_update &2098 a8 TAY &2099 20 b3 20 JSR &20b3 ; get_next_object_of_type # Returns Y = object &209c 84 74 STY &74 ; last_slot ; update_next_object_of_type_loop &209e b1 7e LDA (&7e),Y ; objects_sprite_address &20a0 c9 ff CMP #&ff ; SPRITE_NONE &20a2 f0 0e BEQ &20b2 ; leave &20a4 c9 fe CMP #&fe ; SPRITE_SKIP_TO_NEXT &20a6 d0 21 BNE &20c9 ; update_object # If there is an object in this slot, update it. &20a8 ac 31 04 LDY &0431 ; vm_type_to_update &20ab 20 b3 20 JSR &20b3 ; get_next_object_of_type # Returns Y = object &20ae c4 74 CPY &74 ; last_slot &20b0 d0 ec BNE &209e ; update_objects_loop ; leave &20b2 60 RTS ; get_next_object_of_type &20b3 b9 00 04 LDA &0400,Y ; object_types_next_object &20b6 48 PHA &20b7 aa TAX &20b8 e8 INX &20b9 8a TXA &20ba d9 31 23 CMP &2331,Y ; object_types_first_slots + 1 &20bd d0 03 BNE &20c2 ; skip_wraparound &20bf be 30 23 LDX &2330,Y ; object_types_first_slots ; skip_wraparound &20c2 8a TXA &20c3 99 00 04 STA &0400,Y ; object_types_next_object &20c6 68 PLA &20c7 a8 TAY # Leave with Y = previous next object for type &20c8 60 RTS ; update_object # Called with Y = object &20c9 98 TYA &20ca 48 PHA ; object &20cb 8d 2f 04 STA &042f ; vm_object &20ce b1 7e LDA (&7e),Y ; objects_sprite_address &20d0 a8 TAY &20d1 20 03 19 JSR &1903 ; execute_bytecode_function_Y # Call function associated with sprite &20d4 68 PLA ; object &20d5 20 67 1c JSR &1c67 ; set_vm_object &20d8 ac 2f 04 LDY &042f ; vm_object &20db 18 CLC &20dc b1 80 LDA (&80),Y ; objects_x_address # Apply x velocity &20de 71 84 ADC (&84),Y ; objects_velocity_x_address &20e0 91 80 STA (&80),Y ; objects_x_address &20e2 18 CLC &20e3 b1 82 LDA (&82),Y ; objects_y_address # Apply y velocity &20e5 71 86 ADC (&86),Y ; objects_velocity_y_address &20e7 91 82 STA (&82),Y ; objects_y_address &20e9 4c e7 1e JMP &1ee7 ; plot_object # Replot object in new position ; unused &20ec 29 3d c1 ; unused # Source code fragment &20ef 41 24 2c 32 29 3a 41 52 52 25 3d 41 52 52 25 2b ; "A$,2):ARR%=ARR%+" ; unused &20ff a9 ; opcode_subroutines_010_addresses_low ; 0 1 2 3 4 5 6 7 8 9 a b c d e f &2100 41 09 09 09 09 09 09 09 09 32 38 2d 09 09 09 09 ; &00 / &40 &2110 09 09 30 09 14 26 2c 09 1a 20 09 2b 31 0d 1c e8 ; &10 / &50 ; opcode_subroutines_010_addresses_high ; 0 1 2 3 4 5 6 7 8 9 a b c d e f &2120 36 1c 1c 1c 1c 1c 1c 1c 1c 1d 1d 0c 1c 1c 1c 1c ; &00 / &40 &2130 1c 1c 1c 1c 1d 1d 1d 1c 1d 1d 1c 66 66 3f 28 51 ; &10 / &50 ; opcode_subroutines_110_addresses_low ; 0 1 2 3 4 5 6 7 8 9 a b c d e f &2140 51 0d 0d 0d 0d 0d 4f 0d 0d 04 0c 0d 0d 0d 66 67 ; &00 / &c0 &2150 0d 80 0d 0d dc f4 fc 0d e4 ec 0d 00 00 19 00 00 ; &10 / &d0 ; opcode_subroutines_110_addresses_high ; 0 1 2 3 4 5 6 7 8 9 a b c d e f &2160 f4 1c 1c 1c 1c 1c 1c 1c 1c 1d 1d 1c 1c 1c 1c 1c ; &00 / &c0 &2170 1c 1c 1c 1c 1c 1c 1c 1c 1c 1c 1c 07 6c 07 d0 08 ; &10 / &d0 ; opcode_subroutines_000_addresses_low ; 0 1 2 3 4 5 6 7 8 9 a b c d e f &2180 bf c2 c5 c8 d0 da e2 ec f4 71 75 79 93 b2 f0 0b ; &00 / &00 &2190 54 0b b8 0c 1c 0c 80 0c e4 0d 48 0d ac 0e 10 0e ; &10 / &10 ; opcode_subroutines_000_addresses_high ; 0 1 2 3 4 5 6 7 8 9 a b c d e f &21a0 1b 1b 1b 1b 1b 1b 1b 1b 1b 1b 1b 1b 1b 1b 30 11 ; &00 / &00 &21b0 94 11 f8 12 5c 12 c0 13 24 13 88 13 ec 14 50 14 ; &10 / &10 ; input_block &21c0 b4 09 # Low byte is modified at &0a4b to point to high score &21c2 13 ; 19 characters maximum &21c3 20 ; " " &21c4 ff ; joystick_keys &21c5 5a ; "Z" &21c6 3a ; ":" &21c7 58 ; "X" &21c8 2f ; "/" ; congratulations_text &21c9 88 ; length &21ca 16 07 ; MODE 7 &21cc 1f 05 05 ; TAB(&05, &05) &21cf 8d 86 9d 84 ; DOUBLE_HEIGHT, CYAN, NEW_BACKGROUND, BLUE &21d3 43 6f 6e 67 72 61 74 75 6c 61 74 69 6f 6e 73 20 ; "Congratulations !!! " &21e3 21 21 21 20 20 &21e8 9c ; BLACK_BACKGROUND &21e9 1f 05 06 ; TAB(&05, &06) &21ec 8d 86 9d 84 ; DOUBLE_HEIGHT, CYAN, NEW_BACKGROUND, BLUE &21f0 43 6f 6e 67 72 61 74 75 6c 61 74 69 6f 6e 73 20 ; "Congratulations !!! " &2200 21 21 21 20 20 &2205 9c ; BLACK_BACKGROUND &2206 1f 03 0a ; TAB(&03, &0a) &2209 81 ; RED &220a 59 6f 75 72 20 73 63 6f 72 65 20 69 73 20 69 6e ; "Your score is in the top eight." &221a 20 74 68 65 20 74 6f 70 20 65 69 67 68 74 2e &2229 1f 06 0d ; TAB(&06, &0d) &222c 82 ; GREEN &222d 50 6c 65 61 73 65 20 65 6e 74 65 72 20 79 6f 75 ; "Please enter your name:" &223d 72 20 6e 61 6d 65 3a &2244 1f 06 12 ; TAB(&06, &12) &2247 86 9d 84 ; CYAN, NEW_BACKGROUND, BLUE &224a 1f 1e 12 ; TAB(&1e, &12) &224d 9c ; BLACK_BACKGROUND &224e 1f 09 12 ; TAB(&09, &12) ; happy_hoppers_text &2251 7f ; length &2252 16 07 ; MODE 7 &2254 17 00 0a 20 00 00 00 00 00 00 ; R10: Cursor start register; disable cursor &225e 1f 00 00 ; TAB(&00, &00) &2261 8d 81 9d 83 ; DOUBLE_HEIGHT, RED, NEW_BACKGROUND, YELLOW &2265 1f 0e 00 ; TAB(&0e, &00) &2268 48 61 70 70 79 20 48 6f 70 70 65 72 73 ; "Happy Hoppers" &2275 1f 00 01 ; TAB(&00, &01) &2278 8d 81 9d 83 ; DOUBLE_HEIGHT, RED, NEW_BACKGROUND, YELLOW &227c 1f 0e 01 ; TAB(&0e, &01) &227f 48 61 70 70 79 20 48 6f 70 70 65 72 73 ; "Happy Hoppers" &228c 1f 02 17 ; TAB(&02, &17) &228f 88 86 ; FLASH, CYAN &2291 50 72 65 73 73 20 53 50 41 43 45 20 42 41 52 20 ; "Press SPACE BAR or fire button" &22a1 6f 72 20 66 69 72 65 20 62 75 74 74 6f 6e &22af 1f 03 18 ; TAB(&03, &18) &22b2 88 86 ; FLASH, CYAN &22b4 6f 6e 20 6a 6f 79 73 74 69 63 6b 20 66 6f 72 20 ; "on joystick for another game" &22c4 61 6e 6f 74 68 65 72 20 67 61 6d 65 ; dots_text &22d0 06 &22d1 20 2e 2e 2e 20 ; " ... " ; empty_string &22d6 07 &22d7 13 00 00 00 00 00 ; unused &22dd 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 &22ed 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 &22fd 00 00 00 ; temporary_object_type &2300 10 ; unused &2301 4d ; initial_active_object_types_address_low &2302 00 ; initial_active_object_types_address_high &2303 00 ; unused &2304 00 00 00 00 ; decimals_length ; 0 1 2 3 4 5 6 7 &2308 00 05 06 03 00 00 00 00 ; decimal_positions_x ; 0 1 2 3 4 5 6 7 &2310 00 00 0e 11 00 00 00 00 ; decimal_positions_y ; 0 1 2 3 4 5 6 7 &2318 00 01 01 1e 00 00 00 00 ; black_palette &2320 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ; object_types_first_slots ; 0 1 2 3 4 5 6 7 8 9 a b c d e f &2330 00 03 06 09 0c 0d 10 16 1c 22 26 27 28 29 2d 2e ; &00 &2340 2f 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ; &10 ; object_types_sprites ; 0 1 2 3 4 5 6 7 8 9 a b c d e f &2350 42 42 45 45 3b 37 15 12 14 49 3e 40 38 0e 4a 48 ; &00 &2360 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ; &10 ; Object types ; ============ ; &00: OBJECT_TYPE_LOG_ONE slots &00 - &02 SPRITE_STUB_LOG ; &01: OBJECT_TYPE_LOG_TWO slots &03 - &05 SPRITE_STUB_LOG ; &02: OBJECT_TYPE_TURTLES_ONE slots &06 - &08 SPRITE_STUB_TURTLES ; &03: OBJECT_TYPE_TURTLES_TWO slots &09 - &0b SPRITE_STUB_TURTLES ; &04: OBJECT_TYPE_PLAYER slot &0c SPRITE_STUB_PLAYER ; &05: OBJECT_TYPE_VEHICLE_RIGHT_ONE slots &0d - &0f SPRITE_DOUBLE_FAST_VEHICLE ; &06: OBJECT_TYPE_VEHICLE_RIGHT_TWO slots &10 - &15 SPRITE_VEHICLE_RIGHT_TWO ; &07: OBJECT_TYPE_VEHICLE_LEFT_ONE slots &16 - &1b SPRITE_VEHICLE_LEFT_ONE ; &08: OBJECT_TYPE_VEHICLE_LEFT_TWO slots &1c - &21 SPRITE_VEHICLE_LEFT_TWO ; &09: OBJECT_TYPE_TRAFFIC slots &22 - &25 SPRITE_STUB_INITIALISE_TRAFFIC ; &0a: OBJECT_TYPE_NEW_FROG slot &26 SPRITE_STUB_INITIALISE_NEW_FROG ; &0b: OBJECT_TYPE_TIME slot &27 SPRITE_STUB_TIME ; &0c: OBJECT_TYPE_SNAKE slot &28 SPRITE_BUFFER_SNAKE_ONE ; &0d: OBJECT_TYPE_OTHER slots &29 - &2c SPRITE_BANK_ONE ; &0e: OBJECT_TYPE_LEVEL slot &2d SPRITE_STUB_INITIALISE_LEVEL ; &0f: OBJECT_TYPE_TUNE slot &2e SPRITE_STUB_TUNE ; &ff: OBJECT_TYPE_TEMPORARY slot &2f ; bytecode_function_addresses_low ; 0 1 2 3 4 5 6 7 8 9 a b c d e f &2370 5c 70 70 70 70 70 70 70 70 b0 dd 70 70 70 49 70 ; &00 &2380 70 70 64 6e 64 6e 70 70 2d 70 70 70 70 70 64 6e ; &10 &2390 7a 70 70 70 70 70 70 70 70 70 d6 c5 70 70 70 70 ; &20 &23a0 70 70 70 70 70 70 70 48 f2 f2 47 59 78 78 e0 5c ; &30 &23b0 83 a0 20 c8 fb 38 33 3e 4c 87 58 52 ff 70 70 70 ; &40 &23c0 70 70 70 70 70 70 70 70 70 70 70 70 70 70 70 70 ; &50 &23d0 70 70 70 70 70 70 70 70 70 70 70 70 70 70 70 70 ; &60 &23e0 70 70 70 70 70 70 70 70 70 70 70 70 70 70 70 70 ; &70 ; bytecode_function_addresses_high ; 0 1 2 3 4 5 6 7 8 9 a b c d e f &23f0 27 25 25 25 25 25 25 25 25 2a 2a 25 25 25 29 25 ; &00 &2400 25 25 2a 2a 2a 2a 25 25 2f 25 25 25 25 25 2a 2a ; &10 &2410 2b 25 25 25 25 25 25 25 25 25 29 2f 25 25 25 25 ; &20 &2420 25 25 25 25 25 25 25 2a 2a 2a 2c 2d 2e 2a 29 2f ; &30 &2430 2c 2f 2c 2c 2c 2b 2b 2d 26 29 29 2a 2b 25 25 25 ; &40 &2440 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 ; &50 &2450 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 ; &60 &2460 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 ; &70 ; sprite_addresses_low ; 0 1 2 3 4 5 6 7 8 9 a b c d e f &2470 70 73 d5 37 99 fb 5d bf 21 83 b5 17 29 43 75 b7 ; &00 &2480 39 53 7d df 35 97 f9 5b 8d ef 19 57 95 a3 cd 2f ; &10 &2490 91 b3 71 7a 83 8c 95 9e a7 b0 b9 be c3 c8 cd d2 ; &20 &24a0 d7 e0 e9 f6 03 08 0d 16 1f 2c 39 3a 3b 3c 3d 3e ; &30 &24b0 3f 40 41 42 43 44 45 46 47 48 49 4a 4b 00 00 00 ; &40 &24c0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ; &50 &24d0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ; &60 &24e0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ; &70 ; sprite_addresses_high ; 0 1 2 3 4 5 6 7 8 9 a b c d e f &24f0 0e 0e 0e 0f 0f 0f 10 10 11 11 11 12 12 12 12 12 ; &00 &2500 13 13 13 13 14 14 14 15 15 15 16 16 16 16 16 17 ; &10 &2510 17 17 25 25 25 25 25 25 25 25 25 25 25 25 25 25 ; &20 &2520 25 25 25 25 26 26 26 26 26 26 26 26 26 26 26 26 ; &30 &2530 26 26 26 26 26 26 26 26 26 26 26 26 26 00 00 00 ; &40 &2540 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ; &50 &2550 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ; &60 &2560 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ; &70 ; undefined_function_bytecode &2570 3f abort ; sprite_22 (SPRITE_BUFFER_MASKED_FROG_UP) &2571 01 0d 00 00 ; PLOT_COPY_TO_BUFFER sprite &0d (SPRITE_PLAYER_BUFFER) at (0, 0) &2575 03 01 00 00 ; PLOT_MASKED sprite &01 (SPRITE_FROG_UP) at (0, 0) &2579 ff ; sprite_23 (SPRITE_BUFFER_MASKED_FROG_LEFT) &257a 01 0d 00 00 ; PLOT_COPY_TO_BUFFER sprite &0d (SPRITE_PLAYER_BUFFER) at (0, 0) &257e 03 02 00 00 ; PLOT_MASKED sprite &02 (SPRITE_FROG_LEFT) at (0, 0) &2582 ff ; sprite_24 (SPRITE_BUFFER_MASKED_FROG_DOWN) &2583 01 0d 00 00 ; PLOT_COPY_TO_BUFFER sprite &0d (SPRITE_PLAYER_BUFFER) at (0, 0) &2587 03 03 00 00 ; PLOT_MASKED sprite &03 (SPRITE_FROG_DOWN) at (0, 0) &258b ff ; sprite_25 (SPRITE_BUFFER_MASKED_FROG_RIGHT) &258c 01 0d 00 00 ; PLOT_COPY_TO_BUFFER sprite &0d (SPRITE_PLAYER_BUFFER) at (0, 0) &2590 03 04 00 00 ; PLOT_MASKED sprite &04 (SPRITE_FROG_RIGHT) at (0, 0) &2594 ff ; sprite_26 (SPRITE_BUFFER_MASKED_FROG_JUMPING_UP) &2595 01 0d 00 00 ; PLOT_COPY_TO_BUFFER sprite &0d (SPRITE_PLAYER_BUFFER) at (0, 0) &2599 03 05 00 00 ; PLOT_MASKED sprite &05 (SPRITE_FROG_JUMPING_UP) at (0, 0) &259d ff ; sprite_27 (SPRITE_BUFFER_MASKED_FROG_JUMPING_LEFT) &259e 01 0d 00 00 ; PLOT_COPY_TO_BUFFER sprite &0d (SPRITE_PLAYER_BUFFER) at (0, 0) &25a2 03 06 00 00 ; PLOT_MASKED sprite &06 (SPRITE_FROG_JUMPING_LEFT) at (0, 0) &25a6 ff ; sprite_28 (SPRITE_BUFFER_MASKED_FROG_JUMPING_DOWN) &25a7 01 0d 00 00 ; PLOT_COPY_TO_BUFFER sprite &0d (SPRITE_PLAYER_BUFFER) at (0, 0) &25ab 03 07 00 00 ; PLOT_MASKED sprite &07 (SPRITE_FROG_JUMPING_DOWN) at (0, 0) &25af ff ; sprite_29 (SPRITE_BUFFER_MASKED_FROG_JUMPING_RIGHT) &25b0 01 0d 00 00 ; PLOT_COPY_TO_BUFFER sprite &0d (SPRITE_PLAYER_BUFFER) at (0, 0) &25b4 03 08 00 00 ; PLOT_MASKED sprite &08 (SPRITE_FROG_JUMPING_RIGHT) at (0, 0) &25b8 ff ; sprite_2a (SPRITE_LIFE) # Updated by update_life (&29d6) &25b9 03 01 00 00 ; PLOT_MASKED sprite &01 (SPRITE_FROG_UP) at (0, 0) &25bd ff ; sprite_2b (SPRITE_MASKED_SKULL) # Updated by update_skull (&2fc5) &25be 03 16 00 00 ; PLOT_MASKED sprite &16 (SPRITE_SKULL) at (0, 0) &25c2 ff ; sprite_2c (SPRITE_CREATE_TRAFFIC_BUFFER) &25c3 01 17 00 00 ; PLOT_COPY_TO_BUFFER sprite &17 (SPRITE_TRAFFIC_BUFFER) at (0, 0) &25c7 ff ; sprite_2d (SPRITE_CHECK_TRAFFIC_BUFFER) &25c8 04 17 00 00 ; PLOT_COLLISION_CHECK sprite &17 (SPRITE_TRAFFIC_BUFFER) at (0, 0) &25cc ff ; sprite_2e (SPRITE_UNPLOT_LIFE) &25cd 02 00 04 0c ; PLOT_UNPLOT with &00 (8 pixels wide, 12 pixels high) &25d1 ff ; sprite_2f (SPRITE_RIVER) &25d2 02 30 50 54 ; PLOT_UNPLOT with &30 (160 pixels wide, 84 pixels high) &25d6 ff ; sprite_30 (SPRITE_UNPLOT_HOME) &25d7 02 30 06 0c ; PLOT_UNPLOT with &30 (24 pixels wide, 12 pixels high) &25db 00 10 00 03 ; PLOT_OVERWRITE sprite &10 (SPRITE_HOME) at (0, 3) &25df ff ; sprite_31 (SPRITE_LOG) &25e0 00 0b ff 00 ; PLOT_OVERWRITE sprite &0b (SPRITE_LOG_LEFT) at (-1, 0) &25e4 00 0c 14 00 ; PLOT_OVERWRITE sprite &0c (SPRITE_LOG_RIGHT) at (20, 0) &25e8 ff ; sprite_32 (SPRITE_TURTLES) &25e9 00 11 00 00 ; PLOT_OVERWRITE sprite &11 (SPRITE_TURTLE) at (0, 0) &25ed 00 11 05 00 ; PLOT_OVERWRITE sprite &11 (SPRITE_TURTLE) at (5, 0) &25f1 00 11 05 00 ; PLOT_OVERWRITE sprite &11 (SPRITE_TURTLE) at (5, 0) &25f5 ff ; sprite_33 (SPRITE_TURTLES_SUBMERGING) &25f6 00 1d 00 00 ; PLOT_OVERWRITE sprite &1d (SPRITE_SUBMERGING_TURTLE) at (0, 0) &25fa 00 1d 05 00 ; PLOT_OVERWRITE sprite &1d (SPRITE_SUBMERGING_TURTLE) at (5, 0) &25fe 00 1d 05 00 ; PLOT_OVERWRITE sprite &1d (SPRITE_SUBMERGING_TURTLE) at (5, 0) &2602 ff ; sprite_34 (SPRITE_TURTLES_SUBMERGED) &2603 02 30 0f 08 ; PLOT_UNPLOT with &30 (30 pixels wide, 8 pixels high) &2607 ff ; sprite_35 (SPRITE_ROAD) &2608 02 00 50 4e ; PLOT_UNPLOT with &00 (160 pixels wide, 78 pixels high) &260c ff ; sprite_36 (SPRITE_FAST_VEHICLE) &260d 02 00 02 0c ; PLOT_UNPLOT with &00 (4 pixels wide, 12 pixels high) &2611 00 13 02 00 ; PLOT_OVERWRITE sprite &13 (SPRITE_VEHICLE_RIGHT_ONE) at (2, 0) &2615 ff ; sprite_37 (SPRITE_DOUBLE_FAST_VEHICLE) # Updated by update_fast_vehicles (&2a48) &2616 00 36 fd 00 ; PLOT_OVERWRITE sprite &36 (SPRITE_FAST_VEHICLE) at (-3, 0) &261a 00 36 0e 00 ; PLOT_OVERWRITE sprite &36 (SPRITE_FAST_VEHICLE) at (14, 0) &261e ff ; sprite_38 (SPRITE_BUFFER_SNAKE_ONE) # Updated by update_snake (&2af2) &261f 00 1b 01 00 ; PLOT_OVERWRITE sprite &1b (SPRITE_SNAKE_BUFFER) at (1, 0) &2623 01 1b ff 00 ; PLOT_COPY_TO_BUFFER sprite &1b (SPRITE_SNAKE_BUFFER) at (-1, 0) &2627 00 19 01 00 ; PLOT_OVERWRITE sprite &19 (SPRITE_SNAKE_ONE) at (1, 0) &262b ff ; sprite_39 (SPRITE_BUFFER_SNAKE_TWO) # Updated by update_snake (&2af2) &262c 00 1b 01 00 ; PLOT_OVERWRITE sprite &1b (SPRITE_SNAKE_BUFFER) at (1, 0) &2630 01 1b ff 00 ; PLOT_COPY_TO_BUFFER sprite &1b (SPRITE_SNAKE_BUFFER) at (-1, 0) &2634 00 1a 00 00 ; PLOT_OVERWRITE sprite &1a (SPRITE_SNAKE_TWO) at (0, 0) &2638 ff ; sprite_3a # Unused (consider_moving_player_on_water_object) &2639 ff ; sprite_3b (SPRITE_STUB_PLAYER) # Updated by update_player (&2d59) &263a ff ; sprite_3c (SPRITE_STUB_JUMPING_PLAYER) # Updated by update_jumping_player (&2e78) &263b ff ; sprite_3d (SPRITE_CROCODILE_HIDDEN) # Updated by update_hidden_crocodile (&2a78) &263c ff ; sprite_3e (SPRITE_STUB_INITIALISE_NEW_FROG) # Updated by update_new_frog_initialisation (&29e0) &263d ff ; sprite_3f (SPRITE_STUB_CLEAR_FROGS) # Updated by update_clear_frogs (&2f5c) &263e ff ; sprite_40 (SPRITE_STUB_TIME) # Updated by update_time (&2c83) &263f ff ; sprite_41 # Unused (kill_player) &2640 ff ; sprite_42 (SPRITE_STUB_LOG) # Updated by update_log (&2c20) &2641 ff ; sprite_43 # Unused (check_for_water_support) &2642 ff ; sprite_44 # Unused (check_if_object_supporting_player) &2643 ff ; sprite_45 (SPRITE_STUB_TURTLES) # Updated by update_turtles (&2b38) &2644 ff ; sprite_46 (SPRITE_SNAKE_HIDDEN) # Updated by update_hidden_snake (&2b33) &2645 ff ; sprite_47 (SPRITE_STUB_EXTRA_LIFE) # Updated by update_extra_life (&2d3e) &2646 ff ; sprite_48 (SPRITE_STUB_TUNE) # Updated by update_tune (&264c) &2647 ff ; sprite_49 (SPRITE_STUB_INITIALISE_TRAFFIC) # Updated by update_traffic_initialisation (&2987) &2648 ff ; sprite_4a (SPRITE_STUB_INITIALISE_LEVEL) # Updated by update_level_initialisation (&2958) &2649 ff ; sprite_4b (SPRITE_STUB_INITIALISE_FAST_TRAFFIC) # Updated by update_fast_traffic_initialisation (&2a52) &264a ff ; sprite_4c (SPRITE_DRAGONFLY_HIDDEN) # Updated by update_hidden_dragonfly (&2bff) &264b ff ; bytecode ; update_tune # Function &48, updates OBJECT_TYPE_TUNE &264c 49 push objects_data_one[object] ; note_duration &264d 81 push #&01 &264e 0a push (pull2 - pull1) &264f c9 objects_data_one[object] = pull ; note_duration # note_duration -= 1 &2650 49 push objects_data_one[object] ; note_duration &2651 80 push #&00 &2652 04 push (pull2 > pull1) &2653 22 05 01 if(pull) jump &275b ; leave # If note_duration == 0, &2656 72 push variables[&12] ; tune_position &2657 2e d7 00 array(pull, [...]) &265a 01 03 29 3d 3d 45 4d 3d 3d 39 29 3d 3d 45 4d 3f # tune_data[] = [...] &266a 39 29 3d 3d 45 4d 51 4d 45 3d 3a 28 31 39 3f 3d &267a 01 32 38 31 29 31 39 3f 2a 30 29 21 1d 21 2b 32 &268a 38 31 29 31 39 3d 45 4d 3d 45 39 3f 3d 01 00 03 &269a 28 3d 3c 3c 38 30 29 20 1d 28 3d 3c 45 38 3e 00 &26aa 00 28 3d 44 4d 50 59 4c 3d 44 4d 4c 4c 44 3c 46 &26ba 00 00 28 3d 44 4d 50 59 4c 3d 44 4d 4c 4c 44 3c &26ca 46 4d 44 3d 3c 3c 38 30 29 20 1c 28 28 3d 3c 45 &26da 38 3e 00 03 03 03 03 01 29 37 3d 46 48 45 3f 31 &26ea 22 28 31 37 29 2a 24 29 33 25 17 31 37 3d 46 48 &26fa 45 3f 31 22 28 31 36 30 29 26 1c 25 2b 01 2b 01 &270a 53 01 52 4c 45 3f 31 22 28 31 37 29 2a 24 29 33 &271a 25 17 01 53 01 52 4c 45 3f 31 22 28 31 36 30 29 &272a 26 1c 25 2b 01 2b 01 &2731 f4 variables[&14] = pull ; tune_byte # tune_byte = tune_data[tune_position] &2732 74 push variables[&14] ; tune_byte &2733 83 push #&03 &2734 00 push (pull2 AND pull1) &2735 81 push #&01 &2736 09 push (pull2 + pull1) &2737 c9 objects_data_one[object] = pull ; note_duration # note_duration = (tune_byte & 3) + 1 &2738 74 push variables[&14] ; tune_byte &2739 23 7c push #&7c &273b 00 push (pull2 AND pull1) &273c f4 variables[&14] = pull ; note_pitch # note_pitch = tune_byte & &7c &273d 73 push variables[&13] ; sound_enabled &273e 82 push #&02 &273f 00 push (pull2 AND pull1) &2740 22 0b 00 if(pull) jump &274e ; skip_tune_note # If (sound_enabled & 2) == 2 (i.e. tune enabled) &2743 74 push variables[&14] ; note_pitch &2744 22 07 00 if(pull) jump &274e ; skip_tune_note # and note_pitch != 0 (i.e. note is not silent), &2747 93 push #&13 &2748 84 push #&04 &2749 74 push variables[&14] ; note_pitch &274a 81 push #&01 &274b 09 push (pull2 + pull1) &274c 49 push objects_data_one[object] ; note_duration &274d 29 sound(pull4, pull3, pull2, pull1) # SOUND &13, &04. note_pitch, note_duration + 1 (tune) ; skip_tune_note &274e 72 push variables[&12] ; tune_position &274f 81 push #&01 &2750 09 push (pull2 + pull1) &2751 f2 variables[&12] = pull ; tune_position # tune_position += 1 &2752 72 push variables[&12] ; tune_position &2753 a9 push #&29 &2754 20 push -pull &2755 05 push (pull2 != pull1) &2756 22 02 00 if(pull) jump &275b ; leave # If tune_position == &d7 (i.e. end of tune), &2759 81 push #&01 &275a f2 variables[&12] = pull ; tune_position # tune_position = 1 (restart tune) ; leave &275b 27 end ; prepare_level_objects # Function &00, called at &1ded &275c 80 push #&00 &275d ed variables[&0d] = pull ; occupied_homes # occupied_homes = 0 (all homes are unoccupied) &275e 81 push #&01 &275f 20 push -pull &2760 ec variables[&0c] = pull ; player_water_support_one # player_water_support_one = &ff (not supported) &2761 81 push #&01 &2762 20 push -pull &2763 eb variables[&0b] = pull ; player_water_support_two # player_water_support_two = &ff (not supported) &2764 81 push #&01 &2765 f7 variables[&17] = pull ; objects_still_initialising # objects_still_initialising = 1 &2766 28 02 00 activate( &2769 0e OBJECT_TYPE_LEVEL &276a ff ) # activate(OBJECT_TYPE_LEVEL) &276b 53 push level &276c 81 push #&01 &276d 05 push (pull2 != pull1) &276e 22 82 01 if(pull) jump &28f3 ; not_first_level # If level == 1, &2771 82 push #&02 &2772 ee variables[&0e] = pull ; player_lives # player_lives = 2 &2773 80 push #&00 &2774 e3 variables[&03] = pull ; crocodile_home # crocodile_home = 0 &2775 81 push #&01 &2776 20 push -pull &2777 e5 variables[&05] = pull ; extra_life_toggle # extra_life_toggle = -1 &2778 94 push #&14 &2779 e4 variables[&04] = pull ; traffic_density # traffic_density = 20 &277a 8b push #&0b ; OBJECT_TYPE_TIME &277b d1 create(type=pull) # create(OBJECT_TYPE_TIME) &277c 8e push #&0e ; OBJECT_TYPE_LEVEL &277d d1 create(type=pull) # create(OBJECT_TYPE_LEVEL) &277e 8f push #&0f ; OBJECT_TYPE_TUNE &277f d1 create(type=pull) # create(OBJECT_TYPE_TUNE) &2780 81 push #&01 &2781 c9 objects_data_one[object] = pull ; note_duration # note_duration = 1 &2782 8d push #&0d ; OBJECT_TYPE_OTHER &2783 d1 create(type=pull) # create(OBJECT_TYPE_OTHER) (lives) &2784 aa push #&2a ; SPRITE_LIFE &2785 d4 objects_sprite[object] = pull # sprite = SPRITE_LIFE &2786 85 push #&05 &2787 6e push variables[&0e] ; player_lives &2788 0b push (pull2 * pull1) &2789 d8 objects_x[object] = pull # x = player_lives * 5 &278a 82 push #&02 &278b d9 objects_y[object] = pull # y = 2 &278c 85 push #&05 &278d 20 push -pull &278e d5 objects_velocity_x[object] = pull # velocity_x = -5 &278f 2a 3b write(...) &2791 17 00 0a 20 00 00 00 00 00 00 # R10: Cursor start register; disable cursor &279b 05 # Write at graphics cursor &279c 12 00 01 # GCOL 0, 1 &279f 19 04 c8 01 f8 03 # MOVE &01c8, &03f8 &27a5 48 4f 50 50 45 52 # "HOPPER" &27ab 12 00 02 # GCOL 0, 2 &27ae 19 04 c0 01 fc 03 # MOVE &01c0, &03fc &27b4 48 4f 50 50 45 52 # "HOPPER" &27ba 04 # Write at text cursor &27bb 1f 00 00 # TAB(&00, &00) &27be 11 07 # COLOUR 7 &27c0 53 63 6f 72 65 # "Score" &27c5 1f 10 00 # TAB(&10, &00) &27c8 48 69 67 68 # "High" &27cc 2a 02 write(...) &27ce 11 01 # COLOUR 1 &27d0 2c 01 01 decimals[1] -= decimals[1] ; score # score = 0 &27d3 2b 01 02 decimals[2] += decimals[1] ; high += score # high += score (0, but writes high score to screen) &27d6 af push #&2f ; SPRITE_RIVER &27d7 80 push #&00 &27d8 a3 push #&23 &27d9 31 plot(sprite=pull3, x=pull2, y=pull1) # plot(SPRITE_RIVER, 0, &23) (plot river) &27da 28 08 00 activate( &27dd 0e OBJECT_TYPE_LEVEL, &27de 0d OBJECT_TYPE_OTHER, &27df 0d OBJECT_TYPE_OTHER, &27e0 00 OBJECT_TYPE_LOG_ONE, &27e1 00 OBJECT_TYPE_LOG_ONE, &27e2 01 OBJECT_TYPE_LOG_TWO, &27e3 01 OBJECT_TYPE_LOG_TWO &27e4 ff ) # activate(...) (initialise level) &27e5 8d push #&0d ; OBJECT_TYPE_OTHER &27e6 d1 create(type=pull) # create(OBJECT_TYPE_OTHER) (top bank) &27e7 8e push #&0e ; SPRITE_BANK_ONE &27e8 d4 objects_sprite[object] = pull # sprite = SPRITE_BANK_ONE &27e9 84 push #&04 &27ea 20 push -pull &27eb d8 objects_x[object] = pull # x = -4 &27ec b8 push #&38 &27ed d9 objects_y[object] = pull # y = &38 &27ee 84 push #&04 &27ef d5 objects_velocity_x[object] = pull # velocity_x = 4 &27f0 8d push #&0d ; OBJECT_TYPE_OTHER &27f1 d1 create(type=pull) # create(OBJECT_TYPE_OTHER) (middle bank) &27f2 8e push #&0e ; SPRITE_BANK_ONE &27f3 d4 objects_sprite[object] = pull # sprite = SPRITE_BANK_ONE &27f4 84 push #&04 &27f5 20 push -pull &27f6 d8 objects_x[object] = pull # x = -4 &27f7 9f push #&1f &27f8 d9 objects_y[object] = pull # y = &1f &27f9 84 push #&04 &27fa d5 objects_velocity_x[object] = pull # velocity_x = 4 &27fb 8d push #&0d ; OBJECT_TYPE_OTHER &27fc d1 create(type=pull) # create(OBJECT_TYPE_OTHER) (bottom bank) &27fd 8e push #&0e ; SPRITE_BANK_ONE &27fe d4 objects_sprite[object] = pull # sprite = SPRITE_BANK_ONE &27ff 84 push #&04 &2800 20 push -pull &2801 d8 objects_x[object] = pull # x = -4 &2802 86 push #&06 &2803 d9 objects_y[object] = pull # y = &06 &2804 84 push #&04 &2805 d5 objects_velocity_x[object] = pull # velocity_x = 4 &2806 77 push variables[&17] ; objects_still_initialising &2807 83 push #&03 &2808 09 push (pull2 + pull1) &2809 f7 variables[&17] = pull ; objects_still_initialising # objects_still_initialising += 3 &280a 8f push #&0f ; SPRITE_BANK_TWO &280b 81 push #&01 &280c b4 push #&34 &280d 31 plot(sprite=pull3, x=pull2, y=pull1) # plot(SPRITE_BANK_TWO, &01, &34) (bank between homes) &280e 54 push objects_sprite[object] &280f 8f push #&0f &2810 59 push objects_y[object] &2811 31 plot(sprite=pull3, x=pull2, y=pull1) # plot(sprite, &0f, y) &2812 54 push objects_sprite[object] &2813 9d push #&1d &2814 59 push objects_y[object] &2815 31 plot(sprite=pull3, x=pull2, y=pull1) # plot(sprite, &1d, y) &2816 54 push objects_sprite[object] &2817 ab push #&2b &2818 59 push objects_y[object] &2819 31 plot(sprite=pull3, x=pull2, y=pull1) # plot(sprite, &2b, y) &281a 54 push objects_sprite[object] &281b b9 push #&39 &281c 59 push objects_y[object] &281d 31 plot(sprite=pull3, x=pull2, y=pull1) # plot(sprite, &39, y) &281e 54 push objects_sprite[object] &281f 23 47 push #&47 &2821 59 push objects_y[object] &2822 31 plot(sprite=pull3, x=pull2, y=pull1) # plot(sprite, &47, y) &2823 8e push #&0e ; SPRITE_BANK_ONE &2824 81 push #&01 &2825 20 push -pull &2826 59 push objects_y[object] &2827 31 plot(sprite=pull3, x=pull2, y=pull1) # plot(SPRITE_BANK_ONE, -1 ,y) (bank at left edge) &2828 54 push objects_sprite[object] &2829 23 4d push #&4d &282b 59 push objects_y[object] &282c 31 plot(sprite=pull3, x=pull2, y=pull1) # plot(sprite, &4d, y) (bank at right edge) &282d 90 push #&10 ; SPRITE_HOME &282e 89 push #&09 &282f b7 push #&37 &2830 31 plot(sprite=pull3, x=pull2, y=pull1) # plot(SPRITE_HOME, &09, &37) (first home) &2831 54 push objects_sprite[object] &2832 97 push #&17 &2833 59 push objects_y[object] &2834 31 plot(sprite=pull3, x=pull2, y=pull1) # plot(sprite, &17, y) (second home) &2835 54 push objects_sprite[object] &2836 a5 push #&25 &2837 59 push objects_y[object] &2838 31 plot(sprite=pull3, x=pull2, y=pull1) # plot(sprite, &25, y) (third home) &2839 54 push objects_sprite[object] &283a b3 push #&33 &283b 59 push objects_y[object] &283c 31 plot(sprite=pull3, x=pull2, y=pull1) # plot(sprite, &33, y) (fourth home) &283d 54 push objects_sprite[object] &283e 23 41 push #&41 &2840 59 push objects_y[object] &2841 31 plot(sprite=pull3, x=pull2, y=pull1) # plot(sprite, &41, y) (fifth home) &2842 80 push #&00 ; OBJECT_TYPE_LOG_ONE &2843 d1 create(type=pull) # create(OBJECT_TYPE_LOG_ONE) (first row, right) &2844 a0 push #&20 &2845 20 push -pull &2846 ca objects_data_two[object] = pull ; left_x # left_x = -&20 &2847 23 48 push #&48 &2849 d8 objects_x[object] = pull # x = &48 &284a b0 push #&30 &284b d9 objects_y[object] = pull # y = &30 &284c 81 push #&01 &284d d5 objects_velocity_x[object] = pull # velocity_x = 1 &284e 80 push #&00 ; OBJECT_TYPE_LOG_ONE &284f d1 create(type=pull) # create(OBJECT_TYPE_LOG_ONE) (first row, middle) &2850 a0 push #&20 &2851 20 push -pull &2852 ca objects_data_two[object] = pull ; left_x # left_x = -&20 &2853 a4 push #&24 &2854 d8 objects_x[object] = pull # x = &24 &2855 81 push #&01 &2856 d5 objects_velocity_x[object] = pull # velocity_x = 1 &2857 4f push object &2858 e2 variables[&02] = pull ; disappearing_log_two # disappearing_log_two = object (disappears on level 4) &2859 80 push #&00 ; OBJECT_TYPE_LOG_ONE &285a d1 create(type=pull) # create(OBJECT_TYPE_LOG_ONE) (first row, left) &285b a0 push #&20 &285c 20 push -pull &285d ca objects_data_two[object] = pull ; left_x # left_x = -&20 &285e 80 push #&00 &285f d8 objects_x[object] = pull # x = &00 &2860 81 push #&01 &2861 d5 objects_velocity_x[object] = pull # velocity_x = 1 &2862 82 push #&02 ; OBJECT_TYPE_TURTLES_ONE &2863 d1 create(type=pull) # create(OBJECT_TYPE_TURTLES_ONE) (second row, left) &2864 80 push #&00 &2865 c9 objects_data_one[object] = pull ; turtle_timer # turtle_timer = 0 &2866 82 push #&02 &2867 ca objects_data_two[object] = pull ; level_to_submerge # level_to_submerge = 2 (starts to submerge on level 2) &2868 8a push #&0a &2869 d8 objects_x[object] = pull # x = &0a &286a ac push #&2c &286b d9 objects_y[object] = pull # y = &2c &286c 81 push #&01 &286d 20 push -pull &286e d5 objects_velocity_x[object] = pull # velocity_x = -1 &286f 82 push #&02 ; OBJECT_TYPE_TURTLES_ONE &2870 d1 create(type=pull) # create(OBJECT_TYPE_TURTLES_ONE) (second row, middle) &2871 80 push #&00 &2872 c9 objects_data_one[object] = pull ; turtle_timer # turtle_timer = 0 &2873 80 push #&00 &2874 ca objects_data_two[object] = pull ; level_to_submerge # level_to_submerge = 0 (never submerges) &2875 a6 push #&26 &2876 d8 objects_x[object] = pull # x = &26 &2877 81 push #&01 &2878 20 push -pull &2879 d5 objects_velocity_x[object] = pull # velocity_x = -1 &287a 82 push #&02 ; OBJECT_TYPE_TURTLES_ONE &287b d1 create(type=pull) # create(OBJECT_TYPE_TURTLES_ONE) (second row, right) &287c 80 push #&00 &287d c9 objects_data_one[object] = pull ; turtle_timer # turtle_timer = 0 &287e 80 push #&00 &287f ca objects_data_two[object] = pull ; level_to_submerge # level_to_submerge = 0 (never submerges) &2880 23 42 push #&42 &2882 d8 objects_x[object] = pull # x = &42 &2883 81 push #&01 &2884 20 push -pull &2885 d5 objects_velocity_x[object] = pull # velocity_x = -1 &2886 81 push #&01 ; OBJECT_TYPE_LOG_TWO &2887 d1 create(type=pull) # create(OBJECT_TYPE_LOG_TWO) (third row, right) &2888 99 push #&19 &2889 20 push -pull &288a ca objects_data_two[object] = pull ; left_x # left_x = -&19 &288b b2 push #&32 &288c d8 objects_x[object] = pull # x = &32 &288d a8 push #&28 &288e d9 objects_y[object] = pull # y = &28 &288f 81 push #&01 &2890 d5 objects_velocity_x[object] = pull # velocity_x = 1 &2891 81 push #&01 ; OBJECT_TYPE_LOG_TWO &2892 d1 create(type=pull) # create(OBJECT_TYPE_LOG_TWO) &2893 a0 push #&20 ; SPRITE_DRAGONFLY_LEFT &2894 d4 objects_sprite[object] = pull # sprite = SPRITE_DRAGONFLY_LEFT &2895 58 push objects_x[object] &2896 88 push #&08 &2897 09 push (pull2 + pull1) &2898 d8 objects_x[object] = pull # x = x + 8 &2899 81 push #&01 &289a d5 objects_velocity_x[object] = pull # velocity_x = 1 &289b 83 push #&03 &289c c9 objects_data_one[object] = pull ; dragonfly_offset # dragonfly_offset = 3 &289d 99 push #&19 &289e 20 push -pull &289f ca objects_data_two[object] = pull ; left_x # left_x = -&19 &28a0 81 push #&01 ; OBJECT_TYPE_LOG_TWO &28a1 d1 create(type=pull) # create(OBJECT_TYPE_LOG_TWO) (third row, left) &28a2 99 push #&19 &28a3 20 push -pull &28a4 ca objects_data_two[object] = pull ; left_x # left_x = -&19 &28a5 80 push #&00 &28a6 d8 objects_x[object] = pull # x = &00 &28a7 81 push #&01 &28a8 d5 objects_velocity_x[object] = pull # x_velocity = 1 &28a9 4f push object &28aa e1 variables[&01] = pull ; disappearing_log_one # disappearing_log_one = object (disappears on level 3) &28ab 83 push #&03 ; OBJECT_TYPE_TURTLES_TWO &28ac d1 create(type=pull) # create(OBJECT_TYPE_TURTLES_TWO) (fourth row, left) &28ad 80 push #&00 &28ae c9 objects_data_one[object] = pull ; turtle_timer # turtle_timer = 0 &28af 83 push #&03 &28b0 ca objects_data_two[object] = pull ; level_to_submerge # level_to_submerge = 3 (starts to submerge on level 3) &28b1 80 push #&00 &28b2 d8 objects_x[object] = pull # x = &00 &28b3 a4 push #&24 &28b4 d9 objects_y[object] = pull # y = &24 &28b5 81 push #&01 &28b6 20 push -pull &28b7 d5 objects_velocity_x[object] = pull # velocity_x = -1 &28b8 83 push #&03 ; OBJECT_TYPE_TURTLES_TWO &28b9 d1 create(type=pull) # create(OBJECT_TYPE_TURTLES_TWO) (fourth row, middle) &28ba 80 push #&00 &28bb c9 objects_data_one[object] = pull ; turtle_timer # turtle_timer = 0 &28bc 80 push #&00 &28bd ca objects_data_two[object] = pull ; level_to_submerge # level_to_submerge = 0 (never submerges) &28be 9e push #&1e &28bf d8 objects_x[object] = pull # x = &1e &28c0 81 push #&01 &28c1 20 push -pull &28c2 d5 objects_velocity_x[object] = pull # velocity_x = -1 &28c3 83 push #&03 ; OBJECT_TYPE_TURTLES_TWO &28c4 d1 create(type=pull) # create(OBJECT_TYPE_TURTLES_TWO) (fourth row, right) &28c5 80 push #&00 &28c6 c9 objects_data_one[object] = pull ; turtle_timer # turtle_timer = 0 &28c7 80 push #&00 &28c8 ca objects_data_two[object] = pull ; level_to_submerge # level_to_submerge = 0 (never submerges) &28c9 bc push #&3c &28ca d8 objects_x[object] = pull # x = &3c &28cb 81 push #&01 &28cc 20 push -pull &28cd d5 objects_velocity_x[object] = pull # velocity_x = -1 &28ce 94 push #&14 &28cf 20 push -pull &28d0 ea variables[&0a] = pull ; turtle_wraparound # turtle_wraparound = -&14 &28d1 85 push #&05 ; OBJECT_TYPE_VEHICLE_RIGHT_ONE &28d2 d1 create(type=pull) # create(OBJECT_TYPE_VEHICLE_RIGHT_ONE) (second row) &28d3 80 push #&00 &28d4 d8 objects_x[object] = pull # x = &00 (first pair, always present) &28d5 96 push #&16 &28d6 d9 objects_y[object] = pull # y = &16 &28d7 83 push #&03 &28d8 d5 objects_velocity_x[object] = pull # velocity_x = 3 &28d9 85 push #&05 ; OBJECT_TYPE_VEHICLE_RIGHT_ONE &28da d1 create(type=pull) # create(OBJECT_TYPE_VEHICLE_RIGHT_ONE) (second row) &28db 23 4b push #&4b ; SPRITE_FAST_VEHICLES &28dd d4 objects_sprite[object] = pull # sprite = SPRITE_FAST_VEHICLES &28de a6 push #&26 &28df d8 objects_x[object] = pull # x = &26 &28e0 83 push #&03 &28e1 d5 objects_velocity_x[object] = pull # velocity_x = 3 &28e2 83 push #&03 &28e3 c9 objects_data_one[object] = pull ; level_to_appear # level_to_appear = 3 (second pair appears on level 3) &28e4 85 push #&05 ; OBJECT_TYPE_VEHICLE_RIGHT_ONE &28e5 d1 create(type=pull) # create(OBJECT_TYPE_VEHICLE_RIGHT_ONE) (second row) &28e6 23 4b push #&4b ; SPRITE_FAST_VEHICLES &28e8 d4 objects_sprite[object] = pull # sprite = SPRITE_FAST_VEHICLES &28e9 23 4c push #&4c &28eb d8 objects_x[object] = pull # x = &4c &28ec 83 push #&03 &28ed d5 objects_velocity_x[object] = pull # velocity_x = 3 &28ee 84 push #&04 &28ef c9 objects_data_one[object] = pull ; level_to_appear # level_to_appear = 4 (third pair appears on level 4) &28f0 21 31 00 jump &2924 ; skip_adding_crocodile ; not_first_level # (if level != 1) &28f3 64 push variables[&04] ; traffic_density &28f4 8a push #&0a &28f5 06 push (pull2 <= pull1) &28f6 22 04 00 if(pull) jump &28fd ; skip_changing_density # If traffic_density > 10, &28f9 64 push variables[&04] ; traffic_density &28fa 81 push #&01 &28fb 0a push (pull2 - pull1) &28fc e4 variables[&04] = pull ; traffic_density # traffic_density -= 1 (i.e. traffic becomes denser) ; skip_changing_density &28fd 9c push #&1c ; SPRITE_LEVEL_COUNTER &28fe 23 52 push #&52 &2900 82 push #&02 &2901 53 push level &2902 0b push (pull2 * pull1) &2903 0a push (pull2 - pull1) &2904 84 push #&04 &2905 31 plot(sprite=pull3, x=pull2, y=pull1) # plot(SPRITE_LEVEL_COUNTER, &52 - (2 * level), &04) &2906 53 push level &2907 82 push #&02 &2908 05 push (pull2 != pull1) &2909 22 0c 00 if(pull) jump &2918 ; skip_adding_snake # If level == 2, &290c 8c push #&0c ; OBJECT_TYPE_SNAKE &290d d1 create(type=pull) # create(OBJECT_TYPE_SNAKE) &290e 4d push right_clip &290f d8 objects_x[object] = pull # x = right_clip &2910 a0 push #&20 &2911 d9 objects_y[object] = pull # y = &20 &2912 81 push #&01 &2913 20 push -pull &2914 d5 objects_velocity_x[object] = pull # velocity_x = -1 &2915 9e push #&1e &2916 20 push -pull &2917 ca objects_data_two[object] = pull ; snake_left_edge # snake_left_edge = -&1e ; skip_adding_snake &2918 53 push level &2919 82 push #&02 &291a 05 push (pull2 != pull1) &291b 22 06 00 if(pull) jump &2924 ; skip_adding_crocodile # If level == 2, &291e 8d push #&0d ; OBJECT_TYPE_OTHER &291f d1 create(type=pull) # create(OBJECT_TYPE_OTHER) (hidden crocodile) &2920 bd push #&3d ; SPRITE_CROCODILE_HIDDEN &2921 d4 objects_sprite[object] = pull # sprite = SPRITE_CROCODILE_HIDDEN &2922 90 push #&10 &2923 c9 objects_data_one[object] = pull ; crocodile_timer # crocodile_timer = &10 ; skip_adding_crocodile &2924 b5 push #&35 ; SPRITE_ROAD &2925 80 push #&00 &2926 8c push #&0c &2927 31 plot(sprite=pull3, x=pull2, y=pull1) # plot(SPRITE_ROAD, &00, &0c) (plot road) &2928 89 push #&09 ; OBJECT_TYPE_TRAFFIC &2929 c6 remove(type=pull) # remove(OBJECT_TYPE_TRAFFIC) &292a 86 push #&06 ; OBJECT_TYPE_VEHICLE_RIGHT_TWO &292b c6 remove(type=pull) # remove(OBJECT_TYPE_VEHICLE_RIGHT_TWO) &292c 87 push #&07 ; OBJECT_TYPE_VEHICLE_LEFT_ONE &292d c6 remove(type=pull) # remove(OBJECT_TYPE_VEHICLE_LEFT_ONE) &292e 88 push #&08 ; OBJECT_TYPE_VEHICLE_LEFT_TWO &292f c6 remove(type=pull) # remove(OBJECT_TYPE_VEHICLE_LEFT_TWO) &2930 89 push #&09 ; OBJECT_TYPE_TRAFFIC &2931 d1 create(type=pull) # create(OBJECT_TYPE_TRAFFIC) (fourth row) &2932 80 push #&00 &2933 d8 objects_x[object] = pull # x = &00 &2934 8c push #&0c &2935 d9 objects_y[object] = pull # y = &0c &2936 86 push #&06 ; OBJECT_TYPE_VEHICLE_RIGHT_TWO &2937 c9 objects_data_one[object] = pull ; traffic_type # traffic_type = OBJECT_TYPE_VEHICLE_RIGHT_TWO &2938 89 push #&09 ; OBJECT_TYPE_TRAFFIC &2939 d1 create(type=pull) # create(OBJECT_TYPE_TRAFFIC) (third row) &293a 91 push #&11 &293b d9 objects_y[object] = pull # y = &11 &293c 88 push #&08 ; OBJECT_TYPE_VEHICLE_LEFT_TWO &293d c9 objects_data_one[object] = pull ; traffic_type # traffic_type = OBJECT_TYPE_VEHICLE_LEFT_TWO &293e 89 push #&09 ; OBJECT_TYPE_TRAFFIC &293f d1 create(type=pull) # create(OBJECT_TYPE_TRAFFIC) (first row) &2940 9b push #&1b &2941 d9 objects_y[object] = pull # y = &1b &2942 87 push #&07 ; OBJECT_TYPE_VEHICLE_LEFT_ONE &2943 c9 objects_data_one[object] = pull ; traffic_type # traffic_type = OBJECT_TYPE_VEHICLE_LEFT_ONE &2944 77 push variables[&17] ; objects_still_initialising &2945 83 push #&03 &2946 09 push (pull2 + pull1) &2947 f7 variables[&17] = pull ; objects_still_initialising # objects_still_initialising += 3 &2948 27 end ; update_bank_initialisation # Function &0e, updates SPRITE_BANK_ONE &2949 58 push objects_x[object] &294a 23 4c push #&4c &294c 05 push (pull2 != pull1) &294d 22 07 00 if(pull) jump &2957 ; leave # If x == &4c, &2950 81 push #&01 &2951 20 push -pull &2952 d4 objects_sprite[object] = pull # sprite = SPRITE_NONE (remove object) &2953 77 push variables[&17] ; objects_still_initialising &2954 81 push #&01 &2955 0a push (pull2 - pull1) &2956 f7 variables[&17] = pull ; objects_still_initialising # objects_still_initialising -= 1 ; leave &2957 27 end ; update_level_initialisation # Function &4a, updates SPRITE_STUB_INITIALISE_LEVEL &2958 77 push variables[&17] ; objects_still_initialising &2959 84 push #&04 &295a 05 push (pull2 != pull1) &295b 22 0d 00 if(pull) jump &296b ; skip_adding_traffic # if objects_still_initialising == 4, &295e 77 push variables[&17] ; objects_still_initialising &295f 81 push #&01 &2960 0a push (pull2 - pull1) &2961 f7 variables[&17] = pull ; objects_still_initialising # objects_still_initialising -= 1 &2962 28 03 00 activate( &2965 0e OBJECT_TYPE_LEVEL, &2966 09 OBJECT_TYPE_TRAFFIC &2967 ff ) # activate(OBJECT_TYPE_LEVEL, OBJECT_TYPE_TRAFFIC) &2968 21 1b 00 jump &2986 ; leave ; skip_adding_traffic &296b 77 push variables[&17] ; objects_still_initialising &296c 80 push #&00 &296d 05 push (pull2 != pull1) &296e 22 15 00 if(pull) jump &2986 ; leave # If objects_still_initialising == 0, &2971 2d command("FX126") # *FX 126 (Acknowledge ESCAPE condition) &2972 46 58 31 32 36 0d &2978 28 02 00 activate( &297b 0a OBJECT_TYPE_NEW_FROG &297c ff ) # activate(OBJECT_TYPE_NEW_FROG) &297d 8a push #&0a ; OBJECT_TYPE_NEW_FROG &297e d1 create(type=pull) # create(OBJECT_TYPE_NEW_FROG) &297f 2a 03 write(...) &2981 14 # restore default logical colours &2982 11 01 # COLOUR 1 &2984 81 push #&01 &2985 f2 variables[&12] = pull ; tune_position # tune_position = 1 ; leave &2986 27 end ; update_traffic_initialisation # Function &49, updates SPRITE_STUB_INITIALISE_TRAFFIC &2987 58 push objects_x[object] &2988 23 4c push #&4c &298a 06 push (pull2 <= pull1) &298b 22 0a 00 if(pull) jump &2998 ; add_vehicle_to_traffic # If x > &4c, &298e 81 push #&01 &298f 20 push -pull &2990 d4 objects_sprite[object] = pull # sprite = SPRITE_NONE (remove object) &2991 77 push variables[&17] ; objects_still_initialising &2992 81 push #&01 &2993 0a push (pull2 - pull1) &2994 f7 variables[&17] = pull ; objects_still_initialising # objects_still_initialising -= 1 &2995 21 3d 00 jump &29d5 ; leave ; add_vehicle_to_traffic &2998 64 push variables[&04] ; traffic_density &2999 52 push rnd() &299a 87 push #&07 &299b 00 push (pull2 AND pull1) &299c 09 push (pull2 + pull1) &299d d5 objects_velocity_x[object] = pull # velocity_x = (rnd() & 7) + traffic_density &299e 49 push objects_data_one[object] ; traffic_type &299f d1 create(type=pull) # create(traffic_type) &29a0 59 push objects_y[object] &29a1 87 push #&07 &29a2 0a push (pull2 - pull1) &29a3 85 push #&05 &29a4 0c push (pull2 / pull1) &29a5 2e 04 00 array(pull) &29a8 01 ff 03 ff # stream_velocities[] = [1, -1, 3, -1] &29ac d5 objects_velocity_x[object] = pull # velocity_x = stream_velocities[(y - 7) / 5] &29ad 52 push rnd() &29ae 23 7f push #&7f &29b0 00 push (pull2 AND pull1) &29b1 f4 variables[&14] = pull ; r # r = rnd() & &7f &29b2 74 push variables[&14] ; r &29b3 74 push variables[&14] ; r &29b4 83 push #&03 &29b5 0c push (pull2 / pull1) &29b6 83 push #&03 &29b7 0b push (pull2 * pull1) &29b8 0a push (pull2 - pull1) &29b9 81 push #&01 &29ba 09 push (pull2 + pull1) &29bb f4 variables[&14] = pull ; vehicle # vehicle = 1 + r - ((r / 3) * 3), i.e. = 1 + (r MOD 3) &29bc 55 push objects_velocity_x[object] &29bd 80 push #&00 &29be 06 push (pull2 <= pull1) &29bf 22 0b 00 if(pull) jump &29cd ; use_left_sprite # If velocity_x > 0, ; use_right_sprite &29c2 74 push variables[&14] ; vehicle &29c3 2e 03 00 array(pull) &29c6 13 ; SPRITE_VEHICLE_RIGHT_ONE # right_vehicle_sprites[] = [...] &29c7 15 ; SPRITE_VEHICLE_RIGHT_TWO &29c8 1f ; SPRITE_VEHICLE_RIGHT_THREE &29c9 d4 objects_sprite[object] = pull # sprite = right_vehicle_sprites[vehicle] &29ca 21 08 00 jump &29d5 ; leave ; use_left_sprite &29cd 74 push variables[&14] ; vehicle &29ce 2e 03 00 array(pull) &29d1 12 ; SPRITE_VEHICLE_LEFT_ONE # left_vehicle_sprites[] = [...] &29d2 14 ; SPRITE_VEHICLE_LEFT_TWO &29d3 1e ; SPRITE_VEHICLE_LEFT_THREE &29d4 d4 objects_sprite[object] = pull # sprite = left_vehicle_sprite[vehicle] ; leave &29d5 27 end ; update_life # Function &2a, updates SPRITE_LIFE &29d6 58 push objects_x[object] &29d7 80 push #&00 &29d8 04 push (pull2 > pull1) &29d9 22 03 00 if(pull) jump &29df ; leave # If x < 0, &29dc 81 push #&01 &29dd 20 push -pull &29de d4 objects_sprite[object] = pull # sprite = SPRITE_NONE (remove object) ; leave &29df 27 end ; update_new_frog_initialisation # Function &3e, updates SPRITE_STUB_INITIALISE_NEW_FROG &29e0 28 2a 00 activate( &29e3 06 OBJECT_TYPE_VEHICLE_RIGHT_TWO, &29e4 06 OBJECT_TYPE_VEHICLE_RIGHT_TWO, &29e5 06 OBJECT_TYPE_VEHICLE_RIGHT_TWO, &29e6 06 OBJECT_TYPE_VEHICLE_RIGHT_TWO, &29e7 06 OBJECT_TYPE_VEHICLE_RIGHT_TWO, &29e8 06 OBJECT_TYPE_VEHICLE_RIGHT_TWO, &29e9 01 OBJECT_TYPE_LOG_TWO, &29ea 02 OBJECT_TYPE_TURTLES_ONE, &29eb 0b OBJECT_TYPE_TIME, &29ec 04 OBJECT_TYPE_PLAYER, &29ed 05 OBJECT_TYPE_VEHICLE_RIGHT_ONE, &29ee 05 OBJECT_TYPE_VEHICLE_RIGHT_ONE, &29ef 05 OBJECT_TYPE_VEHICLE_RIGHT_ONE, &29f0 0f OBJECT_TYPE_TUNE, &29f1 01 OBJECT_TYPE_LOG_TWO, &29f2 03 OBJECT_TYPE_TURTLES_TWO, &29f3 00 OBJECT_TYPE_LOG_ONE, &29f4 0c OBJECT_TYPE_SNAKE, &29f5 08 OBJECT_TYPE_VEHICLE_LEFT_TWO, &29f6 08 OBJECT_TYPE_VEHICLE_LEFT_TWO, &29f7 08 OBJECT_TYPE_VEHICLE_LEFT_TWO, &29f8 08 OBJECT_TYPE_VEHICLE_LEFT_TWO, &29f9 08 OBJECT_TYPE_VEHICLE_LEFT_TWO, &29fa 08 OBJECT_TYPE_VEHICLE_LEFT_TWO, &29fb 01 OBJECT_TYPE_LOG_TWO, &29fc 00 OBJECT_TYPE_LOG_ONE, &29fd 02 OBJECT_TYPE_TURTLES_ONE, &29fe 03 OBJECT_TYPE_TURTLES_TWO, &29ff 0d OBJECT_TYPE_OTHER, &2a00 01 OBJECT_TYPE_LOG_TWO, &2a01 03 OBJECT_TYPE_TURTLES_TWO, &2a02 00 OBJECT_TYPE_LOG_ONE, &2a03 04 OBJECT_TYPE_PLAYER, &2a04 07 OBJECT_TYPE_VEHICLE_LEFT_ONE, &2a05 07 OBJECT_TYPE_VEHICLE_LEFT_ONE, &2a06 07 OBJECT_TYPE_VEHICLE_LEFT_ONE, &2a07 07 OBJECT_TYPE_VEHICLE_LEFT_ONE, &2a08 01 OBJECT_TYPE_LOG_TWO, &2a09 02 OBJECT_TYPE_TURTLES_ONE, &2a0a 03 OBJECT_TYPE_TURTLES_TWO, &2a0b 0d OBJECT_TYPE_OTHER &2a0c ff ) # activate(...) (activate all game elements) &2a0d 84 push #&04 ; OBJECT_TYPE_PLAYER &2a0e c6 remove(type=pull) # remove(OBJECT_TYPE_PLAYER) &2a0f 84 push #&04 ; OBJECT_TYPE_PLAYER &2a10 d1 create(type=pull) # create(OBJECT_TYPE_PLAYER) &2a11 a6 push #&26 &2a12 d8 objects_x[object] = pull # x = &26 &2a13 87 push #&07 &2a14 d9 objects_y[object] = pull # y = &07 &2a15 a2 push #&22 ; SPRITE_BUFFER_MASKED_FROG_UP &2a16 c9 objects_data_one[object] = pull ; player_sprite # player_sprite = SPRITE_BUFFER_MASKED_FROG_UP &2a17 81 push #&01 &2a18 20 push -pull &2a19 ec variables[&0c] = pull ; player_water_support_one # player_water_support_one = &ff (not supported) &2a1a 81 push #&01 &2a1b 20 push -pull &2a1c eb variables[&0b] = pull ; player_water_support_two # player_water_support_two = &ff (not supported) &2a1d 58 push objects_x[object] &2a1e f8 variables[&18] = pull ; player_x # player_x = x &2a1f 59 push objects_y[object] &2a20 f9 variables[&19] = pull ; player_y # player_y = y &2a21 4f push object &2a22 e6 variables[&06] = pull ; player_object # player_object = object &2a23 a2 push #&22 ; SPRITE_BUFFER_MASKED_FROG_UP &2a24 58 push objects_x[object] &2a25 59 push objects_y[object] &2a26 31 plot(sprite=pull3, x=pull2, y=pull1) # plot(SPRITE_BUFFER_MASKED_FROG_UP, x, y) &2a27 2c 03 03 decimals[3] -= decimals[3] ; time &2a2a 80 push #&00 &2a2b 83 push #&03 &2a2c 23 99 push #&99 &2a2e 2b 00 03 decimals[3] += (pull3, pull2, pull1) ; time # time = 399 &2a31 2a 0b write(...) &2a33 1f 0c 1e # TAB(&0c, &1e) &2a36 11 07 # COLOUR 7 &2a38 54 69 6d 65 # "Time" &2a3c 11 01 # COLOUR 1 &2a3e 2d command("FX 15,1") # *FX 15, 1 (Flush input buffer) &2a3f 46 58 20 31 35 2c 31 0d &2a47 27 end ; update_fast_vehicles # Function &37, updates SPRITE_DOUBLE_FAST_VEHICLE &2a48 58 push objects_x[object] &2a49 4d push right_clip &2a4a 06 push (pull2 <= pull1) &2a4b 22 03 00 if(pull) jump &2a51 ; leave # If x > right_clip, &2a4e 96 push #&16 &2a4f 20 push -pull &2a50 d8 objects_x[object] = pull # Set x to -&16 ; leave &2a51 27 end ; update_fast_traffic_initialisation # Function &4b, updates SPRITE_STUB_INITIALISE_FAST_TRAFFIC &2a52 58 push objects_x[object] &2a53 4d push right_clip &2a54 06 push (pull2 <= pull1) &2a55 22 0b 00 if(pull) jump &2a63 ; leave # If x > right_clip, &2a58 96 push #&16 &2a59 20 push -pull &2a5a d8 objects_x[object] = pull # x = -16 &2a5b 53 push level &2a5c 49 push objects_data_one[object] ; level_to_appear &2a5d 05 push (pull2 != pull1) &2a5e 22 02 00 if(pull) jump &2a63 ; leave # If level_to_appear == level, &2a61 b7 push #&37 ; SPRITE_DOUBLE_FAST_VEHICLE &2a62 d4 objects_sprite[object] = pull # sprite = SPRITE_DOUBLE_FAST_VEHICLE ; leave &2a63 27 end ; update_vehicle_left # Function &12, updates SPRITE_VEHICLE_LEFT_ONE ; # Function &14, updates SPRITE_VEHICLE_LEFT_TWO ; # Function &1e, updates SPRITE_VEHICLE_LEFT_THREE &2a64 58 push objects_x[object] &2a65 88 push #&08 &2a66 20 push -pull &2a67 03 push (pull2 >= pull1) &2a68 22 02 00 if(pull) jump &2a6d ; leave # If x < -8, &2a6b 4d push right_clip &2a6c d8 objects_x[object] = pull # x = right_clip ; leave &2a6d 27 end ; update_vehicle_right # Function &13, updates SPRITE_VEHICLE_RIGHT_ONE ; # Function &14, updates SPRITE_VEHICLE_RIGHT_TWO ; # Function &1e, updates SPRITE_VEHICLE_RIGHT_THREE &2a6e 58 push objects_x[object] &2a6f 4d push right_clip &2a70 06 push (pull2 <= pull1) &2a71 22 03 00 if(pull) jump &2a77 ; leave # If x > right_clip &2a74 88 push #&08 &2a75 20 push -pull &2a76 d8 objects_x[object] = pull # x = -8 ; leave &2a77 27 end ; update_hidden_crocodile # Function &3d, updates SPRITE_CROCODILE_HIDDEN &2a78 49 push objects_data_one[object] ; crocodile_timer &2a79 81 push #&01 &2a7a 0a push (pull2 - pull1) &2a7b c9 objects_data_one[object] = pull ; crocodile_timer # crocodile_timer -= 1 &2a7c 49 push objects_data_one[object] ; crocodile_timer &2a7d 80 push #&00 &2a7e 04 push (pull2 > pull1) &2a7f 22 2d 00 if(pull) jump &2aaf ; leave # If crocodile_timer <= 0, &2a82 52 push rnd() &2a83 23 7f push #&7f &2a85 00 push (pull2 AND pull1) &2a86 f4 variables[&14] = pull ; r # r = rnd() & &7f &2a87 74 push variables[&14] ; r &2a88 74 push variables[&14] ; r &2a89 85 push #&05 &2a8a 0c push (pull2 / pull1) &2a8b 85 push #&05 &2a8c 0b push (pull2 * pull1) &2a8d 0a push (pull2 - pull1) &2a8e 81 push #&01 &2a8f 09 push (pull2 + pull1) &2a90 f4 variables[&14] = pull ; home # home = 1 + r - ((r / 5) * 5), i.e. = 1 + (r MOD 5) &2a91 74 push variables[&14] ; home &2a92 2e 05 00 array(pull) &2a95 01 02 04 08 10 &2a9a e9 variables[&09] = pull ; crocodile_home_bit # crocodile_home_bit = 1 << (home - 1) &2a9b 6d push variables[&0d] ; occupied_homes &2a9c 69 push variables[&09] ; crocodile_home_bit &2a9d 00 push (pull2 AND pull1) &2a9e 80 push #&00 &2a9f 05 push (pull2 != pull1) &2aa0 22 0c 00 if(pull) jump &2aaf ; leave # If (occupied_homes & crocodile_home_bit) = 0, &2aa3 89 push #&09 ; SPRITE_CROCODILE_HALF &2aa4 d4 objects_sprite[object] = pull # sprite = SPRITE_CROCODILE_HALF &2aa5 8e push #&0e &2aa6 74 push variables[&14] ; home &2aa7 0b push (pull2 * pull1) &2aa8 85 push #&05 &2aa9 0a push (pull2 - pull1) &2aaa d8 objects_x[object] = pull # x = (home * 14) - 5 &2aab b4 push #&34 &2aac d9 objects_y[object] = pull # y = &34 &2aad 86 push #&06 &2aae c9 objects_data_one[object] = pull ; crocodile_timer # crocodile_timer = 6 ; leave &2aaf 27 end ; update_half_crocodile # Function &09, updates SPRITE_CROCODILE_HALF &2ab0 58 push objects_x[object] &2ab1 85 push #&05 &2ab2 09 push (pull2 + pull1) &2ab3 8e push #&0e &2ab4 0c push (pull2 / pull1) &2ab5 f4 variables[&14] = pull ; home # home = (x + 5) / 14 &2ab6 49 push objects_data_one[object] ; crocodile_timer &2ab7 81 push #&01 &2ab8 0a push (pull2 - pull1) &2ab9 c9 objects_data_one[object] = pull ; crocodile_timer # crocodile_timer -= 1 &2aba 49 push objects_data_one[object] ; crocodile_timer &2abb 80 push #&00 &2abc 04 push (pull2 > pull1) &2abd 22 06 00 if(pull) jump &2ac6 ; skip_full_crocodile # If crocodile_time <= 0, &2ac0 74 push variables[&14] ; home &2ac1 e3 variables[&03] = pull ; crocodile_home # crocodile_home = home &2ac2 8a push #&0a ; SPRITE_CROCODILE_FULL &2ac3 d4 objects_sprite[object] = pull # sprite = SPRITE_CROCODILE_FULL &2ac4 90 push #&10 &2ac5 c9 objects_data_one[object] = pull ; crocodile_timer # crocodile_time = 16 ; skip_full_crocodile &2ac6 74 push variables[&14] ; home &2ac7 2e 05 00 array(pull) &2aca 01 02 04 08 10 &2acf e9 variables[&09] = pull ; crocodile_home_bit # crocodile_home_bit = 1 << (home - 1) &2ad0 6d push variables[&0d] ; occupied_homes &2ad1 69 push variables[&09] ; crocodile_home_bit &2ad2 00 push (pull2 AND pull1) &2ad3 22 06 00 if(pull) jump &2adc ; leave # If (occupied_homes & crocodile_home_bit) != 0, &2ad6 bd push #&3d ; SPRITE_CROCODILE_HIDDEN &2ad7 d4 objects_sprite[object] = pull # sprite = SPRITE_CROCODILE_HIDDEN &2ad8 80 push #&00 &2ad9 e3 variables[&03] = pull ; crocodile_home # crocodile_home = 0 &2ada 90 push #&10 &2adb c9 objects_data_one[object] = pull ; crocodile_timer # crocodile_timer = 16 ; leave &2adc 27 end ; update_full_crocodile # Function &0a, updates SPRITE_CROCODILE_FULL &2add 49 push objects_data_one[object] ; crocodile_timer &2ade 81 push #&01 &2adf 0a push (pull2 - pull1) &2ae0 c9 objects_data_one[object] = pull # crocodile_timer -= 1 &2ae1 49 push objects_data_one[object] ; crocodile_timer &2ae2 80 push #&00 &2ae3 04 push (pull2 > pull1) &2ae4 22 0a 00 if(pull) jump &2af1 ; leave # If crocodile_timer <= 0, &2ae7 bd push #&3d ; SPRITE_CROCODILE_HIDDEN &2ae8 d4 objects_sprite[object] = pull # sprite = SPRITE_CROCODILE_HIDDEN &2ae9 90 push #&10 &2aea c9 objects_data_one[object] = pull # crocodile_timer = 16 &2aeb 80 push #&00 &2aec e3 variables[&03] = pull ; crocodile_home # crocodile_home = 0 &2aed b0 push #&30 ; SPRITE_UNPLOT_HOME &2aee 58 push objects_x[object] &2aef 59 push objects_y[object] &2af0 31 plot(sprite=pull3, x=pull2, y=pull1) # plot(SPRITE_UNPLOT_HOME, x, y) ; leave &2af1 27 end ; update_snake # Function &38, updates SPRITE_BUFFER_SNAKE_ONE ; # Function &39, updates SPRITE_BUFFER_SNAKE_TWO &2af2 58 push objects_x[object] &2af3 4a push objects_data_two[object] ; snake_left_edge &2af4 03 push (pull2 >= pull1) &2af5 22 0d 00 if(pull) jump &2b05 ; skip_wraparound # If x < snake_left_edge, &2af8 4d push right_clip &2af9 d8 objects_x[object] = pull # x = right_clip &2afa 4a push objects_data_two[object] ; snake_left_edge &2afb 8a push #&0a &2afc 20 push -pull &2afd 03 push (pull2 >= pull1) &2afe 22 04 00 if(pull) jump &2b05 ; skip_wraparound # If snake_left_edge < -10, &2b01 4a push objects_data_two[object] ; snake_left_edge &2b02 83 push #&03 &2b03 09 push (pull2 + pull1) &2b04 ca objects_data_two[object] = pull ; snake_left_edge # snake_left_edge += 3 ; skip_wraparound &2b05 79 push variables[&19] ; player_y &2b06 a0 push #&20 &2b07 05 push (pull2 != pull1) # If player_y == &20, &2b08 78 push variables[&18] ; player_x &2b09 58 push objects_x[object] &2b0a 85 push #&05 &2b0b 0a push (pull2 - pull1) &2b0c 06 push (pull2 <= pull1) &2b0d 00 push (pull2 AND pull1) # and player_x > (x - 5) &2b0e 78 push variables[&18] ; player_x &2b0f 58 push objects_x[object] &2b10 86 push #&06 &2b11 09 push (pull2 + pull1) &2b12 54 push objects_sprite[object] &2b13 99 push #&19 ; SPRITE_SNAKE_ONE &2b14 05 push (pull2 != pull1) &2b15 0a push (pull2 - pull1) &2b16 03 push (pull2 >= pull1) &2b17 00 push (pull2 AND pull1) &2b18 22 11 00 if(pull) jump &2b2c ; snake_not_touching_player # and player_x < (x + 6 - (sprite != SPRITE_SNAKE_ONE ? 0: -1)), ; snake_touching_player &2b1b 54 push objects_sprite[object] &2b1c f4 variables[&14] = pull ; snake_sprite # snake_sprite = sprite &2b1d 58 push objects_x[object] &2b1e 81 push #&01 &2b1f 09 push (pull2 + pull1) &2b20 d8 objects_x[object] = pull # x += 1 &2b21 23 46 push #&46 ; SPRITE_SNAKE_HIDDEN &2b23 d4 objects_sprite[object] = pull # sprite = SPRITE_SNAKE_HIDDEN &2b24 74 push variables[&14] ; snake_sprite &2b25 c9 objects_data_one[object] = pull ; previous_sprite # previous_sprite = snake_sprite &2b26 23 41 push #&41 ; kill_player &2b28 2f call(pull) # kill_player() for touching snake &2b29 21 06 00 jump &2b32 ; leave ; snake_not_touching_player &2b2c 54 push objects_sprite[object] &2b2d b8 push #&38 ; SPRITE_BUFFER_SNAKE_ONE &2b2e b9 push #&39 ; SPRITE_BUFFER_SNAKE_TWO &2b2f 02 push (pull2 EOR pull1) &2b30 02 push (pull2 EOR pull1) &2b31 d4 objects_sprite[object] = pull # sprite = sprite ^ (SPRITE_BUFFER_SNAKE_ONE ^ SPRITE_BUFFER_SNAKE_TWO) ; leave &2b32 27 end ; update_hidden_snake # Function &46, updates SPRITE_SNAKE_HIDDEN &2b33 49 push objects_data_one[object] ; previous_sprite &2b34 d4 objects_sprite[object] = pull # sprite = previous_sprite &2b35 54 push objects_sprite[object] &2b36 2f call(pull) # update_snake() &2b37 27 end ; update_turtles # Function &45, updates SPRITE_STUB_TURTLES &2b38 49 push objects_data_one[object] ; turtle_timer &2b39 22 0c 00 if(pull) jump &2b48 ; skip_timer # If turtle_timer != 0 (i.e. turtles can submerge), &2b3c 49 push objects_data_one[object] ; turtle_timer &2b3d 81 push #&01 &2b3e 0a push (pull2 - pull1) &2b3f c9 objects_data_one[object] = pull ; turtle_timer # turtle_timer -= 1 &2b40 49 push objects_data_one[object] ; turtle_timer &2b41 80 push #&00 &2b42 05 push (pull2 != pull1) &2b43 22 02 00 if(pull) jump &2b48 ; skip_timer_wraparound # If turtle_timer == 0, &2b46 af push #&2f &2b47 c9 objects_data_one[object] = pull ; turtle_timer # turtle_timer = &2f ; skip_timer_wraparound ; skip_timer &2b48 49 push objects_data_one[object] ; turtle_timer &2b49 90 push #&10 &2b4a 0c push (pull2 / pull1) &2b4b 81 push #&01 &2b4c 09 push (pull2 + pull1) &2b4d 2e 03 00 array(pull, &2b50 32 [SPRITE_TURTLES, # turtle_sprites[] = [...] &2b51 34 SPRITE_TURTLES_SUBMERGED, &2b52 33 SPRITE_TURTLES_SUBMERGING]) &2b53 e9 variables[&09] = pull ; water_sprite # water_sprite = turtle_sprites[(turtle_timer / 16) + 1] &2b54 ba push #&3a ; consider_moving_player_on_water_object &2b55 2f call(pull) # consider_moving_player_on_water_object() &2b56 58 push objects_x[object] &2b57 6a push variables[&0a] ; turtle_wraparound &2b58 03 push (pull2 >= pull1) &2b59 22 02 00 if(pull) jump &2b5e ; skip_wraparound # If x < turtle_wraparound &2b5c 4d push right_clip &2b5d d8 objects_x[object] = pull # x = right_clip ; skip_wraparound &2b5e 53 push level &2b5f 4a push objects_data_two[object] ; level_to_submerge &2b60 05 push (pull2 != pull1) &2b61 22 04 00 if(pull) jump &2b68 ; skip_reset # If level_to_submerge == level, &2b64 80 push #&00 &2b65 ca objects_data_two[object] = pull ; level_to_submerge # level_to_submerge = 0, &2b66 87 push #&07 &2b67 c9 objects_data_one[object] = pull ; turtle_timer # turtle_timer = 7 (i.e. allow turtles to submerge) ; skip_reset &2b68 6c push variables[&0c] ; player_water_support_one &2b69 4f push object &2b6a 05 push (pull2 != pull1) # If player_water_support_one == object, &2b6b 79 push variables[&19] ; player_y &2b6c 59 push objects_y[object] &2b6d 05 push (pull2 != pull1) &2b6e 00 push (pull2 AND pull1) # and player_y = y, &2b6f 69 push variables[&09] ; water_sprite &2b70 b4 push #&34 ; SPRITE_TURTLES_SUBMERGED &2b71 05 push (pull2 != pull1) &2b72 00 push (pull2 AND pull1) # and water_sprite == SPRITE_TURTLES_SUBMERGED, &2b73 22 03 00 if(pull) jump &2b79 ; leave &2b76 23 41 push #&41 ; kill_player &2b78 2f call(pull) # kill_player() (for riding submerged turtles) ; leave &2b79 27 end ; update_dragonfly # Function &20, updates SPRITE_DRAGONFLY_LEFT &2b7a 4f push object &2b7b ef variables[&0f] = pull ; dragonfly_object # dragonfly_object = object &2b7c 58 push objects_x[object] &2b7d 4d push right_clip &2b7e 06 push (pull2 <= pull1) &2b7f 22 13 00 if(pull) jump &2b95 ; skip_hiding_dragonfly # If x > right_clip, &2b82 4f push object &2b83 81 push #&01 &2b84 0a push (pull2 - pull1) &2b85 cf object = pull # object -= 1 &2b86 58 push objects_x[object] &2b87 f4 variables[&14] = pull ; dragonfly_x # dragonfly_x = x &2b88 4f push object &2b89 81 push #&01 &2b8a 09 push (pull2 + pull1) &2b8b cf object = pull # object += 1 &2b8c 74 push variables[&14] ; dragonfly_x &2b8d 88 push #&08 &2b8e 09 push (pull2 + pull1) &2b8f d8 objects_x[object] = pull # x = dragon_fly_x + 8 &2b90 23 4c push #&4c ; SPRITE_DRAGONFLY_HIDDEN &2b92 d4 objects_sprite[object] = pull # sprite = SPRITE_DRAGONFLY_HIDDEN &2b93 82 push #&02 &2b94 f0 variables[&10] = pull ; dragonfly_timer # dragonfly_timer = 2 ; skip_hiding_dragonfly &2b95 79 push variables[&19] ; player_y &2b96 59 push objects_y[object] &2b97 05 push (pull2 != pull1) # If player_y = y &2b98 79 push variables[&19] ; player_y &2b99 59 push objects_y[object] &2b9a 82 push #&02 &2b9b 0a push (pull2 - pull1) &2b9c 05 push (pull2 != pull1) &2b9d 01 push (pull2 OR pull1) &2b9e 22 3d 00 if(pull) jump &2bde ; consider_flipping_dragonfly # or player_y = (y - 2), &2ba1 78 push variables[&18] ; player_x &2ba2 58 push objects_x[object] &2ba3 83 push #&03 &2ba4 0a push (pull2 - pull1) &2ba5 06 push (pull2 <= pull1) If player_x > (x - 3) &2ba6 78 push variables[&18] ; player_x &2ba7 58 push objects_x[object] &2ba8 84 push #&04 &2ba9 09 push (pull2 + pull1) &2baa 03 push (pull2 >= pull1) &2bab 00 push (pull2 AND pull1) &2bac 22 2c 00 if(pull) jump &2bdb ; to_leave # and player_x < (x + 4), &2baf 80 push #&00 &2bb0 82 push #&02 &2bb1 80 push #&00 &2bb2 2b 00 01 decimals[1] += (pull3, pull2, pull1) ; score # score += 200 (for eating dragonfly) &2bb5 73 push variables[&13] ; sound_enabled &2bb6 81 push #&01 &2bb7 00 push (pull2 AND pull1) &2bb8 22 07 00 if(pull) jump &2bc2 ; skip_sound # If (sound_enabled & 1) == 1, &2bbb 91 push #&11 &2bbc 81 push #&01 &2bbd 23 4c push #&4c &2bbf 20 push -pull &2bc0 83 push #&03 &2bc1 29 sound(pull4, pull3, pull2, pull1) # SOUND &11, &01, &B4, &03 (for eating dragonfly) ; skip_sound &2bc2 23 4c push #&4c ; SPRITE_DRAGONFLY_HIDDEN &2bc4 d4 objects_sprite[object] = pull # sprite = SPRITE_DRAGONFLY_HIDDEN &2bc5 82 push #&02 &2bc6 f0 variables[&10] = pull ; dragonfly_timer # dragonfly_timer = 2 &2bc7 8d push #&0d ; SPRITE_PLAYER_BUFFER &2bc8 78 push variables[&18] ; player_x &2bc9 79 push variables[&19] ; player_y &2bca 31 plot(sprite=pull3, x=pull2, y=pull1) # plot(SPRITE_PLAYER_BUFFER, player_x, player_y) &2bcb 6f push variables[&0f] ; dragonfly_object &2bcc cf object = pull # object = dragonfly_object &2bcd a1 push #&21 ; SPRITE_DRAGONFLY_RIGHT &2bce 58 push objects_x[object] &2bcf 81 push #&01 &2bd0 09 push (pull2 + pull1) &2bd1 59 push objects_y[object] &2bd2 31 plot(sprite=pull3, x=pull2, y=pull1) # plot(SPRITE_DRAGONFLY_RIGHT, x + 1, y) &2bd3 66 push variables[&06] ; player_object &2bd4 cf object = pull # object = player_object &2bd5 49 push objects_data_one[object] ; player_sprite &2bd6 f4 variables[&14] = pull ; s &2bd7 74 push variables[&14] ; s # s = player_sprite &2bd8 58 push objects_x[object] &2bd9 59 push objects_y[object] &2bda 31 plot(sprite=pull3, x=pull2, y=pull1) # plot(x, x, y) ; to_leave &2bdb 21 20 00 jump &2bfe ; leave ; consider_flipping_dragonfly &2bde 58 push objects_x[object] &2bdf 81 push #&01 &2be0 00 push (pull2 AND pull1) &2be1 80 push #&00 &2be2 05 push (pull2 != pull1) &2be3 22 18 00 if(pull) jump &2bfe ; leave # If (x & 1) == 0, &2be6 52 push rnd() &2be7 23 7f push #&7f &2be9 00 push (pull2 AND pull1) &2bea a8 push #&28 &2beb 03 push (pull2 >= pull1) &2bec 22 0f 00 if(pull) jump &2bfe ; leave # If (rnd() & &7f) < &28, &2bef a1 push #&21 ; SPRITE_DRAGONFLY_RIGHT &2bf0 58 push objects_x[object] &2bf1 81 push #&01 &2bf2 09 push (pull2 + pull1) &2bf3 59 push objects_y[object] &2bf4 31 plot(sprite=pull3, x=pull2, y=pull1) # plot(SPRITE_DRAGONFLY_RIGHT, x + 1, y) &2bf5 6f push variables[&0f] ; dragonfly_object &2bf6 cf object = pull # object = dragonfly_object &2bf7 58 push objects_x[object] &2bf8 49 push objects_data_one[object] ; dragonfly_offset &2bf9 09 push (pull2 + pull1) &2bfa d8 objects_x[object] = pull # x = x + dragonfly_offset &2bfb 49 push objects_data_one[object] ; dragonfly_offset &2bfc 20 push -pull &2bfd c9 objects_data_one[object] = pull ; dragonfly_offset # dragonfly_offset = -dragonfly_offset ; leave &2bfe 27 end ; update_hidden_dragonfly # Function &4c, updates SPRITE_DRAGONFLY_HIDDEN &2bff 58 push objects_x[object] &2c00 4d push right_clip &2c01 06 push (pull2 <= pull1) &2c02 22 1a 00 if(pull) jump &2c1f ; leave # If x > right_clip, &2c05 4f push object &2c06 81 push #&01 &2c07 0a push (pull2 - pull1) &2c08 cf object = pull # object -= 1 &2c09 58 push objects_x[object] &2c0a f4 variables[&14] = pull ; dragonfly_x # dragonfly_x = x &2c0b 4f push object &2c0c 81 push #&01 &2c0d 09 push (pull2 + pull1) &2c0e cf object = pull # object += 1 &2c0f 74 push variables[&14] ; dragonfly_x &2c10 88 push #&08 &2c11 09 push (pull2 + pull1) &2c12 d8 objects_x[object] = pull # x = dragonfly_x + 8 &2c13 70 push variables[&10] ; dragonfly_timer &2c14 81 push #&01 &2c15 0a push (pull2 - pull1) &2c16 f0 variables[&10] = pull ; dragonfly_timer # dragonfly_timer -= 1 &2c17 70 push variables[&10] ; dragonfly_timer &2c18 80 push #&00 &2c19 04 push (pull2 > pull1) &2c1a 22 02 00 if(pull) jump &2c1f ; leave # If dragonfly_timer <= 0, &2c1d a0 push #&20 ; SPRITE_DRAGONFLY_LEFT &2c1e d4 objects_sprite[object] = pull # sprite = SPRITE_DRAGONFLY_LEFT ; leave &2c1f 27 end ; update_log # Function &42, updates SPRITE_STUB_LOG &2c20 b1 push #&31 ; SPRITE_LOG &2c21 e9 variables[&09] = pull ; water_sprite # water_sprite = SPRITE_LOG &2c22 ba push #&3a ; consider_moving_player_on_water_object &2c23 2f call(pull) # consider_moving_player_on_water_object() &2c24 58 push objects_x[object] &2c25 4d push right_clip &2c26 06 push (pull2 <= pull1) &2c27 22 1c 00 if(pull) jump &2c46 ; leave # If x > right_clip, &2c2a 4a push objects_data_two[object] ; left_x &2c2b d8 objects_x[object] = pull # x = left_x &2c2c 53 push level &2c2d 83 push #&03 &2c2e 05 push (pull2 != pull1) # If level == 3 &2c2f 4f push object &2c30 61 push variables[&01] ; disappearing_log_one &2c31 05 push (pull2 != pull1) &2c32 00 push (pull2 AND pull1) &2c33 22 03 00 if(pull) jump &2c39 ; keep_log_one # and object = disappearing_log_one, &2c36 82 push #&02 &2c37 20 push -pull &2c38 d4 objects_sprite[object] = pull # sprite = SPRITE_SKIP_TO_NEXT (remove log) ; keep_log_one &2c39 53 push level &2c3a 84 push #&04 &2c3b 05 push (pull2 != pull1) # If level == 4 &2c3c 4f push object &2c3d 62 push variables[&02] ; disappearing_log_two &2c3e 05 push (pull2 != pull1) &2c3f 00 push (pull2 AND pull1) &2c40 22 03 00 if(pull) jump &2c46 ; keep_log_two # and object = disappearing_log_two, &2c43 81 push #&01 &2c44 20 push -pull &2c45 d4 objects_sprite[object] = pull # sprite = SPRITE_NONE (remove log) ; keep_log_two &2c46 27 end ; consider_moving_player_on_water_object # Function &3a &2c47 4f push object &2c48 ef variables[&0f] = pull ; water_object # water_object = object &2c49 55 push objects_velocity_x[object] &2c4a f5 variables[&15] = pull ; player_velocity_x # player_velocity_x = velocity_x &2c4b 6c push variables[&0c] ; player_water_support_one &2c4c 4f push object &2c4d 05 push (pull2 != pull1) # If object == player_water_support_one &2c4e 6b push variables[&0b] ; player_water_support_two &2c4f 4f push object &2c50 05 push (pull2 != pull1) &2c51 01 push (pull2 OR pull1) &2c52 22 25 00 if(pull) jump &2c7a ; player_not_on_object # or object == player_water_support_two, &2c55 66 push variables[&06] ; player_object &2c56 cf object = pull # object = player_object &2c57 8d push #&0d ; SPRITE_PLAYER_BUFFER &2c58 58 push objects_x[object] &2c59 59 push objects_y[object] &2c5a 31 plot(sprite=pull3, x=pull2, y=pull1) # plot(SPRITE_PLAYER_BUFFER, x, y) &2c5b 6f push variables[&0f] ; water_object &2c5c cf object = pull # object = water_object &2c5d 69 push variables[&09] ; water_sprite &2c5e 58 push objects_x[object] &2c5f 75 push variables[&15] ; player_velocity_x &2c60 09 push (pull2 + pull1) &2c61 59 push objects_y[object] &2c62 31 plot(sprite=pull3, x=pull2, y=pull1) # plot(water_sprite, x + player_velocity_x, y) &2c63 79 push variables[&19] ; player_y &2c64 59 push objects_y[object] &2c65 05 push (pull2 != pull1) &2c66 22 04 00 if(pull) jump &2c6d ; skip_moving_player # If player_y = y, &2c69 78 push variables[&18] ; player_x &2c6a 75 push variables[&15] ; player_velocity_x &2c6b 09 push (pull2 + pull1) &2c6c f8 variables[&18] = pull ; player_x # player_x += player_velocity_x ; skip_moving_player &2c6d 66 push variables[&06] ; player_object &2c6e cf object = pull # object = player_object &2c6f 49 push objects_data_one[object] ; player_sprite &2c70 f4 variables[&14] = pull ; s # s = player_sprite &2c71 78 push variables[&18] ; player_x &2c72 d8 objects_x[object] = pull # x = player_x &2c73 74 push variables[&14] ; s &2c74 58 push objects_x[object] &2c75 59 push objects_y[object] &2c76 31 plot(sprite=pull3, x=pull2, y=pull1) # plot(s, x, y) &2c77 21 06 00 jump &2c80 ; leave_after_restoring_object ; player_not_on_object &2c7a 69 push variables[&09] ; water_sprite &2c7b 58 push objects_x[object] &2c7c 75 push variables[&15] ; player_velocity_x &2c7d 09 push (pull2 + pull1) &2c7e 59 push objects_y[object] &2c7f 31 plot(sprite=pull3, x=pull2, y=pull1) # plot(water_sprite, x + player_velocity_x, y) ; leave_after_restoring_object &2c80 6f push variables[&0f] ; water_object &2c81 cf object = pull # object = water_object &2c82 27 end ; update_time # Function &40, updates SPRITE_STUB_TIME &2c83 80 push #&00 &2c84 80 push #&00 &2c85 83 push #&03 &2c86 2c 00 03 decimals[3] -= (pull3, pull2, pull1) ; time # time -= 3 &2c89 83 push #&03 &2c8a 81 push #&01 &2c8b 0d push decimal[pull2].digit[pull1] ; time &2c8c 80 push #&00 &2c8d 05 push (pull2 != pull1) &2c8e 22 36 00 if(pull) jump &2cc7 ; leave # If (time DIV 100) == 0, &2c91 83 push #&03 &2c92 80 push #&00 &2c93 0d push decimal[pull2].digit[pull1] ; time &2c94 f4 variables[&14] = pull ; time_low # time_low = time MOD 100 &2c95 74 push variables[&14] ; time_low &2c96 23 99 push #&99 &2c98 05 push (pull2 != pull1) # If time_low = 99 &2c99 74 push variables[&14] ; time_low &2c9a 23 87 push #&87 &2c9c 05 push (pull2 != pull1) &2c9d 01 push (pull2 OR pull1) &2c9e 22 1b 00 if(pull) jump &2cbc ; skip_writing_time # or time_low = 87, &2ca1 73 push variables[&13] ; sound_enabled &2ca2 81 push #&01 &2ca3 00 push (pull2 AND pull1) &2ca4 22 08 00 if(pull) jump &2caf ; skip_sound # If (sound_enabled & 1) == 1, &2ca7 92 push #&12 &2ca8 8f push #&0f &2ca9 20 push -pull &2caa 23 64 push #&64 &2cac 20 push -pull &2cad 87 push #&07 &2cae 29 sound(pull4, pull3, pull2, pull1) # SOUND &12, &f1, &9c, &07 (for low time) ; skip_sound &2caf 2a 0b write(...) &2cb1 1f 0c 1e # TAB(&0c, &1e) &2cb4 11 0f # COLOUR 15 &2cb6 54 69 6d 65 # "Time" &2cba 11 01 # COLOUR 1 ; skip_writing_time &2cbc 83 push #&03 &2cbd 80 push #&00 &2cbe 0d push decimal[pull2].digit[pull1] ; time &2cbf 80 push #&00 &2cc0 05 push (pull2 != pull1) &2cc1 22 03 00 if(pull) jump &2cc7 ; leave # If (time MOD 100) == 0, &2cc4 23 41 push #&41 ; kill_player &2cc6 2f call(pull) # kill_player() (for running out of time) ; leave &2cc7 27 end ; check_for_water_support # Function &43 &2cc8 81 push #&01 &2cc9 20 push -pull &2cca ec variables[&0c] = pull ; player_water_support_one # player_water_support_one = &ff (player not supported) &2ccb 81 push #&01 &2ccc 20 push -pull &2ccd eb variables[&0b] = pull ; player_water_support_two # player_water_support_two = &ff (player not supported) &2cce 59 push objects_y[object] &2ccf a0 push #&20 &2cd0 06 push (pull2 <= pull1) # If y > &20 &2cd1 59 push objects_y[object] &2cd2 b4 push #&34 &2cd3 03 push (pull2 >= pull1) &2cd4 00 push (pull2 AND pull1) &2cd5 22 22 00 if(pull) jump &2cfa ; leave # and y < &34, i.e. player is in river, &2cd8 23 44 push #&44 ; check_if_object_supporting_player &2cda 2f call(pull) # check_if_object_supporting_player() &2cdb 59 push objects_y[object] &2cdc 83 push #&03 &2cdd 00 push (pull2 AND pull1) &2cde 22 10 00 if(pull) jump &2cf1 ; kill_player_if_not_supported # If (y & 3) == 0, &2ce1 6c push variables[&0c] ; player_water_support_one &2ce2 eb variables[&0b] = pull ; player_water_support_two # player_water_support_two = player_water_support_one &2ce3 59 push objects_y[object] &2ce4 82 push #&02 &2ce5 0a push (pull2 - pull1) &2ce6 d9 objects_y[object] = pull # y -= 2 &2ce7 23 44 push #&44 ; check_if_object_supporting_player &2ce9 2f call(pull) # check_if_object_supporting_player() &2cea 59 push objects_y[object] &2ceb 82 push #&02 &2cec 09 push (pull2 + pull1) &2ced d9 objects_y[object] = pull # y += 2 &2cee 21 09 00 jump &2cfa ; leave ; kill_player_if_not_supported &2cf1 6c push variables[&0c] ; player_water_support_one &2cf2 80 push #&00 &2cf3 03 push (pull2 >= pull1) &2cf4 22 03 00 if(pull) jump &2cfa ; leave # If player_water_support_one < 0, &2cf7 23 41 push #&41 ; kill_player &2cf9 2f call(pull) # kill_player() (for not being supported in water) ; leave &2cfa 27 end ; check_if_object_supporting_player # Function &44 &2cfb 59 push objects_y[object] &2cfc 9e push #&1e &2cfd 0a push (pull2 - pull1) &2cfe 84 push #&04 &2cff 0c push (pull2 / pull1) &2d00 f4 variables[&14] = pull ; row # row = (y - &1e) / 4 &2d01 74 push variables[&14] ; row &2d02 85 push #&05 &2d03 03 push (pull2 >= pull1) &2d04 22 34 00 if(pull) jump &2d3b ; leave_after_resetting_object # If row < 5, &2d07 74 push variables[&14] ; row &2d08 2e 04 00 array(pull, [ &2d0b 03 OBJECT_TYPE_TURTLES_TWO # log_or_turtle_types[] = [...] &2d0c 01 OBJECT_TYPE_LOG_TWO &2d0d 02 OBJECT_TYPE_TURTLES_ONE &2d0e 00 OBJECT_TYPE_LOG_ONE ]) &2d0f f1 variables[&11] = pull ; water_support_type # water_support_type = log_or_turtle_types[row] &2d10 74 push variables[&14] ; row &2d11 2e 04 00 array(pull) &2d14 0e 16 0e 16 # log_or_turtle_lengths[] = [14, 22, 14, 22] &2d18 e9 variables[&09] = pull ; water_support_length # water_support_length = log_or_turtle_lengths[row] &2d19 74 push variables[&14] ; row &2d1a 2e 04 00 array(pull, [ &2d1d 45 SPRITE_STUB_TURTLES # log_or_turtle_sprites[] = [...] &2d1e 42 SPRITE_STUB_LOG &2d1f 45 SPRITE_STUB_TURTLES &2d20 42 SPRITE_STUB_LOG ]) &2d21 f4 variables[&14] = pull ; water_support_sprite # water_support_sprite = log_or_turtle_sprites[row] &2d22 71 push variables[&11] ; water_support_type &2d23 30 replot(type=pull) # replot(water_support_type) &2d24 78 push variables[&18] ; player_x &2d25 58 push objects_x[object] &2d26 84 push #&04 &2d27 0a push (pull2 - pull1) &2d28 06 push (pull2 <= pull1) # If player_x > (x - 4) &2d29 78 push variables[&18] ; player_x &2d2a 58 push objects_x[object] &2d2b 69 push variables[&09] ; water_support_length &2d2c 09 push (pull2 + pull1) &2d2d 03 push (pull2 >= pull1) &2d2e 00 push (pull2 AND pull1) # and player_x < (x + water_support_length) &2d2f 22 08 00 if(pull) jump &2d3a ; leave &2d32 54 push objects_sprite[object] &2d33 74 push variables[&14] ; water_support_sprite &2d34 05 push (pull2 != pull1) &2d35 22 02 00 if(pull) jump &2d3a ; leave # and sprite != water_support_sprite, &2d38 4f push object &2d39 ec variables[&0c] = pull ; player_water_support_one # player_water_support_one = object ; leave &2d3a 27 end ; leave_after_resetting_object &2d3b 66 push variables[&06] ; player_object &2d3c cf object = pull # object = player_object &2d3d 27 end ; update_extra_life # Function &47, updates SPRITE_STUB_EXTRA_LIFE &2d3e 49 push objects_data_one[object] ; extra_life_timer &2d3f 81 push #&01 &2d40 0a push (pull2 - pull1) &2d41 c9 objects_data_one[object] = pull ; extra_life_timer # extra_life_timer -= 1 &2d42 49 push objects_data_one[object] ; extra_life_timer &2d43 80 push #&00 &2d44 04 push (pull2 > pull1) &2d45 22 03 00 if(pull) jump &2d4b ; skip_removing # If extra_life_timer <= 0, &2d48 81 push #&01 &2d49 20 push -pull &2d4a d4 objects_sprite[object] = pull # sprite = SPRITE_NONE (remove object) ; skip_removing &2d4b 73 push variables[&13] ; sound_enabled &2d4c 81 push #&01 &2d4d 00 push (pull2 AND pull1) &2d4e 22 07 00 if(pull) jump &2d58 ; skip_sound # If (sound_enabled & 1) == 1, &2d51 92 push #&12 &2d52 84 push #&04 &2d53 23 4c push #&4c &2d55 20 push -pull &2d56 81 push #&01 &2d57 29 sound(pull4, pull3, pull2, pull1) # SOUND &12, &04, &b4, &01 (for extra life) ; skip_sound &2d58 27 end ; update_player # Function &3b, updates SPRITE_STUB_PLAYER &2d59 65 push variables[&05] ; extra_life_toggle &2d5a 81 push #&01 &2d5b 81 push #&01 &2d5c 0d push decimal[pull2].digit[pull1] ; score &2d5d 23 50 push #&50 &2d5f 07 push (pull2 < pull1) &2d60 00 push (pull2 AND pull1) &2d61 22 15 00 if(pull) jump &2d79 ; skip_extra_life # If (((score DIV 100) > 50) & extra_life_toggle) == 0, &2d64 8d push #&0d ; OBJECT_TYPE_OTHER &2d65 d1 create(type=pull) # create(OBJECT_TYPE_OTHER) &2d66 23 47 push #&47 ; SPRITE_STUB_EXTRA_LIFE &2d68 d4 objects_sprite[object] = pull # sprite = SPRITE_STUB_EXTRA_LIFE &2d69 85 push #&05 &2d6a c9 objects_data_one[object] = pull ; extra_life_timer # extra_life_timer = 5 &2d6b aa push #&2a ; SPRITE_LIFE &2d6c 85 push #&05 &2d6d 6e push variables[&0e] ; player_lives &2d6e 0b push (pull2 * pull1) &2d6f 82 push #&02 &2d70 31 plot(sprite=pull3, x=pull2, y=pull1) # plot(SPRITE_LIFE, 5 * player_lives, 2) &2d71 66 push variables[&06] ; player_object &2d72 cf object = pull # object = player_object &2d73 6e push variables[&0e] ; player_lives &2d74 81 push #&01 &2d75 09 push (pull2 + pull1) &2d76 ee variables[&0e] = pull ; player_lives # player_lives += 1 &2d77 80 push #&00 &2d78 e5 variables[&05] = pull ; extra_life_toggle ; skip_extra_life &2d79 58 push objects_x[object] &2d7a 4c push left_clip &2d7b 03 push (pull2 >= pull1) # If x < left_clip &2d7c 58 push objects_x[object] &2d7d 4d push right_clip &2d7e 84 push #&04 &2d7f 0a push (pull2 - pull1) &2d80 06 push (pull2 <= pull1) &2d81 01 push (pull2 OR pull1) &2d82 22 06 00 if(pull) jump &2d8b ; check_for_player_input # or x > (right_clip - 4), &2d85 23 41 push #&41 ; kill_player &2d87 2f call(pull) # kill_player() (for crossing edge of screen) &2d88 21 ec 00 jump &2e77 ; leave ; check_for_player_input &2d8b 80 push #&00 &2d8c cb key = pull # key = 0 (read any key, immediately) &2d8d 4b push check(key) &2d8e e9 variables[&09] = pull ; key_pressed # key_pressed = check(key) &2d8f 80 push #&00 &2d90 f5 variables[&15] = pull ; player_velocity_x # player_velocity_x = 0 &2d91 80 push #&00 &2d92 f6 variables[&16] = pull ; player_velocity_y # player_velocity_y = 0 &2d93 69 push variables[&09] ; key_pressed &2d94 81 push #&01 &2d95 20 push -pull &2d96 08 push (pull2 == pull1) &2d97 22 74 00 if(pull) jump &2e0e ; skip_checking_key # If key_pressed != &ff (i.e. a key was pressed), &2d9a 2d command("FX 15,1") # *FX 15,1 (Flush input buffer) &2d9b 46 58 20 31 35 2c 31 0d &2da3 69 push variables[&09] ; key_pressed &2da4 9b push #&1b ; ESCAPE &2da5 05 push (pull2 != pull1) &2da6 22 06 00 if(pull) jump &2daf ; escape_not_pressed # If key_pressed == ESCAPE, &2da9 81 push #&01 &2daa 20 push -pull &2dab c4 game_over = pull # game_over = &ff (player pressed ESCAPE) &2dac 2c 01 01 decimals[1] -= decimals[1] ; score # score = 0 ; escape_not_pressed &2daf 69 push variables[&09] ; key_pressed &2db0 23 5f push #&5f &2db2 00 push (pull2 AND pull1) &2db3 e9 variables[&09] = pull ; key_pressed # key_pressed &= &5f (convert to lowercase) &2db4 69 push variables[&09] ; key_pressed &2db5 23 51 push #&51 ; "Q" &2db7 05 push (pull2 != pull1) &2db8 22 02 00 if(pull) jump &2dbd ; q_not_pressed # If key_pressed == "Q", &2dbb 80 push #&00 &2dbc f3 variables[&13] = pull ; sound_enabled # sound_enabled = 0 (disable sound and tune) ; q_not_pressed &2dbd 69 push variables[&09] ; key_pressed &2dbe 23 53 push #&53 ; "S" &2dc0 05 push (pull2 != pull1) &2dc1 22 02 00 if(pull) jump &2dc6 ; s_not_pressed # If key_pressed == "S", &2dc4 81 push #&01 &2dc5 f3 variables[&13] = pull ; sound_enabled # sound_enabled = 1 (enable sound, but disable tune) ; s_not_pressed &2dc6 69 push variables[&09] ; key_pressed &2dc7 23 54 push #&54 ; "T" &2dc9 05 push (pull2 != pull1) &2dca 22 02 00 if(pull) jump &2dcf ; t_not_pressed # If key_pressed == "T", &2dcd 83 push #&03 &2dce f3 variables[&13] = pull ; sound_enabled # sound_enabled = 3 (enable sound and tune) ; t_not_pressed &2dcf 69 push variables[&09] ; key_pressed &2dd0 9a push #&1a ; ":" & &5f &2dd1 05 push (pull2 != pull1) &2dd2 22 04 00 if(pull) jump &2dd9 ; up_not_pressed # If key_pressed == ":", &2dd5 a6 push #&26 ; SPRITE_BUFFER_MASKED_FROG_JUMPING_UP &2dd6 c9 objects_data_one[object] = pull ; player_sprite # player_sprite = SPRITE_BUFFER_MASKED_FROG_JUMPING_UP &2dd7 82 push #&02 &2dd8 f6 variables[&16] = pull ; player_velocity_y # player_velocity_y = 2 ; up_not_pressed &2dd9 69 push variables[&09] ; key_pressed &2dda 23 5a push #&5a ; "Z" &2ddc 05 push (pull2 != pull1) &2ddd 22 0b 00 if(pull) jump &2deb ; left_not_pressed # If key_pressed == "Z" &2de0 58 push objects_x[object] &2de1 84 push #&04 &2de2 06 push (pull2 <= pull1) &2de3 22 05 00 if(pull) jump &2deb ; left_not_pressed # and x > 4 (i.e. player not at left of screen), &2de6 a7 push #&27 ; SPRITE_BUFFER_MASKED_FROG_JUMPING_LEFT &2de7 c9 objects_data_one[object] = pull ; player_sprite # player_sprite = SPRITE_BUFFER_MASKED_FROG_JUMPING_LEFT &2de8 82 push #&02 &2de9 20 push -pull &2dea f5 variables[&15] = pull ; player_velocity_x # player_velocity_x = -2 ; left_not_pressed &2deb 69 push variables[&09] ; key_pressed &2dec 8f push #&0f ; "/" & &5f &2ded 05 push (pull2 != pull1) &2dee 22 0b 00 if(pull) jump &2dfc ; down_not_pressed # If key_pressed == "/" &2df1 59 push objects_y[object] &2df2 87 push #&07 &2df3 06 push (pull2 <= pull1) &2df4 22 05 00 if(pull) jump &2dfc ; down_not_pressed # and y > 7 (i.e. player not at bottom of screen), &2df7 a8 push #&28 ; SPRITE_BUFFER_MASKED_FROG_JUMPING_DOWN &2df8 c9 objects_data_one[object] = pull ; player_sprite # player_sprite = SPRITE_BUFFER_MASKED_FROG_JUMPING_DOWN &2df9 82 push #&02 &2dfa 20 push -pull &2dfb f6 variables[&16] = pull ; player_velocity_y # player_velocity_y = 2 ; down_not_pressed &2dfc 69 push variables[&09] ; key_pressed &2dfd 23 58 push #&58 ; "X" &2dff 05 push (pull2 != pull1) &2e00 22 0b 00 if(pull) jump &2e0e ; right_not_pressed # If key_pressed == "X" &2e03 58 push objects_x[object] &2e04 23 48 push #&48 &2e06 03 push (pull2 >= pull1) &2e07 22 04 00 if(pull) jump &2e0e ; right_not_pressed # and x < 48 (i.e. player not at right of screen), &2e0a a9 push #&29 ; SPRITE_BUFFER_MASKED_FROG_JUMPING_RIGHT &2e0b c9 objects_data_one[object] = pull ; player_sprite # player_sprite = SPRITE_BUFFER_MASKED_FROG_JUMPING_RIGHT &2e0c 82 push #&02 &2e0d f5 variables[&15] = pull ; player_velocity_x # player_velocity_x = 2 ; right_not_pressed ; skip_checking_key &2e0e 75 push variables[&15] ; player_velocity_x &2e0f 76 push variables[&16] ; player_velocity_y &2e10 01 push (pull2 OR pull1) &2e11 22 48 00 if(pull) jump &2e5c ; skip_movement # If player_velocity_x != 0 or player_velocity_y != 0, &2e14 8d push #&0d ; SPRITE_PLAYER_BUFFER &2e15 58 push objects_x[object] &2e16 59 push objects_y[object] &2e17 31 plot(sprite=pull3, x=pull2, y=pull1) # plot(SPRITE_PLAYER_BUFFER, x, y) (unplot player) &2e18 66 push variables[&06] ; player_object &2e19 cf object = pull # object = player_object &2e1a 49 push objects_data_one[object] ; player_sprite &2e1b f4 variables[&14] = pull ; s # s = player_sprite &2e1c bc push #&3c ; SPRITE_STUB_JUMPING_PLAYER &2e1d d4 objects_sprite[object] = pull # sprite = SPRITE_STUB_JUMPING_PLAYER &2e1e 58 push objects_x[object] &2e1f 75 push variables[&15] ; player_velocity_x &2e20 09 push (pull2 + pull1) &2e21 d8 objects_x[object] = pull # player x += player_velocity_x &2e22 59 push objects_y[object] &2e23 76 push variables[&16] ; player_velocity_y &2e24 09 push (pull2 + pull1) &2e25 d9 objects_y[object] = pull # player y += player_velocity_y &2e26 74 push variables[&14] ; s &2e27 58 push objects_x[object] &2e28 59 push objects_y[object] &2e29 31 plot(sprite=pull3, x=pull2, y=pull1) # plot(s, x, y) (plot player in new position) &2e2a 81 push #&01 &2e2b 20 push -pull &2e2c d1 create(type=pull) # create(OBJECT_TYPE_TEMPORARY) &2e2d 43 push collision_result &2e2e f4 variables[&14] = pull ; previous_collision_result # previous_collision_result = collision_result &2e2f ac push #&2c ; SPRITE_CREATE_TRAFFIC_BUFFER &2e30 d4 objects_sprite[object] = pull # sprite = SPRITE_CREATE_TRAFFIC_BUFFER &2e31 81 push #&01 &2e32 20 push -pull &2e33 58 push objects_x[object] &2e34 59 push objects_y[object] &2e35 31 plot(sprite=pull3, x=pull2, y=pull1) # plot(&ff, x, y) (plots temporary object) &2e36 74 push variables[&14] ; previous_collision_result &2e37 c3 collision_result = pull # collision_result = previous_collision_result &2e38 73 push variables[&13] ; sound_enabled &2e39 81 push #&01 &2e3a 00 push (pull2 AND pull1) &2e3b 22 0c 00 if(pull) jump &2e4a ; skip_sound # If (sound_enabled & 1) == 1, &2e3e 91 push #&11 &2e3f 81 push #&01 &2e40 23 46 push #&46 &2e42 82 push #&02 &2e43 29 sound(pull4, pull3, pull2, pull1) # SOUND &11, &01, &46, &02 (for jumping) &2e44 81 push #&01 &2e45 81 push #&01 &2e46 23 64 push #&64 &2e48 81 push #&01 &2e49 29 sound(pull4, pull3, pull2, pull1) # SOUND &01, &01, &64, &01 (for jumping) ; skip_sound &2e4a 76 push variables[&16] ; player_velocity_y &2e4b 80 push #&00 &2e4c 06 push (pull2 <= pull1) &2e4d 22 06 00 if(pull) jump &2e56 ; skip_score_for_moving_up # If player_velocity_y > 0, &2e50 80 push #&00 &2e51 80 push #&00 &2e52 90 push #&10 &2e53 2b 00 01 decimals[1] += (pull3, pull2, pull1) ; score # score += 10 (for moving up) ; skip_score_for_moving_up &2e56 23 43 push #&43 ; check_for_water_support &2e58 2f call(pull) # check_for_water_support() &2e59 21 04 00 jump &2e60 ; check_if_player_hit_by_traffic ; skip_movement &2e5c ad push #&2d ; SPRITE_CHECK_TRAFFIC_BUFFER &2e5d 58 push objects_x[object] &2e5e 59 push objects_y[object] &2e5f 31 plot(sprite=pull3, x=pull2, y=pull1) # plot(SPRITE_CHECK_TRAFFIC_BUFFER, x, y) ; check_if_player_hit_by_traffic &2e60 66 push variables[&06] ; player_object &2e61 cf object = pull # object = player_object &2e62 58 push objects_x[object] &2e63 f8 variables[&18] = pull ; player_x # player_x = x &2e64 59 push objects_y[object] &2e65 f9 variables[&19] = pull ; player_y # player_y = y &2e66 59 push objects_y[object] &2e67 89 push #&09 &2e68 06 push (pull2 <= pull1) # If player_y > &09 &2e69 59 push objects_y[object] &2e6a 9d push #&1d &2e6b 03 push (pull2 >= pull1) &2e6c 00 push (pull2 AND pull1) # and player_y < &1d (i.e. player is in road), &2e6d 43 push collision_result &2e6e 80 push #&00 &2e6f 08 push (pull2 == pull1) &2e70 00 push (pull2 AND pull1) &2e71 22 03 00 if(pull) jump &2e77 ; leave # and collision_result != 0 (i.e. player was hit) &2e74 23 41 push #&41 ; kill_player &2e76 2f call(pull) # kill_player() (for being hit by traffic) ; leave &2e77 27 end ; update_jumping_player # Function &3c, updates SPRITE_STUB_JUMPING_PLAYER &2e78 bb push #&3b ; SPRITE_STUB_PLAYER &2e79 d4 objects_sprite[object] = pull # sprite = SPRITE_STUB_PLAYER &2e7a 49 push objects_data_one[object] ; player_sprite &2e7b 84 push #&04 &2e7c 0a push (pull2 - pull1) &2e7d c9 objects_data_one[object] = pull ; player_sprite # player_sprite -= 4 (converts to not jumping) &2e7e 49 push objects_data_one[object] ; player_sprite &2e7f f4 variables[&14] = pull ; s # s = player_sprite &2e80 8d push #&0d ; SPRITE_PLAYER_BUFFER &2e81 58 push objects_x[object] &2e82 59 push objects_y[object] &2e83 31 plot(sprite=pull3, x=pull2, y=pull1) # plot(SPRITE_PLAYER_BUFFER, x, y) (unplot player) &2e84 66 push variables[&06] ; player_object &2e85 cf object = pull # object = player_object &2e86 74 push variables[&14] ; s &2e87 a2 push #&22 ; SPRITE_BUFFER_MASKED_FROG_UP &2e88 05 push (pull2 != pull1) &2e89 22 08 00 if(pull) jump &2e94 ; not_jumping_up # If s == SPRITE_BUFFER_MASKED_FROG_UP, &2e8c 59 push objects_y[object] &2e8d 83 push #&03 &2e8e 09 push (pull2 + pull1) &2e8f 59 push objects_y[object] &2e90 a0 push #&20 &2e91 06 push (pull2 <= pull1) &2e92 09 push (pull2 + pull1) &2e93 d9 objects_y[object] = pull # y += 3 + (y <= 20 ? 0 : -1) ; not_jumping_up &2e94 74 push variables[&14] ; s &2e95 a3 push #&23 ; SPRITE_BUFFER_MASKED_FROG_LEFT &2e96 05 push (pull2 != pull1) &2e97 22 04 00 if(pull) jump &2e9e ; not_jumping_left # If s == SPRITE_BUFFER_MASKED_FROG_LEFT, &2e9a 58 push objects_x[object] &2e9b 83 push #&03 &2e9c 0a push (pull2 - pull1) &2e9d d8 objects_x[object] = pull # x -= 3 ; not_jumping_left &2e9e 74 push variables[&14] &2e9f a4 push #&24 ; SPRITE_BUFFER_MASKED_FROG_DOWN &2ea0 05 push (pull2 != pull1) &2ea1 22 08 00 if(pull) jump &2eac ; not_jumping_down # If s == SPRITE_BUFFER_MASKED_FROG_DOWN, &2ea4 59 push objects_y[object] &2ea5 83 push #&03 &2ea6 0a push (pull2 - pull1) &2ea7 59 push objects_y[object] &2ea8 a0 push #&20 &2ea9 06 push (pull2 <= pull1) &2eaa 0a push (pull2 - pull1) &2eab d9 objects_y[object] = pull # y += 3 - (y <= 20 ? 0 : -1) ; not_jumping_down &2eac 74 push variables[&14] &2ead a5 push #&25 ; SPRITE_BUFFER_MASKED_FROG_RIGHT &2eae 05 push (pull2 != pull1) &2eaf 22 04 00 if(pull) jump &2eb6 ; not_jumping_right # If s == SPRITE_BUFFER_MASKED_FROG_RIGHT, &2eb2 58 push objects_x[object] &2eb3 83 push #&03 &2eb4 09 push (pull2 + pull1) &2eb5 d8 objects_x[object] = pull # x += 3 ; not_jumping_right &2eb6 74 push variables[&14] ; s &2eb7 58 push objects_x[object] &2eb8 59 push objects_y[object] &2eb9 31 plot(sprite=pull3, x=pull2, y=pull1) # plot(s, x, y) (plot player in new position) &2eba 58 push objects_x[object] &2ebb f8 variables[&18] = pull ; player_x # player_x = x &2ebc 59 push objects_y[object] &2ebd f9 variables[&19] = pull ; player_y # player_x = y &2ebe 66 push variables[&06] ; player_object &2ebf cf object = pull # object = player_object &2ec0 23 43 push #&43 ; check_for_water_support &2ec2 2f call(pull) # check_for_water_support() &2ec3 59 push objects_y[object] &2ec4 89 push #&09 &2ec5 06 push (pull2 <= pull1) # If y > &09 &2ec6 59 push objects_y[object] &2ec7 9d push #&1d &2ec8 03 push (pull2 >= pull1) &2ec9 00 push (pull2 AND pull1) # and y < &1d (i.e. player is in road), &2eca 43 push collision_result &2ecb 80 push #&00 &2ecc 08 push (pull2 == pull1) &2ecd 00 push (pull2 AND pull1) &2ece 22 06 00 if(pull) jump &2ed7 ; not_jumping_into_traffic # and collision_result != 0 (i.e. player was hit) &2ed1 23 41 push #&41 ; kill_player &2ed3 2f call(pull) # kill_player() (for jumping into traffic) &2ed4 21 04 00 jump &2edb ; skip_updating_traffic_buffer ; not_jumping_into_traffic &2ed7 ac push #&2c ; SPRITE_CREATE_TRAFFIC_BUFFER &2ed8 58 push objects_x[object] &2ed9 59 push objects_y[object] &2eda 31 plot(sprite=pull3, x=pull2, y=pull1) # plot(SPRITE_CREATE_TRAFFIC_BUFFER, x, y) ; skip_updating_traffic_buffer &2edb 80 push #&00 &2edc e8 variables[&08] = pull ; player_home # player_home = 0 &2edd 59 push objects_y[object] &2ede b4 push #&34 &2edf 05 push (pull2 != pull1) &2ee0 22 49 00 if(pull) jump &2f2c ; leave # If y = &34 (i.e. player is at top bank), &2ee3 58 push objects_x[object] &2ee4 85 push #&05 &2ee5 09 push (pull2 + pull1) &2ee6 8e push #&0e &2ee7 0c push (pull2 / pull1) &2ee8 e8 variables[&08] = pull ; player_home # player_home = (x + 5) / 14 &2ee9 68 push variables[&08] ; player_home &2eea 2e 05 00 array(pull) &2eed 01 02 04 08 10 &2ef2 f4 variables[&14] = pull ; player_home_bit # player_home_bit = = 1 << (player_home - 1) &2ef3 58 push objects_x[object] &2ef4 8e push #&0e &2ef5 68 push variables[&08] ; player_home &2ef6 0b push (pull2 * pull1) &2ef7 83 push #&03 &2ef8 0a push (pull2 - pull1) &2ef9 06 push (pull2 <= pull1) &2efa 22 02 00 if(pull) jump &2eff ; not_misaligned # If x < (player_home * 14) - 3, &2efd 80 push #&00 &2efe e8 variables[&08] = pull ; player_home # player_home = 0 ; not_misaligned &2eff 68 push variables[&08] ; player_home &2f00 80 push #&00 &2f01 06 push (pull2 <= pull1) # If player_home != 0 &2f02 68 push variables[&08] ; player_home &2f03 63 push variables[&03] ; crocodile_home &2f04 08 push (pull2 == pull1) &2f05 00 push (pull2 AND pull1) # and player_home != crocodile_home &2f06 74 push variables[&14] ; player_home_bit &2f07 6d push variables[&0d] ; occupied_homes &2f08 00 push (pull2 AND pull1) &2f09 80 push #&00 &2f0a 05 push (pull2 != pull1) &2f0b 00 push (pull2 AND pull1) &2f0c 22 1a 00 if(pull) jump &2f29 ; not_free_home # and (player_home_bit & occupied_homes) == 0, &2f0f 6d push variables[&0d] ; occupied_homes &2f10 74 push variables[&14] ; player_home_bit &2f11 01 push (pull2 OR pull1) &2f12 ed variables[&0d] = pull ; occupied_homes # occupied_homes |= player_home_bit &2f13 8d push #&0d ; SPRITE_PLAYER_BUFFER &2f14 58 push objects_x[object] &2f15 59 push objects_y[object] &2f16 31 plot(sprite=pull3, x=pull2, y=pull1) # plot(SPRITE_PLAYER_BUFFER, x, y) (unplot player) &2f17 66 push variables[&06] ; player_object &2f18 cf object = pull # object = player_object &2f19 98 push #&18 ; SPRITE_FROG_HOME &2f1a d4 objects_sprite[object] = pull # sprite = SPRITE_FROG_HOME &2f1b 8e push #&0e &2f1c 68 push variables[&08] ; player_home &2f1d 0b push (pull2 * pull1) &2f1e 85 push #&05 &2f1f 0a push (pull2 - pull1) &2f20 d8 objects_x[object] = pull # x = (player_home * 14) - 5 &2f21 28 02 00 activate( &2f24 04 OBJECT_TYPE_PLAYER, &2f25 ff ) # activate(OBJECT_TYPE_PLAYER) &2f26 21 03 00 jump &2f2c ; leave ; not_free_home &2f29 23 41 push #&41 ; kill_player &2f2b 2f call(pull) # kill_player() (for entering bank or occupied home) ; leave &2f2c 27 end ; update_frog_in_home # Function &18, updates SPRITE_FROG_HOME &2f2d 80 push #&00 &2f2e 82 push #&02 &2f2f 80 push #&00 &2f30 2b 00 01 decimals[1] += (pull3, pull2, pull1) ; score &2f33 2b 03 01 decimals[1] += decimals[3] ; score += time # score += 200 + time (for entering home) &2f36 73 push variables[&13] ; sound_enabled &2f37 81 push #&01 &2f38 00 push (pull2 AND pull1) &2f39 22 05 00 if(pull) jump &2f41 ; skip_sound # If (sound_enabled & 1) == 1, &2f3c 82 push #&02 &2f3d 82 push #&02 &2f3e 80 push #&00 &2f3f 88 push #&08 &2f40 29 sound(pull4, pull3, pull2, pull1) # SOUND &02, &02, &00, &08 (for frog entering home) ; skip_sound &2f41 6d push variables[&0d] ; occupied_homes &2f42 9f push #&1f &2f43 08 push (pull2 == pull1) &2f44 22 08 00 if(pull) jump &2f4f ; all_homes_occupied # If occupied_homes != &1f, &2f47 28 02 00 activate( &2f4a 0a OBJECT_TYPE_NEW_FROG, &2f4b ff ) # activate(OBJECT_TYPE_NEW_FROG) &2f4c 21 0c 00 jump &2f5b ; leave ; all_homes_occupied &2f4f bf push #&3f ; SPRITE_STUB_CLEAR_FROGS &2f50 d4 objects_sprite[object] = pull # sprite = SPRITE_STUB_CLEAR_FROGS &2f51 89 push #&09 &2f52 d8 objects_x[object] = pull # x = 9 &2f53 b2 push #&32 &2f54 c9 objects_data_one[object] = pull ; timer_high # timer_high = 50 &2f55 94 push #&14 &2f56 ca objects_data_two[object] = pull ; timer_low # timer_low = 20 &2f57 80 push #&00 &2f58 f4 variables[&14] = pull ; pitch # pitch = 0 &2f59 81 push #&01 &2f5a e9 variables[&09] = pull ; duration # duration = 1 ; leave &2f5b 27 end ; update_clear_frogs # Function &3f, updates SPRITE_CLEAR_FROG &2f5c 4a push objects_data_two[object] ; timer_low &2f5d 81 push #&01 &2f5e 0a push (pull2 - pull1) &2f5f ca objects_data_two[object] = pull ; timer_low # timer_low -= 1 &2f60 4a push objects_data_two[object] ; timer_low &2f61 80 push #&00 &2f62 05 push (pull2 != pull1) &2f63 22 39 00 if(pull) jump &2f9f ; leave # If timer_low == 0, &2f66 94 push #&14 &2f67 ca objects_data_two[object] = pull ; timer_low # timer_low = 20 &2f68 49 push objects_data_one[object] ; timer_high &2f69 81 push #&01 &2f6a 0a push (pull2 - pull1) &2f6b c9 objects_data_one[object] = pull ; timer_high # timer_high -= 1 &2f6c 49 push objects_data_one[object] ; timer_high &2f6d 80 push #&00 &2f6e 05 push (pull2 != pull1) &2f6f 22 2d 00 if(pull) jump &2f9f ; leave # If timer_high == 0, &2f72 94 push #&14 &2f73 c9 objects_data_one[object] = pull ; timer_high # timer_low = 20 &2f74 80 push #&00 &2f75 82 push #&02 &2f76 80 push #&00 &2f77 2b 00 01 decimals[1] += (pull3, pull2, pull1) ; score # score += 200 (for each frog cleared) &2f7a b0 push #&30 ; SPRITE_UNPLOT_HOME &2f7b 58 push objects_x[object] &2f7c 59 push objects_y[object] &2f7d 31 plot(sprite=pull3, x=pull2, y=pull1) # plot(SPRITE_UNPLOT_HOME, x, y) (unplot frog in home) &2f7e 73 push variables[&13] ; sound_enabled &2f7f 22 0d 00 if(pull) jump &2f8f ; skip_sound # If sound_enabled != 0, &2f82 81 push #&01 &2f83 84 push #&04 &2f84 74 push variables[&14] ; pitch &2f85 69 push variables[&09] ; duration &2f86 29 sound(pull4, pull3, pull2, pull1) # SOUND &01, &04, pitch, duration (for clearing frog) &2f87 74 push variables[&14] ; pitch &2f88 98 push #&18 &2f89 09 push (pull2 + pull1) &2f8a f4 variables[&14] = pull ; pitch # pitch += 24 &2f8b 69 push variables[&09] ; duration &2f8c 81 push #&01 &2f8d 09 push (pull2 + pull1) &2f8e e9 variables[&09] = pull ; duration # duration += 1 ; skip_sound &2f8f 66 push variables[&06] ; player_object &2f90 cf object = pull # object = player_object &2f91 58 push objects_x[object] &2f92 8e push #&0e &2f93 09 push (pull2 + pull1) &2f94 d8 objects_x[object] = pull # x += 14 &2f95 58 push objects_x[object] &2f96 23 41 push #&41 &2f98 06 push (pull2 <= pull1) &2f99 22 03 00 if(pull) jump &2f9f ; leave # If x > &41, &2f9c 81 push #&01 &2f9d 20 push -pull &2f9e c5 level_completed = pull # level_completed = &ff (all frogs cleared) ; leave &2f9f 27 end ; kill_player # Function &41 &2fa0 66 push variables[&06] ; player_object &2fa1 cf object = pull # object = player_object &2fa2 ab push #&2b ; SPRITE_MASKED_SKULL &2fa3 d4 objects_sprite[object] = pull # sprite = SPRITE_MASKED_SKULL &2fa4 b2 push #&32 &2fa5 c9 objects_data_one[object] = pull ; timer_high # timer_high = 50 &2fa6 94 push #&14 &2fa7 ca objects_data_two[object] = pull ; timer_low # timer_low = 20 &2fa8 8d push #&0d ; SPRITE_PLAYER_BUFFER &2fa9 58 push objects_x[object] &2faa 59 push objects_y[object] &2fab 31 plot(sprite=pull3, x=pull2, y=pull1) # plot(SPRITE_PLAYER_BUFFER, x, y) (unplot player) &2fac 28 02 00 activate( &2faf 04 OBJECT_TYPE_PLAYER &2fb0 ff ) # activate(OBJECT_TYPE_PLAYER) &2fb1 73 push variables[&13] ; sound_enabled &2fb2 81 push #&01 &2fb3 00 push (pull2 AND pull1) &2fb4 22 0d 00 if(pull) jump &2fc4 ; skip_sound # If (sound_enabled & 1) == 1, &2fb7 91 push #&11 &2fb8 83 push #&03 &2fb9 23 78 push #&78 &2fbb 81 push #&01 &2fbc 20 push -pull &2fbd 29 sound(pull4, pull3, pull2, pull1) # SOUND &11, &03, &78. &ff (for dying) &2fbe 90 push #&10 &2fbf 8f push #&0f &2fc0 20 push -pull &2fc1 83 push #&03 &2fc2 86 push #&06 &2fc3 29 sound(pull4, pull3, pull2, pull1) # SOUND &10, &f0, &03, &06 (for dying) ; skip_sound ; leave &2fc4 27 end ; update_skull # Function &2b, updates SPRITE_MASKED_SKULL &2fc5 4a push objects_data_two[object] ; timer_low &2fc6 81 push #&01 &2fc7 0a push (pull2 - pull1) &2fc8 ca objects_data_two[object] = pull ; timer_low # timer_low -= 1 &2fc9 4a push objects_data_two[object] ; timer_low &2fca 80 push #&00 &2fcb 05 push (pull2 != pull1) &2fcc 22 2e 00 if(pull) jump &2ffd ; leave # If timer_low == 0, &2fcf 94 push #&14 &2fd0 ca objects_data_two[object] = pull ; timer_low # timer_low = 20 &2fd1 49 push objects_data_one[object] ; timer_high &2fd2 81 push #&01 &2fd3 0a push (pull2 - pull1) &2fd4 c9 objects_data_one[object] = pull ; timer_high # timer_high -= 1 &2fd5 49 push objects_data_one[object] ; timer_high &2fd6 80 push #&00 &2fd7 05 push (pull2 != pull1) &2fd8 22 22 00 if(pull) jump &2ffd ; leave # If timer_high == 0, &2fdb 8d push #&0d ; SPRITE_PLAYER_BUFFER &2fdc d4 objects_sprite[object] = pull # sprite = SPRITE_PLAYER_BUFFER &2fdd 28 02 00 activate( &2fe0 0a OBJECT_TYPE_NEW_FROG &2fe1 ff ) # activate(OBJECT_TYPE_NEW_FROG) &2fe2 8a push #&0a ; OBJECT_TYPE_NEW_FROG &2fe3 d1 create(type=pull) # create(OBJECT_TYPE_NEW_FROG) &2fe4 ae push #&2e ; SPRITE_UNPLOT_LIFE &2fe5 58 push objects_x[object] &2fe6 59 push objects_y[object] &2fe7 31 plot(sprite=pull3, x=pull2, y=pull1) # plot(SPRITE_UNPLOT_LIFE, x, y) (unplot last life) &2fe8 85 push #&05 &2fe9 6e push variables[&0e] ; player_lives &2fea 0b push (pull2 * pull1) &2feb 85 push #&05 &2fec 0a push (pull2 - pull1) &2fed d8 objects_x[object] = pull # x = (player_lives * 5) - 5 &2fee 82 push #&02 &2fef d9 objects_y[object] = pull # y = 2 &2ff0 6e push variables[&0e] ; player_lives &2ff1 81 push #&01 &2ff2 0a push (pull2 - pull1) &2ff3 ee variables[&0e] = pull ; player_lives # player_lives -= 1 &2ff4 6e push variables[&0e] ; player_lives &2ff5 80 push #&00 &2ff6 03 push (pull2 >= pull1) &2ff7 22 03 00 if(pull) jump &2ffd ; leave # If player_lives < 0 &2ffa 81 push #&01 &2ffb 20 push -pull &2ffc c4 game_over = pull # game_over = &ff (player ran out of lives) ; leave &2ffd 27 end ; unused &2ffe 00 00 ; relocate_code ; move_3200_to_33ff &3000 a9 00 LDA #&00 &3002 85 70 STA &70 ; source_address_low &3004 85 72 STA &72 ; target_address_low &3006 a8 TAY &3007 a9 09 LDA #&09 &3009 85 73 STA &73 ; target_address_high &300b a9 32 LDA #&32 &300d 85 71 STA &71 ; source_address_high ; move_3200_to_33ff_loop # Move &3200 - &33ff to &0900 - &0aff &300f b1 70 LDA (&70),Y ; source_address &3011 91 72 STA (&72),Y ; target_address &3013 a9 00 LDA #&00 &3015 91 70 STA (&70),Y ; source_address # Wipe &3200 - &33ff &3017 c8 INY &3018 d0 f5 BNE &300f ; move_3200_to_33ff_loop &301a e6 71 INC &71 ; source_address_high &301c e6 73 INC &73 ; target_address_high &301e a5 71 LDA &71 ; source_address_high &3020 c9 34 CMP #&34 &3022 d0 eb BNE &300f ; move_3200_to_33ff_loop ; move_3400_to_34ff &3024 a9 00 LDA #&00 &3026 85 70 STA &70 ; source_address_low &3028 85 72 STA &72 ; target_address_low &302a a8 TAY &302b a9 0c LDA #&0c &302d 85 73 STA &73 ; target_address_high &302f a9 34 LDA #&34 &3031 85 71 STA &71 ; source_address_high ; move_3400_to_34ff_loop # Move &3400 - &34ff to &0c00 - &0cff &3033 b1 70 LDA (&70),Y ; source_address &3035 91 72 STA (&72),Y ; target_address &3037 a9 00 LDA #&00 &3039 91 70 STA (&70),Y ; source_address # Wipe &3400 - &34ff &303b c8 INY &303c d0 f5 BNE &3033 ; move_3400_to_34ff_loop &303e e6 71 INC &71 ; source_address_high &3040 e6 73 INC &73 ; target_address_high &3042 a5 71 LDA &71 ; source_address_high &3044 c9 35 CMP #&35 &3046 d0 eb BNE &3033 ; move_3400_to_34ff_loop ; write_instructions &3048 a9 82 LDA #&82 ; &3082 = instructions_text &304a 85 70 STA &70 ; text_address_low &304c a9 30 LDA #&30 &304e 85 71 STA &71 ; text_address_high &3050 a0 00 LDY #&00 ; write_instructions_loop &3052 b1 70 LDA (&70),Y ; text_address &3054 20 ee ff JSR &ffee ; OSWRCH &3057 e6 70 INC &70 ; text_address_low &3059 d0 02 BNE &305d ; skip_page &305b e6 71 INC &71 ; text_address_high ; skip_page &305d a5 70 LDA &70 ; text_address_low &305f cd 80 30 CMP &3080 ; instructions_end_address_low &3062 d0 ee BNE &3052 ; write_instructions_loop &3064 a5 71 LDA &71 ; text_address_high &3066 cd 81 30 CMP &3081 ; instructions_end_address_high &3069 d0 e7 BNE &3052 ; write_instructions_loop &306b 4c 00 19 JMP &1900 ; to_start ; unused &306e 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 &307e 00 00 ; instructions_end_address &3080 9d 31 ; &319d = instructions_end ; instructions_text &3082 16 07 ; MODE 7 &3084 17 00 0a 20 00 00 00 00 00 00 ; R10: Cursor start register; disable cursor &308e 0a ; cursor down &308f 81 9d 83 8d ; RED, NEW_BACKGROUND, YELLOW, DOUBLE_HEIGHT &3093 1f 11 01 ; TAB(&11, &01) &3096 48 6f 70 70 65 72 ; "Hopper" &309c 0d 0a &309e 81 9d 83 8d ; RED, NEW_BACKGROUND, YELLOW, DOUBLE_HEIGHT &30a2 1f 11 02 ; TAB(&11, &02) &30a5 48 6f 70 70 65 72 ; "Hopper" &30ab 0d 0a &30ad 1f 0c 04 ; TAB(&0c, &04) &30b0 86 8d ; CYAN, DOUBLE_HEIGHT &30b2 49 6e 73 74 72 75 63 74 69 6f 6e 73 ; "Instructions" &30be 1f 0c 05 ; TAB(&0c, &05) &30c1 86 8d ; CYAN, DOUBLE_HEIGHT &30c3 49 6e 73 74 72 75 63 74 69 6f 6e 73 ; "Instructions" &30cf 1f 09 08 ; TAB(&09, &08) &30d2 4b 65 79 73 3a ; "Keys:" &30d7 1f 0e 0a ; TAB(&0e, &0a) &30da 5a 20 2d 20 6c 65 66 74 ; "Z - left" &30e2 1f 0e 0b ; TAB(&0e, &0b) &30e5 58 20 2d 20 72 69 67 68 74 ; "X - right" &30ee 1f 0e 0c ; TAB(&0e, &0c) &30f1 2f 20 2d 20 62 61 63 6b 77 61 72 64 73 ; "/ - backwards" &30fe 1f 0e 0d ; TAB(&0e, &0d) &3101 3a 20 2d 20 66 6f 72 77 61 72 64 73 ; ": - forwards" &310d 1f 08 0f ; TAB(&08, &0f) &3110 82 ; GREEN &3111 51 20 2d 20 54 75 72 6e 20 6f 66 66 20 61 6c 6c ; "Q - Turn off all sound" &3121 20 73 6f 75 6e 64 &3127 1f 08 10 ; TAB(&08, &10) &312a 82 ; GREEN &312b 53 20 2d 20 53 6f 75 6e 64 20 65 66 66 65 63 74 ; "S - Sound effects only" &313b 73 20 6f 6e 6c 79 &3141 1f 08 11 ; TAB(&08, &11) &3144 82 ; GREEN &3145 54 20 2d 20 42 6f 74 68 20 74 75 6e 65 20 61 6e ; "T - Both tune and sound" &3155 64 20 73 6f 75 6e 64 &315c 1f 08 14 ; TAB(&08, &14) &315f 83 ; YELLOW &3160 28 43 29 20 41 63 6f 72 6e 73 6f 66 74 20 4c 74 ; "(C) Acornsoft Ltd 1983" &3170 64 20 31 39 38 33 &3176 1f 02 17 ; TAB(&02, &17) &3179 88 ; FLASH &317a 86 50 72 65 73 73 20 53 50 41 43 45 20 42 41 52 ; "Press SPACE BAR or (fire) to start" &318a 20 6f 72 20 28 66 69 72 65 29 20 74 6f 20 73 74 &319a 61 72 74 ; instructions_end &319d 0d ; unused &319e 60 60 00 00 66 66 66 3e 06 3c 30 30 7c 30 30 30 &31ae 1c 00 00 00 3c 66 66 66 3c 00 00 00 18 18 00 18 &31be 18 00 3c 66 60 3c 06 66 3c 00 7e 18 18 18 18 18 &31ce 18 00 3c 66 66 7e 66 66 66 00 30 30 7c 30 30 30 &31de 1c 00 00 00 3c 66 66 66 3c 00 00 18 18 7e 18 18 &31ee 00 00 18 38 18 18 18 18 7e 00 00 00 18 18 00 18 &31fe 18 00 # &3200 - &33ff is copied to &0900 - &0aff at &3011 ; rank_offsets ; 0 1 2 3 4 5 6 7 8 &0900 09 20 37 4e 65 7c 93 aa c1 ; high_scores &0909 00 10 00 ; 1000 &090c 41 63 6f 72 6e 73 6f 66 74 0d ff ff 3c fc 48 24 1a e8 41 00 ; "Acornsoft" &0920 00 10 00 ; 1000 &0923 41 63 6f 72 6e 73 6f 66 74 0d 41 50 50 50 fb 30 30 30 00 10 ; "Acornsoft" &0937 00 10 00 ; 1000 &093a 41 63 6f 72 6e 73 6f 66 74 0d b1 20 34 38 1f 06 02 00 10 00 ; "Acornsoft" &094e 00 10 00 ; 1000 &0951 41 63 6f 72 6e 73 6f 66 74 0d 01 00 00 ff 00 04 00 10 00 41 ; "Acornsoft" &0965 00 10 00 ; 1000 &0968 41 63 6f 72 6e 73 6f 66 74 0d 00 00 00 00 00 00 10 00 41 63 ; "Acornsoft" &097c 00 10 00 ; 1000 &097f 41 63 6f 72 6e 73 6f 66 74 0d 00 00 00 00 24 13 00 31 32 33 ; "Acornsoft" &0993 00 10 00 ; 1000 &0996 41 63 6f 72 6e 73 6f 66 74 0d 0d 38 39 54 23 00 0d 63 6f 72 ; "Acornsoft" &09aa 00 10 00 ; 1000 &09ad 41 63 6f 72 6e 73 6f 66 74 0d 79 04 78 40 00 0d 63 6f 72 6e ; "Acornsoft" &09c1 00 10 00 ; 1000 &09c4 41 63 6f 72 6e 73 6f 66 74 0d 0d a0 0f 98 48 8c b5 24 b9 20 ; "Acornsoft" ; initialise_colours &09d8 a0 0f LDY #&0f ; initialise_colours_loop &09da 98 TYA &09db 48 PHA &09dc 8c d8 22 STY &22d8 ; set_colour_string + 2 &09df b9 20 23 LDA &2320,Y ; black_palette &09e2 8d d9 22 STA &22d9 ; set_colour_string + 3 &09e5 a2 d6 LDX #&d6 ; &22d6 = set_colour_string &09e7 a0 22 LDY #&22 &09e9 20 cc 0a JSR &0acc ; write_string &09ec 68 PLA &09ed a8 TAY &09ee 88 DEY &09ef 10 e9 BPL &09da ; initialise_colours_loop &09f1 60 RTS ; check_for_high_score &09f2 20 7a 0c JSR &0c7a ; flush_input_buffer &09f5 ad 08 09 LDA &0908 ; rank_offsets + 8 &09f8 85 72 STA &72 ; player_score_address_low &09fa a9 09 LDA #&09 &09fc 85 73 STA &73 ; player_score_address_high &09fe 85 71 STA &71 ; existing_score_address_high &0a00 a0 00 LDY #&00 &0a02 ad 71 04 LDA &0471 ; decimals + 1 # Copy game score into rank 8 score &0a05 91 72 STA (&72),Y ; player_score_address &0a07 c8 INY &0a08 ad 79 04 LDA &0479 ; decimals + 1 + 8 &0a0b 91 72 STA (&72),Y ; player_score_address &0a0d c8 INY &0a0e ad 81 04 LDA &0481 ; decimals + 1 + 16 &0a11 91 72 STA (&72),Y ; player_score_address &0a13 a2 08 LDX #&08 ; check_for_high_score_rank_loop &0a15 bd ff 08 LDA &08ff,X ; rank_offsets &0a18 85 70 STA &70 ; existing_score_address_low &0a1a a0 02 LDY #&02 ; check_for_high_score_byte_loop &0a1c b1 72 LDA (&72),Y ; player_score_address &0a1e d1 70 CMP (&70),Y ; existing_score_address &0a20 90 16 BCC &0a38 ; found_rank # Stop checking if player score is lower than rank score &0a22 d0 06 BNE &0a2a ; swap_ranks &0a24 88 DEY &0a25 10 f5 BPL &0a1c ; check_for_high_score_byte_loop &0a27 4c 38 0a JMP &0a38 ; found_rank # Stop checking if player score is highest score ; swap_ranks &0a2a bd ff 08 LDA &08ff,X ; rank_offsets - 1 &0a2d 9d 00 09 STA &0900,X ; rank_offsets &0a30 a5 72 LDA &72 ; player_score_address_low &0a32 9d ff 08 STA &08ff,X ; rank_offsets - 1 &0a35 ca DEX &0a36 d0 dd BNE &0a15 ; check_for_high_score_rank_loop ; found_rank &0a38 8e 92 04 STX &0492 ; player_rank &0a3b e0 08 CPX #&08 &0a3d f0 20 BEQ &0a5f ; skip_entering_name &0a3f a2 c9 LDX #&c9 ; &21c9 = congratulations_text &0a41 a0 21 LDY #&21 &0a43 20 cc 0a JSR &0acc ; write_string &0a46 a6 72 LDX &72 ; player_score_address_low &0a48 e8 INX &0a49 e8 INX &0a4a e8 INX &0a4b 8e c0 21 STX &21c0 ; input_block # Set input block to point at name &0a4e a9 00 LDA #&00 ; Input line (INPUT) &0a50 a2 c0 LDX #&c0 &0a52 a0 21 LDY #&21 ; &21c0 = input_block &0a54 20 f1 ff JSR &fff1 ; OSWORD # Returns carry set if ESCAPE pressed &0a57 90 06 BCC &0a5f ; skip_entering_name &0a59 a0 03 LDY #&03 &0a5b a9 0d LDA #&0d ; CR # Use blank name if ESCAPE pressed &0a5d 91 72 STA (&72),Y ; player_score_address ; skip_entering_name &0a5f a2 51 LDX #&51 ; &2251 = happy_hoppers_text &0a61 a0 22 LDY #&22 &0a63 20 cc 0a JSR &0acc ; write_string &0a66 a2 00 LDX #&00 &0a68 a9 05 LDA #&05 &0a6a 8d 93 04 STA &0493 ; y ; write_high_scores_loop &0a6d a9 1f LDA #&1f # TAB(&04, y) &0a6f 20 ee ff JSR &ffee ; OSWRCH &0a72 a9 04 LDA #&04 &0a74 20 ee ff JSR &ffee ; OSWRCH &0a77 ad 93 04 LDA &0493 ; y &0a7a 20 ee ff JSR &ffee ; OSWRCH &0a7d a9 20 LDA #&20 ; " " &0a7f ec 92 04 CPX &0492 ; player_rank &0a82 d0 02 BNE &0a86 ; skip_flash &0a84 a9 88 LDA #&88 ; FLASH ; skip_flash &0a86 20 ee ff JSR &ffee ; OSWRCH &0a89 8a TXA &0a8a 18 CLC &0a8b 69 31 ADC #&31 ; "1" &0a8d 20 ee ff JSR &ffee ; OSWRCH &0a90 a9 2e LDA #&2e "." &0a92 20 ee ff JSR &ffee ; OSWRCH &0a95 bd 00 09 LDA &0900,X ; rank_offsets &0a98 85 70 STA &70 ; scores_address_low &0a9a a0 02 LDY #&02 ; copy_high_score_loop &0a9c b1 70 LDA (&70),Y ; scores_address &0a9e 99 8f 04 STA &048f,Y ; number &0aa1 88 DEY &0aa2 10 f8 BPL &0a9c ; copy_high_score_loop &0aa4 a0 06 LDY #&06 &0aa6 20 41 1e JSR &1e41 ; write_number &0aa9 8a TXA &0aaa 48 PHA &0aab a2 d0 LDX #&d0 ; &22d0 = dots_text &0aad a0 22 LDY #&22 &0aaf 20 cc 0a JSR &0acc ; write_string &0ab2 68 PLA &0ab3 aa TAX &0ab4 a0 03 LDY #&03 ; write_name_loop &0ab6 b1 70 LDA (&70),Y &0ab8 20 ee ff JSR &ffee ; OSWRCH &0abb c8 INY &0abc c9 0d CMP #&0d ; CR &0abe d0 f6 BNE &0ab6 ; write_name_loop &0ac0 ee 93 04 INC &0493 ; y &0ac3 ee 93 04 INC &0493 ; y &0ac6 e8 INX &0ac7 e0 08 CPX #&08 &0ac9 d0 a2 BNE &0a6d ; write_high_scores_loop &0acb 60 RTS ; write_string &0acc 86 7a STX &7a ; string_address_low &0ace 84 7b STY &7b ; string_address_high &0ad0 a0 00 LDY #&00 &0ad2 b1 7a LDA (&7a),Y ; string_address # First byte of string is length &0ad4 85 74 STA &74 ; length &0ad6 c8 INY ; write_string_loop &0ad7 b1 7a LDA (&7a),Y ; string_address &0ad9 20 ee ff JSR &ffee ; OSWRCH &0adc c8 INY &0add c4 74 CPY &74 ; length &0adf d0 f6 BNE &0ad7 ; write_string_loop &0ae1 60 RTS ; unused &0ae2 30 30 30 18 0c 00 30 30 7c 30 30 30 1c 00 00 00 &0af2 3c 66 66 66 3c 00 30 18 0c 0c 0c 18 30 00 # &3400 - &34ff is copied to &0c00 - &0cff at &3035 ; wait_for_key_or_fire &0c00 20 7a 0c JSR &0c7a ; flush_input_buffer &0c03 a9 00 LDA #&00 # Set to zero to check for any key, return immediately &0c05 8d 2b 04 STA &042b ; vm_key ; wait_for_key_or_fire_loop &0c08 a9 00 LDA #&00 # Unnecessary code &0c0a 20 11 1c JSR &1c11 ; check_for_keypress_or_get_key # Returns key pressed, or &ff if no key was pressed &0c0d a0 00 LDY #&00 &0c0f c9 1b CMP #&1b ; ESCAPE &0c11 f0 f5 BEQ &0c08 ; wait_for_key_or_fire_loop &0c13 c9 ff CMP #&ff &0c15 d0 10 BNE &0c27 ; set_joystick_enabled_and_check_for_fire # Branch if key pressed, set joystick_enabled to zero &0c17 a2 00 LDX #&00 # Zero to read joystick buttons &0c19 20 75 0c JSR &0c75 ; read_io &0c1c 8a TXA &0c1d a0 01 LDY #&01 # Use first joystick if first joystick button pressed &0c1f 4a LSR A &0c20 b0 05 BCS &0c27 ; set_joystick_enabled_and_check_for_fire &0c22 a0 03 LDY #&03 # Use second joystick if second joystick button pressed &0c24 4a LSR A &0c25 90 e1 BCC &0c08 ; wait_for_key_or_fire_loop # Branch if no joystick button pressed ; set_joystick_enabled_and_check_for_fire &0c27 8c 96 04 STY &0496 ; joystick_enabled &0c2a d0 01 BNE &0c2d ; execute_opcode_4b # Store initial joystick position if button pressed ; leave &0c2c 60 RTS ; execute_opcode_4b # Opcode &4b to check for keypress or get key &0c2d ad 2b 04 LDA &042b ; vm_key &0c30 20 11 1c JSR &1c11 ; check_for_keypress_or_get_key &0c33 c9 ff CMP #&ff # &ff if read key timed out, or specific key was pressed &0c35 d0 f5 BNE &0c2c ; leave &0c37 ae 96 04 LDX &0496 ; joystick_enabled # Zero if not using joystick, otherwise joystick channel &0c3a f0 f0 BEQ &0c2c ; leave # Leave if not using joystick &0c3c 20 6d 0c JSR &0c6d ; check_joystick &0c3f cc 97 04 CPY &0497 ; joystick_x &0c42 8c 97 04 STY &0497 ; joystick_x &0c45 f0 0a BEQ &0c51 ; not_moving_horizontally &0c47 c8 INY &0c48 c8 INY &0c49 c0 03 CPY #&03 &0c4b b0 04 BCS &0c51 ; not_moving_horizontally &0c4d b9 c5 21 LDA &21c5,Y ; joystick_keys # Leave with corresponding key for horizontal direction &0c50 60 RTS ; not_moving_horizontally &0c51 ae 96 04 LDX &0496 ; joystick_enabled &0c54 e8 INX &0c55 20 6d 0c JSR &0c6d ; check_joystick &0c58 cc 98 04 CPY &0498 ; joystick_y &0c5b 8c 98 04 STY &0498 ; joystick_y &0c5e f0 0a BEQ &0c6a ; leave_with_minus_one &0c60 c8 INY &0c61 c8 INY &0c62 c0 03 CPY #&03 &0c64 b0 04 BCS &0c6a ; leave_with_minus_one &0c66 b9 c6 21 LDA &21c6,Y ; joystick_keys + 1 # Leave with corresponding key for vertical direction &0c69 60 RTS ; leave_with_minus_one &0c6a a9 ff LDA #&ff # Leave with &ff to indicate no movement &0c6c 60 RTS ; check_joystick # Called with X = channel to read &0c6d 20 75 0c JSR &0c75 ; read_io &0c70 98 TYA &0c71 29 fe AND #&fe &0c73 a8 TAY &0c74 60 RTS ; read_io # Called with X = channel to read &0c75 a9 80 LDA #&80 ; Read I/O device &0c77 4c 83 1e JMP &1e83 ; osbyte_with_Y_zero ; flush_input_buffer &0c7a a9 0f LDA #&0f ; Flush buffers &0c7c a2 01 LDX #&01 ; Flush inbut buffer &0c7e 4c 83 1e JMP &1e83 ; osbyte_with_Y_zero ; unused &0c81 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 &0c91 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 &0ca1 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 &0cb1 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 &0cc1 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 &0cd1 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 &0ce1 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 &0cf1 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ; entry_point &3500 a9 81 LDA #&81 ; Check machine type &3502 a2 00 LDX #&00 &3504 a0 ff LDY #&ff &3506 20 f4 ff JSR &fff4 ; OSBYTE &3509 e0 00 CPX #&00 ; BBC A/B with OS 0.10 &350b f0 09 BEQ &3516 ; skip_break_and_escape &350d a9 c8 LDA #&c8 ; Read/Write BREAK/ESCAPE effect &350f a2 02 LDX #&02 ; Memory cleared on next reset, Escape disabled &3511 a0 00 LDY #&00 &3513 20 f4 ff JSR &fff4 ; OSBYTE ; skip_break_and_escape &3516 4c 00 30 JMP &3000 ; relocate_code ; unused &3519 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 &3529 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 &3539 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 &3549 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 &3559 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 &3569 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 &3579 00 00 00 00 00 00 00 30 18 0c 06 0c 18 30 00 7c &3589 66 66 7c 6c 66 66 00 66 66 66 66 66 66 3c 00 66 &3599 66 76 7e 6e 66 66 00 00 00 00 00 00 00 00 00 00 &35a9 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 &35b9 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 &35c9 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 &35d9 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 &35e9 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 &35f9 00 00 00 00 00 00 00