A Documenting of mine Even More Enhanced Enchantment CHIP-8 Game This is but a minor improvement of a previous game, made due to a lack of time for the ninth Octojam event. I wanted to make the field scroll and amusingly found this to be difficult purely due to the optimizations made in the previous version, as every register was used. For the next event I intend to entirely rewrite the game, and it will lead to something more efficient when extended in any way. I'll note the big changes and, as with last time, leave a deeper understanding to the prior article. Follows is a view of the complete game, when loaded into the MMC: 200-201 0512-0513 ÜÜÜÜÜÜÜÜ 00FF 00255 Enable extended mode 202-203 0514-0515 ßÜÛ ßÛ A3C2 41922 I  from 204-205 0516-0517 ÛßßÛÛßÛß FF65 65381 Load V0VF; I  I + 16 206-207 0518-0519 ÛÜÛ ÜÛ A244 41540 I  ball 208-209 0520-0521 Ûß ß Û Ü D451 54353 Draw 08x01 at V4,V5; VF  XOR 20A-20B 0522-0523 ÛÛ ÜßßÜ CC1E 52254 VC  ??? AND 030 20C-20D 0524-0525 ÛÛ ÜßßÜÛ CD1E 52510 VD  ??? AND 030 20E-20F 0526-0527 ÛÛ Üßßß CE1E 52766 VE  ??? AND 030 210-211 0528-0529 ÛÛÛß ÜÛß F315 62229 movement delay  V3 212-213 0530-0531 ÛÛ ßßßß 6F0F 28431 VF  015 214-215 0532-0533 ßÛß ÛÛÛß EFA1 61345 Skip next if VF <> key 216-217 0534-0535 ÛÛÛÛßÛßÛ FF0A 65290 VF  key 218-219 0536-0537 Ûß ß Û Ü D451 54353 Draw 08x01 at V4,V5; VF  XOR 21A-21B 0538-0539 Û ÛÛÛÛ 4F00 20224 Skip next if VF <> 000 21C-21D 0540-0541 ÜÜÜ 00E0 00224 Clear the screen 21E-21F 0542-0543 Û ÛÛÛÛ 4F00 20224 Skip next if VF <> 000 220-221 0544-0545 Û ß 1202 04610 Jump to 0514 222-223 0546-0547 ßÛß Ü E0A1 57505 Skip next if V0 <> key 224-225 0548-0549 ÛÛÛ Û Ü 7401 29697 V4  V4 + 001 226-227 0550-0551 ßÛß ß E1A1 57761 Skip next if V1 <> key 228-229 0552-0553 ÜßßßÜßÜÜ 74FF 29951 V4  V4 + 255 22A-22B 0554-0555 ßÛß ÛÜ E2A1 58017 Skip next if V2 <> key 22C-22D 0556-0557 ÛÛÛ Û ß 7501 29953 V5  V5 + 001 22E-22F 0558-0559 ßÛß Ûß E3A1 58273 Skip next if V3 <> key 230-231 0560-0561 ÜßßßÜßÜß 75FF 30207 V5  V5 + 255 232-233 0562-0563 ÜßÜÜÜßÜÜ 44FF 17663 Skip next if V4 <> 255 234-235 0564-0565 ÛÛ Û 6400 25600 V4  000 236-237 0566-0567 ÜÛ Û 4480 17536 Skip next if V4 <> 128 238-239 0568-0569 ßßÜÜßÜÜ 647F 25727 V4  127 23A-23B 0570-0571 ÜßÜÜÜßÜß 45FF 17919 Skip next if V5 <> 255 23C-23D 0572-0573 ÛÛ Û Û 6500 25856 V5  000 23E-23F 0574-0575 ß Û Û 4540 17728 Skip next if V5 <> 064 240-241 0576-0577 ÛßÜÜßÜß 653F 25919 V5  063 242-243 0578-0579 Ûß ß Û Ü D451 54353 Draw 08x01 at V4,V5; VF  XOR 244-245 0580-0581 ßÜ 80C0 32960+ ball V0  VC 246-247 0582-0583 ÛÛ Û 6100 24832 V1  000 248-249 0584-0585 ß Û 8280 33408 V2  V8 24A-24B 0586-0587 ß Ü ÛÛ 8390 33680 V3  V9 24C-24D 0588-0589 Û ÛÛÛÛ 4F00 20224 Skip next if VF <> 000 24E-24F 0590-0591 ÛÜßÛÜ Û B268 45672 Jump to V0 + table 250-251 0592-0593 ÜÜÜ 00E0 00224 Clear the screen 252-253 0594-0595 Û ß 1202 04610 Jump to 0514 254-255 0596-0597 ßÜ Ü 80D0 32976 second V0  VD 256-257 0598-0599 ÛÛ ß 6101 24833 V1  001 258-259 0600-0601 ß Ü Û 82A0 33440 V2  VA 25A-25B 0602-0603 ß ÜÜ ÛÛ 83B0 33712 V3  VB 25C-25D 0604-0605 ÛÜßÛÜ Û B268 45672 Jump to V0 + table 25E-25F 0606-0607 ßÜÜ 80E0 32992 third V0  VE 260-261 0608-0609 ÛÛ ÜÛ 6102 24834 V1  002 262-263 0610-0611 ÛÜÜ Û 8260 33376 V2  V6 264-265 0612-0613 ÛÜÜÜ ÛÛ 8370 33648 V3  V7 266-267 0614-0615 ÛÜßÛÜ Û B268 45672 Jump to V0 + table 268-269 0616-0617 Ü ß Û 1290 04752 table Jump to up left 26A-26B 0618-0619 Ü ß Üß 1296 04758 Jump to up right 26C-26D 0620-0621 Ü ßÜÜÛ 129C 04764 Jump to down left 26E-26F 0622-0623 Ü ÜÛ ß 12A2 04770 Jump to down right 270-271 0624-0625 Ü ÜÛÜ Û 12A8 04776 Jump to left up 272-273 0626-0627 Ü ÜÛÜÜß 12AE 04782 Jump to left down 274-275 0628-0629 Ü Üß ÜÛ 12B4 04788 Jump to right up 276-277 0630-0631 Ü ÜßÜ ß 12BA 04794 Jump to right down 278-279 0632-0633 ÜÜ Û Û 12C0 04800 Jump to two up left 27A-27B 0634-0635 ÜÜ ÛÜ Û 12C8 04808 Jump to two up right 27C-27D 0636-0637 ÜÜ ß Û 12D0 04816 Jump to two down left 27E-27F 0638-0639 ÜÜ ßÜ Û 12D8 04824 Jump to two down right 280-281 0640-0641 ÜÜÜÛ Û 12E0 04832 Jump to two left up 282-283 0642-0643 ÜÜÜÛÜ Û 12E8 04840 Jump to two right down 284-285 0644-0645 ÜÜÜß Û 12F0 04848 Jump to left targeting 286-287 0646-0647 ÜÜÜß ÜÛ 12F4 04852 Jump to right targeting 288-289 0648-0649 ÛÜÜßÛ 130E 04878 Jump to up targeting 28A-28B 0650-0651 ß ßÛ 1312 04882 Jump to down targeting 28C-28D 0652-0653 ÜÛÜÜÛÛ 132C 04908 Jump to left 28E-28F 0654-0655 ÜÛÜÜßÛ 132E 04910 Jump to right 290-291 0656-0657 ÜßßßÜÜßÜ 72FF 29439 up left V2  V2 + 255 292-293 0658-0659 ÛÛÛ Ûß 7301 29441 V3  V3 + 001 294-295 0660-0661 Üß ÛÛ 1330 04912 Jump to integrate 296-297 0662-0663 ÛÛÛ ÛÜ 7201 29185 up right V2  V2 + 001 298-299 0664-0665 ÛÛÛ Ûß 7301 29441 V3  V3 + 001 29A-29B 0666-0667 Üß ÛÛ 1330 04912 Jump to integrate 29C-29D 0668-0669 ÜßßßÜÜßÜ 72FF 29439 down left V2  V2 + 255 29E-29F 0670-0671 ÜßßßÜÜßß 73FF 29695 V3  V3 + 255 2A0-2A1 0672-0673 Üß ÛÛ 1330 04912 Jump to integrate 2A2-2A3 0674-0675 ÛÛÛ ÛÜ 7201 29185 down right V2  V2 + 001 2A4-2A5 0676-0677 ÜßßßÜÜßß 73FF 29695 V3  V3 + 255 2A6-2A7 0678-0679 Üß ÛÛ 1330 04912 Jump to integrate 2A8-2A9 0680-0681 ÛÛÛ ÛÜ 7201 29185 left up V2  V2 + 001 2AA-2AB 0682-0683 ÜßßßÜÜßß 73FF 29695 V3  V3 + 255 2AC-2AD 0684-0685 Üß ÛÛ 1330 04912 Jump to integrate 2AE-2AF 0686-0687 ÛÛÛ ÛÜ 7201 29185 left down V2  V2 + 001 2B0-2B1 0688-0689 ÛÛÛ Ûß 7301 29441 V3  V3 + 001 2B2-2B3 0690-0691 Üß ÛÛ 1330 04912 Jump to integrate 2B4-2B5 0692-0693 ÜßßßÜÜßÜ 72FF 29439 right up V2  V2 + 255 2B6-2B7 0694-0695 ÜßßßÜÜßß 73FF 29695 V3  V3 + 255 2B8-2B9 0696-0697 Üß ÛÛ 1330 04912 Jump to integrate 2BA-2BB 0698-0699 ÜßßßÜÜßÜ 72FF 29439 right down V2  V2 + 255 2BC-2BD 0700-0701 ÛÛÛ Ûß 7301 29441 V3  V3 + 001 2BE-2BF 0702-0703 Üß ÛÛ 1330 04912 Jump to integrate 2C0-2C1 0704-0705 ÜßßßÜÜß 72FE 29438 two up left V2  V2 + 254 2C2-2C3 0706-0707 ÛÛÛ Ûß 7301 29441 V3  V3 + 001 2C4-2C5 0708-0709 ÛÜÛ ÜÛÜ A245 41541 I  two balls 2C6-2C7 0710-0711 Üß ÛÛ 1330 04912 Jump to integrate 2C8-2C9 0712-0713 ÛÛÛ ß 7202 29186 two up right V2  V2 + 002 2CA-2CB 0714-0715 ÛÛÛ Ûß 7301 29441 V3  V3 + 001 2CC-2CD 0716-0717 ÛÜÛ ÜÛÜ A245 41541 I  two balls 2CE-2CF 0718-0719 Üß ÛÛ 1330 04912 Jump to integrate 2D0-2D1 0720-0721 ÜßßßÜÜß 72FE 29438 two down left V2  V2 + 254 2D2-2D3 0722-0723 ÜßßßÜÜßß 73FF 29695 V3  V3 + 255 2D4-2D5 0724-0725 ÛÜÛ ÜÛÜ A245 41541 I  two balls 2D6-2D7 0726-0727 Üß ÛÛ 1330 04912 Jump to integrate 2D8-2D9 0728-0729 ÛÛÛ ß 7202 29186 two down right V2  V2 + 002 2DA-2DB 0730-0731 ÜßßßÜÜßß 73FF 29695 V3  V3 + 255 2DC-2DD 0732-0733 ÛÜÛ ÜÛÜ A245 41541 I  two balls 2DE-2DF 0734-0735 Üß ÛÛ 1330 04912 Jump to integrate 2E0-2E1 0736-0737 ÛÛÛ ß 7202 29186 two left up V2  V2 + 002 2E2-2E3 0738-0739 ÛÛÛ Ûß 7301 29441 V3  V3 + 001 2E4-2E5 0740-0741 ÛÜÛ ÜÛÜ A245 41541 I  two balls 2E6-2E7 0742-0743 Üß ÛÛ 1330 04912 Jump to integrate 2E8-2E9 0744-0745 ÜßßßÜÜß 72FE 29438 two right down V2  V2 + 254 2EA-2EB 0746-0747 ÜßßßÜÜßß 73FF 29695 V3  V3 + 255 2EC-2ED 0748-0749 ÛÜÛ ÜÛÜ A245 41541 I  two balls 2EE-2EF 0750-0751 Üß ÛÛ 1330 04912 Jump to integrate 2F0-2F1 0752-0753 ÜßßÜßßßß 6FFF 28671 left targeting VF  255 2F2-2F3 0754-0755 Û Û 5000 20480 Skip next if V0 = V0 2F4-2F5 0756-0757 ÛÛ ÛÛÛß 6F01 28417 right targeting VF  001 2F6-2F7 0758-0759 ÛÜ Û Û 9240 37440 Skip next if V2 <> V4 2F8-2F9 0760-0761 Û ÛÛ 1300 04864 Jump to vertical target 2FA-2FB 0762-0763 ßÜÜÜ ÜÛ 82F4 33524 V2  V2 + VF; VF  overflow 2FC-2FD 0764-0765 ß Û Û 5240 21056 Skip next if V2 = V4 2FE-2FF 0766-0767 Üß ÛÛ 1330 04912 Jump to integrate 300-301 0768-0769 Û ÜÜ Û 8230 33328 vertical target V2  V3 302-303 0770-0771 ÛÜ Ü ÜÛÜ 8255 33365 V2  V2 - V5; VF  borrow 304-305 0772-0773 ÛÜ Û 8240 33344 V2  V4 306-307 0774-0775 Ûß 6020 24608 V0  032 308-309 0776-0777 Û ÛÛÛÛ 4F00 20224 Skip next if VF <> 000 30A-30B 0778-0779 Ûß Ü 6022 24610 V0  034 30C-30D 0780-0781 Üß ÛÛ 1330 04912 Jump to integrate 30E-30F 0782-0783 ÜßßÜßßßß 6FFF 28671 up targeting VF  255 310-311 0784-0785 Û Û 5000 20480 Skip next if V0 = V0 312-313 0786-0787 ÛÛ ÛÛÛß 6F01 28417 down targeting VF  001 314-315 0788-0789 ÛÜ ß ÛÛ 9350 37712 Skip next if V3 <> V5 316-317 0790-0791 ßÜÜßÛ 131E 04894 Jump to up down target 318-319 0792-0793 ßÜÜÜ ÜÛÛ 83F4 33780 V3  V3 + VF; VF  overflow 31A-31B 0794-0795 ß ß ÛÛ 5350 21328 Skip next if V3 = V5 31C-31D 0796-0797 Üß ÛÛ 1330 04912 Jump to integrate 31E-31F 0798-0799 Û Ü ÛÛ 8320 33568 up down target V3  V2 320-321 0800-0801 ÛÜ Ü ÜÛß 8355 33621 V3  V3 - V5; VF  borrow 322-323 0802-0803 ÛÜ Ü ÛÛ 8350 33616 V3  V5 324-325 0804-0805 Ûß Ü 6024 24612 V0  036 326-327 0806-0807 Û ÛÛÛÛ 4F00 20224 Skip next if VF <> 000 328-329 0808-0809 Ûß ÜÜ 6026 24614 V0  038 32A-32B 0810-0811 Üß ÛÛ 1330 04912 Jump to integrate 32C-32D 0812-0813 ÜßßßÜÜß 72FE 29438 left V2  V2 + 254 32E-32F 0814-0815 ÛÛÛ ÛÜ 7201 29185 right V2  V2 + 001 330-331 0816-0817 ÜßÜÜÜÜß 42FE 17150 integrate Skip next if V2 <> 254 332-333 0818-0819 Ü ÜÛÜ ÛÛ 13A8 05032 Jump to new line 334-335 0820-0821 ÜßÜÜÜÜßÜ 42FF 17151 Skip next if V2 <> 255 336-337 0822-0823 Ü ÜÛÜ ÛÛ 13A8 05032 Jump to new line 338-339 0824-0825 ÜßÜÜÜÜßß 43FF 17407 Skip next if V3 <> 255 33A-33B 0826-0827 Ü ÜÛÜ ÛÛ 13A8 05032 Jump to new line 33C-33D 0828-0829 ÜÛ ÛÜ 4281 17025 Skip next if V2 <> 129 33E-33F 0830-0831 Ü ÜÛÜ ÛÛ 13A8 05032 Jump to new line 340-341 0832-0833 ÜÛ Û 4280 17024 Skip next if V2 <> 128 342-343 0834-0835 Ü ÜÛÜ ÛÛ 13A8 05032 Jump to new line 344-345 0836-0837 ß ÛÛ 4340 17216 Skip next if V3 <> 064 346-347 0838-0839 Ü ÜÛÜ ÛÛ 13A8 05032 Jump to new line 348-349 0840-0841 ÛÛÜß ÛÜ D231 53809 Draw 08x01 at V2,V3; VF  XOR 34A-34B 0842-0843 Û ÛÛ 4300 17152 Skip next if V3 <> 000 34C-34D 0844-0845 Ü ÜÛÜ ÛÛ 13A8 05032 Jump to new line 34E-34F 0846-0847 ÛÜÜÜÜßß 433F 17215 Skip next if V3 <> 063 350-351 0848-0849 Ü ÜÛÜ ÛÛ 13A8 05032 Jump to new line 352-353 0850-0851 ÛÜ 4020 16416 Skip next if V0 <> 032 354-355 0852-0853 ÜÜÛ ßÛ 1362 04962 Jump to dispatch 356-357 0854-0855 ÛÜ Ü 4022 16418 Skip next if V0 <> 034 358-359 0856-0857 ÜÜÛ ßÛ 1362 04962 Jump to dispatch 35A-35B 0858-0859 Û Û 4200 16896 Skip next if V2 <> 000 35C-35D 0860-0861 Ü ÜÛÜ ÛÛ 13A8 05032 Jump to new line 35E-35F 0862-0863 ßÜÜÜÜßÜ 427F 17023 Skip next if V2 <> 127 360-361 0864-0865 Ü ÜÛÜ ÛÛ 13A8 05032 Jump to new line 362-363 0866-0867 ÛÜÛ ÜÛ A244 41540 dispatch I  ball 364-365 0868-0869 Û ß 4101 16641 Skip next if V1 <> 001 366-367 0870-0871 ÜÜß ÜÛÛ 1374 04980 Jump to next 368-369 0872-0873 Û ÜÛ 4102 16642 Skip next if V1 <> 002 36A-36B 0874-0875 ÜÜßÜÜÛÛ 137C 04988 Jump to last 36C-36D 0876-0877 Û ÛÛ 8C00 35840 VC  V0 36E-36F 0878-0879 Û Ü Û 8820 34848 V8  V2 370-371 0880-0881 Û ÜÜÛ Û 8930 35120 V9  V3 372-373 0882-0883 Ü ß ÜÛ 1254 04692 Jump to second 374-375 0884-0885 Û ÛÛ Û 8D00 36096 next VD  V0 376-377 0886-0887 Û Ü Û Û 8A20 35360 VA  V2 378-379 0888-0889 Û ÜÜÛ ÛÛ 8B30 35632 VB  V3 37A-37B 0890-0891 Ü ßÜÜß 125E 04702 Jump to third 37C-37D 0892-0893 Û ÛÛÛ 8E00 36352 last VE  V0 37E-37F 0894-0895 Û Ü ÛÛ 8620 34336 V6  V2 380-381 0896-0897 Û ÜÜ ÛÛÛ 8730 34608 V7  V3 382-383 0898-0899 ßÜÛÜ ßÛ A3D2 41938 I  timer 384-385 0900-0901 ÛßßÛ Ü Ü F065 61541 Load V0V0; I  I + 01 386-387 0902-0903 ßÜÛÜ ßÛ A3D2 41938 I  timer 388-389 0904-0905 ÛÛÛ Ü 7001 28673 V0  V0 + 001 38A-38B 0906-0907 Ûß 3010 12304 Skip next if V0 = 016 38C-38D 0908-0909 Ü ßÜ ÛÛ 1398 05016 Jump to save timer 38E-38F 0910-0911 ÜÜ Ü 00C1 00193 Scroll  by 01 390-391 0912-0913 ÛÛ 6000 24576 V0  000 392-393 0914-0915 ÛÛÛ Û ß 7501 29953 V5  V5 + 001 394-395 0916-0917 ß Û Û 4540 17728 Skip next if V5 <> 064 396-397 0918-0919 ÛßÜÜßÜß 653F 25919 V5  063 398-399 0920-0921 ÛßÛß Ü Ü F055 61525 save timer Save V0V0; I  I + 01 39A-39B 0922-0923 ÛÛÛÛÛßßß FF07 65287 exhaust delay VF  delay 39C-39D 0924-0925 ÛÛÛÛÛÛ 3F00 16128 Skip next if VF = 000 39E-39F 0926-0927 Ü ßÜ ßÛ 139A 05018 Jump to exhaust delay 3A0-3A1 0928-0929 ßÜÛ ßÛ A3C2 41922 I  from 3A2-3A3 0930-0931 ÛßßÛ ÜÛß F365 62309 Load V0V3; I  I + 04 3A4-3A5 0932-0933 ÛÜÛ ÜÛ A244 41540 I  ball 3A6-3A7 0934-0935 ß Û 1210 04624 Jump to ovement 3A8-3A9 0936-0937 ÛÛ ÜÜÜÜ C01E 49182 new line V0  ??? AND 030 3AA-3AB 0938-0939 ÛÛ ÛÛßß CF03 52995 VF  ??? AND 003 3AC-3AD 0940-0941 ÛßÜÜÜÜßÜ C27F 49791 V2  ??? AND 127 3AE-3AF 0942-0943 ÛÛÜÜÜÜßß C33F 49983 V3  ??? AND 063 3B0-3B1 0944-0945 Û ÛÛÛÛ 4F00 20224 Skip next if VF <> 000 3B2-3B3 0946-0947 ÛÛ Û 6200 25088 V2  000 3B4-3B5 0948-0949 Û ÛÛÛß 4F01 20225 Skip next if VF <> 001 3B6-3B7 0950-0951 ÛÛ ÛÛ 6300 25344 V3  000 3B8-3B9 0952-0953 Û ÛÛßÛ 4F02 20226 Skip next if VF <> 002 3BA-3BB 0954-0955 ßßÜÜÜßÜ 627F 25215 V2  127 3BC-3BD 0956-0957 Û ÛÛßß 4F03 20227 Skip next if VF <> 003 3BE-3BF 0958-0959 ÛßÜÜÜßß 633F 25407 V3  063 3C0-3C1 0960-0961 ÜÜÛ ßÛ 1362 04962 Jump to dispatch 3C2 0962 ßß 06 006 from 3C3 0963 ß 04 004 3C4 0964 ß 02 002 3C5 0965 ß 08 008 3C6 0966 ßßßßßß 3F 063 3C7 0967 ßßßßß 1F 031 3C8-3C9 0968-0969 0000 00000 3CA-3CB 0970-0971 0000 00000 3CC-3CD 0972-0973 0000 00000 3CE-3CF 0974-0975 0000 00000 3D0-3D1 0976-0977 0000 00000 3D2-3D3 0978-0979 0000 00000 timer The register usage is as follows: V0 Right movement button, holding the identifier code, and holding the timer. V1 Left movement button and cardinal line information. V2 Down movement button, and line horizontal coordinate storage. V3 Up movement button, delay, and line vertical coordinate storage. V4 Horizontal coordinate of player. V5 Vertical coordinate of player. V6 Horizontal coordinate of third line. V7 Vertical coordinate of third line. V8 Horizontal coordinate of first line. V9 Vertical coordinate of first line. VA Horizontal coordinate of second line. VB Vertical coordinate of second line. VC Identifier code of first line. VD Identifier code of second line. VE Identifier code of third line. VF Collision detection and holding a key code. The registers were chosen for the following reasons: V0 Ease of access. V1 Ease of access. V2 Ease of access. V3 Ease of access. V4 Ease of access. V5 Ease of access. V6 It's available. V7 It follows V6. V8 It follows the V4 and V5 pattern. V9 It follows the V4 and V5 pattern. VA It follows the V4 and V5 pattern. VB It follows the V4 and V5 pattern. VC It's even. VD It follows VC. VE It's available and follows VC. VF Unimportance and necessity. The code I'd added is after the name last. As all available registers were used, I had to store the timer elsewhere. Each sixteenth iteration of the program loop has the screen scroll down by a line; when this is done, the player's position is adjusted and the timer reset. The code to restore those first four registers and change I to once again point at the ball have merely been moved. When this was written, I noticed the inadequacy of my previous design, and how inefficient it is to have those separate code segments for separate lines, as compared to a design which wouldn't use every register but would support more lines than can fit in the registers at once; I'm also dissatisfied with how I ran out of time to update the line positions alongside the player's; I'll fix such issues next time. .