rightsetr.blogg.se

Pac man pinky bug
Pac man pinky bug














The following subroutine draws colors onscreen for a 2x2 grid.

#PAC MAN PINKY BUG CODE#

It requires that A is loaded with the code for the first part of the fruit and HL is loaded with the memory address of the first position on screen where it is to be drawn.ĢB91 111F00 LD DE,#001F this offset is added later for third part of fruitĢB94 77 LD (HL),A Draw first part of fruit code into screen memoryĢB95 3C INC A Point to second part of fruitĢB96 23 INC HL Increment screen memory for second part of fruitĢB97 77 LD (HL),A Draw second part of fruit code into screen memoryĢB98 3C INC A Point to third part of fruitĢB99 19 ADD HL,DE Add offset for third part of fruitĢB9A 77 LD (HL),A Draw third part of fruit code into screen memoryĢB9B 3C INC A Point to fourth part of fruitĢB9C 23 INC HL Increment screen memory for fourth part of fruitĢB9D 77 LD (HL),A Draw fourth part of fruit code into screen memory The following subroutine draws the four parts of a fruit onscreen. Here are the subroutines which draw the fruit and the colors. It turns out that each fruit is actually made up of four separate pieces of graphics, all painted with a single color code.

pac man pinky bug

The first part draws the fruit, and the second part draws the color. There are two main parts to drawing a fruit. The memories which end up getting fed into this subroutine have different values than the ones the subroutine is expecting. The subroutine which draws the fruit is expecting only eight distinct values for the various fruit, and is expecting only seven memory locations where the fruit are drawn at the bottom of the screen. The result is that memory locations which are up to 512 bytes past the start of the fruit table, which are used for some other totally different part of the program, are drawn on the screen at increasing locations in video memory. It is decremented at the end of the loop, which makes it roll back down to 255, causing the loop to run a total of 256 times, which is why the split screen gets drawn on this level. If it is not zero then the loop runs again, if it is zero then the subroutine ends. At the end of the loop, B is decreased by one and checked for zero. The program starts drawing fruit with the counter in register B set to zero, instead of the expected number from 1 to 7. So with the counter at zero, this causes the subroutine which draws fruit to think that it is a level less than 7 with only 1 to 7 fruit to draw, in addition to some possible blank spaces. No check is done to see if the Carry flag is set, which would have been one way for the programmers to realize the game has reached this point. The subroutine is called to draw the fruit and the value for the level wraps around to zero when it is incremented. When level 256 is reached, it is counted by the game as level 255 (this number is #FF in hexadecimal). Then it figures out how many and which fruit to draw. The programmers know this and so when the subroutine is called to draw the fruit, it loads the level counter and then increases it by one. The second level (strawberry) is counted as level 1 by the game, and so on. In other words, the first level that we play (cherry) is treated as level zero by the game. Levels in Pac-Man are stored with a starting value of zero. If so, then draw the proper number of blank spaces and color them all black. Check to see if any blank spaces are needed.Loop back up to 7 times to draw the rest of the fruit.Increase the pointers to the next fruit in the table and the next location on screen.

pac man pinky bug

One is for drawing fruit, the other is for possibly drawing blank spaces in cases where there are less than 7 fruit to draw.

  • If the level is 19 or above, set the fruit pointer to the 1st key.
  • If the level is 8 or more, set the fruit pointer to the starting fruit for the current level.
  • If the level is 7 or less, set the pointer to the starting fruit to the cherry.
  • Load level number and increase its count by 1.
  • Here are the main points of fruit drawing: The table below details the fruit descriptions, their colors, and their position in memory: 2BF0 3A134E LD A,(#4E13) Load A with level numberĢBF4 FE08 CP #08 Is this level #13 (19 decimal, 7th key) ?ĢC30 3802 JR C,#2C34 If not, skip next stepĢC32 3E13 LD A,#13 If yes, treat all levels 19 and up as if they are level 19.ĢC34 D607 SUB #07 Subtract 7 to point to first value to be drawnĢC39 21083B LD HL,#3B08 Load HL with pointer to start of fruit tableĢC3D 09 ADD HL,BC Adjust fruit table pointer, based on current levelĢC3E EB EX DE,HL Load DE to point to fruit in tableĢC3F 0607 LD B,#07 Load B counter to draw 7 fruitĢC41 C3FD2B JP #2BFD Jump back up to fruit drawing section














    Pac man pinky bug