diff options
author | Juan J. Martinez <jjm@usebox.net> | 2023-05-09 22:43:33 +0100 |
---|---|---|
committer | Juan J. Martinez <jjm@usebox.net> | 2023-05-09 22:43:33 +0100 |
commit | d532317c011b9e5653241d50b961ee8caa710144 (patch) | |
tree | cb9fb308b9a92aa667ee626c8474b3e1e9f6f083 /game/player.asm | |
parent | 741561787cc2df547d5f520a142beaff234c488e (diff) | |
download | tr8vm-d532317c011b9e5653241d50b961ee8caa710144.tar.gz tr8vm-d532317c011b9e5653241d50b961ee8caa710144.zip |
Playground
Potential example game.
Diffstat (limited to 'game/player.asm')
-rw-r--r-- | game/player.asm | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/game/player.asm b/game/player.asm new file mode 100644 index 0000000..4a6537f --- /dev/null +++ b/game/player.asm @@ -0,0 +1,48 @@ +; +; player update code +; + +player_update: + ld x, [sp + 2] + ld a, [sp + 3] + + ; read controller 1 + ld b, 0xf0 + port b, b + + inc x + bo + inc a + ; x coord + ld y, [a : x] + + ; left + bit b, 4 + bz + dec y + ; right + bit b, 5 + bz + inc y + + ld [a : x], y + + inc x + bo + inc a + ; y coord + ld y, [a : x] + + ; up + bit b, 2 + bz + dec y + ; down + bit b, 3 + bz + inc y + + ld [a : x], y + + ret + |