Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/arch/z80/translator.py
Original file line number Diff line number Diff line change
Expand Up @@ -709,6 +709,7 @@ def visit_PLOT(self, node):
self.ic_fparam(node.children[1].type_, node.children[1].t)
self.runtime_call(RuntimeLabel.PLOT, 0)
self.HAS_ATTR = TMP_HAS_ATTR is not None
self.norm_attr()

def visit_DRAW(self, node):
TMP_HAS_ATTR = self.check_attr(node, 2)
Expand All @@ -719,6 +720,7 @@ def visit_DRAW(self, node):
self.ic_fparam(node.children[1].type_, node.children[1].t)
self.runtime_call(RuntimeLabel.DRAW, 0)
self.HAS_ATTR = TMP_HAS_ATTR is not None
self.norm_attr()

def visit_DRAW3(self, node):
TMP_HAS_ATTR = self.check_attr(node, 3)
Expand All @@ -731,6 +733,7 @@ def visit_DRAW3(self, node):
self.ic_fparam(node.children[2].type_, node.children[2].t)
self.runtime_call(RuntimeLabel.DRAW3, 0)
self.HAS_ATTR = TMP_HAS_ATTR is not None
self.norm_attr()

def visit_CIRCLE(self, node):
TMP_HAS_ATTR = self.check_attr(node, 3)
Expand All @@ -743,6 +746,7 @@ def visit_CIRCLE(self, node):
self.ic_fparam(node.children[2].type_, node.children[2].t)
self.runtime_call(RuntimeLabel.CIRCLE, 0)
self.HAS_ATTR = TMP_HAS_ATTR is not None
self.norm_attr()

# endregion

Expand Down
8 changes: 7 additions & 1 deletion src/arch/zx48k/library-asm/circle.asm
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ __CIRCLE:
ld a, h
exx
pop de ; D'E' = x0, y0
ld h, a ; H' = r
ld h, a ; H' = r

ld c, e
ld a, h
Expand Down Expand Up @@ -107,6 +107,7 @@ __CIRCLE:

__CIRCLE_LOOP:
ld a, b
inc a
cp c
ret nc ; Returns when x >= y

Expand Down Expand Up @@ -170,6 +171,10 @@ __CIRCLE_NEXT:
ld c, a ; C = x0 - x
call __CIRCLE_PLOT ; plot(x0 - x, y0 - y)

ld a, l
cp h
jr z, 1f

ld a, d
add a, l
ld b, a ; B = y0 + x
Expand Down Expand Up @@ -202,6 +207,7 @@ __CIRCLE_NEXT:
ld c, a ; C = x0 + y
call __CIRCLE_PLOT ; plot(x0 - y, y0 - x)

1:
exx
jp __CIRCLE_LOOP

Expand Down
8 changes: 7 additions & 1 deletion src/arch/zxnext/library-asm/circle.asm
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ __CIRCLE:
ld a, h
exx
pop de ; D'E' = x0, y0
ld h, a ; H' = r
ld h, a ; H' = r

ld c, e
ld a, h
Expand Down Expand Up @@ -107,6 +107,7 @@ __CIRCLE:

__CIRCLE_LOOP:
ld a, b
inc a
cp c
ret nc ; Returns when x >= y

Expand Down Expand Up @@ -170,6 +171,10 @@ __CIRCLE_NEXT:
ld c, a ; C = x0 - x
call __CIRCLE_PLOT ; plot(x0 - x, y0 - y)

ld a, l
cp h
jr z, 1f

ld a, d
add a, l
ld b, a ; B = y0 + x
Expand Down Expand Up @@ -202,6 +207,7 @@ __CIRCLE_NEXT:
ld c, a ; C = x0 + y
call __CIRCLE_PLOT ; plot(x0 - y, y0 - x)

1:
exx
jp __CIRCLE_LOOP

Expand Down
7 changes: 6 additions & 1 deletion tests/functional/zx48k/circle.asm
Original file line number Diff line number Diff line change
Expand Up @@ -393,7 +393,7 @@ __CIRCLE:
ld a, h
exx
pop de ; D'E' = x0, y0
ld h, a ; H' = r
ld h, a ; H' = r
ld c, e
ld a, h
add a, d
Expand Down Expand Up @@ -430,6 +430,7 @@ __CIRCLE:
ex af, af' ; Saves it
__CIRCLE_LOOP:
ld a, b
inc a
cp c
ret nc ; Returns when x >= y
bit 7, h ; HL >= 0? : if (f >= 0)...
Expand Down Expand Up @@ -482,6 +483,9 @@ __CIRCLE_NEXT:
sub l
ld c, a ; C = x0 - x
call __CIRCLE_PLOT ; plot(x0 - x, y0 - y)
ld a, l
cp h
jr z, 1f
ld a, d
add a, l
ld b, a ; B = y0 + x
Expand Down Expand Up @@ -510,6 +514,7 @@ __CIRCLE_NEXT:
sub h
ld c, a ; C = x0 + y
call __CIRCLE_PLOT ; plot(x0 - y, y0 - x)
1:
exx
jp __CIRCLE_LOOP
__CIRCLE_PLOT:
Expand Down
7 changes: 6 additions & 1 deletion tests/functional/zx48k/inktemp.asm
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,7 @@ __CIRCLE:
ld a, h
exx
pop de ; D'E' = x0, y0
ld h, a ; H' = r
ld h, a ; H' = r
ld c, e
ld a, h
add a, d
Expand Down Expand Up @@ -391,6 +391,7 @@ __CIRCLE:
ex af, af' ; Saves it
__CIRCLE_LOOP:
ld a, b
inc a
cp c
ret nc ; Returns when x >= y
bit 7, h ; HL >= 0? : if (f >= 0)...
Expand Down Expand Up @@ -443,6 +444,9 @@ __CIRCLE_NEXT:
sub l
ld c, a ; C = x0 - x
call __CIRCLE_PLOT ; plot(x0 - x, y0 - y)
ld a, l
cp h
jr z, 1f
ld a, d
add a, l
ld b, a ; B = y0 + x
Expand Down Expand Up @@ -471,6 +475,7 @@ __CIRCLE_NEXT:
sub h
ld c, a ; C = x0 + y
call __CIRCLE_PLOT ; plot(x0 - y, y0 - x)
1:
exx
jp __CIRCLE_LOOP
__CIRCLE_PLOT:
Expand Down
7 changes: 6 additions & 1 deletion tests/functional/zx48k/spfill.asm
Original file line number Diff line number Diff line change
Expand Up @@ -969,7 +969,7 @@ __CIRCLE:
ld a, h
exx
pop de ; D'E' = x0, y0
ld h, a ; H' = r
ld h, a ; H' = r
ld c, e
ld a, h
add a, d
Expand Down Expand Up @@ -1006,6 +1006,7 @@ __CIRCLE:
ex af, af' ; Saves it
__CIRCLE_LOOP:
ld a, b
inc a
cp c
ret nc ; Returns when x >= y
bit 7, h ; HL >= 0? : if (f >= 0)...
Expand Down Expand Up @@ -1058,6 +1059,9 @@ __CIRCLE_NEXT:
sub l
ld c, a ; C = x0 - x
call __CIRCLE_PLOT ; plot(x0 - x, y0 - y)
ld a, l
cp h
jr z, 1f
ld a, d
add a, l
ld b, a ; B = y0 + x
Expand Down Expand Up @@ -1086,6 +1090,7 @@ __CIRCLE_NEXT:
sub h
ld c, a ; C = x0 + y
call __CIRCLE_PLOT ; plot(x0 - y, y0 - x)
1:
exx
jp __CIRCLE_LOOP
__CIRCLE_PLOT:
Expand Down