A Documenting of mine Extra Enhanced Enchantment CHIP-8 Game In considering removing field wrapping from that previous iteration of this game, I noticed I'd have two extra registers in addition to one not already in use, with three being necessary to add another line, and did so. I've also perfected the line targeting, removed a flaw only noticed recently, and increased the delay due to this added difficulty. Registers and memory locations have been changed, but I'll only document some of these changes, and leave a deeper understanding to the prior article. Follows is a view of the complete game, when loaded into mine MMC: 200-201 0512-0513 ▀▄█▄▄▄█▀ A37E 41854 I ← from 202-203 0514-0515 ▀██▀▀█▀█ FF65 65381 Load V0→VF; I ← I + 16 204-205 0516-0517 ▀ █▄▄ █ A23A 41530 I ← ball 206-207 0518-0519 ▀█ █ ▀ ▄ D451 54353 Draw 08×01 at V4,V5; VF ← XOR 208-209 0520-0521 ▀▀ ▄██▄ CC1E 52254 VC ← ??? AND 030 20A-20B 0522-0523 ▀▀ ▄██▄▀ CD1E 52510 VD ← ??? AND 030 20C-20D 0524-0525 ▀▀ ▄███ CE1E 52766 VE ← ??? AND 030 20E-20F 0526-0527 ▀▀▀█ ▄▀█ F315 62229 movement delay ← V3 210-211 0528-0529 ▀▀ ████ 6F0F 28431 VF ← 015 212-213 0530-0531 █▀█ ▀▀▀█ EFA1 61345 Skip next if VF <> key 214-215 0532-0533 ▀▀▀▀█▀█▀ FF0A 65290 VF ← key 216-217 0534-0535 ▀█ █ ▀ ▄ D451 54353 Draw 08×01 at V4,V5; VF ← XOR 218-219 0536-0537 █▀█ ▄ E0A1 57505 Skip next if V0 <> key 21A-21B 0538-0539 ▀▀▀ ▀ ▄ 7401 29697 V4 ← V4 + 001 21C-21D 0540-0541 █▀█ █ E1A1 57761 Skip next if V1 <> key 21E-21F 0542-0543 ▄███▄█▄▄ 74FF 29951 V4 ← V4 + 255 220-221 0544-0545 █▀█ ▀▄ E2A1 58017 Skip next if V2 <> key 222-223 0546-0547 ▀▀▀ ▀ █ 7501 29953 V5 ← V5 + 001 224-225 0548-0549 █▀█ ▀█ E3A1 58273 Skip next if V3 <> key 226-227 0550-0551 ▄███▄█▄█ 75FF 30207 V5 ← V5 + 255 228-229 0552-0553 ▄█▄▄▄█▄▄ 44FF 17663 Skip next if V4 <> 255 22A-22B 0554-0555 ▀▀ ▀ 6400 25600 V4 ← 000 22C-22D 0556-0557 █ ▀ 4440 17472 Skip next if V4 <> 064 22E-22F 0558-0559 ▀█▄▄█▄▄ 643F 25663 V4 ← 063 230-231 0560-0561 ▄█▄▄▄█▄█ 45FF 17919 Skip next if V5 <> 255 232-233 0562-0563 ▀▀ ▀ ▀ 6500 25856 V5 ← 000 234-235 0564-0565 ▀▄ ▀ ▀ 4520 17696 Skip next if V5 <> 032 236-237 0566-0567 ▀▀▄▄█▄█ 651F 25887 V5 ← 031 238-239 0568-0569 ▀█ █ ▀ ▄ D451 54353 Draw 08×01 at V4,V5; VF ← XOR 23A-23B 0570-0571 █▄ 80C0 32960+ ball V0 ← VC 23C-23D 0572-0573 ▀▀ ▀ 6100 24832 V1 ← 000 23E-23F 0574-0575 █ ▀ 8280 33408 V2 ← V8 240-241 0576-0577 █ ▄ ▀▀ 8390 33680 V3 ← V9 242-243 0578-0579 ▀ ▀▀▀▀ 4F00 20224 Skip next if VF <> 000 244-245 0580-0581 ▀▄▀█▄▄█ B25E 45662 Jump to V0 + table 246-247 0582-0583 ▄▄▄ 00E0 00224 Clear the screen 248-249 0584-0585 ▀ ▀ 1200 04608 Jump to 0512 24A-24B 0586-0587 █▄ ▄ 80D0 32976 second V0 ← VD 24C-24D 0588-0589 ▀▀ █ 6101 24833 V1 ← 001 24E-24F 0590-0591 █ ▄ ▀ 82A0 33440 V2 ← VA 250-251 0592-0593 █ ▄▄ ▀▀ 83B0 33712 V3 ← VB 252-253 0594-0595 ▀▄▀█▄▄█ B25E 45662 Jump to V0 + table 254-255 0596-0597 █▄▄ 80E0 32992 third V0 ← VE 256-257 0598-0599 ▀▀ ▄▀ 6102 24834 V1 ← 002 258-259 0600-0601 ▀▄▄ ▀ 8260 33376 V2 ← V6 25A-25B 0602-0603 ▀▄▄▄ ▀▀ 8370 33648 V3 ← V7 25C-25D 0604-0605 ▀▄▀█▄▄█ B25E 45662 Jump to V0 + table 25E-25F 0606-0607 ▄ ▀ █ 1282 04738 table Jump to up left 260-261 0608-0609 ▄ ▀▄ ▀ 1288 04744 Jump to up right 262-263 0610-0611 ▄ ▀▄▄█ 128E 04750 Jump to down left 264-265 0612-0613 ▄ █ ▄▀ 1294 04756 Jump to down right 266-267 0614-0615 ▄ █▄ █ 129A 04762 Jump to left up 268-269 0616-0617 ▄ ▄▀ ▀ 12A0 04768 Jump to left down 26A-26B 0618-0619 ▄ ▄▀ ▄█ 12A6 04774 Jump to right up 26C-26D 0620-0621 ▄ ▄▀▄▄▀ 12AC 04780 Jump to right down 26E-26F 0622-0623 ▄ ▄█ █ 12B2 04786 Jump to two up left 270-271 0624-0625 ▄ ▄█▄ █ 12BA 04794 Jump to two up right 272-273 0626-0627 ▄▄ ▀ █ 12C2 04802 Jump to two down left 274-275 0628-0629 ▄▄ ▀▄ █ 12CA 04810 Jump to two down right 276-277 0630-0631 ▄▄ █ █ 12D2 04818 Jump to two left up 278-279 0632-0633 ▄▄ █▄ █ 12DA 04826 Jump to two right down 27A-27B 0634-0635 ▄▄▄▀ █ 12E2 04834 Jump to left targeting 27C-27D 0636-0637 ▄▄▄▀ ▄█ 12E6 04838 Jump to right targeting 27E-27F 0638-0639 ▀ ▀▀ 1300 04864 Jump to up 280-281 0640-0641 ▀ █▀ 1302 04866 Jump to down 282-283 0642-0643 ▄███▄▄█▄ 72FF 29439 up left V2 ← V2 + 255 284-285 0644-0645 ▀▀▀ ▀█ 7301 29441 V3 ← V3 + 001 286-287 0646-0647 ▀ ▄▀▀ 1304 04868 Jump to integrate 288-289 0648-0649 ▀▀▀ ▀▄ 7201 29185 up right V2 ← V2 + 001 28A-28B 0650-0651 ▀▀▀ ▀█ 7301 29441 V3 ← V3 + 001 28C-28D 0652-0653 ▀ ▄▀▀ 1304 04868 Jump to integrate 28E-28F 0654-0655 ▄███▄▄█▄ 72FF 29439 down left V2 ← V2 + 255 290-291 0656-0657 ▄███▄▄██ 73FF 29695 V3 ← V3 + 255 292-293 0658-0659 ▀ ▄▀▀ 1304 04868 Jump to integrate 294-295 0660-0661 ▀▀▀ ▀▄ 7201 29185 down right V2 ← V2 + 001 296-297 0662-0663 ▄███▄▄██ 73FF 29695 V3 ← V3 + 255 298-299 0664-0665 ▀ ▄▀▀ 1304 04868 Jump to integrate 29A-29B 0666-0667 ▀▀▀ ▀▄ 7201 29185 left up V2 ← V2 + 001 29C-29D 0668-0669 ▄███▄▄██ 73FF 29695 V3 ← V3 + 255 29E-29F 0670-0671 ▀ ▄▀▀ 1304 04868 Jump to integrate 2A0-2A1 0672-0673 ▀▀▀ ▀▄ 7201 29185 left down V2 ← V2 + 001 2A2-2A3 0674-0675 ▀▀▀ ▀█ 7301 29441 V3 ← V3 + 001 2A4-2A5 0676-0677 ▀ ▄▀▀ 1304 04868 Jump to integrate 2A6-2A7 0678-0679 ▄███▄▄█▄ 72FF 29439 right up V2 ← V2 + 255 2A8-2A9 0680-0681 ▄███▄▄██ 73FF 29695 V3 ← V3 + 255 2AA-2AB 0682-0683 ▀ ▄▀▀ 1304 04868 Jump to integrate 2AC-2AD 0684-0685 ▄███▄▄█▄ 72FF 29439 right down V2 ← V2 + 255 2AE-2AF 0686-0687 ▀▀▀ ▀█ 7301 29441 V3 ← V3 + 001 2B0-2B1 0688-0689 ▀ ▄▀▀ 1304 04868 Jump to integrate 2B2-2B3 0690-0691 ▄███▄▄█ 72FE 29438 two up left V2 ← V2 + 254 2B4-2B5 0692-0693 ▀▀▀ ▀█ 7301 29441 V3 ← V3 + 001 2B6-2B7 0694-0695 ▀ █▄▄ █▄ A23B 41531 I ← two balls 2B8-2B9 0696-0697 ▀ ▄▀▀ 1304 04868 Jump to integrate 2BA-2BB 0698-0699 ▀▀▀ █ 7202 29186 two up right V2 ← V2 + 002 2BC-2BD 0700-0701 ▀▀▀ ▀█ 7301 29441 V3 ← V3 + 001 2BE-2BF 0702-0703 ▀ █▄▄ █▄ A23B 41531 I ← two balls 2C0-2C1 0704-0705 ▀ ▄▀▀ 1304 04868 Jump to integrate 2C2-2C3 0706-0707 ▄███▄▄█ 72FE 29438 two down left V2 ← V2 + 254 2C4-2C5 0708-0709 ▄███▄▄██ 73FF 29695 V3 ← V3 + 255 2C6-2C7 0710-0711 ▀ █▄▄ █▄ A23B 41531 I ← two balls 2C8-2C9 0712-0713 ▀ ▄▀▀ 1304 04868 Jump to integrate 2CA-2CB 0714-0715 ▀▀▀ █ 7202 29186 two down right V2 ← V2 + 002 2CC-2CD 0716-0717 ▄███▄▄██ 73FF 29695 V3 ← V3 + 255 2CE-2CF 0718-0719 ▀ █▄▄ █▄ A23B 41531 I ← two balls 2D0-2D1 0720-0721 ▀ ▄▀▀ 1304 04868 Jump to integrate 2D2-2D3 0722-0723 ▀▀▀ █ 7202 29186 two left up V2 ← V2 + 002 2D4-2D5 0724-0725 ▀▀▀ ▀█ 7301 29441 V3 ← V3 + 001 2D6-2D7 0726-0727 ▀ █▄▄ █▄ A23B 41531 I ← two balls 2D8-2D9 0728-0729 ▀ ▄▀▀ 1304 04868 Jump to integrate 2DA-2DB 0730-0731 ▄███▄▄█ 72FE 29438 two right down V2 ← V2 + 254 2DC-2DD 0732-0733 ▄███▄▄██ 73FF 29695 V3 ← V3 + 255 2DE-2DF 0734-0735 ▀ █▄▄ █▄ A23B 41531 I ← two balls 2E0-2E1 0736-0737 ▀ ▄▀▀ 1304 04868 Jump to integrate 2E2-2E3 0738-0739 ▄██▄████ 6FFF 28671 left targeting VF ← 255 2E4-2E5 0740-0741 ▀ ▀ 5000 20480 Skip next if V0 = V0 2E6-2E7 0742-0743 ▀▀ ▀▀▀█ 6F01 28417 right targeting VF ← 001 2E8-2E9 0744-0745 ▀▄ ▀ ▀ 9240 37440 Skip next if V2 <> V4 2EA-2EB 0746-0747 ▄▄▄█ █ 12F2 04850 Jump to target 2EC-2ED 0748-0749 █▄▄▄ ▄▀ 82F4 33524 V2 ← V2 + VF; VF ← overflow 2EE-2EF 0750-0751 █ ▀ ▀ 5240 21056 Skip next if V2 = V4 2F0-2F1 0752-0753 ▀ ▄▀▀ 1304 04868 Jump to integrate 2F2-2F3 0754-0755 ▀ ▄▄ ▀ 8230 33328 target V2 ← V3 2F4-2F5 0756-0757 ▀▄ ▄ ▄▀▄ 8255 33365 V2 ← V2 − V5; VF ← borrow 2F6-2F7 0758-0759 ▀▄ ▀ 8240 33344 V2 ← V4 2F8-2F9 0760-0761 ▀█ 6020 24608 V0 ← 032 2FA-2FB 0762-0763 ▀ ▀▀▀▀ 4F00 20224 Skip next if VF <> 000 2FC-2FD 0764-0765 ▀█ ▄ 6022 24610 V0 ← 034 2FE-2FF 0766-0767 ▀ ▄▀▀ 1304 04868 Jump to integrate 300-301 0768-0769 ▄███▄▄█▀ 73FE 29694 up V3 ← V3 + 254 302-303 0770-0771 ▀▀▀ ▀█ 7301 29441 down V3 ← V3 + 001 304-305 0772-0773 ▄█▄▄▄▄█ 42FE 17150 integrate Skip next if V2 <> 254 306-307 0774-0775 ▄▄▀ ▄▀▀ 1364 04964 Jump to new line 308-309 0776-0777 ▄█▄▄▄▄█▄ 42FF 17151 Skip next if V2 <> 255 30A-30B 0778-0779 ▄▄▀ ▄▀▀ 1364 04964 Jump to new line 30C-30D 0780-0781 ▄█▄▄▄▄██ 43FF 17407 Skip next if V3 <> 255 30E-30F 0782-0783 ▄▄▀ ▄▀▀ 1364 04964 Jump to new line 310-311 0784-0785 █ ▀▄ 4241 16961 Skip next if V2 <> 065 312-313 0786-0787 ▄▄▀ ▄▀▀ 1364 04964 Jump to new line 314-315 0788-0789 █ ▀ 4240 16960 Skip next if V2 <> 064 316-317 0790-0791 ▄▄▀ ▄▀▀ 1364 04964 Jump to new line 318-319 0792-0793 ▀▄ ▀▀ 4320 17184 Skip next if V3 <> 032 31A-31B 0794-0795 ▄▄▀ ▄▀▀ 1364 04964 Jump to new line 31C-31D 0796-0797 ▀▀▄█ ▀▄ D231 53809 Draw 08×01 at V2,V3; VF ← XOR 31E-31F 0798-0799 ▀ ▀▀ 4300 17152 Skip next if V3 <> 000 320-321 0800-0801 ▄▄▀ ▄▀▀ 1364 04964 Jump to new line 322-323 0802-0803 ▀ ▄▄▄██ 431F 17183 Skip next if V3 <> 031 324-325 0804-0805 ▄▄▀ ▄▀▀ 1364 04964 Jump to new line 326-327 0806-0807 ▀▄ 4020 16416 Skip next if V0 <> 032 328-329 0808-0809 ▄█ ▄█▀ 1336 04918 Jump to dispatch 32A-32B 0810-0811 ▀▄ ▄ 4022 16418 Skip next if V0 <> 034 32C-32D 0812-0813 ▄█ ▄█▀ 1336 04918 Jump to dispatch 32E-32F 0814-0815 ▀ ▀ 4200 16896 Skip next if V2 <> 000 330-331 0816-0817 ▄▄▀ ▄▀▀ 1364 04964 Jump to new line 332-333 0818-0819 ▀▄▄▄▄█▄ 423F 16959 Skip next if V2 <> 063 334-335 0820-0821 ▄▄▀ ▄▀▀ 1364 04964 Jump to new line 336-337 0822-0823 ▀ █▄▄ █ A23A 41530 dispatch I ← ball 338-339 0824-0825 ▀ █ 4101 16641 Skip next if V1 <> 001 33A-33B 0826-0827 ▄ ▀▄ ▀▀ 1348 04936 Jump to next 33C-33D 0828-0829 ▀ ▄▀ 4102 16642 Skip next if V1 <> 002 33E-33F 0830-0831 ▄ █ ▀▀ 1350 04944 Jump to last 340-341 0832-0833 ▀ ▀▀ 8C00 35840 VC ← V0 342-343 0834-0835 ▀ ▄ ▀ 8820 34848 V8 ← V2 344-345 0836-0837 ▀ ▄▄▀ ▀ 8930 35120 V9 ← V3 346-347 0838-0839 ▄ ▀▄ █ 124A 04682 Jump to second 348-349 0840-0841 ▀ ▀▀ ▀ 8D00 36096 next VD ← V0 34A-34B 0842-0843 ▀ ▄ ▀ ▀ 8A20 35360 VA ← V2 34C-34D 0844-0845 ▀ ▄▄▀ ▀▀ 8B30 35632 VB ← V3 34E-34F 0846-0847 ▄ █ ▄▀ 1254 04692 Jump to third 350-351 0848-0849 ▀ ▀▀▀ 8E00 36352 last VE ← V0 352-353 0850-0851 ▀ ▄ ▀▀ 8620 34336 V6 ← V2 354-355 0852-0853 ▀ ▄▄ ▀▀▀ 8730 34608 V7 ← V3 356-357 0854-0855 ▀▄█▄▄▄█▀ A37E 41854 I ← from 358-359 0856-0857 ▀██▀ ▄▀█ F365 62309 Load V0→V3; I ← I + 04 35A-35B 0858-0859 ▀ █▄▄ █ A23A 41530 I ← ball 35C-35D 0860-0861 ▀▀▀▀▀███ FF07 65287 exhaust delay VF ← delay 35E-35F 0862-0863 ▀▀▀▀▀▀ 3F00 16128 Skip next if VF = 000 360-361 0864-0865 ▄ █▄▄▀▀ 135C 04956 Jump to exhaust delay 362-363 0866-0867 ▀▄▄█ 120E 04622 Jump to movement 364-365 0868-0869 ▀▀ ▄▄▄▄ C01E 49182 new line V0 ← ??? AND 030 366-367 0870-0871 ▀▀ ▀▀██ CF03 52995 VF ← ??? AND 003 368-369 0872-0873 ▀▀▄▄▄▄█▄ C23F 49727 V2 ← ??? AND 063 36A-36B 0874-0875 ▀▀ ▄▄▄██ C31F 49951 V3 ← ??? AND 031 36C-36D 0876-0877 ▀ ▀▀▀▀ 4F00 20224 Skip next if VF <> 000 36E-36F 0878-0879 ▀▀ ▀ 6200 25088 V2 ← 000 370-371 0880-0881 ▀ ▀▀▀█ 4F01 20225 Skip next if VF <> 001 372-373 0882-0883 ▀▀ ▀▀ 6300 25344 V3 ← 000 374-375 0884-0885 ▀ ▀▀█▀ 4F02 20226 Skip next if VF <> 002 376-377 0886-0887 ▀█▄▄▄█▄ 623F 25151 V2 ← 063 378-379 0888-0889 ▀ ▀▀██ 4F03 20227 Skip next if VF <> 003 37A-37B 0890-0891 ▀▀▄▄▄██ 631F 25375 V3 ← 031 37C-37D 0892-0893 ▄█ ▄█▀ 1336 04918 Jump to dispatch 37E 0894 ██ 06 006 from 37F 0895 █ 04 004 380 0896 █ 02 002 381 0897 █ 08 008 382 0898 █████ 1F 031 383 0899 ████ 0F 015 The register usage is as follows: V0 Right movement button and holding the identifier code. 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. I noticed some unnecessary vertical coordinate checks in that integrate segment, which only moves in increments of one, and removed them. I'm pleased with my left and right targeting code, which still appropriately share code; unfortunately, the state of VF by that point isn't consistent, requiring I avoid combining them as I did with the up and down. I'm most pleased with the target code: I needed another register, unable to use VF, and noticed that code is only entered through register equality; thus, that register was already saved, and I was able to nicely restore it with but one instruction. The delay code was moved to a better location, as mentioned regarding that prior. Lastly, I noticed only one targeting line was being used, and realized that my new line code would only generate those starting coordinates required for roughly half of the lines; correcting this required only expanding the domain of random state, and now my game seems truly complete. I'll try to avoid further change. .