Compare commits

...

2 commits

5 changed files with 54 additions and 56 deletions

View file

@ -10,12 +10,6 @@
.endif
;; If b_low != A
.if .match(.mid (0, 1, {b_low}), A )
.elseif .match(.mid (0, 1, {b_low}), X)
LDX
kssk
.match(.mid (0, 1, {b_low}), Y)
LDY
kkdkd
.else
LDA b_low
.endif
@ -23,15 +17,7 @@ kkdkd
ADC a_low
STA a_low
LDA b_hi
.if .match(.mid (0, 1, {b_low}), X )
LDX
kdkdkd
.elseif .match(.mid (0, 1, {b_low}), Y )
LDY
dkkdk
.else
LDA b_hi
.endif
ADC a_hi
STA a_hi
.endmacro

View file

@ -48,33 +48,28 @@
Add_16 >D, <D, #$ff, #$01, !
Sub_16 >D, <D, dx, #$00
start_paint:
LDY #$00
jsr pixel_draw ;;only used first pixel. after this relative position is abused
;byte_to_paint = $FE ;Byte with one 1 that corasponds to a pixel.
;btp_mem_pos =$494A; byte to paint memory position ;Position of byte on screen
jmp increment_x_pos_end
for_x:
;; Lets increment btp_mem_pos with +8
;; Read more in pixel_draw to understand this!
increment_x_pos:
INC X_pos;; legacy
CLC
LDA byte_to_paint
ROR byte_to_paint
LDX #$00
LDA byte_to_paint
ORA (>btp_mem_pos, X)
STA (>btp_mem_pos, X)
increment_pixel_x:
CLC
ROR byte_to_paint
BCS move_8px_left
jmp increment_x_pos_end
JMP increment_pixel_x_end
move_8px_left:
;; add +8 to btp_mem_pos. Find more of why in pixel_draw
Add_16 >btp_mem_pos, <btp_mem_pos, #$08, #$00
;; reset byte_to_paint
LDA #%10000000
STA byte_to_paint
increment_x_pos_end:
;; add +8 to btp_mem_pos. Find more of why in pixel_draw
Add_16 >btp_mem_pos, <btp_mem_pos, #$08, #$00
;; reset byte_to_paint
LDA #%10000000
STA byte_to_paint
increment_pixel_x_end:
INC X_pos;; legacy
LDX X_pos
CPX X_end
BEQ end
@ -82,21 +77,21 @@ increment_x_pos_end:
;;else case 1.
Lag_16 >D, <D, #$00, #$02, case_2
case_1:; C =1 so we can use !
Sub_16 >D, <D, >V, <V ; D = D - V
increment_y_pos:
INC Y_pos
Sub_16 >D, <D, >V, <V, ! ; D = D - V
increment_y_pos:
Add_16 >btp_mem_pos, <btp_mem_pos, #$01, #$00
INY
CPY #$08 ;
BEQ move_8px_down
jmp for_x
move_8px_down:
move_8px_down: ; Z=1 --> C=1
;; +320-8 bytes
LDY #$00
Add_16 >btp_mem_pos, <btp_mem_pos,#$38 , #$01
jmp for_x
increment_y_pos_end:
case_2: ;; C =0 because LAG_16 so we can use !
Add_16 >D, <D, >dy_2, <dy_2 ;D = D + 2*dy
Add_16 >D, <D, >dy_2, <dy_2, ! ;D = D + 2*dy
JMP for_x
end:
RTS

View file

@ -8,16 +8,6 @@
;;NOTE THAT X_pos <= X_end, Y_pos <= Y_end. Min 45deg!
.include "line.inc"; Defines memory positions, ex X_pos
;example values ~~~~~ SHOULD BE PRECOMPILED
;LDA #$00
;STA X_pos
;STA Y_pos
;LDA #$40
;STA X_end
;LDA #$a0
;STA Y_end
;;~~~~~~~~~~
;;We need to clear this memory
LDA #$00
STA <V
@ -52,23 +42,50 @@
Add_16 >D, <D, #$ff, #$01
Sub_16 >D, <D, dy, #$00
LDY #$00
jsr pixel_draw ;;only used first pixel. after this relative position is abused
CLC ; this makes it that C =0 always on for_x
for_y:
jsr pixel_draw
;;Increment Y until Y_pos = Y_end and X_pos = X_end
INC Y_pos
LDY Y_pos
CPY Y_end
LDX #$00
LDA byte_to_paint
ORA (>btp_mem_pos, X)
STA (>btp_mem_pos, X)
increment_y_pos:
Add_16 >btp_mem_pos, <btp_mem_pos, #$01, #$00, ! ; I know that C ==0 on for_y
INY
CPY #$08 ;
BEQ move_8px_down
jmp increment_y_pos_end
move_8px_down:
;; +320-8 bytes
LDY #$00
Add_16 >btp_mem_pos, <btp_mem_pos,#$38 , #$01
increment_y_pos_end:
INC Y_pos;; legacy
LDX Y_pos
CPX Y_end
BEQ end
;;If D < %00000010 00000000: case_2
;;else case 1.
Lag_16 >D, <D, #$00, #$02, case_2
case_1:
INC X_pos
Sub_16 >D, <D, >V, <V; D = D - V
increment_pixel_x:
CLC
LDA byte_to_paint
ROR byte_to_paint
BCS move_8px_left
JMP for_y
case_2:
Add_16 >D, <D, >dx_2, <dx_2;D = D + 2*dx
move_8px_left:
;; add +8 to btp_mem_pos. Find more of why in pixel_draw
Add_16 >btp_mem_pos, <btp_mem_pos, #$08, #$00
;; reset byte_to_paint
LDA #%10000000
STA byte_to_paint
JMP for_y
case_2: ;; C =0 because LAG_16 so we can use !
Add_16 >D, <D, >dx_2, <dx_2, ! ;D = D + 2*dx
JMP for_y
end:
RTS

View file

@ -15,7 +15,7 @@
;;Store pixel in byte_to_paint
LDA #%10000000
INX
@shift_btp:
@shift_btp: ;; check out SMB instruction here! //Hugo
DEX
BEQ end__;X=0 end this
CLC

View file

@ -2,7 +2,7 @@
.include "macros/timer.s"
.include "STARTUP.s"
.include "routines/line/line_test_time.s"
.include "routines/line/line_test.s"
;;This is used by .s files to terminate nicely without reading includes at the end!
exit: