A Documenting of the Craps CHIP-8 Game This is documentation for the craps game provided in the sixth edition of VIPER magazine; follows is a view of the program when it is first loaded into the tool: 200-201 0512-0513  ▀▀ ▄ ▀ 6108 24840  V1 ← 008 202-203 0514-0515  ▄▀▄▄ ▀ 2258 08792  Call 0600 204-205 0516-0517  ▀▀▄ ▄▀ 6112 24850  V1 ← 018 206-207 0518-0519  ▄▀▄▄ ▀ 2258 08792  Call 0600 208-209 0520-0521 ▀▀▀▀█▀█ FE0A 65034  VE ← key 20A-20B 0522-0523  ▀▀ ▄ █ 6109 24841  V1 ← 009 20C-20D 0524-0525  ▄█ ▀ 2260 08800  Call 0608 20E-20F 0526-0527 ▀ ▀▀▀ 8700 34560  V7 ← V0 210-211 0528-0529  ▀▀▄ ▄█ 6113 24851  V1 ← 019 212-213 0530-0531  ▄█ ▀ 2260 08800  Call 0608 214-215 0532-0533 ▀ ▀ 8800 34816  V8 ← V0 216-217 0534-0535 █ ▀ ▀ 8980 35200  V9 ← V8 218-219 0536-0537 ▀▄▄▄▀▄ ▀ 8974 35188  V9 ← V9 + V7; VF ← overflow 21A-21B 0538-0539  ▀ ▀ ▄▀ 4902 18690  Skip next if V9 <> 002 21C-21D 0540-0541 ▄ █▄▄▀ 129C 04764  Jump to 0668 21E-21F 0542-0543  ▀ ▀ ▄█ 4903 18691  Skip next if V9 <> 003 220-221 0544-0545 ▄ █▄▄▀ 129C 04764  Jump to 0668 222-223 0546-0547  ▀ █▄ ▀ 490C 18700  Skip next if V9 <> 012 224-225 0548-0549 ▄ █▄▄▀ 129C 04764  Jump to 0668 226-227 0550-0551  ▀ ▀▄▄█ 4907 18695  Skip next if V9 <> 007 228-229 0552-0553 ▄ ▀▄▄▀ 128C 04748  Jump to 0652 22A-22B 0554-0555  ▀ █ ▄█ 490B 18699  Skip next if V9 <> 011 22C-22D 0556-0557 ▄ ▀▄▄▀ 128C 04748  Jump to 0652 22E-22F 0558-0559 █ ▄▀ ▀ 8A90 35472  VA ← V9 230-231 0560-0561  █▀ 6040 24640  V0 ← 064 232-233 0562-0563 ▀▀▀█ ▄ ▄ F015 61461  delay ← V0 234-235 0564-0565 ▀▀▀▀ ▄▄▄ F007 61447  V0 ← delay 236-237 0566-0567  ▀▀ 3000 12288  Skip next if V0 = 000 238-239 0568-0569  ▄█ ▄▀ 1234 04660  Jump to 0564 23A-23B 0570-0571  ▄█▄▄▄▀ 227C 08828  Call 0636 23C-23D 0572-0573 ▀▀▀▀█▀█ FE0A 65034  VE ← key 23E-23F 0574-0575  ▀▀ ▄ █ 6109 24841  V1 ← 009 240-241 0576-0577  ▄█ ▀ 2260 08800  Call 0608 242-243 0578-0579 ▀ ▀▀▀ 8700 34560  V7 ← V0 244-245 0580-0581  ▀▀▄ ▄█ 6113 24851  V1 ← 019 246-247 0582-0583  ▄█ ▀ 2260 08800  Call 0608 248-249 0584-0585 ▀ ▀ 8800 34816  V8 ← V0 24A-24B 0586-0587 █ ▀ ▀ 8980 35200  V9 ← V8 24C-24D 0588-0589 ▀▄▄▄▀▄ ▀ 8974 35188  V9 ← V9 + V7; VF ← overflow 24E-24F 0590-0591 █ ▄▀▀ ▀ 99A0 39328  Skip next if V9 <> VA 250-251 0592-0593 ▄ ▀▄▄▀ 128C 04748  Jump to 0652 252-253 0594-0595  ▀ ▀▄▄█ 4907 18695  Skip next if V9 <> 007 254-255 0596-0597 ▄ █▄▄▀ 129C 04764  Jump to 0668 256-257 0598-0599  ▄█ ▀ 1230 04656  Jump to 0560 258-259 0600-0601 █▄█▄ ▀ A2F0 41712  I ← 0752 25A-25B 0602-0603  ▀▀ ▄ ▀ 6208 25096  V2 ← 008 25C-25D 0604-0605 ▀▀▄▀ ▄▄█ D127 53543  Draw 08×07 at V1,V2; VF ← XOR 25E-25F 0606-0607 ▄▄▄ ▄▄▄ 00EE 00238  Return 260-261 0608-0609  ▀▀ ▀▀▄ 6601 26113  V6 ← 001 262-263 0610-0611  ▀▀ ▄ ▀▄ 6209 25097  V2 ← 009 264-265 0612-0613  ▀▀ ▄ 6001 24577  V0 ← 001 266-267 0614-0615 ▀▀█▀▄ ▄ F029 61481  I ← digit sprite of V0 268-269 0616-0617 ▀▀▄▀ ▄ █ D125 53541  Draw 08×05 at V1,V2; VF ← XOR 26A-26B 0618-0619 ▀▀▀█▄▀▀ F618 63000  sound ← V6 26C-26D 0620-0621 ▀▀ ▄██ C307 49927  V3 ← ??? AND 007 26E-26F 0622-0623  ▀ ▀▀ 4300 17152  Skip next if V3 <> 000 270-271 0624-0625 ▄▄▄ ▄▄▄ 00EE 00238  Return 272-273 0626-0627  ▀▀▀ ▄ 7001 28673  V0 ← V0 + 001 274-275 0628-0629 ▀▀▄▀ ▄ █ D125 53541  Draw 08×05 at V1,V2; VF ← XOR 276-277 0630-0631  ▀▀ ▄▄▄ 3007 12295  Skip next if V0 = 007 278-279 0632-0633  ▄▄▀ ▄█ 1266 04710  Jump to 0614 27A-27B 0634-0635  ▄▄▀ ▄▀ 1264 04708  Jump to 0612 27C-27D 0636-0637  ▀▀ ▄ ▀▄ 6209 25097  V2 ← 009 27E-27F 0638-0639  ▀▀ ▄ █ 6109 24841  V1 ← 009 280-281 0640-0641 ▀▀█▀▄▀▀█ F729 63273  I ← digit sprite of V7 282-283 0642-0643 ▀▀▄▀ ▄ █ D125 53541  Draw 08×05 at V1,V2; VF ← XOR 284-285 0644-0645  ▀▀▄ ▄█ 6113 24851  V1 ← 019 286-287 0646-0647 ▀▀█▀█ ▄ F829 63529  I ← digit sprite of V8 288-289 0648-0649 ▀▀▄▀ ▄ █ D125 53541  Draw 08×05 at V1,V2; VF ← XOR 28A-28B 0650-0651 ▄▄▄ ▄▄▄ 00EE 00238  Return 28C-28D 0652-0653 █ █ ▄▄▀ A2AC 41644  I ← 0684 28E-28F 0654-0655  ▀▀ 6000 24576  V0 ← 000 290-291 0656-0657  ▀▀▄ ▄ █ 6115 24853  V1 ← 021 292-293 0658-0659 ▀▀ █ ▄ ▄ D015 53269  Draw 08×05 at V0,V1; VF ← XOR 294-295 0660-0661 █ █▄ ▀▄ A2B1 41649  I ← 0689 296-297 0662-0663  ▀▀ ▄ 6008 24584  V0 ← 008 298-299 0664-0665 ▀▀ █ ▄ ▄ D015 53269  Draw 08×05 at V0,V1; VF ← XOR 29A-29B 0666-0667 ▄ █▄ █ 129A 04762  Jump to 0666 29C-29D 0668-0669 █ █▄ ▄█ A2B6 41654  I ← 0694 29E-29F 0670-0671  ▀▀ 6000 24576  V0 ← 000 2A0-2A1 0672-0673  ▀▀▄ ▀ 6110 24848  V1 ← 016 2A2-2A3 0674-0675 ▀▀ █ ▄ ▄ D015 53269  Draw 08×05 at V0,V1; VF ← XOR 2A4-2A5 0676-0677 █ █▄▄ █▄ A2BB 41659  I ← 0699 2A6-2A7 0678-0679  ▀▀ ▄ 6008 24584  V0 ← 008 2A8-2A9 0680-0681 ▀▀ █ ▄ ▄ D015 53269  Draw 08×05 at V0,V1; VF ← XOR 2AA-2AB 0682-0683 ▄ ▄▀▄ █ 12AA 04778  Jump to 0682 2AC-2AD 0684-0685 █ █ ▀█ 8B89 35721 2AE-2AF 0686-0687 █ ▄ █ █ 89A9 35241 2B0-2B1 0688-0689 █▀▄█▀ █▀ DBB2 56242  Draw 08×02 at VB,VB; VF ← XOR 2B2-2B3 0690-0691  █▀▄ █ 322A 12842  Skip next if V2 = 042 2B4-2B5 0692-0693 ▄ █ ██ 26A6 09894  Call 1702 2B6-2B7 0694-0695 █ █▀█ 8E8A 36490 2B8-2B9 0696-0697 █ █ █ 8A8A 35466 2BA-2BB 0698-0699 ███ ███ EEEE 61166 2BC-2BD 0700-0701 █▄▄ █▄ 88EC 35052 2BE-2BF 0702-0703 ▄▄█ █▄▄ 28EE 10478  Call 2286 Follows now is the fully annotated view of the program when it is loaded into the tool: 200-201 0512-0513  ▀▀ ▄ ▀ 6108 24840  V1 ← 008 202-203 0514-0515  ▄▀▄▄ ▀ 2258 08792  Call impotent 204-205 0516-0517  ▀▀▄ ▄▀ 6112 24850  V1 ← 018 206-207 0518-0519  ▄▀▄▄ ▀ 2258 08792  Call impotent 208-209 0520-0521 ▀▀▀▀█▀█ FE0A 65034  VE ← key 20A-20B 0522-0523  ▀▀ ▄ █ 6109 24841  V1 ← 009 20C-20D 0524-0525  ▄█ ▀ 2260 08800  Call random draw 20E-20F 0526-0527 ▀ ▀▀▀ 8700 34560  V7 ← V0 210-211 0528-0529  ▀▀▄ ▄█ 6113 24851  V1 ← 019 212-213 0530-0531  ▄█ ▀ 2260 08800  Call random draw 214-215 0532-0533 ▀ ▀ 8800 34816  V8 ← V0 216-217 0534-0535 █ ▀ ▀ 8980 35200  V9 ← V8 218-219 0536-0537 ▀▄▄▄▀▄ ▀ 8974 35188  V9 ← V9 + V7; VF ← overflow 21A-21B 0538-0539  ▀ ▀ ▄▀ 4902 18690  Skip next if V9 <> 002 21C-21D 0540-0541 ▄ █▄▄▀ 129C 04764  Jump to lose 21E-21F 0542-0543  ▀ ▀ ▄█ 4903 18691  Skip next if V9 <> 003 220-221 0544-0545 ▄ █▄▄▀ 129C 04764  Jump to lose 222-223 0546-0547  ▀ █▄ ▀ 490C 18700  Skip next if V9 <> 012 224-225 0548-0549 ▄ █▄▄▀ 129C 04764  Jump to lose 226-227 0550-0551  ▀ ▀▄▄█ 4907 18695  Skip next if V9 <> 007 228-229 0552-0553 ▄ ▀▄▄▀ 128C 04748  Jump to win 22A-22B 0554-0555  ▀ █ ▄█ 490B 18699  Skip next if V9 <> 011 22C-22D 0556-0557 ▄ ▀▄▄▀ 128C 04748  Jump to win 22E-22F 0558-0559 █ ▄▀ ▀ 8A90 35472  VA ← V9 230-231 0560-0561  █▀ 6040 24640  again V0 ← 064 232-233 0562-0563 ▀▀▀█ ▄ ▄ F015 61461  delay ← V0 234-235 0564-0565 ▀▀▀▀ ▄▄▄ F007 61447  delay V0 ← delay 236-237 0566-0567  ▀▀ 3000 12288  Skip next if V0 = 000 238-239 0568-0569  ▄█ ▄▀ 1234 04660  Jump to delay 23A-23B 0570-0571  ▄█▄▄▄▀ 227C 08828  Call deal draw 23C-23D 0572-0573 ▀▀▀▀█▀█ FE0A 65034  VE ← key 23E-23F 0574-0575  ▀▀ ▄ █ 6109 24841  V1 ← 009 240-241 0576-0577  ▄█ ▀ 2260 08800  Call random draw 242-243 0578-0579 ▀ ▀▀▀ 8700 34560  V7 ← V0 244-245 0580-0581  ▀▀▄ ▄█ 6113 24851  V1 ← 019 246-247 0582-0583  ▄█ ▀ 2260 08800  Call random draw 248-249 0584-0585 ▀ ▀ 8800 34816  V8 ← V0 24A-24B 0586-0587 █ ▀ ▀ 8980 35200  V9 ← V8 24C-24D 0588-0589 ▀▄▄▄▀▄ ▀ 8974 35188  V9 ← V9 + V7; VF ← overflow 24E-24F 0590-0591 █ ▄▀▀ ▀ 99A0 39328  Skip next if V9 <> VA 250-251 0592-0593 ▄ ▀▄▄▀ 128C 04748  Jump to win 252-253 0594-0595  ▀ ▀▄▄█ 4907 18695  Skip next if V9 <> 007 254-255 0596-0597 ▄ █▄▄▀ 129C 04764  Jump to lose 256-257 0598-0599  ▄█ ▀ 1230 04656  Jump to again 258-259 0600-0601 █▄█▄ ▀ A2F0 41712  impotent I ← 0752 25A-25B 0602-0603  ▀▀ ▄ ▀ 6208 25096  V2 ← 008 25C-25D 0604-0605 ▀▀▄▀ ▄▄█ D127 53543  Draw 08×07 at V1,V2; VF ← XOR 25E-25F 0606-0607 ▄▄▄ ▄▄▄ 00EE 00238  Return 260-261 0608-0609  ▀▀ ▀▀▄ 6601 26113  random draw V6 ← 001 262-263 0610-0611  ▀▀ ▄ ▀▄ 6209 25097  V2 ← 009 264-265 0612-0613  ▀▀ ▄ 6001 24577  over V0 ← 001 266-267 0614-0615 ▀▀█▀▄ ▄ F029 61481  from I ← digit sprite of V0 268-269 0616-0617 ▀▀▄▀ ▄ █ D125 53541  Draw 08×05 at V1,V2; VF ← XOR 26A-26B 0618-0619 ▀▀▀█▄▀▀ F618 63000  sound ← V6 26C-26D 0620-0621 ▀▀ ▄██ C307 49927  V3 ← ??? AND 007 26E-26F 0622-0623  ▀ ▀▀ 4300 17152  Skip next if V3 <> 000 270-271 0624-0625 ▄▄▄ ▄▄▄ 00EE 00238  Return 272-273 0626-0627  ▀▀▀ ▄ 7001 28673  V0 ← V0 + 001 274-275 0628-0629 ▀▀▄▀ ▄ █ D125 53541  Draw 08×05 at V1,V2; VF ← XOR 276-277 0630-0631  ▀▀ ▄▄▄ 3007 12295  Skip next if V0 = 007 278-279 0632-0633  ▄▄▀ ▄█ 1266 04710  Jump to from 27A-27B 0634-0635  ▄▄▀ ▄▀ 1264 04708  Jump to over 27C-27D 0636-0637  ▀▀ ▄ ▀▄ 6209 25097  deal draw V2 ← 009 27E-27F 0638-0639  ▀▀ ▄ █ 6109 24841  V1 ← 009 280-281 0640-0641 ▀▀█▀▄▀▀█ F729 63273  I ← digit sprite of V7 282-283 0642-0643 ▀▀▄▀ ▄ █ D125 53541  Draw 08×05 at V1,V2; VF ← XOR 284-285 0644-0645  ▀▀▄ ▄█ 6113 24851  V1 ← 019 286-287 0646-0647 ▀▀█▀█ ▄ F829 63529  I ← digit sprite of V8 288-289 0648-0649 ▀▀▄▀ ▄ █ D125 53541  Draw 08×05 at V1,V2; VF ← XOR 28A-28B 0650-0651 ▄▄▄ ▄▄▄ 00EE 00238  Return 28C-28D 0652-0653 █ █ ▄▄▀ A2AC 41644  win I ← wi 28E-28F 0654-0655  ▀▀ 6000 24576  V0 ← 000 290-291 0656-0657  ▀▀▄ ▄ █ 6115 24853  V1 ← 021 292-293 0658-0659 ▀▀ █ ▄ ▄ D015 53269  Draw 08×05 at V0,V1; VF ← XOR 294-295 0660-0661 █ █▄ ▀▄ A2B1 41649  I ← n 296-297 0662-0663  ▀▀ ▄ 6008 24584  V0 ← 008 298-299 0664-0665 ▀▀ █ ▄ ▄ D015 53269  Draw 08×05 at V0,V1; VF ← XOR 29A-29B 0666-0667 ▄ █▄ █ 129A 04762  self Jump to self 29C-29D 0668-0669 █ █▄ ▄█ A2B6 41654  lose I ← lo 29E-29F 0670-0671  ▀▀ 6000 24576  V0 ← 000 2A0-2A1 0672-0673  ▀▀▄ ▀ 6110 24848  V1 ← 016 2A2-2A3 0674-0675 ▀▀ █ ▄ ▄ D015 53269  Draw 08×05 at V0,V1; VF ← XOR 2A4-2A5 0676-0677 █ █▄▄ █▄ A2BB 41659  I ← se 2A6-2A7 0678-0679  ▀▀ ▄ 6008 24584  V0 ← 008 2A8-2A9 0680-0681 ▀▀ █ ▄ ▄ D015 53269  Draw 08×05 at V0,V1; VF ← XOR 2AA-2AB 0682-0683 ▄ ▄▀▄ █ 12AA 04778  end Jump to end 2AC 0684 █ █ ██ 8B 139  wi 2AD 0685 █ █ █ 89 137 2AE 0686 █ █ █ 89 137 2AF 0687 █ █ █ █ A9 169 2B0 0688 ██ ██ ██ DB 219 2B1 0689 █ ██ █ B2 178  n 2B2 0690  ██ █ 32 050 2B3 0691  █ █ █ 2A 042 2B4 0692  █ ██ 26 038 2B5 0693 █ █ ██ A6 166 2B6 0694 █ ███ 8E 142  lo 2B7 0695 █ █ █ 8A 138 2B8 0696 █ █ █ 8A 138 2B9 0697 █ █ █ 8A 138 2BA 0698 ███ ███ EE 238 2BB 0699 ███ ███ EE 238  se 2BC 0700 █ █ 88 136 2BD 0701 ███ ██ EC 236 2BE 0702  █ █ 28 040 2BF 0703 ███ ███ EE 238 The register usage is as follows: V0 Manipulating the delay register; hold an integer returned from a routine. Horizontal positioning of some sprites. V1 Horizontal and vertical positioning of some sprites. V2 Vertical positioning of some sprites. V3 Store a random value. V4 Unused. V5 Unused. V6 Manipulating the sound register. V7 Store another register value. V8 Store another register value. V9 Store a sum. VA Store a sum. VB Unused. VC Unused. VD Unused. VE Store a key. VF Unused. The game begins by initializing register one, to parameterize the impotent routine, which doesn't do anything. It then halts until a key is pressed, but never uses the result: 200-201 0512-0513  ▀▀ ▄ ▀ 6108 24840  V1 ← 008 202-203 0514-0515  ▄▀▄▄ ▀ 2258 08792  Call impotent 204-205 0516-0517  ▀▀▄ ▄▀ 6112 24850  V1 ← 018 206-207 0518-0519  ▄▀▄▄ ▀ 2258 08792  Call impotent 208-209 0520-0521 ▀▀▀▀█▀█ FE0A 65034  VE ← key The game then uses register one to parameterize the random draw routine, storing the results in zero to registers seven and eight across two calls: 20A-20B 0522-0523  ▀▀ ▄ █ 6109 24841  V1 ← 009 20C-20D 0524-0525  ▄█ ▀ 2260 08800  Call random draw 20E-20F 0526-0527 ▀ ▀▀▀ 8700 34560  V7 ← V0 210-211 0528-0529  ▀▀▄ ▄█ 6113 24851  V1 ← 019 212-213 0530-0531  ▄█ ▀ 2260 08800  Call random draw 214-215 0532-0533 ▀ ▀ 8800 34816  V8 ← V0 The sum of the two calls are stored into register nine and winning or losing is then determined from this in an obvious way, with fall-through otherwise: 216-217 0534-0535 █ ▀ ▀ 8980 35200  V9 ← V8 218-219 0536-0537 ▀▄▄▄▀▄ ▀ 8974 35188  V9 ← V9 + V7; VF ← overflow 21A-21B 0538-0539  ▀ ▀ ▄▀ 4902 18690  Skip next if V9 <> 002 21C-21D 0540-0541 ▄ █▄▄▀ 129C 04764  Jump to lose 21E-21F 0542-0543  ▀ ▀ ▄█ 4903 18691  Skip next if V9 <> 003 220-221 0544-0545 ▄ █▄▄▀ 129C 04764  Jump to lose 222-223 0546-0547  ▀ █▄ ▀ 490C 18700  Skip next if V9 <> 012 224-225 0548-0549 ▄ █▄▄▀ 129C 04764  Jump to lose 226-227 0550-0551  ▀ ▀▄▄█ 4907 18695  Skip next if V9 <> 007 228-229 0552-0553 ▄ ▀▄▄▀ 128C 04748  Jump to win 22A-22B 0554-0555  ▀ █ ▄█ 490B 18699  Skip next if V9 <> 011 22C-22D 0556-0557 ▄ ▀▄▄▀ 128C 04748  Jump to win The previous sum is stored in register ten and a 64/60 second delay is entered: 22E-22F 0558-0559 █ ▄▀ ▀ 8A90 35472  VA ← V9 230-231 0560-0561  █▀ 6040 24640  again V0 ← 064 232-233 0562-0563 ▀▀▀█ ▄ ▄ F015 61461  delay ← V0 234-235 0564-0565 ▀▀▀▀ ▄▄▄ F007 61447  delay V0 ← delay 236-237 0566-0567  ▀▀ 3000 12288  Skip next if V0 = 000 238-239 0568-0569  ▄█ ▄▀ 1234 04660  Jump to delay Afterwards, the deal draw routine is called; another key is collected for a delay, but unused again; and two calls to random draw are made again, just as earlier: 23A-23B 0570-0571  ▄█▄▄▄▀ 227C 08828  Call deal draw 23C-23D 0572-0573 ▀▀▀▀█▀█ FE0A 65034  VE ← key 23E-23F 0574-0575  ▀▀ ▄ █ 6109 24841  V1 ← 009 240-241 0576-0577  ▄█ ▀ 2260 08800  Call random draw 242-243 0578-0579 ▀ ▀▀▀ 8700 34560  V7 ← V0 244-245 0580-0581  ▀▀▄ ▄█ 6113 24851  V1 ← 019 246-247 0582-0583  ▄█ ▀ 2260 08800  Call random draw 248-249 0584-0585 ▀ ▀ 8800 34816  V8 ← V0 A sum is collected into register nine again and another table is used, with an identical sum to that previous resulting in a win and a sum of seven resulting in a loss, with fall-through leading to the earlier delay: 24A-24B 0586-0587 █ ▀ ▀ 8980 35200  V9 ← V8 24C-24D 0588-0589 ▀▄▄▄▀▄ ▀ 8974 35188  V9 ← V9 + V7; VF ← overflow 24E-24F 0590-0591 █ ▄▀▀ ▀ 99A0 39328  Skip next if V9 <> VA 250-251 0592-0593 ▄ ▀▄▄▀ 128C 04748  Jump to win 252-253 0594-0595  ▀ ▀▄▄█ 4907 18695  Skip next if V9 <> 007 254-255 0596-0597 ▄ █▄▄▀ 129C 04764  Jump to lose 256-257 0598-0599  ▄█ ▀ 1230 04656  Jump to again The impotent routine draws a sprite from an unused memory location, achieving naught: 258-259 0600-0601 █▄█▄ ▀ A2F0 41712  impotent I ← 0752 25A-25B 0602-0603  ▀▀ ▄ ▀ 6208 25096  V2 ← 008 25C-25D 0604-0605 ▀▀▄▀ ▄▄█ D127 53543  Draw 08×07 at V1,V2; VF ← XOR 25E-25F 0606-0607 ▄▄▄ ▄▄▄ 00EE 00238  Return The random draw routine begins by initializing registers six, two, and zero: 260-261 0608-0609  ▀▀ ▀▀▄ 6601 26113  random draw V6 ← 001 262-263 0610-0611  ▀▀ ▄ ▀▄ 6209 25097  V2 ← 009 264-265 0612-0613  ▀▀ ▄ 6001 24577  over V0 ← 001 The zeroeth register iterates from zero to seven in this routine. Register zero's digit is shown; a sound of 1/60 of a second is played; and register three is given one of eight random values, leading to a 1/8 chance that the routine won't exit afterwards: 266-267 0614-0615 ▀▀█▀▄ ▄ F029 61481  from I ← digit sprite of V0 268-269 0616-0617 ▀▀▄▀ ▄ █ D125 53541  Draw 08×05 at V1,V2; VF ← XOR 26A-26B 0618-0619 ▀▀▀█▄▀▀ F618 63000  sound ← V6 26C-26D 0620-0621 ▀▀ ▄██ C307 49927  V3 ← ??? AND 007 26E-26F 0622-0623  ▀ ▀▀ 4300 17152  Skip next if V3 <> 000 270-271 0624-0625 ▄▄▄ ▄▄▄ 00EE 00238  Return Otherwise, it continues by incrementing register zero, erasing the digit, and continues from the new value or restarts entirely, meaning it will loop between values one through six perhaps without end: 272-273 0626-0627  ▀▀▀ ▄ 7001 28673  V0 ← V0 + 001 274-275 0628-0629 ▀▀▄▀ ▄ █ D125 53541  Draw 08×05 at V1,V2; VF ← XOR 276-277 0630-0631  ▀▀ ▄▄▄ 3007 12295  Skip next if V0 = 007 278-279 0632-0633  ▄▄▀ ▄█ 1266 04710  Jump to from 27A-27B 0634-0635  ▄▄▀ ▄▀ 1264 04708  Jump to over The deal draw routine merely displays the two values of registers seven and eight, both of which are between one and six, inclusive: 27C-27D 0636-0637  ▀▀ ▄ ▀▄ 6209 25097  deal draw V2 ← 009 27E-27F 0638-0639  ▀▀ ▄ █ 6109 24841  V1 ← 009 280-281 0640-0641 ▀▀█▀▄▀▀█ F729 63273  I ← digit sprite of V7 282-283 0642-0643 ▀▀▄▀ ▄ █ D125 53541  Draw 08×05 at V1,V2; VF ← XOR 284-285 0644-0645  ▀▀▄ ▄█ 6113 24851  V1 ← 019 286-287 0646-0647 ▀▀█▀█ ▄ F829 63529  I ← digit sprite of V8 288-289 0648-0649 ▀▀▄▀ ▄ █ D125 53541  Draw 08×05 at V1,V2; VF ← XOR 28A-28B 0650-0651 ▄▄▄ ▄▄▄ 00EE 00238  Return The win routine displays the wi and n sprites before entering an infinite loop: 28C-28D 0652-0653 █ █ ▄▄▀ A2AC 41644  win I ← wi 28E-28F 0654-0655  ▀▀ 6000 24576  V0 ← 000 290-291 0656-0657  ▀▀▄ ▄ █ 6115 24853  V1 ← 021 292-293 0658-0659 ▀▀ █ ▄ ▄ D015 53269  Draw 08×05 at V0,V1; VF ← XOR 294-295 0660-0661 █ █▄ ▀▄ A2B1 41649  I ← n 296-297 0662-0663  ▀▀ ▄ 6008 24584  V0 ← 008 298-299 0664-0665 ▀▀ █ ▄ ▄ D015 53269  Draw 08×05 at V0,V1; VF ← XOR 29A-29B 0666-0667 ▄ █▄ █ 129A 04762  self Jump to self The lose routine is as for the win routine, but showing the lo and se sprites: 29C-29D 0668-0669 █ █▄ ▄█ A2B6 41654  lose I ← lo 29E-29F 0670-0671  ▀▀ 6000 24576  V0 ← 000 2A0-2A1 0672-0673  ▀▀▄ ▀ 6110 24848  V1 ← 016 2A2-2A3 0674-0675 ▀▀ █ ▄ ▄ D015 53269  Draw 08×05 at V0,V1; VF ← XOR 2A4-2A5 0676-0677 █ █▄▄ █▄ A2BB 41659  I ← se 2A6-2A7 0678-0679  ▀▀ ▄ 6008 24584  V0 ← 008 2A8-2A9 0680-0681 ▀▀ █ ▄ ▄ D015 53269  Draw 08×05 at V0,V1; VF ← XOR 2AA-2AB 0682-0683 ▄ ▄▀▄ █ 12AA 04778  end Jump to end The game ends with the wi, n, lo, and se sprites; these are the only sprites in the game: 2AC 0684 █ █ ██ 8B 139  wi 2AD 0685 █ █ █ 89 137 2AE 0686 █ █ █ 89 137 2AF 0687 █ █ █ █ A9 169 2B0 0688 ██ ██ ██ DB 219 2B1 0689 █ ██ █ B2 178  n 2B2 0690  ██ █ 32 050 2B3 0691  █ █ █ 2A 042 2B4 0692  █ ██ 26 038 2B5 0693 █ █ ██ A6 166 2B6 0694 █ ███ 8E 142  lo 2B7 0695 █ █ █ 8A 138 2B8 0696 █ █ █ 8A 138 2B9 0697 █ █ █ 8A 138 2BA 0698 ███ ███ EE 238 2BB 0699 ███ ███ EE 238  se 2BC 0700 █ █ 88 136 2BD 0701 ███ ██ EC 236 2BE 0702  █ █ 28 040 2BF 0703 ███ ███ EE 238 This game nicely performs a dice roll, but uses a loop which can strictly run indefinitely, and this is poor. A better approach would've been to sum six one-bit random integers; summing a two-bit with two one-bit random integers; or summing three three-bit random integers, and shifting this summation to the right twice, as three examples. .