So for the gameplay itself I'll need to implement the rules of the 2048 game. My strategy is to create the gameplay states, such as the tile spawning state, arrow movement state, check if the movement was valid, tile shifting state, tile merging state (if possible) and game over if a new tile couldn't the spawned on the grid.
In the tile spawning state a RNG (random number generator) is required in two moments: when selecting an available cell in the grid and determining the tile type to spawn (a 2 or 4).
I originally planed to use the Lehmer RNG, but since the 8080 doesn't have multiply and divide opcodes, it's more annoying to implement the algorithm, so I chose the LFSR (linear-feedback shift register) method which requires only shift and XOR operations.
For writing the 8080 code I'm using this documentation, it tells which Z80 opcodes are available on 8080:
https://www.8bit-era.cz/z80-8080-instruction-set.html
For debugging the code I'm using the command mame maze -debug. The problem is the disassembled code on MAME debugger window uses the 8080 syntax (like I said before, I prefer the Z80 syntax for 8080, and Intel syntax for 8086).
It helps to learn the Z80 syntax and get familiarity with it, because in the future I could write Z80 code on another hardware, like the VIC Dual hardware.
Louis Paul
Discussions
Become a Hackaday.io Member
Create an account to leave a comment. Already have an account? Log In.