Skip to content

Commit

Permalink
handle extreme edge case of zero width or height oval, which should b…
Browse files Browse the repository at this point in the history
…ecome a line
  • Loading branch information
mooinglemur committed Aug 30, 2024
1 parent 32ad9b1 commit c5f0848
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions graphics/graph/graph.s
Original file line number Diff line number Diff line change
Expand Up @@ -630,6 +630,10 @@ GRAPH_move_rect:

GRAPH_draw_oval:
; push callee-saved r-regs
PushW r0
PushW r1
PushW r2
PushW r3
PushW r4
PushW r5
PushW r6
Expand All @@ -641,6 +645,28 @@ GRAPH_draw_oval:
php ; store fill flag in Y
ply

; are we asking for a line?

lda r2H
bne @chkh
lda r2L
cmp #1
beq @isline
@chkh:
lda r3H
bne @cont
lda r3L
cmp #1
bne @cont
@isline:
DecW r2
DecW r3
AddW r0, r2
AddW r1, r3

jsr GRAPH_draw_line
jmp @end
@cont:
DecW r2
DecW r3

Expand Down Expand Up @@ -880,6 +906,7 @@ GRAPH_draw_oval:
PopW r0
PopW r1

@after_plot:
; copy e2 to scratch
MoveW r10, r14
MoveW r11, r15
Expand Down Expand Up @@ -1090,5 +1117,9 @@ GRAPH_draw_oval:
PopW r6
PopW r5
PopW r4
PopW r3
PopW r2
PopW r1
PopW r0
clc
rts

0 comments on commit c5f0848

Please sign in to comment.