Memory Manipulation Routines ------------------------------------------------------------------ 1-101 Function Name: InitRam Purpose: Uses a table to set various memory locations in a uniform manner. Call address: $C181 Input requirements: $02-$03 R0 Address of a data table. Description: This routine allows many memory locations to be specified and set in an orderly manner. The format of the data table is as follows: #bytes Description 2 Address to store values at. 1 # of values that follow. ? Values to be stored at the designated memory region. ... More definitions. 2 An address of $0000 ends the table. 1-102 Function Name: MoveData Purpose: Intelligent block move. Call address: $C17E Input requirements: $02-$03 R0 The source address. $04-$05 R1 The destination address. $06-$07 R2 The length of the region to be moved. Description: This routine will perform an intelligent, i.e. nonconflicting, block move of memory. If an attempt is made to move a block of memory to a destination that is within the block, the transfer is done from back to front so as to prevent the conflict, or 'ripple effect'. 1-103 Function Name: i_MoveData Purpose: Identical to MoveData, but with inline data. Call address: $C1B7 Description: This routine uses the inline data to set everything up before calling MoveData. For example: JSR i_MoveData .word Source address .word Destination address .word Length of transfer Control returns here upon completion. 1-104 Function Name: FillRam Purpose: Fills a memory region with a specified byte. Call address: $C17B Input requirements: $02-$03 R0 The length of the region. $04-$05 R1 The address of the region. $06 R2L The byte to fill the region with. Description: A simple loop fills memory with the specified byte. 1-105 Function Name: i_FillRam Purpose: Identical to FillRam, but with inline data. Call address: $C1B4 Description: This routine takes the inline data and sets everything up before calling FillRam. For example: JSR i_FillRam .word Length of region .word Address of region .byte Byte to fill memory with Control returns here upon completion. 1-106 Function Name: ClearRam Purpose: Fills a memory region with zeroes. Call address: $C178 Input requirements: $02-$03 R0 The length of the region. $04-$05 R1 The address of the region. Description: Memory is filled with zeroes by storing a $00 at location $06 and calling FillRam. 1-107 Function Name: CmpString Purpose: Compare two strings for equality. Call address: $C26B Input requirements: X Address of a zero page pointer. Y Address of a zero page pointer. Output: Z flag Set accordingly. Description: The X and Y registers point to zero page pointers. The two strings are compared up to a zero byte. The Z flag is set accordingly. 1-108 Function Name: CopyString Purpose: Copy a string. Call address: $C265 Input requirements: X Address of zero page source pointer. Y Address of zero page destination pointer. Description: The X and Y registers point to zero page pointers. Data is copied up to and including a zero byte. This routine is used to copy strings by setting A to zero and calling CopyFString. 1-109 Function Name: CmpFString Purpose: Compares two blocks of memory for a fixed length. Call address: $C26E Input requirements: A Byte count. X Address of zero page source pointer. Y Address of zero page destination pointer. Output: Z flag Set accordingly. Description: The X and Y registers point to zero page pointers. A has the number of bytes to be compared (1-255). If A is zero, this routine will compare up to and including a zero byte. The Z flag is set accordingly. See CmpString. 1-110 Function Name: CopyFString Purpose: Copy a block of memory. Call address: $C268 Input requirements: A Byte count. X Address of zero page source pointer. Y Address of zero page destination pointer. Description: The X and Y registers point to zero page pointers. A has the number of bytes to be transferred (1-255). If A is zero, this routine will copy up to and including a zero byte. See CopyString. 1-111 Function Name: StashRAM Purpose: Copy a block of memory into an REU from main memory Call address: $C2C8 Input requirements: $02-$03 R0 Pointer to an address in main memory $04-$05 R1 Address within the 64k REU bank addressed $06-$07 R2 Number of bytes to swap, fetch, verify, etc. $08 R3L REU 64k bank to work with Output: X Error code A REU status Description: The Y register is loaded with $90, and DoRamOp (see blow) is called. 1-112 Function Name: FetchRAM Purpose: Copies a block of memory from an REU into main memory Call address: $C2CB Input requirements: $02-$03 R0 Pointer to an address in main memory $04-$05 R1 Address within the 64k REU bank addressed $06-$07 R2 Number of bytes to fetch $08 R3L REU 64k bank to work with Output: X Error code A REU status Description: The Y register is loaded with $91, and DoRamOp (see blow) is called. 1-113 Function Name: SwapRAM Purpose: Swaps a block of main memory with an REU block Call address: $C2CE Input requirements: $02-$03 R0 Pointer to an address in main memory $04-$05 R1 Address within the 64k REU bank addressed $06-$07 R2 Number of bytes to swap $08 R3L REU 64k bank to work with Output: X Error code A REU status Description: The Y register is loaded with $92, and DoRamOp (see blow) is called. 1-114 Function Name: VerifyRAM Purpose: Verifies (compares) a block of memory to one in an REU Call address: $C2D1 Input requirements: $02-$03 R0 Pointer to an address in main memory $04-$05 R1 Address within the 64k REU bank addressed $06-$07 R2 Number of bytes verify $08 R3L REU 64k bank to work with Output: X Error code A REU status Description: The Y register is loaded with $93, and DoRamOp (see blow) is called. 1-115 Function Name: DoRamOp Purpose: Move memory to and from an REU Call address: $C2D4 Input requirements: $02-$03 R0 Pointer to an address in main memory $04-$05 R1 Address within the 64k REU bank addressed $06-$07 R2 Number of bytes to swap, fetch, verify, etc. $08 R3L REU 64k bank to work with Y REU command to execute (see below) Output: X Error code A REU status Description: The Y register contains $90 to store, $91 for a fetch, $92 for a memory swap, and $11 to verify (compare). R0 and R2 tell this routine the block of main memory to store, swap, fetch, or verify. R3L and R1 combine to form a 3-byte address within the REU to work with.