-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path8_loop_draw_graphics.asm
executable file
·69 lines (47 loc) · 1.25 KB
/
8_loop_draw_graphics.asm
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
; /////////////////////////////////////////////////////////////////////////////
; Znake (ZX Spectrum 48K)
; -----------------------------------------------------------------------------
; 8_loop_draw_graphics.asm
; -----------------------------------------------------------------------------
; Copyright (C) 2016, Chris Wyatt
; All rights reserved
; Distributed under the Apache 2 license (see LICENSE)
; /////////////////////////////////////////////////////////////////////////////
update_graphics_init:
ld hl,str_score
ld de,0x0b02
call print
; If food eaten flag is not set, loop 4 times to update grid locations:
; new head, existing head, new tail, existing tail (c = 5)
; Otherwise, draw current score and loop 2 times to update grid locations:
; new head, existing head (c = 3)
ld a,(flags)
cpl
and 0x01
add a,a
add a,3
ld c,a
ld iy,draw_line
halt
update_graphics_next:
dec c
jp z,next_game_loop
pop hl
ld b,0x0f
; Load x-coordinate into register d
ld a,h
rrca
rrca
rrca
rrca
and b
add a,8
ld d,a
; Load y-coordinate into register e
ld a,h
and b
add a,4
ld e,a
ld h,0x81
call draw_char
jp update_graphics_next