make circle draw not write over program mem.
This commit is contained in:
parent
ad961e2d23
commit
eff01e5411
4 changed files with 22 additions and 9 deletions
|
@ -45,6 +45,8 @@ draw_upper_px_in_circle:
|
|||
SBC radius
|
||||
STA Y_pos
|
||||
|
||||
BCC outside_screen_error
|
||||
|
||||
JSR pixel_calc
|
||||
;; A = byte_to_paint (small_X_offset)
|
||||
;; Y =small_y_offset
|
||||
|
@ -93,6 +95,11 @@ draw_lower_px_in_circle: ;similar as above
|
|||
ADC radius
|
||||
STA Y_pos
|
||||
|
||||
;; Stop this if overflow or if outside screen.
|
||||
BCS outside_screen_error
|
||||
CMP #$C8 ;; Screen width
|
||||
BCS outside_screen_error
|
||||
|
||||
JSR pixel_calc
|
||||
;; A = byte_to_paint (small_X_offset)
|
||||
;; Y =small_y_offset
|
||||
|
@ -132,8 +139,13 @@ draw_right_px_in_circle:; similar as above
|
|||
STY Y_qaa
|
||||
|
||||
|
||||
JMP outside_screen_error_end
|
||||
outside_screen_error:
|
||||
RTS
|
||||
outside_screen_error_end:
|
||||
LDX #$08 ; X=8 always expected inside the loop
|
||||
SEC
|
||||
|
||||
while_x_bigger_then_y: ; C=1 here because above and branching logic
|
||||
draw_pixels:
|
||||
draw_qaa:
|
||||
|
@ -286,4 +298,5 @@ endif:
|
|||
jmp while_x_bigger_then_y
|
||||
end:
|
||||
RTS
|
||||
|
||||
.endproc
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
.include "circle.inc"
|
||||
|
||||
;; Set initial parameters for circle
|
||||
LDA #$50
|
||||
LDA #$00
|
||||
STA $AD
|
||||
LDA #$50
|
||||
STA $AE
|
||||
|
@ -38,6 +38,6 @@ loop:
|
|||
|
||||
;; end loop when x_pos = $70
|
||||
LDA $AD
|
||||
CMP #$70
|
||||
CMP #$ff
|
||||
BNE loop
|
||||
.endscope
|
||||
|
|
|
@ -37,6 +37,6 @@ loop:
|
|||
|
||||
;; end loop if radius = $aa
|
||||
LDA $AD
|
||||
CMP #$20
|
||||
CMP #$ff
|
||||
BNE loop
|
||||
.endscope
|
||||
|
|
|
@ -15,12 +15,12 @@
|
|||
mainsetup:
|
||||
;; Note that arithmetic tests may use upp all the memory and the compiler don't complain!
|
||||
;.include "routines/arithmatic/mult_test.s"
|
||||
.include "routines/arithmatic/div_test.s"
|
||||
;.include "routines/arithmatic/div_test.s"
|
||||
;.include "routines/arithmatic/div_test_zero.s"
|
||||
|
||||
;.include "routines/circle/circle_test.s"
|
||||
;.include "routines/circle/circle_test_size.s"
|
||||
;.include "routines/circle/circle_test_position.s"
|
||||
.include "routines/circle/circle_test.s"
|
||||
.include "routines/circle/circle_test_size.s"
|
||||
.include "routines/circle/circle_test_position.s"
|
||||
;.include "routines/line/line_test.s"
|
||||
;.include "routines/line/line_test_extensive.s"
|
||||
;.include "routines/text/char_draw_test.s"
|
||||
|
@ -33,10 +33,10 @@ exit:
|
|||
JMP exit
|
||||
.include "public.inc"
|
||||
;.include "routines/line/line.s"
|
||||
;.include "routines/circle/circle.s"
|
||||
.include "routines/circle/circle.s"
|
||||
;.include "routines/triangle/triangle.s"
|
||||
.include "routines/pixel/pixel_draw.s"
|
||||
;.include "routines/pixel/pixel_calc.s"
|
||||
.include "routines/pixel/pixel_calc.s"
|
||||
;.include "routines/pixel/misc_pixel.s"
|
||||
;.include "routines/text/char_draw.s"
|
||||
.include "routines/memory/memset.s"
|
||||
|
|
Loading…
Add table
Reference in a new issue