diff --git a/wip-hugo/macros/16aritmatic.s b/wip-hugo/macros/16aritmatic.s index 820dae3..8aca513 100755 --- a/wip-hugo/macros/16aritmatic.s +++ b/wip-hugo/macros/16aritmatic.s @@ -90,7 +90,7 @@ ;;Larger then operation, uses the A register ;;IF a < b then: jump to label ; C =0 if jump to LABEL -.macro Lag_16 a_low, a_hi, b_low, b_hi, label ; [low, hi] = [low, hi]*2 +.macro Lag_16 a_low, a_hi, b_low, b_hi, label LDA a_hi CMP b_hi BCC label @@ -100,3 +100,27 @@ BCC label LABEL: .endmacro + + +;.macro Lag_16y a_hi, b_hi,b_low, label +; LDA a_hi +; CMP b_hi +; BCC label +; BNE LABEL +; ;LDA a_low +; CPY b_low +; BCC label +; LABEL: +;.endmacro +.macro Lag_16y a_low, a_hi, b_hi, label + LDA a_hi + CMP b_hi + BCC label + BNE LABEL + LDA a_low + STY next +1 +next: + CMP #$ff + BCC label + LABEL: +.endmacro diff --git a/wip-hugo/routines/memory/memcpy.s b/wip-hugo/routines/memory/memcpy.s index e69de29..0bfdf06 100644 --- a/wip-hugo/routines/memory/memcpy.s +++ b/wip-hugo/routines/memory/memcpy.s @@ -0,0 +1,40 @@ +;;; -*- Mode: asm; indent-tabs-mode: t; tab-width: 8 -*- + +;;############ HANDLES BIG MEMORY MANAGMENTS ############ +;;Move memory from B_start B_end to A_start , (implied address) +;; B_start and B_end gets modified under execution. +.proc memcpy + A_start = $FAFB + B_start = $FCFD + B_end = $FEFF + + ;; Let Y + A_start lower nibble represent A_start + ;; therefor: A_start = Y - A_start + ;; With Y we mean what Y will represent later aka >B_start + Sub_16 >A_start, B_start, #$00 + + ;;Lets move B_start lover-nibble to Y + LDY >B_start + LDA #$00 + STA >B_start +loop: + ;Lag_16 >B_end, B_start, B_end, B_end, B_start stop the loop + LDA (>B_start), Y + STA (>A_start), Y + ;Tip save time by counting downward, fast to check if Y ==0 // hugo + INY + TYA + CMP #$ff + BNE loop + ;BPL loop; Branch if Y dont overflow + ;; Fix overflow + ;LDX #$23 + LDY #$00 + INC B_start, $D000 + Mov_16 >B_end, ($D000 +$1F40) + + Mov_16 >A_start, VIC_bank + ;Mov_16 >A_end, >A_end, #<(VIC_bank+100), #>(VIC_bank +100) + JSR memcpy + RTS +.endproc diff --git a/wip-hugo/source.s b/wip-hugo/source.s index 70be136..fb7dab9 100755 --- a/wip-hugo/source.s +++ b/wip-hugo/source.s @@ -1,12 +1,15 @@ +.debuginfo + ; Generate debug info .include "macros/16aritmatic.s" .include "macros/timer.s" .include "STARTUP.s" -.include "routines/line/line_test_time.s" - +;.include "routines/line/line_test_time.s" +jsr text ;;This is used by .s files to terminate nicely without reading includes at the end! exit: jmp exit +.include "routines/text/text.s" .include "routines/memory/memset.s" .include "routines/memory/pixel_draw.s" +.include "routines/memory/memcpy.s"