Z80-MEMORY(3) Memory access Z80-MEMORY(3)NAMEinit_banks(), reset_banks(), bank_port(), switch_bank(), clear_mem‐
ory(), memory_at(), read_addr(), read_memo(), write_memo(),
write_to_memory(), dma_write(), dma_read() - total memory access
SYNOPSIS
#include <stdio.h>
int init_banks(char *rom_path, char *bank_mapping_descr);
void reset_banks(void);
unsigned bank_port(unsigned char id);
void switch_bank(unsigned char id, unsigned i);
void clear_memory(void);
unsigned char memory_at(unsigned short index);
unsigned char * io_address;
unsigned char read_addr(unsigned short index);
unsigned char read_memo(unsigned short index);
void write_memo(unsigned short index, unsigned char data);
unsigned char write_to_memory(unsigend short index, unsigned char
data);
unsigned dma_write(unsigned short offset, unsigned count, FILE *from);
unsigned dma_read(unsigned short offset, unsigned count, FILE *to);
DESCRIPTION
These functions provide all memory access and also read data from
external hardware.
init_banks
initializes the bank handling and reads the bank contents from
the directory *rom_path with the file *bank_mapping_descr con‐
taining the bank mapping description. It returns the number of
usable bank entries in the description file.
reset_banks
does a reset to the banks meaning going to the default initial‐
ization.
bank_port
can be used to test a port whether it is reserved for bank
switching. If this is the case it returns the positive bank
port no else 0.
switch_bank
switches the bank id into memory at the position defined by bank
port no i.
clear_memory
sets these parts of the 64kB RAM to 0 which are writeable.
memory_at
returns the byte value at position index in the memory. Can not
be used by the decoding or execution unit of the CPU because it
by-passes the CPU.
io_address
holds the location of an external supplied byte by the hardware.
read_addr
returns the byte value correspoing to the address index. This
may be an IO-address in which case io_address is just to locate
the byte.
read_memo
returns the byte value correspoing to the address index from
memory.
write_memo
writes the byte value data into memory at address index provided
this address is writeable.
write_to_memory
writes the byte value data to address index provided this
address is writeable. It returns the previous value at the
address. This function can not be used by the execution unit
because it by-passes the CPU. It is demanded from compile(void)
which is called from z80-mon.
dma_write
transfers into memory starting at address offset count many
bytes directly from file from by passing the CPU.
dma_read
transfers from memory address offset count many bytes directly
into file to by passing the CPU.
SEE ALSOz80-memory(5), z80-banks(5)Z80-MEMORY Version 2.4 01 Oct 2006 Z80-MEMORY(3)