aboutsummaryrefslogtreecommitdiff
path: root/game/player.asm
blob: 4a6537f8f99910c6d53bb8562ee434c4931080df (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
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