From 185f37dcccf8a5b15ab0982c1c87ce0721c067f0 Mon Sep 17 00:00:00 2001 From: hugova Date: Sat, 26 Jul 2025 15:55:57 +0200 Subject: [PATCH] make use of new clear_screen macro. --- wip-hugo/STARTUP.s | 9 +- wip-hugo/program.lbl | 168 ------------------ .../routines/circle/circle_test_position.s | 8 +- wip-hugo/routines/circle/circle_test_size.s | 7 +- wip-hugo/routines/line/line_test_extensive.s | 23 +-- wip-hugo/routines/memory/memset_alt.s | 75 -------- wip-hugo/source.s | 22 +-- 7 files changed, 20 insertions(+), 292 deletions(-) delete mode 100644 wip-hugo/program.lbl delete mode 100644 wip-hugo/routines/memory/memset_alt.s diff --git a/wip-hugo/STARTUP.s b/wip-hugo/STARTUP.s index 0852267..bc9ebc8 100755 --- a/wip-hugo/STARTUP.s +++ b/wip-hugo/STARTUP.s @@ -58,17 +58,14 @@ 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 A_start, A_start + 1, #VIC_bank - Mov_16 length, length + 1, #<$1f40, #>$1f40 - LDA #$00 - jsr memset + ;; clear the screen + JSR clear_screen ;; Sets the screen color to black and white Mov_16 A_start, A_start + 1, #Screen_RAM Mov_16 length, length + 1, #<$03E8, #>$03E8 LDA #%11110000 - jsr memset + JSR memset ;; Disable maskeble interups (not all) SEI diff --git a/wip-hugo/program.lbl b/wip-hugo/program.lbl deleted file mode 100644 index 2cec8a4..0000000 --- a/wip-hugo/program.lbl +++ /dev/null @@ -1,168 +0,0 @@ -al 001444 .__BSS_LOAD__ -al 001444 .__BSS_RUN__ -al 000000 .__BSS_SIZE__ -al 000001 .__EXEHDR__ -al 000001 .__LOADADDR__ -al 000000 .__ZP_FILEOFFS__ -al 000002 .__ZP_LAST__ -al 0000FE .__ZP_SIZE__ -al 000002 .__ZP_START__ -al 001404 .big_y_offset -al 0013CE .binary_factor -al 0013C3 .log -al 0013BA .inverse_factor_value -al 0013B9 .for_i_end -al 0013B1 .R_pos -al 0013B5 .R_neg -al 0013A4 .for_i -al 00139A .div -al 001399 .endloop -al 00138C .loop -al 00138E .start -al 001387 .mult -al 001377 .change_length -al 001380 .y_overflow -al 001370 .loop -al 00136E .memcpy -al 00132F .big_set_end -al 001337 .small_set -al 001030 .big_set -al 001029 .memset -al 000FFF .move_data -al 000FD6 .calculate_screen_position -al 000FBC .calculate_petski_position -al 000FBC .char_draw -al 000FB3 .calc_byte_to_paint -al 000F95 .pixel_calc -al 000F90 .draw -al 000F88 .calc_byte_to_paint -al 000F6A .pixel_draw -al 000F68 .draw_lower_triangle -al 000F5C .draw_upper_triangle -al 000F45 .BC_overflow -al 000F5C .BC_overflow_end -al 000F28 .AB_overflow -al 000F3C .AB_overflow_end -al 000F1F .triangle -al 000F1E .end -al 000EF9 .qbb_y_overflow -al 000F15 .qbb_y_end -al 000EF3 .qbb_y -al 000ED9 .qdb_overflow -al 000EF3 .qdb_y_end -al 000ED5 .qdb_y -al 000EBB .qca_x_overflow -al 000ED5 .qca_x_end -al 000EB7 .qca_x -al 000E9D .qaa_x_overflow -al 000EB7 .qaa_x_end -al 000E99 .qaa_x -al 000E95 .change_x -al 000F15 .endif -al 000E95 .if -al 000E6C .qcb_x_overflow -al 000E87 .qcb_x_end -al 000E68 .qcb_x -al 000E4E .qdb_x_overflow -al 000E68 .qdb_x_end -al 000E4A .qdb_x -al 000E2E .qda_y_overflow -al 000E4A .qda_y_end -al 000E28 .qda_y -al 000E0E .qaa_y_underflow -al 000E28 .qaa_y_end -al 000E0A .qaa_y -al 000E08 .change_Y -al 000E00 .draw_qab -al 000DF8 .draw_qbb -al 000DF2 .draw_qdb -al 000DEA .draw_qcb -al 000DE4 .draw_qca -al 000DDC .draw_qda -al 000DD6 .draw_qba -al 000DCE .draw_qaa -al 000DCE .draw_pixels -al 000DCE .while_x_bigger_then_y -al 000DB4 .draw_right_px_in_circle -al 000D93 .draw_lower_px_in_circle -al 000D75 .draw_left_px_in_circle -al 000D57 .draw_upper_px_in_circle -al 000D4B .circle -al 000D2A .move_8px_left -al 000D26 .increment_pixel_x -al 000D1C .LOCALmMACRO_SYMBOLm002F -al 000D4A .end -al 000CFD .move_8px_up -al 000D0B .decrement_y_pos_end -al 000CFA .decrement_y_pos -al 000CF4 .for_y -al 000CDF .end_selfmod -al 000D1C .case_1 -al 000D3B .case_2 -al 000CCB .selfmod -al 000C90 .decrement_y_pos_end -al 000C7F .move_8px_up -al 000C7C .decrement_y_pos -al 000C72 .LOCALmMACRO_SYMBOLm0021 -al 000C9F .end -al 000C53 .move_8px_left -al 000C61 .increment_pixel_x_end -al 000C4F .increment_pixel_x -al 000C49 .for_x -al 000C35 .end_selfmod -al 000C72 .case_1 -al 000C90 .case_2 -al 000C21 .selfmod -al 000BD4 .move_8px_left -al 000BD0 .increment_pixel_x -al 000BC6 .LOCALmMACRO_SYMBOLm0017 -al 000BF5 .end -al 000BA7 .move_8px_down -al 000BB5 .increment_y_pos_end -al 000BA4 .increment_y_pos -al 000B9E .for_y -al 000B7D .end_selfmod -al 000BC6 .case_1 -al 000BE6 .case_2 -al 000B69 .selfmod -al 000B2E .decrement_y_pos_end -al 000B1D .move_8px_up -al 000B1A .decrement_y_pos -al 000B10 .LOCALmMACRO_SYMBOLm0009 -al 000B3D .end -al 000AF1 .move_8px_right -al 000AFF .decrement_pixel_x_end -al 000AED .decrement_pixel_x -al 000AE7 .for_x -al 000AC7 .end_selfmod -al 000B10 .case_1 -al 000B2E .case_2 -al 000AB3 .selfmod -al 000A88 .line_down -al 000B3E .line_down_inv -al 000A80 .steep_ -al 000A84 .shallow_ -al 000BF6 .line_up -al 000CA0 .line_up_inv -al 000A6E .steep -al 000A72 .shallow -al 000A68 .up -al 000A78 .down -al 000A5F .dx_no_underflow -al 000A54 .line -al 000A51 .exit -al 000A21 .end_test_y -al 000A15 .test_y -al 000A0B .end_test_x -al 0009FF .test_x -al 0009D0 .@loop -al 0009BE .long_line_test_b -al 0009A9 .clear_screen_ -al 000992 .@loop -al 000980 .long_line_test_a -al 00096B .clear_screen -al 000954 .@loop -al 0008FE .loop -al 0008C5 .loop -al 000897 .NMI_routine_end -al 000896 .NMI_routine diff --git a/wip-hugo/routines/circle/circle_test_position.s b/wip-hugo/routines/circle/circle_test_position.s index 1c3ea74..ffa296f 100644 --- a/wip-hugo/routines/circle/circle_test_position.s +++ b/wip-hugo/routines/circle/circle_test_position.s @@ -21,12 +21,8 @@ loop: ; DEY ; BNE delay_point - ;;clear screen - VIC_bank = $4000 - Mov_16 A_start, A_start + 1, #VIC_bank - Mov_16 length, length + 1, #<$1f40, #>$1f40 - LDA #$00 - jsr memset + + JSR clear_screen ;;move circle INC $AD diff --git a/wip-hugo/routines/circle/circle_test_size.s b/wip-hugo/routines/circle/circle_test_size.s index 02f901b..1c9093a 100644 --- a/wip-hugo/routines/circle/circle_test_size.s +++ b/wip-hugo/routines/circle/circle_test_size.s @@ -30,12 +30,7 @@ loop: LDA $AD STA radius - ;; clean the screen - VIC_bank = $4000 - Mov_16 A_start, A_start + 1, #VIC_bank - Mov_16 length, length + 1, #<$1f40, #>$1f40 - LDA #$00 - jsr memset + JSR clear_screen ;; draw the circle JSR circle diff --git a/wip-hugo/routines/line/line_test_extensive.s b/wip-hugo/routines/line/line_test_extensive.s index 4f79005..f24537c 100644 --- a/wip-hugo/routines/line/line_test_extensive.s +++ b/wip-hugo/routines/line/line_test_extensive.s @@ -34,14 +34,7 @@ CMP #$ff bne @loop -clear_screen: - ;;Lets clear bitmap - VIC_bank = $4000 - ;;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 A_start, A_start + 1, #VIC_bank - Mov_16 length, length + 1, #<$1f40, #>$1f40 - LDA #$00 - jsr memset +jsr clear_screen long_line_test_a: LDA #$00 @@ -68,12 +61,7 @@ long_line_test_a: CMP #$ff BNE @loop -clear_screen_: - ;;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 A_start, A_start + 1, #VIC_bank - Mov_16 length, length + 1, #<$1f40, #>$1f40 - LDA #$00 - jsr memset + jsr clear_screen long_line_test_b: LDA #$00 @@ -99,12 +87,7 @@ long_line_test_b: CMP #$ff BNE @loop -clear_screen__: - ;;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 A_start, A_start + 1, #VIC_bank - Mov_16 length, length + 1, #<$1f40, #>$1f40 - LDA #$00 - jsr memset +jsr clear_screen long_line_test_b_pos_end_swapped: LDA #$00 diff --git a/wip-hugo/routines/memory/memset_alt.s b/wip-hugo/routines/memory/memset_alt.s deleted file mode 100644 index b2c50b9..0000000 --- a/wip-hugo/routines/memory/memset_alt.s +++ /dev/null @@ -1,75 +0,0 @@ -;;; -*- Mode: asm; indent-tabs-mode: t; tab-width: 8 -*- - -;; Sets memory in 'A'-registry to all addresses from 'A_start' until 'A_start' + 'length' -;; Modifies A, X and A_start -.proc memset - .include "mem.inc" - -;; big_set sets the memory in $ff chunks. -;; skipp if length >= $ff -LDX length +1 -BNE big_set -JMP small_set - -big_set: ;sets $ff of memory - ;; Y value do not matter, will go through all anyway! - .repeat $ff - STA (A_start), Y - DEY - .endrepeat - STA (A_start), Y ; dont forget Y =0 -big_set_end: - ;;set all hole $ff memory chunks! - INC A_start + 1 - DEX ;; length +1 -- - BEQ small_set - JMP big_set - - -small_set: - STA data_to_write - LDA length - STA length_copy - - ;; calculate rts-position - LDX #$00 - STX length + 1 - ;; 3 bytes = STA DEY NOP = seting 1 byte of memory. - ;; So we need to calculate: length*3 - Mult_16 A, length + 1 - ; A= length - ADC length_copy - TAY - LDA length + 1 - ADC #$00 - STA length + 1 - - ;; Now RTS_pointer + Y = length*3 + big_set_label - LDA #big_set - ADC length + 1 - STA RTS_pointer + 1 - - ;; read data we will change to RTS - STY Y_copy - LDA (RTS_pointer), Y - TAX - - ;; set RTS in big_set - LDA #$60 - STA (RTS_pointer), Y - - ;; JSR to modified big_set - LDY length_copy - DEY ; because we want to count to Y=0 :) - LDA data_to_write - JSR big_set - - ;; revert changes - LDY Y_copy - TXA - STA (RTS_pointer), Y - - RTS -.endproc diff --git a/wip-hugo/source.s b/wip-hugo/source.s index 59c0c30..33379cf 100644 --- a/wip-hugo/source.s +++ b/wip-hugo/source.s @@ -11,17 +11,17 @@ .include "STARTUP.s" ;.include "dubbel_buffer/raster_irqs.s" -;.include "routines/arithmatic/mult_test.s" -;.include "routines/arithmatic/div_test.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/arithmatic/mult_test.s" +.include "routines/arithmatic/div_test.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" -;.include "routines/pixel/pixel_test.s" -;.include "routines/memory/memcpy_test.s" -;.include "routines/memory/memset_test.s" +.include "routines/text/char_draw_test.s" +.include "routines/pixel/pixel_test.s" +.include "routines/memory/memcpy_test.s" +.include "routines/memory/memset_test.s" ;.include "routines/triangle/triangle_test.s" exit: @@ -34,7 +34,7 @@ JMP exit .include "routines/pixel/pixel_calc.s" .include "routines/text/char_draw.s" .include "routines/memory/memset.s" -;.include "routines/memory/clear_screen.s" +.include "routines/memory/clear_screen.s" .include "routines/memory/memcpy.s" .include "routines/arithmatic/mult.s" .include "routines/arithmatic/div.s"