Hi,
I am facing an issue while I update a background once a player (two-player Pong game) hits a score. Somehow, nearly randomly after a couple of scores, one digit of the score is drawn beside the last digit of the three digits, which display the score (1-9). This is my update routine:
Does someone has a glimpse why sometimes digits are placed at 0x204e or 0x205e?
Thanks in advance,
Sebastian
I am facing an issue while I update a background once a player (two-player Pong game) hits a score. Somehow, nearly randomly after a couple of scores, one digit of the score is drawn beside the last digit of the three digits, which display the score (1-9). This is my update routine:
Code:
/* player1 score */
PPU_ADDRESS = MSB(0x204b);
PPU_ADDRESS = LSB(0x204b);
PPU_DATA = 0x10+(player1.score >> 10); /* 0x10 is the tile address of digit 0 in .chr file*/
PPU_ADDRESS = MSB(0x204c);
PPU_ADDRESS = LSB(0x204c);
PPU_DATA = 0x10+((player1.score / 10) % 10);
PPU_ADDRESS = MSB(0x204d);
PPU_ADDRESS = LSB(0x204d);
PPU_DATA = 0x10+(player1.score % 10);
/* player2 score */
PPU_ADDRESS = MSB(0x205b);
PPU_ADDRESS = LSB(0x205b);
PPU_DATA = 0x10+(player2.score >> 10);
PPU_ADDRESS = MSB(0x205c);
PPU_ADDRESS = LSB(0x205c);
PPU_DATA = 0x10+((player2.score / 10) % 10);
PPU_ADDRESS = MSB(0x205d);
PPU_ADDRESS = LSB(0x205d);
PPU_DATA = 0x10+(player2.score % 10);
PPU_ADDRESS = MSB(0x204b);
PPU_ADDRESS = LSB(0x204b);
PPU_DATA = 0x10+(player1.score >> 10); /* 0x10 is the tile address of digit 0 in .chr file*/
PPU_ADDRESS = MSB(0x204c);
PPU_ADDRESS = LSB(0x204c);
PPU_DATA = 0x10+((player1.score / 10) % 10);
PPU_ADDRESS = MSB(0x204d);
PPU_ADDRESS = LSB(0x204d);
PPU_DATA = 0x10+(player1.score % 10);
/* player2 score */
PPU_ADDRESS = MSB(0x205b);
PPU_ADDRESS = LSB(0x205b);
PPU_DATA = 0x10+(player2.score >> 10);
PPU_ADDRESS = MSB(0x205c);
PPU_ADDRESS = LSB(0x205c);
PPU_DATA = 0x10+((player2.score / 10) % 10);
PPU_ADDRESS = MSB(0x205d);
PPU_ADDRESS = LSB(0x205d);
PPU_DATA = 0x10+(player2.score % 10);
Does someone has a glimpse why sometimes digits are placed at 0x204e or 0x205e?
Thanks in advance,
Sebastian