A Documenting of mine Advanced Asphyxiation CHIP-8 Game This is documentation for the Advanced Asphyxiation CHIP-8 game, a rewriting and improvement of what I wrote earlier. This is more faithful to the original game, truly being a game, but lacks enemies. Follows is the program as displayed in mine MMC, how I see it as I wrote it: 200-201 0512-0513 ÜÜÜÜÜÜÜÜ 00FF 00255 Enable extended mode 202-203 0514-0515 ßÜßÜ ÛÛÛ A7F0 42992 I  2032 204-205 0516-0517 ÛßßÛÛßÛß FF65 65381 Load V0VF; I  I + 16 206-207 0518-0519 ÛÛ ÜÛßÛ 670A 26378 V7  010 208-209 0520-0521 ÜßßÜßÜÜß 69FF 27135 V9  255 20A-20B 0522-0523 Û ÛÜÜ Û A218 41496 I  player 20C-20D 0524-0525 ßÛÜßÛ ÛÜ DAB1 55985 Draw 08x01 at VA,VB; VF  XOR 20E-20F 0526-0527 ÛÛ ÛÛÛÜ CE01 52737 maze VE  ??? AND 001 210-211 0528-0529 ÛÛ ÛÛ Û 6D00 27904 VD  000 212-213 0530-0531 ÛÜÛ ÜÜßÛ A34E 41806 maze step I  backstage 214-215 0532-0533 ÛÛÛßßßÜÛ FD1E 64798 I  I + VD 216-217 0534-0535 ÛßßÛ ÜÛß F365 62309 Load V0V3; I  I + 04 218-219 0536-0537 Û ÜÜÜ 800E 32782 player V0  V0 x 2; VF  MSB 21A-21B 0538-0539 ßÜÜÜÜßÜ 84FE 34046 V4  VF x 2; VF  MSB 21C-21D 0540-0541 Û ÜÜÜÜÛ 811E 33054 V1  V1 x 2; VF  MSB 21E-21F 0542-0543 ßÜÜÜ Û Ü 84F1 34033 V4  V4 OR VF 220-221 0544-0545 ßÜÜ ÜßÜÛ 85EE 34286 V5  VE x 2; VF  MSB 222-223 0546-0547 Û Ü ÜÜß 822E 33326 V2  V2 x 2; VF  MSB 224-225 0548-0549 ßÜÜÜÛÛÛ 8EF0 36592 VE  VF 226-227 0550-0551 ßÜÜÜ Û ß 85F1 34289 V5  V5 OR VF 228-229 0552-0553 ÛÜ ÜÜßÜÛ 855E 34142 V5  V5 x 2; VF  MSB 22A-22B 0554-0555 Û ÜÜÜÜßÛ 833E 33598 V3  V3 x 2; VF  MSB 22C-22D 0556-0557 ßÜÜÜ Û ß 85F1 34289 V5  V5 OR VF 22E-22F 0558-0559 Û ßÜÜÜßÛ A33E 41790 I  random 230-231 0560-0561 ÛÛÛßÜßÜ F41E 62494 I  I + V4 232-233 0562-0563 ÛßßÛ Ü Ü F065 61541 Load V0V0; I  I + 01 234-235 0564-0565 ß ßÛ 2322 08994 Call shift 236-237 0566-0567 ßÜÜÜ Û 82F0 33520 V2  VF 238-239 0568-0569 ÛÜÛ ßÛ A342 41794 I  drunk 23A-23B 0570-0571 ÛÛÛßÜßÜ F41E 62494 I  I + V4 23C-23D 0572-0573 ÛßßÛ Ü Ü F065 61541 Load V0V0; I  I + 01 23E-23F 0574-0575 ß ßÛ 2322 08994 Call shift 240-241 0576-0577 ÛÛ Û 3200 12800 Skip next if V2 = 000 242-243 0578-0579 ÛÛ ÛÛÛß CF01 52993 VF  ??? AND 001 244-245 0580-0581 ÛÛ 6000 24576 V0  000 246-247 0582-0583 ÛÛÛÛÛÛ 3F00 16128 Skip next if VF = 000 248-249 0584-0585 ÜßßÜ 60F0 24816 V0  240 24A-24B 0586-0587 ÛÜÛÜ ÛÛ A350 41808 I  stage 24C-24D 0588-0589 ÛÛÛßßßÜÛ FD1E 64798 I  I + VD 24E-24F 0590-0591 ÛßÛß Ü Ü F055 61525 Save V0V0; I  I + 01 250-251 0592-0593 ÛÛÛÛÛ ß 7D01 32001 VD  VD + 001 252-253 0594-0595 ÛßÛÛ Û 3D10 15632 Skip next if VD = 016 254-255 0596-0597 ÜÜÛ ÜÛ 1264 04708 Jump to draw curtains 256-257 0598-0599 ÛÜßÜ ÛÛ A370 41840 I  wardrobe 258-259 0600-0601 ÛßÛßÛßÛß FF55 65365 Save V0VF; I  I + 16 25A-25B 0602-0603 ÛÜÛÜ ÛÛ A350 41808 I  stage 25C-25D 0604-0605 ÛßßÛÛßÛß FF65 65381 Load V0VF; I  I + 16 25E-25F 0606-0607 ÛßÛßÛßÛß FF55 65365 Save V0VF; I  I + 16 260-261 0608-0609 ÛÜßÜ ÛÛ A370 41840 I  wardrobe 262-263 0610-0611 ÛßßÛÛßÛß FF65 65381 Load V0VF; I  I + 16 264-265 0612-0613 ÛÛÛÛÛ Ü 7C01 31745 draw curtains VC  VC + 001 266-267 0614-0615 Û Ûß 4C04 19460 Skip next if VC <> 004 268-269 0616-0617 ÛÛ ÛÛ 6C00 27648 VC  000 26A-26B 0618-0619 ÛÛÛÛ 3C00 15360 Skip next if VC = 000 26C-26D 0620-0621 Ü ÛÜÜß 128E 04750 Jump to move 26E-26F 0622-0623 ÛÜß ÛÛ A360 41824 I  fourth wall 270-271 0624-0625 ÜÜ Ü 00C1 00193 Scroll  by 01 272-273 0626-0627 ÛÛ Û 6100 24832 V1  000 274-275 0628-0629 ßßÜÜÜÛ 627C 25212 V2  124 276-277 0630-0631 ÛÛÛÛ Ûß 7B01 31489 VB  VB + 001 278-279 0632-0633 ÜÜßßßÜÜß 39FF 14847 Skip next if V9 = 255 27A-27B 0634-0635 ÛÛÛÛ ß 7901 30977 V9  V9 + 001 27C-27D 0636-0637 ß Û Û 4940 18752 Skip next if V9 <> 064 27E-27F 0638-0639 ÜßßÜßÜÜß 69FF 27135 V9  255 280-281 0640-0641 ßß Û ß D1C1 53697 show time Draw 08x01 at V1,VC; VF  XOR 282-283 0642-0643 ßß Û ÛÜ D2C1 53953 Draw 08x01 at V2,VC; VF  XOR 284-285 0644-0645 ÛßßÛ Ü Ü F065 61541 Load V0V0; I  I + 01 286-287 0646-0647 ÛÛÛ Ü Û 7104 28932 V1  V1 + 004 288-289 0648-0649 ÜßßßÜÜÛ 72FC 29436 V2  V2 + 252 28A-28B 0650-0651 ÜÛÛ Û 3140 12608 Skip next if V1 = 064 28C-28D 0652-0653 Ü Û Û 1280 04736 Jump to show time 28E-28F 0654-0655 ÜÜßßßÜÜß 39FF 14847 move Skip next if V9 = 255 290-291 0656-0657 Ü ÜÛ Üß 12A6 04774 Jump to continue 292-293 0658-0659 ÛÛÛÛ 3C00 15360 Skip next if VC = 000 294-295 0660-0661 Ü ÜÛ Üß 12A6 04774 Jump to continue 296-297 0662-0663 Û ÛÜÜ Û A218 41496 I  player 298-299 0664-0665 ÛßÜÜßÜÜÜ C87F 51327 V8  ??? AND 127 29A-29B 0666-0667 ÛÛ Û ß 6901 26881 V9  001 29C-29D 0668-0669 ßÛ ßÛ Ü D891 55441 Draw 08x01 at V8,V9; VF  XOR 29E-29F 0670-0671 Û ÛÛÛÛ 4F00 20224 Skip next if VF <> 000 2A0-2A1 0672-0673 Ü ÜÛ Üß 12A6 04774 Jump to continue 2A2-2A3 0674-0675 ßÛ ßÛ Ü D891 55441 Draw 08x01 at V8,V9; VF  XOR 2A4-2A5 0676-0677 ÜßßÜßÜÜß 69FF 27135 V9  255 2A6-2A7 0678-0679 ÛÜÛ ÜßÛ A346 41798 continue I  from 2A8-2A9 0680-0681 ÛßßÛ ßÛÜ F665 63077 Load V0V6; I  I + 07 2AA-2AB 0682-0683 ß Û ÛÛ 4B40 19264 Skip next if VB <> 064 2AC-2AD 0684-0685 Û Û 1200 04608 Jump to 0512 2AE-2AF 0686-0687 ßÛÛÜÜÜÜ E09E 57502 down Skip next if V0 = key 2B0-2B1 0688-0689 Ü ÜßÜ Û 12B8 04792 Jump to left 2B2-2B3 0690-0691 ÛÜÜßÜßß 4B3F 19263 Skip next if VB <> 063 2B4-2B5 0692-0693 Ü ÜßÜ Û 12B8 04792 Jump to left 2B6-2B7 0694-0695 ÛÛ ÛÛÜ 6601 26113 V6  001 2B8-2B9 0696-0697 ßÛÛÜÜÜÜÛ E19E 57758 left Skip next if V1 = key 2BA-2BB 0698-0699 ÜÜ Û ß 12C2 04802 Jump to right 2BC-2BD 0700-0701 Û Û Û 4A00 18944 Skip next if VA <> 000 2BE-2BF 0702-0703 ÜÜ Û ß 12C2 04802 Jump to right 2C0-2C1 0704-0705 ÜßßÜÜßÜß 65FF 26111 V5  255 2C2-2C3 0706-0707 ßÛÛÜÜÜß E29E 58014 right Skip next if V2 = key 2C4-2C5 0708-0709 ÜÜ ÛÜÜÛ 12CC 04812 Jump to up 2C6-2C7 0710-0711 ßÜÜßÜßÜ 4A7F 19071 Skip next if VA <> 127 2C8-2C9 0712-0713 ÜÜ ÛÜÜÛ 12CC 04812 Jump to up 2CA-2CB 0714-0715 ÛÛ Û ß 6501 25857 V5  001 2CC-2CD 0716-0717 ßÛÛÜÜÜßÛ E39E 58270 up Skip next if V3 = key 2CE-2CF 0718-0719 ÜÜ ß Üß 12D6 04822 Jump to resolve 2D0-2D1 0720-0721 Û Û ÛÛ 4B00 19200 Skip next if VB <> 000 2D2-2D3 0722-0723 ÜÜ ß Üß 12D6 04822 Jump to resolve 2D4-2D5 0724-0725 ÜßßÜÜßßÜ 66FF 26367 V6  255 2D6-2D7 0726-0727 Û ÛÜÜ Û A218 41496 resolve I  player 2D8-2D9 0728-0729 ßÛ ßÛ Ü D891 55441 Draw 08x01 at V8,V9; VF  XOR 2DA-2DB 0730-0731 Û ÛÛÛÛ 4F00 20224 Skip next if VF <> 000 2DC-2DD 0732-0733 ßÛ ßÛ Ü D891 55441 Draw 08x01 at V8,V9; VF  XOR 2DE-2DF 0734-0735 ßÛÜßÛ ÛÜ DAB1 55985 Draw 08x01 at VA,VB; VF  XOR 2E0-2E1 0736-0737 ÛÜ ÜÛÜÛ 8A54 35412 VA  VA + V5; VF  overflow 2E2-2E3 0738-0739 ÛÜÜ ÛÜÛÛ 8B64 35684 VB  VB + V6; VF  overflow 2E4-2E5 0740-0741 ßÛÜßÛ ÛÜ DAB1 55985 Draw 08x01 at VA,VB; VF  XOR 2E6-2E7 0742-0743 ÜÛÜÛÛ 58A0 22688 Skip next if V8 = VA 2E8-2E9 0744-0745 ÜÜÜß ß 12F2 04850 Jump to next 2EA-2EB 0746-0747 ÜÛÜßÛ Û 59B0 22960 Skip next if V9 = VB 2EC-2ED 0748-0749 ÜÜÜß ß 12F2 04850 Jump to next 2EE-2EF 0750-0751 ÜßßÜßÜÜß 69FF 27135 V9  255 2F0-2F1 0752-0753 ÛÛÛ ÛÛß 7701 30465 V7  V7 + 001 2F2-2F3 0754-0755 Û ÛÛÛÛ 4F00 20224 next Skip next if VF <> 000 2F4-2F5 0756-0757 ÜÜÜßÜÜß 12FE 04862 Jump to break? 2F6-2F7 0758-0759 ßÛÜßÛ ÛÜ DAB1 55985 Draw 08x01 at VA,VB; VF  XOR 2F8-2F9 0760-0761 ÛÜ ÜÛÜÛÜ 8A55 35413 VA  VA - V5; VF  borrow 2FA-2FB 0762-0763 ÛÜÜ ÛÜÛß 8B65 35685 VB  VB - V6; VF  borrow 2FC-2FD 0764-0765 ßÛÜßÛ ÛÜ DAB1 55985 Draw 08x01 at VA,VB; VF  XOR 2FE-2FF 0766-0767 ßÛÛÜÜßÜ E49E 58526 break? Skip next if V4 = key 300-301 0768-0769 ß ÜÛÛ 1314 04884 Jump to exhaust delay 302-303 0770-0771 Û ÛÛÛ 4700 18176 Skip next if V7 <> 000 304-305 0772-0773 ß ÜÛÛ 1314 04884 Jump to exhaust delay 306-307 0774-0775 Û ßÜÜ ßÛ A33A 41786 I  make break 308-309 0776-0777 ß Ü 80A0 32928 V0  VA 30A-30B 0778-0779 ß ÜÜ Û 81B0 33200 V1  VB 30C-30D 0780-0781 ÜßßßÜÜÜÜ 70FF 28927 V0  V0 + 255 30E-30F 0782-0783 ÜßßßÜÜ Û 71FC 29180 V1  V1 + 252 310-311 0784-0785 ÜßßßÜßßß 77FF 30719 V7  V7 + 255 312-313 0786-0787 ÛÛ ß Ü D014 53268 Draw 08x04 at V0,V1; VF  XOR 314-315 0788-0789 ÛÛÛÛÛßßß FF07 65287 exhaust delay VF  delay 316-317 0790-0791 ÛÛÛÛÛÛ 3F00 16128 Skip next if VF = 000 318-319 0792-0793 ß ÜÛÛ 1314 04884 Jump to exhaust delay 31A-31B 0794-0795 ÛÛÛß ÜÛÜ F215 61973 delay  V2 31C-31D 0796-0797 ÛßÛÛ Û 3D10 15632 Skip next if VD = 016 31E-31F 0798-0799 ß ß 1212 04626 Jump to maze step 320-321 0800-0801 ÛÜÜß 120E 04622 Jump to maze 322-323 0802-0803 Û Û 8100 33024 shift V1  V0 324-325 0804-0805 ÛÜ ÜÜÜÜ 805E 32862 V0  V5 x 2; VF  MSB 326-327 0806-0807 Û ßÛÜ ÛÛ B328 45864 Jump to V0 + table 328-329 0808-0809 Û Ü ÜÜÛ 8116 33046 table V1  V1 ö 2; VF  LSB 32A-32B 0810-0811 Û Ü ÜÜÛ 8116 33046 V1  V1 ö 2; VF  LSB 32C-32D 0812-0813 Û Ü ÜÜÛ 8116 33046 V1  V1 ö 2; VF  LSB 32E-32F 0814-0815 Û Ü ÜÜÛ 8116 33046 V1  V1 ö 2; VF  LSB 330-331 0816-0817 Û Ü ÜÜÛ 8116 33046 V1  V1 ö 2; VF  LSB 332-333 0818-0819 Û Ü ÜÜÛ 8116 33046 V1  V1 ö 2; VF  LSB 334-335 0820-0821 Û Ü ÜÜÛ 8116 33046 V1  V1 ö 2; VF  LSB 336-337 0822-0823 Û Ü ÜÜÛ 8116 33046 V1  V1 ö 2; VF  LSB 338-339 0824-0825 ÜÜÜ ÜÜÜ 00EE 00238 Return 33A-33B 0826-0827 ßßßß F0F0 61680 make break 33C-33D 0828-0829 ßßßß F0F0 61680 33E-33F 0830-0831 ÛÜ ÛÛ 1308 04872 random 340-341 0832-0833 Ü ßÜ 1098 04248 342-343 0834-0835 ßßßÜ E0F0 57584 drunk 344-345 0836-0837 ÛÛß E020 57376 346 0838 ß 02 002 from 347 0839 ß 04 004 348 0840 ßß 06 006 349 0841 ß 08 008 34A-34B 0842-0843 0000 00000 34C-34D 0844-0845 0000 00000 34E-34F 0846-0847 ÛÛÛÛ F000 61440 backstage 350-351 0848-0849 0000 00000 stage 352-353 0850-0851 0000 00000 354-355 0852-0853 0000 00000 356-357 0854-0855 0000 00000 358-359 0856-0857 0000 00000 35A-35B 0858-0859 0000 00000 35C-35D 0860-0861 0000 00000 35E-35F 0862-0863 0000 00000 360-361 0864-0865 0000 00000 fourth wall 362-363 0866-0867 0000 00000 364-365 0868-0869 0000 00000 366-367 0870-0871 0000 00000 368-369 0872-0873 0000 00000 36A-36B 0874-0875 0000 00000 36C-36D 0876-0877 0000 00000 36E-36F 0878-0879 0000 00000 370-371 0880-0881 0000 00000 wardrobe The register usage is as follows: V0 Hold cells for the automaton; hold a key code; and hold the argument to a subroutine. V1 Hold a cell for the automaton; hold the horizontal coordinate of part of the maze drawing; hold a key code; and operate as a temporary register. V2 Hold a cell for the automaton; hold the horizontal coordinate of part of the maze drawing; hold a key code; operate as a temporary register; and manipulate the delay register. V3 Hold a cell for the automaton; and hold a key code. V4 Hold a generated index for the maze generation; and hold a key code. V5 Hold a generated index for the maze generation; and hold a movement delta. V6 Hold a movement delta. V7 Store the make break count. V8 Hold the horizontal coordinate of the make break. V9 Hold the vertical coordinate and presence sigil of the make break. VA Hold the horizontal coordinate of the player. VB Hold the vertical coordinate of the player. VC Hold a rotating counter and the vertical coordinate of part of the maze drawing. VD Hold the current cell index of the maze generation. VE Hold a prior cell state for the automaton. VF Hold the result of a subroutine; manipulate the delay register; indicate collisions, and whatnot. More care was taken in register selection with this iteration; in particular, it was recognized that the first many registers had no persistent state after the automaton stepping, and so could be used, without issue. Unfortunately, I resisted using entirely disparate register banks in this; it caused issues with register exhaustion that could've been avoided. The register manipulation of the latter half of the game is sloppy, in mine eyes, and this game would benefit from heavier rewriting, later. The game begins by entering Super CHIP-8 mode, clearing all registers to zero, initializing the make break count, configuring the make break sigil to indicate no presence, and then drawing that player: 200-201 0512-0513 ÜÜÜÜÜÜÜÜ 00FF 00255 Enable extended mode 202-203 0514-0515 ßÜßÜ ÛÛÛ A7F0 42992 I  2032 204-205 0516-0517 ÛßßÛÛßÛß FF65 65381 Load V0VF; I  I + 16 206-207 0518-0519 ÛÛ ÜÛßÛ 670A 26378 V7  010 208-209 0520-0521 ÜßßÜßÜÜß 69FF 27135 V9  255 20A-20B 0522-0523 Û ÛÜÜ Û A218 41496 I  player 20C-20D 0524-0525 ßÛÜßÛ ÛÜ DAB1 55985 Draw 08x01 at VA,VB; VF  XOR Unlike that prior implementation, a more consistent framerate is achieved by generating each cell of the automaton in step with the rest of the game, rather than all at once; the paper I read indicated a random initial value for part of the algorithm, which corresponds to the CE01. Rather than move I by FX65, I use labels offset appropriately; this implementation avoids a mask by using 8XYE instead. Each value is either zero or two hundred and forty, as but two symbols are needed, and these exactly match the sprites used in drawing. Indices into the bit tables drunk and random are built as shown: 20E-20F 0526-0527 ÛÛ ÛÛÛÜ CE01 52737 maze VE  ??? AND 001 210-211 0528-0529 ÛÛ ÛÛ Û 6D00 27904 VD  000 212-213 0530-0531 ÛÜÛ ÜÜßÛ A34E 41806 maze step I  backstage 214-215 0532-0533 ÛÛÛßßßÜÛ FD1E 64798 I  I + VD 216-217 0534-0535 ÛßßÛ ÜÛß F365 62309 Load V0V3; I  I + 04 218-219 0536-0537 Û ÜÜÜ 800E 32782 player V0  V0 x 2; VF  MSB 21A-21B 0538-0539 ßÜÜÜÜßÜ 84FE 34046 V4  VF x 2; VF  MSB 21C-21D 0540-0541 Û ÜÜÜÜÛ 811E 33054 V1  V1 x 2; VF  MSB 21E-21F 0542-0543 ßÜÜÜ Û Ü 84F1 34033 V4  V4 OR VF 220-221 0544-0545 ßÜÜ ÜßÜÛ 85EE 34286 V5  VE x 2; VF  MSB 222-223 0546-0547 Û Ü ÜÜß 822E 33326 V2  V2 x 2; VF  MSB 224-225 0548-0549 ßÜÜÜÛÛÛ 8EF0 36592 VE  VF 226-227 0550-0551 ßÜÜÜ Û ß 85F1 34289 V5  V5 OR VF 228-229 0552-0553 ÛÜ ÜÜßÜÛ 855E 34142 V5  V5 x 2; VF  MSB 22A-22B 0554-0555 Û ÜÜÜÜßÛ 833E 33598 V3  V3 x 2; VF  MSB 22C-22D 0556-0557 ßÜÜÜ Û ß 85F1 34289 V5  V5 OR VF Again for a more consistent framerate, both random and drunk are indexed, regardless of the value in random. The shift routine is used to extract the particular bit. I was unable to avoid conditional code in setting the new cell value, but did nicely avoid unnecessary register movement in how random values are set, by conditionally manipulating the apparent value of that drunk bit. I would've been able to unconditionally map one to two hundred and forty, but lacked a multiplication sled I needed: 22E-22F 0558-0559 Û ßÜÜÜßÛ A33E 41790 I  random 230-231 0560-0561 ÛÛÛßÜßÜ F41E 62494 I  I + V4 232-233 0562-0563 ÛßßÛ Ü Ü F065 61541 Load V0V0; I  I + 01 234-235 0564-0565 ß ßÛ 2322 08994 Call shift 236-237 0566-0567 ßÜÜÜ Û 82F0 33520 V2  VF 238-239 0568-0569 ÛÜÛ ßÛ A342 41794 I  drunk 23A-23B 0570-0571 ÛÛÛßÜßÜ F41E 62494 I  I + V4 23C-23D 0572-0573 ÛßßÛ Ü Ü F065 61541 Load V0V0; I  I + 01 23E-23F 0574-0575 ß ßÛ 2322 08994 Call shift 240-241 0576-0577 ÛÛ Û 3200 12800 Skip next if V2 = 000 242-243 0578-0579 ÛÛ ÛÛÛß CF01 52993 VF  ??? AND 001 244-245 0580-0581 ÛÛ 6000 24576 V0  000 246-247 0582-0583 ÛÛÛÛÛÛ 3F00 16128 Skip next if VF = 000 248-249 0584-0585 ÜßßÜ 60F0 24816 V0  240 The stage is set and, once that automaton is finished with the next generation, those new values are nicely set by using all sixteen registers; the fourth wall indicating the actual maze is immediately following stage, enabling this nice trick. The wardrobe is but temporary storage for all registers: 24A-24B 0586-0587 ÛÜÛÜ ÛÛ A350 41808 I  stage 24C-24D 0588-0589 ÛÛÛßßßÜÛ FD1E 64798 I  I + VD 24E-24F 0590-0591 ÛßÛß Ü Ü F055 61525 Save V0V0; I  I + 01 250-251 0592-0593 ÛÛÛÛÛ ß 7D01 32001 VD  VD + 001 252-253 0594-0595 ÛßÛÛ Û 3D10 15632 Skip next if VD = 016 254-255 0596-0597 ÜÜÛ ÜÛ 1264 04708 Jump to draw curtains 256-257 0598-0599 ÛÜßÜ ÛÛ A370 41840 I  wardrobe 258-259 0600-0601 ÛßÛßÛßÛß FF55 65365 Save V0VF; I  I + 16 25A-25B 0602-0603 ÛÜÛÜ ÛÛ A350 41808 I  stage 25C-25D 0604-0605 ÛßßÛÛßÛß FF65 65381 Load V0VF; I  I + 16 25E-25F 0606-0607 ÛßÛßÛßÛß FF55 65365 Save V0VF; I  I + 16 260-261 0608-0609 ÛÜßÜ ÛÛ A370 41840 I  wardrobe 262-263 0610-0611 ÛßßÛÛßÛß FF65 65381 Load V0VF; I  I + 16 Rows of the maze are drawn once every four cycles, which matches perfectly with the sixteen cells of the automaton. The screen is scrolled, coordinates for the player and make break are incremented if necessary, and the make break is reset if past the end. If not that, the move segment is jumped to: 264-265 0612-0613 ÛÛÛÛÛ Ü 7C01 31745 draw curtains VC  VC + 001 266-267 0614-0615 Û Ûß 4C04 19460 Skip next if VC <> 004 268-269 0616-0617 ÛÛ ÛÛ 6C00 27648 VC  000 26A-26B 0618-0619 ÛÛÛÛ 3C00 15360 Skip next if VC = 000 26C-26D 0620-0621 Ü ÛÜÜß 128E 04750 Jump to move 26E-26F 0622-0623 ÛÜß ÛÛ A360 41824 I  fourth wall 270-271 0624-0625 ÜÜ Ü 00C1 00193 Scroll  by 01 272-273 0626-0627 ÛÛ Û 6100 24832 V1  000 274-275 0628-0629 ßßÜÜÜÛ 627C 25212 V2  124 276-277 0630-0631 ÛÛÛÛ Ûß 7B01 31489 VB  VB + 001 278-279 0632-0633 ÜÜßßßÜÜß 39FF 14847 Skip next if V9 = 255 27A-27B 0634-0635 ÛÛÛÛ ß 7901 30977 V9  V9 + 001 27C-27D 0636-0637 ß Û Û 4940 18752 Skip next if V9 <> 064 27E-27F 0638-0639 ÜßßÜßÜÜß 69FF 27135 V9  255 The show time routine draws one row of the maze. As VC is zero to enter this routine, it can safely be used for the vertical coordinate. As I only progresses one way, the row is drawn towards center: 280-281 0640-0641 ßß Û ß D1C1 53697 show time Draw 08x01 at V1,VC; VF  XOR 282-283 0642-0643 ßß Û ÛÜ D2C1 53953 Draw 08x01 at V2,VC; VF  XOR 284-285 0644-0645 ÛßßÛ Ü Ü F065 61541 Load V0V0; I  I + 01 286-287 0646-0647 ÛÛÛ Ü Û 7104 28932 V1  V1 + 004 288-289 0648-0649 ÜßßßÜÜÛ 72FC 29436 V2  V2 + 252 28A-28B 0650-0651 ÜÛÛ Û 3140 12608 Skip next if V1 = 064 28C-28D 0652-0653 Ü Û Û 1280 04736 Jump to show time The move routine begins by calculating the make break, if necessary. The make break is only changed if not already active and only then once every four cycles. It's opportunistically drawn at the top of the screen, bailing out and correcting the maze if it collides with a wall to try the next cycle: 28E-28F 0654-0655 ÜÜßßßÜÜß 39FF 14847 move Skip next if V9 = 255 290-291 0656-0657 Ü ÜÛ Üß 12A6 04774 Jump to continue 292-293 0658-0659 ÛÛÛÛ 3C00 15360 Skip next if VC = 000 294-295 0660-0661 Ü ÜÛ Üß 12A6 04774 Jump to continue 296-297 0662-0663 Û ÛÜÜ Û A218 41496 I  player 298-299 0664-0665 ÛßÜÜßÜÜÜ C87F 51327 V8  ??? AND 127 29A-29B 0666-0667 ÛÛ Û ß 6901 26881 V9  001 29C-29D 0668-0669 ßÛ ßÛ Ü D891 55441 Draw 08x01 at V8,V9; VF  XOR 29E-29F 0670-0671 Û ÛÛÛÛ 4F00 20224 Skip next if VF <> 000 2A0-2A1 0672-0673 Ü ÜÛ Üß 12A6 04774 Jump to continue 2A2-2A3 0674-0675 ßÛ ßÛ Ü D891 55441 Draw 08x01 at V8,V9; VF  XOR 2A4-2A5 0676-0677 ÜßßÜßÜÜß 69FF 27135 V9  255 The continue routine initializes the key and delta registers, also checking for failure, to restart: 2A6-2A7 0678-0679 ÛÜÛ ÜßÛ A346 41798 continue I  from 2A8-2A9 0680-0681 ÛßßÛ ßÛÜ F665 63077 Load V0V6; I  I + 07 2AA-2AB 0682-0683 ß Û ÛÛ 4B40 19264 Skip next if VB <> 064 2AC-2AD 0684-0685 Û Û 1200 04608 Jump to 0512 This segment merely calculates the movement deltas, also enforcing bounds: 2AE-2AF 0686-0687 ßÛÛÜÜÜÜ E09E 57502 down Skip next if V0 = key 2B0-2B1 0688-0689 Ü ÜßÜ Û 12B8 04792 Jump to left 2B2-2B3 0690-0691 ÛÜÜßÜßß 4B3F 19263 Skip next if VB <> 063 2B4-2B5 0692-0693 Ü ÜßÜ Û 12B8 04792 Jump to left 2B6-2B7 0694-0695 ÛÛ ÛÛÜ 6601 26113 V6  001 2B8-2B9 0696-0697 ßÛÛÜÜÜÜÛ E19E 57758 left Skip next if V1 = key 2BA-2BB 0698-0699 ÜÜ Û ß 12C2 04802 Jump to right 2BC-2BD 0700-0701 Û Û Û 4A00 18944 Skip next if VA <> 000 2BE-2BF 0702-0703 ÜÜ Û ß 12C2 04802 Jump to right 2C0-2C1 0704-0705 ÜßßÜÜßÜß 65FF 26111 V5  255 2C2-2C3 0706-0707 ßÛÛÜÜÜß E29E 58014 right Skip next if V2 = key 2C4-2C5 0708-0709 ÜÜ ÛÜÜÛ 12CC 04812 Jump to up 2C6-2C7 0710-0711 ßÜÜßÜßÜ 4A7F 19071 Skip next if VA <> 127 2C8-2C9 0712-0713 ÜÜ ÛÜÜÛ 12CC 04812 Jump to up 2CA-2CB 0714-0715 ÛÛ Û ß 6501 25857 V5  001 2CC-2CD 0716-0717 ßÛÛÜÜÜßÛ E39E 58270 up Skip next if V3 = key 2CE-2CF 0718-0719 ÜÜ ß Üß 12D6 04822 Jump to resolve 2D0-2D1 0720-0721 Û Û ÛÛ 4B00 19200 Skip next if VB <> 000 2D2-2D3 0722-0723 ÜÜ ß Üß 12D6 04822 Jump to resolve 2D4-2D5 0724-0725 ÜßßÜÜßßÜ 66FF 26367 V6  255 The resolve routine erases the make break so it can't collide with the player, and then redraws him: 2D6-2D7 0726-0727 Û ÛÜÜ Û A218 41496 resolve I  player 2D8-2D9 0728-0729 ßÛ ßÛ Ü D891 55441 Draw 08x01 at V8,V9; VF  XOR 2DA-2DB 0730-0731 Û ÛÛÛÛ 4F00 20224 Skip next if VF <> 000 2DC-2DD 0732-0733 ßÛ ßÛ Ü D891 55441 Draw 08x01 at V8,V9; VF  XOR 2DE-2DF 0734-0735 ßÛÜßÛ ÛÜ DAB1 55985 Draw 08x01 at VA,VB; VF  XOR 2E0-2E1 0736-0737 ÛÜ ÜÛÜÛ 8A54 35412 VA  VA + V5; VF  overflow 2E2-2E3 0738-0739 ÛÜÜ ÛÜÛÛ 8B64 35684 VB  VB + V6; VF  overflow 2E4-2E5 0740-0741 ßÛÜßÛ ÛÜ DAB1 55985 Draw 08x01 at VA,VB; VF  XOR The following code determines if the make break is collected by comparing coordinates and resetting: 2E6-2E7 0742-0743 ÜÛÜÛÛ 58A0 22688 Skip next if V8 = VA 2E8-2E9 0744-0745 ÜÜÜß ß 12F2 04850 Jump to next 2EA-2EB 0746-0747 ÜÛÜßÛ Û 59B0 22960 Skip next if V9 = VB 2EC-2ED 0748-0749 ÜÜÜß ß 12F2 04850 Jump to next 2EE-2EF 0750-0751 ÜßßÜßÜÜß 69FF 27135 V9  255 2F0-2F1 0752-0753 ÛÛÛ ÛÛß 7701 30465 V7  V7 + 001 The next routine moves the player back to his previous location if a collision occurred, then seeing if a make break is used; if so, and the count is positive, the make break's coordinate is calculated and it's drawn. I'd wanted to adjust this based on the last movement direction, but faced pressure: 2F2-2F3 0754-0755 Û ÛÛÛÛ 4F00 20224 next Skip next if VF <> 000 2F4-2F5 0756-0757 ÜÜÜßÜÜß 12FE 04862 Jump to break? 2F6-2F7 0758-0759 ßÛÜßÛ ÛÜ DAB1 55985 Draw 08x01 at VA,VB; VF  XOR 2F8-2F9 0760-0761 ÛÜ ÜÛÜÛÜ 8A55 35413 VA  VA - V5; VF  borrow 2FA-2FB 0762-0763 ÛÜÜ ÛÜÛß 8B65 35685 VB  VB - V6; VF  borrow 2FC-2FD 0764-0765 ßÛÜßÛ ÛÜ DAB1 55985 Draw 08x01 at VA,VB; VF  XOR 2FE-2FF 0766-0767 ßÛÛÜÜßÜ E49E 58526 break? Skip next if V4 = key 300-301 0768-0769 ß ÜÛÛ 1314 04884 Jump to exhaust delay 302-303 0770-0771 Û ÛÛÛ 4700 18176 Skip next if V7 <> 000 304-305 0772-0773 ß ÜÛÛ 1314 04884 Jump to exhaust delay 306-307 0774-0775 Û ßÜÜ ßÛ A33A 41786 I  make break 308-309 0776-0777 ß Ü 80A0 32928 V0  VA 30A-30B 0778-0779 ß ÜÜ Û 81B0 33200 V1  VB 30C-30D 0780-0781 ÜßßßÜÜÜÜ 70FF 28927 V0  V0 + 255 30E-30F 0782-0783 ÜßßßÜÜ Û 71FC 29180 V1  V1 + 252 310-311 0784-0785 ÜßßßÜßßß 77FF 30719 V7  V7 + 255 312-313 0786-0787 ÛÛ ß Ü D014 53268 Draw 08x04 at V0,V1; VF  XOR That remaining delay is exhausted, before being reinstated, and one of the maze routines is entered: 314-315 0788-0789 ÛÛÛÛÛßßß FF07 65287 exhaust delay VF  delay 316-317 0790-0791 ÛÛÛÛÛÛ 3F00 16128 Skip next if VF = 000 318-319 0792-0793 ß ÜÛÛ 1314 04884 Jump to exhaust delay 31A-31B 0794-0795 ÛÛÛß ÜÛÜ F215 61973 delay  V2 31C-31D 0796-0797 ÛßÛÛ Û 3D10 15632 Skip next if VD = 016 31E-31F 0798-0799 ß ß 1212 04626 Jump to maze step 320-321 0800-0801 ÛÜÜß 120E 04622 Jump to maze This shift routine is better than that preceding it, as it adjusts registers as needed, itself. Had I used a multiplication sled instead, I'd have been able to use this for the maze symbol generation: 322-323 0802-0803 Û Û 8100 33024 shift V1  V0 324-325 0804-0805 ÛÜ ÜÜÜÜ 805E 32862 V0  V5 x 2; VF  MSB 326-327 0806-0807 Û ßÛÜ ÛÛ B328 45864 Jump to V0 + table 328-329 0808-0809 Û Ü ÜÜÛ 8116 33046 table V1  V1 ö 2; VF  LSB 32A-32B 0810-0811 Û Ü ÜÜÛ 8116 33046 V1  V1 ö 2; VF  LSB 32C-32D 0812-0813 Û Ü ÜÜÛ 8116 33046 V1  V1 ö 2; VF  LSB 32E-32F 0814-0815 Û Ü ÜÜÛ 8116 33046 V1  V1 ö 2; VF  LSB 330-331 0816-0817 Û Ü ÜÜÛ 8116 33046 V1  V1 ö 2; VF  LSB 332-333 0818-0819 Û Ü ÜÜÛ 8116 33046 V1  V1 ö 2; VF  LSB 334-335 0820-0821 Û Ü ÜÜÛ 8116 33046 V1  V1 ö 2; VF  LSB 336-337 0822-0823 Û Ü ÜÜÛ 8116 33046 V1  V1 ö 2; VF  LSB 338-339 0824-0825 ÜÜÜ ÜÜÜ 00EE 00238 Return The game ends with the various sprites, tables, register banks, and I'll also show the final labels. The backstage begins with a constant symbol, again as that paper I read described this aspect of it: 33A-33B 0826-0827 ßßßß F0F0 61680 make break 33C-33D 0828-0829 ßßßß F0F0 61680 33E-33F 0830-0831 ÛÜ ÛÛ 1308 04872 random 340-341 0832-0833 Ü ßÜ 1098 04248 342-343 0834-0835 ßßßÜ E0F0 57584 drunk 344-345 0836-0837 ÛÛß E020 57376 346 0838 ß 02 002 from 347 0839 ß 04 004 348 0840 ßß 06 006 349 0841 ß 08 008 34A-34B 0842-0843 0000 00000 34C-34D 0844-0845 0000 00000 34E-34F 0846-0847 ÛÛÛÛ F000 61440 backstage 350-351 0848-0849 0000 00000 stage 352-353 0850-0851 0000 00000 354-355 0852-0853 0000 00000 356-357 0854-0855 0000 00000 358-359 0856-0857 0000 00000 35A-35B 0858-0859 0000 00000 35C-35D 0860-0861 0000 00000 35E-35F 0862-0863 0000 00000 360-361 0864-0865 0000 00000 fourth wall 362-363 0866-0867 0000 00000 364-365 0868-0869 0000 00000 366-367 0870-0871 0000 00000 368-369 0872-0873 0000 00000 36A-36B 0874-0875 0000 00000 36C-36D 0876-0877 0000 00000 36E-36F 0878-0879 0000 00000 370-371 0880-0881 0000 00000 wardrobe This game is much better than that which preceded it, and it was fun to finish it in the final hours of the Octo Jam, as I'd added the make break code haphazardly. I was unable to incorporate an enemy which would opportunistically spawn as the make break does, and also to have better placement of the make break; these are improvements to be made in a later version. The maze is twice the size it was in that prior and the original, and how nice; I'm not finished with this game, sans for the present. .