Add memcpy and code skeleton for text.s
This commit is contained in:
parent
6f0b19720d
commit
0adbbaf12c
5 changed files with 88 additions and 5 deletions
|
@ -90,7 +90,7 @@
|
||||||
;;Larger then operation, uses the A register
|
;;Larger then operation, uses the A register
|
||||||
;;IF a < b then: jump to label
|
;;IF a < b then: jump to label
|
||||||
; C =0 if 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
|
LDA a_hi
|
||||||
CMP b_hi
|
CMP b_hi
|
||||||
BCC label
|
BCC label
|
||||||
|
@ -100,3 +100,27 @@
|
||||||
BCC label
|
BCC label
|
||||||
LABEL:
|
LABEL:
|
||||||
.endmacro
|
.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
|
||||||
|
|
|
@ -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, <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_end, >B_start, <B_start, end_loop
|
||||||
|
Lag_16y >B_end, <B_end, <B_start, end_loop
|
||||||
|
;Lag_16y <B_start, >B_end, <B_end, end_loop ; IF 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 <A_start
|
||||||
|
INC <B_start
|
||||||
|
JMP loop
|
||||||
|
end_loop:
|
||||||
|
RTS
|
||||||
|
.endproc
|
|
@ -1,7 +1,7 @@
|
||||||
;;; -*- Mode: asm; indent-tabs-mode: t; tab-width: 8 -*-
|
;;; -*- Mode: asm; indent-tabs-mode: t; tab-width: 8 -*-
|
||||||
|
|
||||||
;;##### HANDLES BIG MEMORY MANAGMENTS ############
|
;;############ HANDLES BIG MEMORY MANAGMENTS ############
|
||||||
;;Sets big barts of memory to a certain byte.
|
;;Sets big parts of memory to a certain byte.
|
||||||
.proc memset
|
.proc memset
|
||||||
Address_start = $FBFC
|
Address_start = $FBFC
|
||||||
Address_end = $FDFE
|
Address_end = $FDFE
|
||||||
|
|
|
@ -1 +1,17 @@
|
||||||
|
;;; -*- Mode: asm; indent-tabs-mode: t; tab-width: 8 -*-
|
||||||
;; petski: https://www.c64-wiki.com/wiki/File:ASCII-Codes.gif
|
;; petski: https://www.c64-wiki.com/wiki/File:ASCII-Codes.gif
|
||||||
|
;; d000
|
||||||
|
.proc text
|
||||||
|
;; TESTING OF MEMCPY TEMPERARLY HERE BECAUSE IT WILL USE THAT :)
|
||||||
|
A_start = $FAFB
|
||||||
|
B_start = $FCFD
|
||||||
|
B_end = $FEFF
|
||||||
|
|
||||||
|
Mov_16 >B_start, <B_start, #<$D000, #>$D000
|
||||||
|
Mov_16 >B_end, <B_end, #<($D000+$1F3F), #>($D000 +$1F40)
|
||||||
|
|
||||||
|
Mov_16 >A_start, <A_start, #<VIC_bank, #>VIC_bank
|
||||||
|
;Mov_16 >A_end, >A_end, #<(VIC_bank+100), #>(VIC_bank +100)
|
||||||
|
JSR memcpy
|
||||||
|
RTS
|
||||||
|
.endproc
|
||||||
|
|
|
@ -1,12 +1,15 @@
|
||||||
|
.debuginfo + ; Generate debug info
|
||||||
.include "macros/16aritmatic.s"
|
.include "macros/16aritmatic.s"
|
||||||
.include "macros/timer.s"
|
.include "macros/timer.s"
|
||||||
|
|
||||||
.include "STARTUP.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!
|
;;This is used by .s files to terminate nicely without reading includes at the end!
|
||||||
exit:
|
exit:
|
||||||
jmp exit
|
jmp exit
|
||||||
|
|
||||||
|
.include "routines/text/text.s"
|
||||||
.include "routines/memory/memset.s"
|
.include "routines/memory/memset.s"
|
||||||
.include "routines/memory/pixel_draw.s"
|
.include "routines/memory/pixel_draw.s"
|
||||||
|
.include "routines/memory/memcpy.s"
|
||||||
|
|
Loading…
Add table
Reference in a new issue