![]() ![]() What this means is that the game is now instructed to loop over the fruit drawing code 256 times - these are by far too many fruits to draw. Video memory locations as mapped to the screen. The loop now repeats as often as required to bring 255 back to 0. When decremented to possibly restart the loop again (line 0x2C17), it underflows back to 255 (since a byte can't hold values lower than 0, thus 0 minus 1 results in 255, or 0xFF). In Level 256, the loop counter is initialized with 0 from the start (line 0x2BFC). Exits if it is 0, otherwise runs the loop again. Ġx2C14 INC HL After current fruit is drawn, increase HL twice to point to tile of the next fruit.Ġx2C16 DEC C (Update the loop to draw the black tiles to cover old fruits.)Ġx2C17 DJNZ #2C02 Decrements B (the loop counter) by 1. Replaces 4 tiles on screen (fruits are of 2x2 tiles size) in order of the video memory. ![]() Initialize it with the value we got before.Ġx2BFD LD C,#07 (Prepare a loop drawing black tiles to cover old fruits.)Ġx2BFF LD HL,#4004 Stores the location in video memory where to draw the first fruit (0x4004) in register HL.Ġx2C02 1A LD A,(DE) Start of the loop (stores the value of the fruit table in register A). It is decremented at the end of the loop and then checked if it is 0 to stop the loop from being started over again.Ġx2BFC LD B,A Prepare the loop, store the counter in B. To implement a loop in assembly language, the counter is stored in register B. However, the aforementioned loop is coded in a way it does not work together with value 0. According to the fruit table, it will always draw 7 Keys then (there's no reason for an 8th Key to be in it, but it happens to be).Ġx2BF4 CP #08 Is the value lower than 8? (yes for level 256, being 0x00).Ġx2BF6 JP NC,#2C2E No: Compute another offset into the fruit table (the code at 0x2C2E is not shown here).Ġx2BF9 LD DE,#3B08 Yes: Places the offset to the cherry in the fruit table in the DE register.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |