-
Notifications
You must be signed in to change notification settings - Fork 0
/
day17asm.asm
87 lines (83 loc) · 1.56 KB
/
day17asm.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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
; assemble with zasm
org $3F00
dw end-start
start
push hl
push hl
ld bc,1
ld de,0
exx
ld bc,0
ld de,0
exx
loop
ld hl,356
add hl,de
ex de,hl
exx
ld hl,0
adc hl,de
ex de,hl
exx
modulo
ld h,d
ld l,e
or a
sbc hl,bc
exx
ld h,d
ld l,e
sbc hl,bc
jr c,mod_ok
ex de,hl
exx
ex de,hl
jr modulo
mod_ok
ld a,e
or d
exx
or e
or d
jr nz,not_zero
exx
pop hl
pop hl
push bc
exx
push bc
not_zero
ld hl,1
add hl,de
ex de,hl
exx
ld hl,0
adc hl,de
ex de,hl
exx
ld hl,1
add hl,bc
ld b,h
ld c,l
exx
ld hl,0
adc hl,bc
ld b,h
ld c,l
exx
ld hl,$F080
or a
sbc hl,bc
exx
ld hl,$02FA
sbc hl,bc
exx
jr nc,loop
pop bc
pop de
pop hl
push de
push bc
push hl
ret
end