A fix of line_up_inv such that X_pos < X_end like all other line_* implementations.
This commit is contained in:
parent
4d12f20a6e
commit
494e9dc5f9
1 changed files with 9 additions and 19 deletions
|
@ -1,11 +1,11 @@
|
||||||
;drawing line from 2 cordinates
|
;drawing line from 2 cordinates
|
||||||
.proc line_up_inv
|
.proc line_up_inv
|
||||||
;;# (X_pos, Y_pos) #
|
|
||||||
;;# * #
|
|
||||||
;;# * #
|
|
||||||
;;# * #
|
|
||||||
;;# (X_end, Y_end) #
|
;;# (X_end, Y_end) #
|
||||||
;;NOTE THAT Y_pos <= Y_end, X_pos >= X_end. Min 45deg!
|
;;# * #
|
||||||
|
;;# * #
|
||||||
|
;;# * #
|
||||||
|
;;# (X_pos, Y_pos) #
|
||||||
|
;;NOTE THAT Y_pos >) Y_end, X_pos <= X_end. Min 45deg!
|
||||||
|
|
||||||
;;Not values but register position in memory
|
;;Not values but register position in memory
|
||||||
X_end = $04
|
X_end = $04
|
||||||
|
@ -17,16 +17,6 @@
|
||||||
V = $0809
|
V = $0809
|
||||||
D = $0a0b
|
D = $0a0b
|
||||||
|
|
||||||
;example values ~~~~~ SHOULD BE PRECOMPILED
|
|
||||||
;LDA #$60
|
|
||||||
;STA X_pos
|
|
||||||
;STA Y_pos
|
|
||||||
;LDA #$50
|
|
||||||
;STA X_end
|
|
||||||
;LDA #$90
|
|
||||||
;STA Y_end
|
|
||||||
;;~~~~~~~~~~
|
|
||||||
|
|
||||||
;We need to clear this memory
|
;We need to clear this memory
|
||||||
LDA #$00
|
LDA #$00
|
||||||
STA <V
|
STA <V
|
||||||
|
@ -35,14 +25,14 @@
|
||||||
|
|
||||||
;; V = 2*(dy -dx)
|
;; V = 2*(dy -dx)
|
||||||
;; where: dy = Y_pos - Y_end, dx = X_end - X_start
|
;; where: dy = Y_pos - Y_end, dx = X_end - X_start
|
||||||
LDA X_pos
|
LDA X_end
|
||||||
SEC
|
SEC
|
||||||
SBC X_end
|
SBC X_pos
|
||||||
STA >V
|
STA >V
|
||||||
STA >dx_2; >dy_2 = dy. Needed for dy_2 (not for V)
|
STA >dx_2; >dy_2 = dy. Needed for dy_2 (not for V)
|
||||||
LDA Y_end
|
LDA Y_pos
|
||||||
SEC
|
SEC
|
||||||
SBC Y_pos
|
SBC Y_end
|
||||||
STA dy
|
STA dy
|
||||||
SEC
|
SEC
|
||||||
SBC >V
|
SBC >V
|
||||||
|
@ -63,7 +53,7 @@
|
||||||
for_y:
|
for_y:
|
||||||
jsr pixel_draw
|
jsr pixel_draw
|
||||||
;;Increment Y until Y_pos = Y_end and X_pos = X_end
|
;;Increment Y until Y_pos = Y_end and X_pos = X_end
|
||||||
INC Y_pos
|
DEC Y_pos
|
||||||
LDY Y_pos
|
LDY Y_pos
|
||||||
CPY Y_end
|
CPY Y_end
|
||||||
BEQ end
|
BEQ end
|
||||||
|
@ -72,7 +62,7 @@ for_y:
|
||||||
;;else case 1.
|
;;else case 1.
|
||||||
Lag_16 >D, <D, #$00, #$02, case_2
|
Lag_16 >D, <D, #$00, #$02, case_2
|
||||||
case_1:
|
case_1:
|
||||||
DEC X_pos
|
INC X_pos
|
||||||
Sub_16 >D, <D, >V, <V; D = D - V
|
Sub_16 >D, <D, >V, <V; D = D - V
|
||||||
JMP for_y
|
JMP for_y
|
||||||
case_2:
|
case_2:
|
||||||
|
|
Loading…
Add table
Reference in a new issue