Hi, truncating values is ok (if it makes sense to do it) - most emulators will do this at some point.
The BCD formula should look like this, check this first. I noticed that you said for the tens you use (number - hundreds variable). This probably works but try using the
modulo operator (%) to get the remainder (see example below), in case you have an error in your code.
hundreds at address I = number / 100
tens at address I+1 = number % 100 / 10
ones at address I+2 = number % 100 % 10 / 1
(<-- omit the divide by 1 if you wish.)
If you want to get the tens by (number - hundreds variable), the BCD formula should look like this:
hundreds at address I = number / 100
tens at address I+1 = (number - hundreds * 100) / 10
ones at address I+2 = ((number - hundreds * 100) - tens * 10) / 1
(<-- omit the divide by 1 if you wish.)
From memory, I points to a single byte of data (ie: storing the BCD takes 3 bytes). If I remember correctly, the I value should
not be changed after the opcode has run.
The BCD is then used by the draw sprite opcode (from the wikipedia article):
"Draws a sprite at coordinate (VX, VY) that has a width of 8 pixels and a height of N pixels. Each row of 8 pixels is read as bit-coded starting from memory location I; I value doesn’t change after the execution of this instruction. As described above, VF is set to 1 if any screen pixels are flipped from set to unset when the sprite is drawn, and to 0 if that doesn’t happen", but since you said you can display level 1 correctly, it shouldn't be this.
If you cant find the problem in any of these areas, maybe try posting the source code if you can and I'll take a look.
