Compare commits

..

No commits in common. "0797e69106dccbbe6cead5640fc189d5860750a7" and "9694d8d55b67ecc174769d50f033102be42c9952" have entirely different histories.

5 changed files with 56 additions and 54 deletions

View file

@ -10,6 +10,12 @@
.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
@ -17,7 +23,15 @@
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,28 +48,33 @@
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!
LDX #$00
increment_x_pos:
INC X_pos;; legacy
CLC
LDA byte_to_paint
ROR byte_to_paint
LDX #$00
ORA (>btp_mem_pos, X)
STA (>btp_mem_pos, X)
increment_pixel_x:
CLC
ROR byte_to_paint
BCS move_8px_left
JMP increment_pixel_x_end
jmp increment_x_pos_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_pixel_x_end:
INC X_pos;; legacy
;; 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:
LDX X_pos
CPX X_end
BEQ end
@ -77,21 +82,21 @@ increment_pixel_x_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:
Sub_16 >D, <D, >V, <V ; D = D - V
increment_y_pos:
INC 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: ; Z=1 --> C=1
move_8px_down:
;; +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,6 +8,16 @@
;;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
@ -42,50 +52,23 @@
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:
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
jsr pixel_draw
;;Increment Y until Y_pos = Y_end and X_pos = X_end
INC Y_pos
LDY Y_pos
CPY 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
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
case_2:
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: ;; check out SMB instruction here! //Hugo
@shift_btp:
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.s"
.include "routines/line/line_test_time.s"
;;This is used by .s files to terminate nicely without reading includes at the end!
exit: