siggi wrote: ↑Fri Nov 10, 2023 8:06 pm
If its my turn now:
I understand, that you can place hidden opcodes, having bit 6 set, into dfile. But they may not do more than a NOP (like ld b,b). Otherwise the display routine will fail. So there are few opcodes, which can be used.
Can you store data like 1,2,3,4,5 in dfile? If yes: how?
Yes, the data stored on the screen will display as a NOP/space.
In GOL the white spaces hold data. For GOL I count up to 4. Above 3 is according to the rules a dead colony. I use LD D,B LD D,C LD D,D, LD D,E and LD D,H for these counts. The opcodes are #58 to #5C. Subtract #58 and you have the number of adjacent colonies.
You can't use all LD opcodes. BC and HL are used by the display so you can't change them.
LD D,(HL) can't be used since this is 7 tstates.
When you store the useable codes in a table you can translate them to a value upon the place in the table, just read and count until your value comes.
For Minesweeper I used a different method. I started with #40 for no bombs around and then #51 to #5F for up to 7 bombs. Each bomb was counted twice, so only the odd values are used, thus skipping the LD D,(HL) and LD E,(HL).
Theoratically 8 bombs can be around a field. This would make #61, LD H,C which crashes the game, so a check is done that a field has never 8 bombs.