git.shiar.nl
/
wormy.git
/ blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
history
|
raw
|
HEAD
final version by jonah
[wormy.git]
/
line.asm
1
Line:
2
push hl
3
push de
4
ld a,d
5
cp h
6
jr c,LineOrdered
7
ex de,hl
8
LineOrdered:
9
ld b,d
10
ld c,e
11
push hl
12
push bc
13
call FindPixel
14
pop bc
15
pop de
16
ConnectedLine:
17
push hl
18
ld h,c
19
ld c,a
20
ld a,d
21
sub b
22
ld b,a
23
ld a,e
24
jr nz,LineNotPoint
25
cp h
26
jr nz,LineNotPoint
27
pop hl
28
jr DoneLine
29
LineNotPoint:
30
sub h
31
ld de,16
32
jr nc,LinePositiveY
33
neg
34
ld de,-16
35
LinePositiveY:
36
cp b
37
jr nc,SteepLine
38
add a,a
39
ld (Line2sm+1),a
40
ld h,a
41
xor a
42
sub b
43
add a,a
44
ld (Line1sm+1),a
45
ld a,h
46
sub b
47
pop hl
48
LineLoopGentle:
49
push af
50
ld a,(hl)
51
or c
52
ld (hl),a
53
rrc c
54
jr nc,$+3
55
inc hl
56
pop af
57
jp m,Line2sm
58
Line1sm add a,0
59
add hl,de
60
Line2sm add a,0
61
djnz LineLoopGentle
62
DoneLine:
63
ld a,(hl)
64
or c
65
ld (hl),a
66
pop de
67
pop hl
68
ret
69
70
SteepLine:
71
ld h,a
72
neg
73
add a,a
74
ld (Line3sm+1),a
75
ld a,b
76
add a,a
77
ld (Line4sm+1),a
78
sub h
79
ld b,h
80
pop hl
81
LineLoopSteep:
82
push af
83
ld a,(hl)
84
or c
85
ld (hl),a
86
add hl,de
87
pop af
88
jp m,Line4sm
89
Line3sm add a,0
90
rrc c
91
jr nc,$+3
92
inc hl
93
Line4sm add a,0
94
djnz LineLoopSteep
95
jr DoneLine