diff --git a/wip-hugo/STARTUP.s b/wip-hugo/STARTUP.s index dea8caa..a065f3c 100755 --- a/wip-hugo/STARTUP.s +++ b/wip-hugo/STARTUP.s @@ -58,15 +58,15 @@ ORA Screen_RAM_settings STA Screen_RAM_settings ;;Paint the bitmap black. More bitmap: https://www.c64-wiki.com/wiki/53272, https://www.c64-wiki.com/wiki/Screen_RAM#Moving_of_screen_RAM -Mov_16 >B_start, VIC_bank -Mov_16 >B_end, $5f3f +Mov_16 B_start, B_start + 1, #VIC_bank +Mov_16 B_end, B_end + 1, #<$5f3f, #>$5f3f LDA #$00 jsr memset ;;Sets the screen color to black and white -Mov_16 >B_start, Screen_RAM -Mov_16 >B_end, Screen_RAM_end +Mov_16 B_start, B_start + 1, #Screen_RAM +Mov_16 B_end, B_end + 1, #Screen_RAM_end LDA #%11110000 jsr memset SEI ;Disable interups (not all) diff --git a/wip-hugo/routines/line/line.inc b/wip-hugo/routines/line/line.inc index b651a58..4060b9b 100644 --- a/wip-hugo/routines/line/line.inc +++ b/wip-hugo/routines/line/line.inc @@ -5,13 +5,13 @@ Y_end = $F0 dx = $F3 dy = $F1 - dy_2 = $F1F2 - dx_2 = $F3F4 - V = $EDEE - D = $EBEC - ;;These come from mem.inc + dy_2 = $F1 ; 16-bit value (uses F2) + dx_2 = $F3 ; 16-bit value (uses F4) + V = $ED ; 16-bit value (uses EE) + D = $EB ; 16-bit value (uses EC) + ;; These come from mem.inc ;; Takes up FF - F5 X_pos = $FC Y_pos = $FB - byte_to_paint = $FE ;Byte with one 1 that corisponds to a pixel. - btp_mem_pos =$F9FA; byte to paint memory position ;Position of byte on screen + byte_to_paint = $FE ; Byte with one 1 that corisponds to a pixel. + btp_mem_pos =$F9 ; 16-bit value (uses FA), byte to paint memory position diff --git a/wip-hugo/routines/line/line.s b/wip-hugo/routines/line/line.s index 5b656e8..b6bde91 100644 --- a/wip-hugo/routines/line/line.s +++ b/wip-hugo/routines/line/line.s @@ -2,8 +2,6 @@ .proc line; X_pos =< X_end skall alltid gälla .include "line.inc" - ; dx_ = $0c - ; dy_ = $06 ;;dx SEC LDA X_end diff --git a/wip-hugo/routines/line/line_down.s b/wip-hugo/routines/line/line_down.s index e90ab7a..a924e30 100644 --- a/wip-hugo/routines/line/line_down.s +++ b/wip-hugo/routines/line/line_down.s @@ -14,19 +14,19 @@ ;;We need to clear this memory LDA #$00 - STA V - Mult_16 >V, dy_2, dy_2 = dy (same address) + Mult_16 dy_2, dy_2 +1 ;>dy_2 = dy (same address) ;; This is an Bresenham's line algorithm, se wikipedia bellow. ;;https://en.wikipedia.org/wiki/Bresenham%27s_line_algorithm @@ -39,9 +39,9 @@ ;; and to its branch logic later in the loop. ;;D = 2*dy - dx + 2*255 - Mov_16 >D, dy_2, D, D, dy_2 - LDA >dy_2 + LDA dy_2 STA case_2 +1 ;; Modifies LDA V - LDA >V + LDA V STA case_1 +1 ;; Modifies SBC btp_mem_pos), Y - STA (>btp_mem_pos), Y + ORA (btp_mem_pos), Y + STA (btp_mem_pos), Y increment_pixel_x: LSR byte_to_paint ; Rotates the pixel one bit to the left ON THE SCREEN. BCC increment_pixel_x_end; We need to move to the next chunk @@ -80,7 +80,7 @@ move_8px_left: ;; Next chunk is 8 addresses away. Look in pixel_draw for more detail. ;; -8. ;; C = 1 therefore you se 07 - Add_16 >btp_mem_pos, D, D - Sub_16_A >D, V, #V, # C=1 ;; Switch to chunk bellow ; C = 1 ; So we subtract #$3F, #$01 +C - Add_16 >btp_mem_pos, D, dy_2, #dy_2, #V - Mult_16 >V, dx_2, D, dx_2, D, D, dx_2 - STA case_2 +1 - LDA V - STA case_1 +1 - LDA btp_mem_pos), Y - STA (>btp_mem_pos), Y + ORA (btp_mem_pos), Y + STA (btp_mem_pos), Y increment_y_pos: INY CPY #$08 BNE increment_y_pos_end move_8px_down: LDY #$00 - Add_16 >btp_mem_pos, D, D, V, #V, #btp_mem_pos, D, dx_2, #dx_2, #B_start, VIC_bank - Mov_16 >B_end, $5f3f + Mov_16 B_start, B_start + 1, #VIC_bank + Mov_16 B_end, B_end + 1, #<$5f3f, #>$5f3f LDA #$00 jsr memset diff --git a/wip-hugo/routines/line/line_test_time.s b/wip-hugo/routines/line/line_test_time.s index 7006dde..6dacd3a 100644 --- a/wip-hugo/routines/line/line_test_time.s +++ b/wip-hugo/routines/line/line_test_time.s @@ -33,17 +33,14 @@ jmp @loop end__: ;;Lets cleer bitmap - B_start = $FCFD - B_end = $FEFF + B_start = $FCFD ;16-bit value (uses FD) + B_end = $FEFF ;16-bit value (uses FF) VIC_bank = $4000 VIC_bank_end = VIC_bank + $3FFF ;;Paint the bitmap black. More bitmap: https://www.c64-wiki.com/wiki/53272, https://www.c64-wiki.com/wiki/Screen_RAM#Moving_of_screen_RAM - Mov_16 >B_start, VIC_bank - Mov_16 >B_end, $5f3f + Mov_16 B_start, B_start + 1, #VIC_bank + Mov_16 B_end, B_end + 1, #<$5f3f, #>$5f3f LDA #$00 jsr memset - - jmp exit - .endscope diff --git a/wip-hugo/routines/line/line_up.s b/wip-hugo/routines/line/line_up.s index 3296bd3..3a77f9d 100644 --- a/wip-hugo/routines/line/line_up.s +++ b/wip-hugo/routines/line/line_up.s @@ -14,64 +14,64 @@ .include "line.inc"; Defines memory positions, ex X_pos LDA #$00 - STA V - Mult_16 >V, dy_2, D, dy_2, D, D, dy_2 - STA case_2 +1 - LDA V - STA case_1 +1 - LDA btp_mem_pos, btp_mem_pos), Y - STA (>btp_mem_pos), Y + ORA (btp_mem_pos), Y + STA (btp_mem_pos), Y increment_pixel_x: LSR byte_to_paint BCC increment_pixel_x_end move_8px_left: - Add_16 >btp_mem_pos, D, D, V, #V, #btp_mem_pos, D, dy_2, #dy_2, #V - Mult_16 >V, dx_2, D, dx_2, D, D, dx_2 - STA case_2 +1 - LDA V - STA case_1 +1 - LDA btp_mem_pos), Y - STA (>btp_mem_pos), Y + ORA (btp_mem_pos), Y + STA (btp_mem_pos), Y decrement_y_pos: DEY CPY #$ff BNE decrement_y_pos_end move_8px_up: LDY #$07 - Sub_16>btp_mem_pos, D, D, V, #V, #btp_mem_pos, D, dx_2, #dx_2, #B_start - Sub_16 >A_start, B_start, #$00 + Sub_16 A_start, A_start + 1, B_start, #$00 ;;Lets move B_start lover-nibble to Y - LDY >B_start + LDY B_start LDA #$00 - STA >B_start + STA B_start loop: - Lag_16 >B_end, B_start), Y - STA (>A_start), Y + Lag_16 B_end, B_end + 1, A, B_start, end_loop + LDA (B_start), Y + STA (A_start), Y ;Tip save time by counting downward, fast to check if Y ==0 // hugo INY TYA @@ -25,8 +25,8 @@ loop: BNE loop ;; Fix overflow LDY #$00 - INC B_start, $D000 + Mov_16 B_start, B_start + 1, #<$D000, #>$D000 ;#### TEMP INIT DATA #### - Mov_16 >B_end, ($D000 +$1F3F) + Mov_16 B_end, B_end + 1, #<($D000+$1F3F), #>($D000 +$1F3F) LDA #$10 STA code LDA #$10 @@ -18,11 +17,9 @@ VIC_bank = $4000 VIC_bank_end = VIC_bank + $3FFF - Mov_16 >A_start, VIC_bank - ;We first need to clear some memory - ;Mov_16 >A_end, >A_end, #<(VIC_bank+100), #>(VIC_bank +100) + Mov_16 A_start, A_start + 1, #VIC_bank LDA #$00 JSR memcpy - STA B_start ,X) + STA (B_start ,X) - Add_16 >B_start, B_start - CMP >B_end + LDA B_start + CMP B_end BEQ test jmp loop test: - LDA B_start, X) + STA (B_start, X) RTS .endproc diff --git a/wip-hugo/routines/memory/pixel_draw.s b/wip-hugo/routines/memory/pixel_draw.s index 2138d70..f13020f 100755 --- a/wip-hugo/routines/memory/pixel_draw.s +++ b/wip-hugo/routines/memory/pixel_draw.s @@ -34,10 +34,10 @@ end__: ;;pos = x_offset LDA #%11111000 AND >X_pos - STA >btp_mem_pos + STA btp_mem_pos LDA C - STA >B + STA C + STA B LDA #$00 - STA C, C, C, B, C, C, C, btp_mem_pos, C, btp_mem_pos, Bitmap, ! + Add_16 btp_mem_pos, btp_mem_pos + 1, #Bitmap, ! ;;Let draw some stuff LDA byte_to_paint ;; note that both bytes are used! diff --git a/wip-hugo/source.s b/wip-hugo/source.s index 8650072..17e6df9 100755 --- a/wip-hugo/source.s +++ b/wip-hugo/source.s @@ -6,7 +6,7 @@ .include "routines/memory/mem.inc" ;;Code to run .include "STARTUP.s" -.include "routines/line/line_test_time.s" +.include "routines/line/line_test.s" ;.include "routines/memory/memcpy_test.s" exit: jmp exit