From bf7021a3a99ca2b9f60c43634965dfbd8b89a7ed Mon Sep 17 00:00:00 2001 From: hugova Date: Tue, 15 Jul 2025 22:37:56 +0200 Subject: [PATCH] revert memset.s --- wip-hugo/routines/memory/memset.s | 51 ++++++------------------------- 1 file changed, 9 insertions(+), 42 deletions(-) diff --git a/wip-hugo/routines/memory/memset.s b/wip-hugo/routines/memory/memset.s index 16e6af6..55700e9 100755 --- a/wip-hugo/routines/memory/memset.s +++ b/wip-hugo/routines/memory/memset.s @@ -18,8 +18,6 @@ big_set: ;sets $ff of memory DEY .endrepeat STA (A_start), Y ; dont forget Y =0 - NOP - NOP big_set_end: ;;set all hole $ff memory chunks! INC A_start + 1 @@ -28,46 +26,15 @@ big_set_end: JMP big_set + +;;sets the rest of the memory +;; note that this can use code above (smc) or the same method. may implement later. small_set: - STA data_to_write - LDA length - STA length_copy - - ;; calculate rts-position - LDA #$00 - STA length + 1 - ;; 4 bytes = STA DEY NOP = seting 1 byte of memory. - ;; So we need to calculate: length*4 - Mult_16 length, length + 1 - Add_16 length, length + 1, length_copy, #$00 - ;; Now RTS_pointer = length*4 + big_set_label - CLC - LDA #big_set - ADC length + 1 - STA RTS_pointer + 1 - - ;; read data we will change to RTS - LDY #$00 - LDA (RTS_pointer), Y - STA instruction_backup - - ;; 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 #$00 - LDA instruction_backup - STA (RTS_pointer), Y - + LDY length +small_set_loop: + STA (A_start), Y + DEY + BNE small_set_loop + STA (A_start), Y RTS .endproc