A Documenting of the Submarine CHIP-8 Game This is documentation for the submarine game provided in the sixth edition of VIPER magazine. Firstly, follows is a view of the program when it is first loaded into the tool: 200-201 0512-0513 ÛÜß ÜÜßÜ A2CD 41677 I  0717 202-203 0514-0515 ßÛÜÛ ß 6938 26936 V9  056 204-205 0516-0517 ßßÜÛÜÛ 6A1E 27166 VA  030 206-207 0518-0519 ÛßÜßß Üß D9A2 55714 Draw 08x02 at V9,VA; VF  XOR 208-209 0520-0521 ÛÜßÜ ß A2D0 41680 I  0720 20A-20B 0522-0523 ßß ß ßß 6B00 27392 VB  000 20C-20D 0524-0525 ßßÜÛßÜ 6C1A 27674 VC  026 20E-20F 0526-0527 ÛÛ ßß Ûß DBC2 56258 Draw 08x02 at VB,VC; VF  XOR 210-211 0528-0529 ÛÜßÜ Üß A2D4 41684 I  0724 212-213 0530-0531 ßÛÜÜÛ 643C 25660 V4  060 214-215 0532-0533 ßß ÛÛ 6606 26118 V6  006 216-217 0534-0535 ßÛÜß ßÜÜ D463 54371 Draw 08x03 at V4,V6; VF  XOR 218-219 0536-0537 ßß ßßß 6700 26368 V7  000 21A-21B 0538-0539 ßßÜÛ Ü 6819 26649 V8  025 21C-21D 0540-0541 Ü Û Û 22A2 08866 Call 0674 21E-21F 0542-0543 Ü Û ÜÜß 22AC 08876 Call 0684 220-221 0544-0545 ß ß 4800 18432 Skip next if V8 <> 000 222-223 0546-0547 ÜÜ ÛÜ ß 12D8 04824 Jump to 0728 224-225 0548-0549 ßß Üß Û 6509 25865 V5  009 226-227 0550-0551 ÛÜßÜ ÜÛÜ A2D7 41687 I  0727 228-229 0552-0553 ßß ßß 6300 25344 V3  000 22A-22B 0554-0555 ßß ßÛ Û 6D05 27909 VD  005 22C-22D 0556-0557 ÛßÛ ßß Û EDA1 60833 Skip next if VD <> key 22E-22F 0558-0559 ßß ßÛ 6301 25345 V3  001 230-231 0560-0561 ßÜ ßßß 8E40 36416 VE  V4 232-233 0562-0563 ÛßÛ ßß Û EDA1 60833 Skip next if VD <> key 234-235 0564-0565 ßÛ ÛßßßÜ DE51 56913 Draw 08x01 at VE,V5; VF  XOR 236-237 0566-0567 ÜÛÜÜß 123C 04668 Jump to 0572 238-239 0568-0569 ÛßÛ ßß Û EDA1 60833 Skip next if VD <> key 23A-23B 0570-0571 ÜÜßÜÜ ß 22D8 08920 Call 0728 23C-23D 0572-0573 ÛÜßÜ Üß A2D4 41684 I  0724 23E-23F 0574-0575 ßÛÜß ßÜÜ D463 54371 Draw 08x03 at V4,V6; VF  XOR 240-241 0576-0577 Ü ß Û 1242 04674 Jump to 0578 242-243 0578-0579 ÜÛÛÛÜÛÜÜ 74FF 29951 V4  V4 + 255 244-245 0580-0581 ßÛÜß ßÜÜ D463 54371 Draw 08x03 at V4,V6; VF  XOR 246-247 0582-0583 ÛÜßÜ ß A2D0 41680 I  0720 248-249 0584-0585 ÛÛ ßß Ûß DBC2 56258 Draw 08x02 at VB,VC; VF  XOR 24A-24B 0586-0587 ßß ßÛ ß CD04 52484 VD  ??? AND 004 24C-24D 0588-0589 ÛÜ ÜßÜßß 8BD4 35796 VB  VB + VD; VF  overflow 24E-24F 0590-0591 ÛÛ ßß Ûß DBC2 56258 Draw 08x02 at VB,VC; VF  XOR 250-251 0592-0593 ßßßßßß 3F00 16128 Skip next if VF = 000 252-253 0594-0595 Ü Û Û 1292 04754 Jump to 0658 254-255 0596-0597 ÛÜß ÜÜßÜ A2CD 41677 I  0717 256-257 0598-0599 ÛßÜßß Üß D9A2 55714 Draw 08x02 at V9,VA; VF  XOR 258-259 0600-0601 ßß ßÛÜÛ CD07 52487 VD  ??? AND 007 25A-25B 0602-0603 ß ßß ß 4D00 19712 Skip next if VD <> 000 25C-25D 0604-0605 ßßßß ÜÛ 7903 30979 V9  V9 + 003 25E-25F 0606-0607 ÜÛÛÛÛÜ Û 79FD 31229 V9  V9 + 253 260-261 0608-0609 ÛßÜßß Üß D9A2 55714 Draw 08x02 at V9,VA; VF  XOR 262-263 0610-0611 ßßßßßß 3F00 16128 Skip next if VF = 000 264-265 0612-0613 Ü ßÜÜß 128C 04748 Jump to 0652 266-267 0614-0615 ß ßß 4300 17152 Skip next if V3 <> 000 268-269 0616-0617 ÜßÜ Û 122A 04650 Jump to 0554 26A-26B 0618-0619 ÛÜßÜ ÜÛÜ A2D7 41687 I  0727 26C-26D 0620-0621 ßÛ ÛßßßÜ DE51 56913 Draw 08x01 at VE,V5; VF  XOR 26E-26F 0622-0623 ß ÜÜÛÜÛ 451F 17695 Skip next if V5 <> 031 270-271 0624-0625 Ü ß ÜÛ 1286 04742 Jump to 0646 272-273 0626-0627 ßßß ßÜß 7502 29954 V5  V5 + 002 274-275 0628-0629 ßßßÛÜ ßß F318 62232 sound  V3 276-277 0630-0631 ßÛ ÛßßßÜ DE51 56913 Draw 08x01 at VE,V5; VF  XOR 278-279 0632-0633 ßßßßßÛ 3F01 16129 Skip next if VF = 001 27A-27B 0634-0635 ÜÛÜÜß 123C 04668 Jump to 0572 27C-27D 0636-0637 ßßÜÛÛÜÛ 6D1F 27935 VD  031 27E-27F 0638-0639 ßÜ ÜßßÜß 8D52 36178 VD  VD AND V5 280-281 0640-0641 ß ÜÛÛÜÛ 4D1F 19743 Skip next if VD <> 031 282-283 0642-0643 Ü ßÜÜß 128C 04748 Jump to 0652 284-285 0644-0645 Ü Û Û 1292 04754 Jump to 0658 286-287 0646-0647 Ü Û ÜÜß 22AC 08876 Call 0684 288-289 0648-0649 ÜÛÛÛÛÜÜÜ 78FF 30975 V8  V8 + 255 28A-28B 0650-0651 ÛÜÜÛ 121E 04638 Jump to 0542 28C-28D 0652-0653 Ü Û Û 22A2 08866 Call 0674 28E-28F 0654-0655 ßßß ÛßÛ 7705 30469 V7  V7 + 005 290-291 0656-0657 Ü Û ÜÛ 1296 04758 Jump to 0662 292-293 0658-0659 Ü Û Û 22A2 08866 Call 0674 294-295 0660-0661 ßßßÜßÛß 770A 30474 V7  V7 + 010 296-297 0662-0663 Ü Û Û 22A2 08866 Call 0674 298-299 0664-0665 ßß ßßÜÛ 6D03 27907 VD  003 29A-29B 0666-0667 ßßßÛÛß ß FD18 64792 sound  VD 29C-29D 0668-0669 ÛÜßÜ ÜÛÜ A2D7 41687 I  0727 29E-29F 0670-0671 ßÛ ÛßßßÜ DE51 56913 Draw 08x01 at VE,V5; VF  XOR 2A0-2A1 0672-0673 Ü ß ÜÛ 1286 04742 Jump to 0646 2A2-2A3 0674-0675 ÛÜÛÜÜ ß A2F8 41720 I  0760 2A4-2A5 0676-0677 ßßÛÛ ßÛÛ F733 63283 V7 as BCD stored from I 2A6-2A7 0678-0679 ßß ßß 6300 25344 V3  000 2A8-2A9 0680-0681 Ü ÛÜ ÜÛ 22B6 08886 Call 0694 2AA-2AB 0682-0683 ÜÜÜ ÜÜÜ 00EE 00238 Return 2AC-2AD 0684-0685 ÛÜÛÜÜ ß A2F8 41720 I  0760 2AE-2AF 0686-0687 ßßÛÛß ÜÜ F833 63539 V8 as BCD stored from I 2B0-2B1 0688-0689 ßÛÜ Ûß 6332 25394 V3  050 2B2-2B3 0690-0691 Ü ÛÜ ÜÛ 22B6 08886 Call 0694 2B4-2B5 0692-0693 ÜÜÜ ÜÜÜ 00EE 00238 Return 2B6-2B7 0694-0695 ßß ßß ß 6D00 27904 VD  000 2B8-2B9 0696-0697 ßÛÛß ÜßÜ F265 62053 Load V0V2; I  I + 03 2BA-2BB 0698-0699 ßßÛßÜ Ü F029 61481 I  digit sprite of V0 2BC-2BD 0700-0701 ÛÛ Û ÜßÛ D3D5 54229 Draw 08x05 at V3,VD; VF  XOR 2BE-2BF 0702-0703 ßßß ÜßÛ 7305 29445 V3  V3 + 005 2C0-2C1 0704-0705 ßßÛßÜ Û F129 61737 I  digit sprite of V1 2C2-2C3 0706-0707 ÛÛ Û ÜßÛ D3D5 54229 Draw 08x05 at V3,VD; VF  XOR 2C4-2C5 0708-0709 ßßß ÜßÛ 7305 29445 V3  V3 + 005 2C6-2C7 0710-0711 ßßÛßÜ ßÜ F229 61993 I  digit sprite of V2 2C8-2C9 0712-0713 ÛÛ Û ÜßÛ D3D5 54229 Draw 08x05 at V3,VD; VF  XOR 2CA-2CB 0714-0715 ÜÜÜ ÜÜÜ 00EE 00238 Return 2CC-2CD 0716-0717 Ü ß 0108 00264 Jump to COSMAC VIP 0264 2CE-2CF 0718-0719 ÛÛÛÛÛßß 7F7C 32636 VF  VF + 124 2D0-2D1 0720-0721 ÜÜÛÜÜ 083E 02110 Jump to COSMAC VIP 2110 2D2-2D3 0722-0723 ßß Ü 6008 24584 V0  008 2D4-2D5 0724-0725 ÜÛÛÜ 183C 06204 Jump to 2108 2D6-2D7 0726-0727 ßßßßÛßßß FF08 65288 2D8-2D9 0728-0729 ß ß ßß A300 41728 I  0768 2DA-2DB 0730-0731 ßßÜ ßÛ 6311 25361 V3  017 2DC-2DD 0732-0733 ßß ÛßÜÛ 6D0B 27915 VD  011 2DE-2DF 0734-0735 ÛÛ Û ÜßÛ D3D5 54229 Draw 08x05 at V3,VD; VF  XOR 2E0-2E1 0736-0737 ß ß ÜßÛ A305 41733 I  0773 2E2-2E3 0738-0739 ßßÜÜ ßÛ 6319 25369 V3  025 2E4-2E5 0740-0741 ÛÛ Û ÜßÛ D3D5 54229 Draw 08x05 at V3,VD; VF  XOR 2E6-2E7 0742-0743 ß ß Ü Ûß A30A 41738 I  0778 2E8-2E9 0744-0745 ßÛ ÛÛ 6323 25379 V3  035 2EA-2EB 0746-0747 ÛÛ Û ÜßÛ D3D5 54229 Draw 08x05 at V3,VD; VF  XOR 2EC-2ED 0748-0749 ß ß ÜÜÛÛ A30F 41743 I  0783 2EE-2EF 0750-0751 ßÛ Ü ÛÛ 632B 25387 V3  043 2F0-2F1 0752-0753 ÛÛ Û ÜßÛ D3D5 54229 Draw 08x05 at V3,VD; VF  XOR 2F2-2F3 0754-0755 ßß ßß 6300 25344 V3  000 2F4-2F5 0756-0757 ÜÜÜÛ Üß 12F4 04852 Jump to 0756 2F6-2F7 0758-0759 ßß ÛßÜÛ 6D0B 27915 VD  011 2F8-2F9 0760-0761 Ü 0001 00001 Jump to COSMAC VIP 0001 2FA-2FB 0762-0763 ß 0400 01024 Jump to COSMAC VIP 1024 2FC-2FD 0764-0765 ÜÜÜ ÜÜÜ 00EE 00238 Return 2FE-2FF 0766-0767 Ü 0001 00001 Jump to COSMAC VIP 0001 300-301 0768-0769 Ûßß ÛßÛ EE8A 61066 302-303 0770-0771 Û Ü Û Û 8AAA 35498 304-305 0772-0773 ÛÛÛ ÛÛÛÜ EEEF 61167 306-307 0774-0775 Û Û Û Û A5A5 42405 I  1445 308-309 0776-0777 ÛÜÛ ÜÛÜÛ A5EF 42479 I  1519 30A-30B 0778-0779 ßÛßÛ Û 7A2A 31274 VA  VA + 042 30C-30D 0780-0781 ÛßÛ ßÛ 3B29 15145 Skip next if VB = 041 30E-30F 0782-0783 ÜßÛÛÛ Üß 79BA 31162 V9  V9 + 186 310-311 0784-0785 Û ÛÜ Û A2B2 41650 I  0690 312-313 0786-0787 ÛÜÜ Ü 203A 08250 Call 0058 314-315 0788-0789 ÛÛÜßÜ 343A 13370 Skip next if V4 = 058 316-317 0790-0791 ÜÜßÛßÛÜ 3CD6 15574 Skip next if VC = 214 318-319 0792-0793 ß ÛÜÛ 541C 21532 31A-31B 0794-0795 Ü ßß 0C40 03136 Jump to COSMAC VIP 3136 31C-31D 0796-0797 ß ÜßßÛßÜ 9E25 40485 31E-31F 0798-0799 ßß ÛÜ 680C 26636 V8  012 Follows now is the fully annotated view of the program when it is loaded into the tool: 200-201 0512-0513 ÛÜß ÜÜßÜ A2CD 41677 I  big enemy 202-203 0514-0515 ßÛÜÛ ß 6938 26936 V9  056 204-205 0516-0517 ßßÜÛÜÛ 6A1E 27166 VA  030 206-207 0518-0519 ÛßÜßß Üß D9A2 55714 Draw 08x02 at V9,VA; VF  XOR 208-209 0520-0521 ÛÜßÜ ß A2D0 41680 I  small enemy 20A-20B 0522-0523 ßß ß ßß 6B00 27392 VB  000 20C-20D 0524-0525 ßßÜÛßÜ 6C1A 27674 VC  026 20E-20F 0526-0527 ÛÛ ßß Ûß DBC2 56258 Draw 08x02 at VB,VC; VF  XOR 210-211 0528-0529 ÛÜßÜ Üß A2D4 41684 I  you 212-213 0530-0531 ßÛÜÜÛ 643C 25660 V4  060 214-215 0532-0533 ßß ÛÛ 6606 26118 V6  006 216-217 0534-0535 ßÛÜß ßÜÜ D463 54371 Draw 08x03 at V4,V6; VF  XOR 218-219 0536-0537 ßß ßßß 6700 26368 V7  000 21A-21B 0538-0539 ßßÜÛ Ü 6819 26649 V8  025 21C-21D 0540-0541 Ü Û Û 22A2 08866 Call show score 21E-21F 0542-0543 Ü Û ÜÜß 22AC 08876 start Call show count 220-221 0544-0545 ß ß 4800 18432 Skip next if V8 <> 000 222-223 0546-0547 ÜÜ ÛÜ ß 12D8 04824 Jump to end 224-225 0548-0549 ßß Üß Û 6509 25865 V5  009 226-227 0550-0551 ÛÜßÜ ÜÛÜ A2D7 41687 I  bomb 228-229 0552-0553 ßß ßß 6300 25344 V3  000 22A-22B 0554-0555 ßß ßÛ Û 6D05 27909 control VD  005 22C-22D 0556-0557 ÛßÛ ßß Û EDA1 60833 Skip next if VD <> key 22E-22F 0558-0559 ßß ßÛ 6301 25345 V3  001 230-231 0560-0561 ßÜ ßßß 8E40 36416 VE  V4 232-233 0562-0563 ÛßÛ ßß Û EDA1 60833 Skip next if VD <> key 234-235 0564-0565 ßÛ ÛßßßÜ DE51 56913 Draw 08x01 at VE,V5; VF  XOR 236-237 0566-0567 ÜÛÜÜß 123C 04668 Jump to prime 238-239 0568-0569 ÛßÛ ßß Û EDA1 60833 skipped Skip next if VD <> key 23A-23B 0570-0571 ÜÜßÜÜ ß 22D8 08920 also skipped Call end 23C-23D 0572-0573 ÛÜßÜ Üß A2D4 41684 prime I  you 23E-23F 0574-0575 ßÛÜß ßÜÜ D463 54371 Draw 08x03 at V4,V6; VF  XOR 240-241 0576-0577 Ü ß Û 1242 04674 Jump to next 242-243 0578-0579 ÜÛÛÛÜÛÜÜ 74FF 29951 next V4  V4 + 255 244-245 0580-0581 ßÛÜß ßÜÜ D463 54371 Draw 08x03 at V4,V6; VF  XOR 246-247 0582-0583 ÛÜßÜ ß A2D0 41680 I  small enemy 248-249 0584-0585 ÛÛ ßß Ûß DBC2 56258 Draw 08x02 at VB,VC; VF  XOR 24A-24B 0586-0587 ßß ßÛ ß CD04 52484 VD  ??? AND 004 24C-24D 0588-0589 ÛÜ ÜßÜßß 8BD4 35796 VB  VB + VD; VF  overflow 24E-24F 0590-0591 ÛÛ ßß Ûß DBC2 56258 Draw 08x02 at VB,VC; VF  XOR 250-251 0592-0593 ßßßßßß 3F00 16128 Skip next if VF = 000 252-253 0594-0595 Ü Û Û 1292 04754 Jump to small hit 254-255 0596-0597 ÛÜß ÜÜßÜ A2CD 41677 I  big enemy 256-257 0598-0599 ÛßÜßß Üß D9A2 55714 Draw 08x02 at V9,VA; VF  XOR 258-259 0600-0601 ßß ßÛÜÛ CD07 52487 VD  ??? AND 007 25A-25B 0602-0603 ß ßß ß 4D00 19712 Skip next if VD <> 000 25C-25D 0604-0605 ßßßß ÜÛ 7903 30979 V9  V9 + 003 25E-25F 0606-0607 ÜÛÛÛÛÜ Û 79FD 31229 V9  V9 + 253 260-261 0608-0609 ÛßÜßß Üß D9A2 55714 Draw 08x02 at V9,VA; VF  XOR 262-263 0610-0611 ßßßßßß 3F00 16128 Skip next if VF = 000 264-265 0612-0613 Ü ßÜÜß 128C 04748 Jump to big hit 266-267 0614-0615 ß ßß 4300 17152 Skip next if V3 <> 000 268-269 0616-0617 ÜßÜ Û 122A 04650 Jump to control 26A-26B 0618-0619 ÛÜßÜ ÜÛÜ A2D7 41687 I  bomb 26C-26D 0620-0621 ßÛ ÛßßßÜ DE51 56913 Draw 08x01 at VE,V5; VF  XOR 26E-26F 0622-0623 ß ÜÜÛÜÛ 451F 17695 Skip next if V5 <> 031 270-271 0624-0625 Ü ß ÜÛ 1286 04742 Jump to decrease 272-273 0626-0627 ßßß ßÜß 7502 29954 V5  V5 + 002 274-275 0628-0629 ßßßÛÜ ßß F318 62232 sound  V3 276-277 0630-0631 ßÛ ÛßßßÜ DE51 56913 Draw 08x01 at VE,V5; VF  XOR 278-279 0632-0633 ßßßßßÛ 3F01 16129 Skip next if VF = 001 27A-27B 0634-0635 ÜÛÜÜß 123C 04668 Jump to prime 27C-27D 0636-0637 ßßÜÛÛÜÛ 6D1F 27935 VD  031 27E-27F 0638-0639 ßÜ ÜßßÜß 8D52 36178 VD  VD AND V5 280-281 0640-0641 ß ÜÛÛÜÛ 4D1F 19743 Skip next if VD <> 031 282-283 0642-0643 Ü ßÜÜß 128C 04748 Jump to big hit 284-285 0644-0645 Ü Û Û 1292 04754 Jump to small hit 286-287 0646-0647 Ü Û ÜÜß 22AC 08876 decrease Call show count 288-289 0648-0649 ÜÛÛÛÛÜÜÜ 78FF 30975 V8  V8 + 255 28A-28B 0650-0651 ÛÜÜÛ 121E 04638 Jump to start 28C-28D 0652-0653 Ü Û Û 22A2 08866 big hit Call show score 28E-28F 0654-0655 ßßß ÛßÛ 7705 30469 V7  V7 + 005 290-291 0656-0657 Ü Û ÜÛ 1296 04758 Jump to shared 292-293 0658-0659 Ü Û Û 22A2 08866 small hit Call show score 294-295 0660-0661 ßßßÜßÛß 770A 30474 V7  V7 + 010 296-297 0662-0663 Ü Û Û 22A2 08866 shared Call show score 298-299 0664-0665 ßß ßßÜÛ 6D03 27907 VD  003 29A-29B 0666-0667 ßßßÛÛß ß FD18 64792 sound  VD 29C-29D 0668-0669 ÛÜßÜ ÜÛÜ A2D7 41687 I  bomb 29E-29F 0670-0671 ßÛ ÛßßßÜ DE51 56913 Draw 08x01 at VE,V5; VF  XOR 2A0-2A1 0672-0673 Ü ß ÜÛ 1286 04742 Jump to decrease 2A2-2A3 0674-0675 ÛÜÛÜÜ ß A2F8 41720 show score I  scratch 2A4-2A5 0676-0677 ßßÛÛ ßÛÛ F733 63283 V7 as BCD stored from I 2A6-2A7 0678-0679 ßß ßß 6300 25344 V3  000 2A8-2A9 0680-0681 Ü ÛÜ ÜÛ 22B6 08886 Call show 2AA-2AB 0682-0683 ÜÜÜ ÜÜÜ 00EE 00238 Return 2AC-2AD 0684-0685 ÛÜÛÜÜ ß A2F8 41720 show count I  scratch 2AE-2AF 0686-0687 ßßÛÛß ÜÜ F833 63539 V8 as BCD stored from I 2B0-2B1 0688-0689 ßÛÜ Ûß 6332 25394 V3  050 2B2-2B3 0690-0691 Ü ÛÜ ÜÛ 22B6 08886 Call show 2B4-2B5 0692-0693 ÜÜÜ ÜÜÜ 00EE 00238 Return 2B6-2B7 0694-0695 ßß ßß ß 6D00 27904 show VD  000 2B8-2B9 0696-0697 ßÛÛß ÜßÜ F265 62053 Load V0V2; I  I + 03 2BA-2BB 0698-0699 ßßÛßÜ Ü F029 61481 I  digit sprite of V0 2BC-2BD 0700-0701 ÛÛ Û ÜßÛ D3D5 54229 Draw 08x05 at V3,VD; VF  XOR 2BE-2BF 0702-0703 ßßß ÜßÛ 7305 29445 V3  V3 + 005 2C0-2C1 0704-0705 ßßÛßÜ Û F129 61737 I  digit sprite of V1 2C2-2C3 0706-0707 ÛÛ Û ÜßÛ D3D5 54229 Draw 08x05 at V3,VD; VF  XOR 2C4-2C5 0708-0709 ßßß ÜßÛ 7305 29445 V3  V3 + 005 2C6-2C7 0710-0711 ßßÛßÜ ßÜ F229 61993 I  digit sprite of V2 2C8-2C9 0712-0713 ÛÛ Û ÜßÛ D3D5 54229 Draw 08x05 at V3,VD; VF  XOR 2CA-2CB 0714-0715 ÜÜÜ ÜÜÜ 00EE 00238 Return 2CC 0716 Û 01 001 2CD 0717 Û 08 008 big enemy 2CE 0718 ÛÛÛÛÛÛÛ 7F 127 2CF 0719 ÛÛÛÛÛ 7C 124 2D0 0720 Û 08 008 small enemy 2D1 0721 ÛÛÛÛÛ 3E 062 2D2 0722 ÛÛ 60 096 2D3 0723 Û 08 008 2D4 0724 ÛÛ 18 024 you 2D5 0725 ÛÛÛÛ 3C 060 2D6 0726 ÛÛÛÛÛÛÛÛ FF 255 2D7 0727 Û 08 008 bomb 2D8-2D9 0728-0729 ß ß ßß A300 41728 end I  go 2DA-2DB 0730-0731 ßßÜ ßÛ 6311 25361 V3  017 2DC-2DD 0732-0733 ßß ÛßÜÛ 6D0B 27915 VD  011 2DE-2DF 0734-0735 ÛÛ Û ÜßÛ D3D5 54229 Draw 08x05 at V3,VD; VF  XOR 2E0-2E1 0736-0737 ß ß ÜßÛ A305 41733 I  od 2E2-2E3 0738-0739 ßßÜÜ ßÛ 6319 25369 V3  025 2E4-2E5 0740-0741 ÛÛ Û ÜßÛ D3D5 54229 Draw 08x05 at V3,VD; VF  XOR 2E6-2E7 0742-0743 ß ß Ü Ûß A30A 41738 I  by 2E8-2E9 0744-0745 ßÛ ÛÛ 6323 25379 V3  035 2EA-2EB 0746-0747 ÛÛ Û ÜßÛ D3D5 54229 Draw 08x05 at V3,VD; VF  XOR 2EC-2ED 0748-0749 ß ß ÜÜÛÛ A30F 41743 I  e! 2EE-2EF 0750-0751 ßÛ Ü ÛÛ 632B 25387 V3  043 2F0-2F1 0752-0753 ÛÛ Û ÜßÛ D3D5 54229 Draw 08x05 at V3,VD; VF  XOR 2F2-2F3 0754-0755 ßß ßß 6300 25344 V3  000 2F4-2F5 0756-0757 ÜÜÜÛ Üß 12F4 04852 self Jump to self 2F6 0758 ÛÛ ÛÛ Û 6D 109 2F7 0759 Û ÛÛ 0B 011 2F8 0760 00 000 scratch 2F9 0761 Û 01 001 2FA 0762 Û 04 004 2FB 0763 00 000 2FC 0764 00 000 2FD 0765 ÛÛÛ ÛÛÛ EE 238 2FE 0766 00 000 2FF 0767 Û 01 001 300 0768 ÛÛÛ ÛÛÛ EE 238 go 301 0769 Û Û Û 8A 138 302 0770 Û Û Û 8A 138 303 0771 Û Û Û Û AA 170 304 0772 ÛÛÛ ÛÛÛ EE 238 305 0773 ÛÛÛ ÛÛÛÛ EF 239 od 306 0774 Û Û Û Û A5 165 307 0775 Û Û Û Û A5 165 308 0776 Û Û Û Û A5 165 309 0777 ÛÛÛ ÛÛÛÛ EF 239 30A 0778 ÛÛÛÛ Û 7A 122 by 30B 0779 Û Û Û 2A 042 30C 0780 ÛÛÛ ÛÛ 3B 059 30D 0781 Û Û Û 29 041 30E 0782 ÛÛÛÛ Û 79 121 30F 0783 Û ÛÛÛ Û BA 186 e! 310 0784 Û Û Û A2 162 311 0785 Û ÛÛ Û B2 178 312 0786 Û 20 032 313 0787 ÛÛÛ Û 3A 058 314 0788 ÛÛ Û 34 052 315 0789 ÛÛÛ Û 3A 058 316 0790 ÛÛÛÛ 3C 060 317 0791 ÛÛ Û ÛÛ D6 214 318 0792 Û Û Û 54 084 319 0793 ÛÛÛ 1C 028 31A 0794 ÛÛ 0C 012 31B 0795 Û 40 064 31C 0796 Û ÛÛÛÛ 9E 158 31D 0797 Û Û Û 25 037 31E 0798 ÛÛ Û 68 104 31F 0799 ÛÛ 0C 012 The register usage is as follows: V0 Load from I and then BCD display. V1 Load from I and then BCD display. V2 Load from I and then BCD display. V3 Flag to indicate key press; horizontal positioning of BCD and ending sprites. Manipulate the sound register. V4 Horizontal positioning of you sprite. V5 Vertical positioning of bomb sprite. V6 Vertical positioning of you sprite. V7 Store the score. V8 Store the bomb count. V9 Horizontal positioning of big enemy sprite. VA Vertical positioning of big enemy sprite. VB Horizontal positioning of small enemy sprite. VC Vertical positioning of big enemy sprite. VD Store a key and the enemy movement delta. VE Horizontal positioning of bomb sprite. VF Collision detection. The game begins by drawing the big enemy sprite in the lower right corner of the screen: 200-201 0512-0513 ÛÜß ÜÜßÜ A2CD 41677 I  big enemy 202-203 0514-0515 ßÛÜÛ ß 6938 26936 V9  056 204-205 0516-0517 ßßÜÛÜÛ 6A1E 27166 VA  030 206-207 0518-0519 ÛßÜßß Üß D9A2 55714 Draw 08x02 at V9,VA; VF  XOR Then the small enemy sprite is drawn in the lower left corner. Note that these sprites are drawn at different heights; this is to simplify collision detection: 208-209 0520-0521 ÛÜßÜ ß A2D0 41680 I  small enemy 20A-20B 0522-0523 ßß ß ßß 6B00 27392 VB  000 20C-20D 0524-0525 ßßÜÛßÜ 6C1A 27674 VC  026 20E-20F 0526-0527 ÛÛ ßß Ûß DBC2 56258 Draw 08x02 at VB,VC; VF  XOR Following that, the you sprite, representing the player's submarine, is drawn at the top right corner of the screen, clipped by the right edge: 210-211 0528-0529 ÛÜßÜ Üß A2D4 41684 I  you 212-213 0530-0531 ßÛÜÜÛ 643C 25660 V4  060 214-215 0532-0533 ßß ÛÛ 6606 26118 V6  006 216-217 0534-0535 ßÛÜß ßÜÜ D463 54371 Draw 08x03 at V4,V6; VF  XOR The score and bomb counts are then initialized and the score is displayed: 218-219 0536-0537 ßß ßßß 6700 26368 V7  000 21A-21B 0538-0539 ßßÜÛ Ü 6819 26649 V8  025 21C-21D 0540-0541 Ü Û Û 22A2 08866 Call show score Now is the starting loop of the game, which starts by showing the bomb count and ends the game if this is zero by calling the end routine: 21E-21F 0542-0543 Ü Û ÜÜß 22AC 08876 start Call show count 220-221 0544-0545 ß ß 4800 18432 Skip next if V8 <> 000 222-223 0546-0547 ÜÜ ÛÜ ß 12D8 04824 Jump to end Registers are initialized for displaying the bomb sprite below the submarine and storing the input flag: 224-225 0548-0549 ßß Üß Û 6509 25865 V5  009 226-227 0550-0551 ÛÜßÜ ÜÛÜ A2D7 41687 I  bomb 228-229 0552-0553 ßß ßß 6300 25344 V3  000 Then the input is tested for, setting a flag and displaying the bomb if so. It's noteworthy that this depends on both tests triggering for a single key press; a better way would have used only one test and collected the conditional code into a single segment: 22A-22B 0554-0555 ßß ßÛ Û 6D05 27909 control VD  005 22C-22D 0556-0557 ÛßÛ ßß Û EDA1 60833 Skip next if VD <> key 22E-22F 0558-0559 ßß ßÛ 6301 25345 V3  001 230-231 0560-0561 ßÜ ßßß 8E40 36416 VE  V4 232-233 0562-0563 ÛßÛ ßß Û EDA1 60833 Skip next if VD <> key 234-235 0564-0565 ßÛ ÛßßßÜ DE51 56913 Draw 08x01 at VE,V5; VF  XOR 236-237 0566-0567 ÜÛÜÜß 123C 04668 Jump to prime These instructions are superfluous: 238-239 0568-0569 ÛßÛ ßß Û EDA1 60833 skipped Skip next if VD <> key 23A-23B 0570-0571 ÜÜßÜÜ ß 22D8 08920 also skipped Call end Now is the prime loop of the game, moving the player's submarine along first, with a superfluous jump instruction: 23C-23D 0572-0573 ÛÜßÜ Üß A2D4 41684 prime I  you 23E-23F 0574-0575 ßÛÜß ßÜÜ D463 54371 Draw 08x03 at V4,V6; VF  XOR 240-241 0576-0577 Ü ß Û 1242 04674 Jump to next 242-243 0578-0579 ÜÛÛÛÜÛÜÜ 74FF 29951 next V4  V4 + 255 244-245 0580-0581 ßÛÜß ßÜÜ D463 54371 Draw 08x03 at V4,V6; VF  XOR Next the small enemy is moved a small and random amount to the right: 246-247 0582-0583 ÛÜßÜ ß A2D0 41680 I  small enemy 248-249 0584-0585 ÛÛ ßß Ûß DBC2 56258 Draw 08x02 at VB,VC; VF  XOR 24A-24B 0586-0587 ßß ßÛ ß CD04 52484 VD  ??? AND 004 24C-24D 0588-0589 ÛÜ ÜßÜßß 8BD4 35796 VB  VB + VD; VF  overflow 24E-24F 0590-0591 ÛÛ ßß Ûß DBC2 56258 Draw 08x02 at VB,VC; VF  XOR If the bomb has now struck the small enemy, the small hit routine is entered to adjust the score and whatnot. Note this is a simple check because of the differing verticals used for the enemies: 250-251 0592-0593 ßßßßßß 3F00 16128 Skip next if VF = 000 252-253 0594-0595 Ü Û Û 1292 04754 Jump to small hit Next the big enemy is moved a small and random amount, with a 1/8 chance of moving to the right and a 7/8 chance of moving to the left a larger amount: 254-255 0596-0597 ÛÜß ÜÜßÜ A2CD 41677 I  big enemy 256-257 0598-0599 ÛßÜßß Üß D9A2 55714 Draw 08x02 at V9,VA; VF  XOR 258-259 0600-0601 ßß ßÛÜÛ CD07 52487 VD  ??? AND 007 25A-25B 0602-0603 ß ßß ß 4D00 19712 Skip next if VD <> 000 25C-25D 0604-0605 ßßßß ÜÛ 7903 30979 V9  V9 + 003 25E-25F 0606-0607 ÜÛÛÛÛÜ Û 79FD 31229 V9  V9 + 253 260-261 0608-0609 ÛßÜßß Üß D9A2 55714 Draw 08x02 at V9,VA; VF  XOR The collision detection is the same as for the small enemy, but transferring to a different hit routine: 262-263 0610-0611 ßßßßßß 3F00 16128 Skip next if VF = 000 264-265 0612-0613 Ü ßÜÜß 128C 04748 Jump to big hit If a bomb has not yet been dropped, then the player may still give a command to do so: 266-267 0614-0615 ß ßß 4300 17152 Skip next if V3 <> 000 268-269 0616-0617 ÜßÜ Û 122A 04650 Jump to control If a bomb is active, then its position is now adjusted at a constant rate and with sound lasting 1/60 of a second. When a bomb reaches the bottom of the screen, that means it's failed to hit any enemies and the count is then decreased: 26A-26B 0618-0619 ÛÜßÜ ÜÛÜ A2D7 41687 I  bomb 26C-26D 0620-0621 ßÛ ÛßßßÜ DE51 56913 Draw 08x01 at VE,V5; VF  XOR 26E-26F 0622-0623 ß ÜÜÛÜÛ 451F 17695 Skip next if V5 <> 031 270-271 0624-0625 Ü ß ÜÛ 1286 04742 Jump to decrease 272-273 0626-0627 ßßß ßÜß 7502 29954 V5  V5 + 002 274-275 0628-0629 ßßßÛÜ ßß F318 62232 sound  V3 276-277 0630-0631 ßÛ ÛßßßÜ DE51 56913 Draw 08x01 at VE,V5; VF  XOR If the bomb collides with an enemy now, then the prime routine is not entered. It's noteworthy that a test if not zero would be better here: 278-279 0632-0633 ßßßßßÛ 3F01 16129 Skip next if VF = 001 27A-27B 0634-0635 ÜÛÜÜß 123C 04668 Jump to prime A collision has occured, and the vertical position is used to determine which enemy was struck: 27C-27D 0636-0637 ßßÜÛÛÜÛ 6D1F 27935 VD  031 27E-27F 0638-0639 ßÜ ÜßßÜß 8D52 36178 VD  VD AND V5 280-281 0640-0641 ß ÜÛÛÜÛ 4D1F 19743 Skip next if VD <> 031 282-283 0642-0643 Ü ßÜÜß 128C 04748 Jump to big hit 284-285 0644-0645 Ü Û Û 1292 04754 Jump to small hit The decrease routine erases the bomb count and decrements it before jumping to the starting loop: 286-287 0646-0647 Ü Û ÜÜß 22AC 08876 decrease Call show count 288-289 0648-0649 ÜÛÛÛÛÜÜÜ 78FF 30975 V8  V8 + 255 28A-28B 0650-0651 ÛÜÜÛ 121E 04638 Jump to start The big hit routine erases the score and increases it by five, before jumping to the shared routine: 28C-28D 0652-0653 Ü Û Û 22A2 08866 big hit Call show score 28E-28F 0654-0655 ßßß ÛßÛ 7705 30469 V7  V7 + 005 290-291 0656-0657 Ü Û ÜÛ 1296 04758 Jump to shared The small hit routine erases the score and increases it by ten, falling into the shared routine. The shared routine shows the updated score, plays a sound lasting 1/20 of a second, erases the bomb, and then jumps to the decrease routine: 292-293 0658-0659 Ü Û Û 22A2 08866 small hit Call show score 294-295 0660-0661 ßßßÜßÛß 770A 30474 V7  V7 + 010 296-297 0662-0663 Ü Û Û 22A2 08866 shared Call show score 298-299 0664-0665 ßß ßßÜÛ 6D03 27907 VD  003 29A-29B 0666-0667 ßßßÛÛß ß FD18 64792 sound  VD 29C-29D 0668-0669 ÛÜßÜ ÜÛÜ A2D7 41687 I  bomb 29E-29F 0670-0671 ßÛ ÛßßßÜ DE51 56913 Draw 08x01 at VE,V5; VF  XOR 2A0-2A1 0672-0673 Ü ß ÜÛ 1286 04742 Jump to decrease The show score routine writes the score to the scratch location, adjusts register three, and calls the show routine before returning: 2A2-2A3 0674-0675 ÛÜÛÜÜ ß A2F8 41720 show score I  scratch 2A4-2A5 0676-0677 ßßÛÛ ßÛÛ F733 63283 V7 as BCD stored from I 2A6-2A7 0678-0679 ßß ßß 6300 25344 V3  000 2A8-2A9 0680-0681 Ü ÛÜ ÜÛ 22B6 08886 Call show 2AA-2AB 0682-0683 ÜÜÜ ÜÜÜ 00EE 00238 Return The show count routine writes the count to the scratch location, adjusts register three, and calls the show routine before returning: 2AC-2AD 0684-0685 ÛÜÛÜÜ ß A2F8 41720 show count I  scratch 2AE-2AF 0686-0687 ßßÛÛß ÜÜ F833 63539 V8 as BCD stored from I 2B0-2B1 0688-0689 ßÛÜ Ûß 6332 25394 V3  050 2B2-2B3 0690-0691 Ü ÛÜ ÜÛ 22B6 08886 Call show 2B4-2B5 0692-0693 ÜÜÜ ÜÜÜ 00EE 00238 Return The show routine draws a basic three digit number at a constant vertical with a variable horizontal position before returning: 2B6-2B7 0694-0695 ßß ßß ß 6D00 27904 show VD  000 2B8-2B9 0696-0697 ßÛÛß ÜßÜ F265 62053 Load V0V2; I  I + 03 2BA-2BB 0698-0699 ßßÛßÜ Ü F029 61481 I  digit sprite of V0 2BC-2BD 0700-0701 ÛÛ Û ÜßÛ D3D5 54229 Draw 08x05 at V3,VD; VF  XOR 2BE-2BF 0702-0703 ßßß ÜßÛ 7305 29445 V3  V3 + 005 2C0-2C1 0704-0705 ßßÛßÜ Û F129 61737 I  digit sprite of V1 2C2-2C3 0706-0707 ÛÛ Û ÜßÛ D3D5 54229 Draw 08x05 at V3,VD; VF  XOR 2C4-2C5 0708-0709 ßßß ÜßÛ 7305 29445 V3  V3 + 005 2C6-2C7 0710-0711 ßßÛßÜ ßÜ F229 61993 I  digit sprite of V2 2C8-2C9 0712-0713 ÛÛ Û ÜßÛ D3D5 54229 Draw 08x05 at V3,VD; VF  XOR 2CA-2CB 0714-0715 ÜÜÜ ÜÜÜ 00EE 00238 Return Following that are the sprites used by the game and some waste: 2CC 0716 Û 01 001 2CD 0717 Û 08 008 big enemy 2CE 0718 ÛÛÛÛÛÛÛ 7F 127 2CF 0719 ÛÛÛÛÛ 7C 124 2D0 0720 Û 08 008 small enemy 2D1 0721 ÛÛÛÛÛ 3E 062 2D2 0722 ÛÛ 60 096 2D3 0723 Û 08 008 2D4 0724 ÛÛ 18 024 you 2D5 0725 ÛÛÛÛ 3C 060 2D6 0726 ÛÛÛÛÛÛÛÛ FF 255 2D7 0727 Û 08 008 bomb The end routine displays the go, od, by, and e! sprites before entering an infinite loop to end the game: 2D8-2D9 0728-0729 ß ß ßß A300 41728 end I  go 2DA-2DB 0730-0731 ßßÜ ßÛ 6311 25361 V3  017 2DC-2DD 0732-0733 ßß ÛßÜÛ 6D0B 27915 VD  011 2DE-2DF 0734-0735 ÛÛ Û ÜßÛ D3D5 54229 Draw 08x05 at V3,VD; VF  XOR 2E0-2E1 0736-0737 ß ß ÜßÛ A305 41733 I  od 2E2-2E3 0738-0739 ßßÜÜ ßÛ 6319 25369 V3  025 2E4-2E5 0740-0741 ÛÛ Û ÜßÛ D3D5 54229 Draw 08x05 at V3,VD; VF  XOR 2E6-2E7 0742-0743 ß ß Ü Ûß A30A 41738 I  by 2E8-2E9 0744-0745 ßÛ ÛÛ 6323 25379 V3  035 2EA-2EB 0746-0747 ÛÛ Û ÜßÛ D3D5 54229 Draw 08x05 at V3,VD; VF  XOR 2EC-2ED 0748-0749 ß ß ÜÜÛÛ A30F 41743 I  e! 2EE-2EF 0750-0751 ßÛ Ü ÛÛ 632B 25387 V3  043 2F0-2F1 0752-0753 ÛÛ Û ÜßÛ D3D5 54229 Draw 08x05 at V3,VD; VF  XOR 2F2-2F3 0754-0755 ßß ßß 6300 25344 V3  000 2F4-2F5 0756-0757 ÜÜÜÛ Üß 12F4 04852 self Jump to self Following that is the scratch location and waste: 2F6 0758 ÛÛ ÛÛ Û 6D 109 2F7 0759 Û ÛÛ 0B 011 2F8 0760 00 000 scratch 2F9 0761 Û 01 001 2FA 0762 Û 04 004 2FB 0763 00 000 2FC 0764 00 000 2FD 0765 ÛÛÛ ÛÛÛ EE 238 2FE 0766 00 000 2FF 0767 Û 01 001 Following yet that are the sprites used for displaying the ending message: 300 0768 ÛÛÛ ÛÛÛ EE 238 go 301 0769 Û Û Û 8A 138 302 0770 Û Û Û 8A 138 303 0771 Û Û Û Û AA 170 304 0772 ÛÛÛ ÛÛÛ EE 238 305 0773 ÛÛÛ ÛÛÛÛ EF 239 od 306 0774 Û Û Û Û A5 165 307 0775 Û Û Û Û A5 165 308 0776 Û Û Û Û A5 165 309 0777 ÛÛÛ ÛÛÛÛ EF 239 30A 0778 ÛÛÛÛ Û 7A 122 by 30B 0779 Û Û Û 2A 042 30C 0780 ÛÛÛ ÛÛ 3B 059 30D 0781 Û Û Û 29 041 30E 0782 ÛÛÛÛ Û 79 121 30F 0783 Û ÛÛÛ Û BA 186 e! 310 0784 Û Û Û A2 162 311 0785 Û ÛÛ Û B2 178 312 0786 Û 20 032 313 0787 ÛÛÛ Û 3A 058 The game ends with more waste: 314 0788 ÛÛ Û 34 052 315 0789 ÛÛÛ Û 3A 058 316 0790 ÛÛÛÛ 3C 060 317 0791 ÛÛ Û ÛÛ D6 214 318 0792 Û Û Û 54 084 319 0793 ÛÛÛ 1C 028 31A 0794 ÛÛ 0C 012 31B 0795 Û 40 064 31C 0796 Û ÛÛÛÛ 9E 158 31D 0797 Û Û Û 25 037 31E 0798 ÛÛ Û 68 104 31F 0799 ÛÛ 0C 012 .