Memory copy.

As tia, tii, tin, etc... only takes immediate values as arguments, the trick is to have the copy instruction in ram and modify the arguments.

Summary
Memory copy.As tia, tii, tin, etc...
Copy Modes.
SOURCE_ALT_DEST_INCAlternate source address and increment destination address (TAI).
SOURCE_DEC_DEST_DEC = $c3Decrement source and destination addresses (TDD).
SOURCE_INC_DEST_ALTIncrement source address and alternate destination address (TIA).
SOURCE_INC_DEST_NOPIncrement source address and leave destination address unchanged (TIN).
SOURCE_INC_DEST_INCIncrement source and destination addresses (TII).
Memory copy helpers.
memcpy_initInitialize memcpy routine.
memcpy_modeSet memcpy mode (see Copy Modes).
memcpy_argsSet memcpy arguments.
memcpy_exCopy len bytes from the src to dst.

Copy Modes.

SOURCE_ALT_DEST_INC

SOURCE_ALT_DEST_INC = $f3

Alternate source address and increment destination address (TAI).

SOURCE_DEC_DEST_DEC = $c3

SOURCE_DEC_DEST_DEC = $c3

Decrement source and destination addresses (TDD).

SOURCE_INC_DEST_ALT

SOURCE_INC_DEST_ALT = $e3

Increment source address and alternate destination address (TIA).

SOURCE_INC_DEST_NOP

SOURCE_INC_DEST_NOP = $d3

Increment source address and leave destination address unchanged (TIN).

SOURCE_INC_DEST_INC

SOURCE_INC_DEST_INC = $73

Increment source and destination addresses (TII).

Memory copy helpers.

memcpy_init

Initialize memcpy routine.

Detail

This macro basically set memcpy_rts to the RTS instruction value.

memcpy_mode

Set memcpy mode (see Copy Modes).

Parameters

modememory copy mode.

memcpy_args

Set memcpy arguments.

Parameters

srcsource.
dstdestination.
lennumber of bytes to copy.

memcpy_ex

Copy len bytes from the src to dst.  This is equivalent to :

memcpy_mode mode
memcpy_args src, dst, len
jsr    memcpy

Assembly call

memcpy_ex <_si, #video_data, #$0100, #SOURCE_INC_DEST_ALT

Parameters

srcsource.
dstdestination.
lennumber of bytes to copy.
modememory copy mode (see Copy Modes).  optinal (default: SOURCE_INC_DEST_ALT).
SOURCE_ALT_DEST_INC = $f3
Alternate source address and increment destination address (TAI).
SOURCE_DEC_DEST_DEC = $c3
Decrement source and destination addresses (TDD).
SOURCE_INC_DEST_ALT = $e3
Increment source address and alternate destination address (TIA).
SOURCE_INC_DEST_NOP = $d3
Increment source address and leave destination address unchanged (TIN).
SOURCE_INC_DEST_INC = $73
Increment source and destination addresses (TII).
Close