diff --git a/wip-hugo/routines/memory/mem.inc b/wip-hugo/routines/memory/mem.inc index 2f301b1..2db17e2 100644 --- a/wip-hugo/routines/memory/mem.inc +++ b/wip-hugo/routines/memory/mem.inc @@ -9,3 +9,4 @@ data_to_write = $D8 length_copy = $d9 ; 16-bit vale (uses da) instruction_backup = $db + Y_copy =$dc diff --git a/wip-hugo/routines/memory/memset_alt.s b/wip-hugo/routines/memory/memset_alt.s index 4197d5b..deec825 100755 --- a/wip-hugo/routines/memory/memset_alt.s +++ b/wip-hugo/routines/memory/memset_alt.s @@ -32,25 +32,29 @@ small_set: 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 + LDX #$00 + STX length + 1 + ;; 3 bytes = STA DEY NOP = seting 1 byte of memory. + ;; So we need to calculate: length*3 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 + STY Y_copy LDA (RTS_pointer), Y - STA instruction_backup + TAX ;; set RTS in big_set LDA #$60 @@ -63,8 +67,8 @@ small_set: JSR big_set ;; revert changes - LDY #$00 - LDA instruction_backup + LDY Y_copy + TXA STA (RTS_pointer), Y RTS diff --git a/wip-hugo/source.s b/wip-hugo/source.s index 7a59d20..ec89c8a 100644 --- a/wip-hugo/source.s +++ b/wip-hugo/source.s @@ -28,7 +28,7 @@ JMP exit .include "routines/pixel/pixel_draw.s" .include "routines/pixel/pixel_calc.s" .include "routines/text/char_draw.s" -.include "routines/memory/memset.s" +.include "routines/memory/memset_alt.s" .include "routines/memory/memcpy.s" .include "routines/arithmatic/mult.s" .include "routines/arithmatic/div.s"