Detailed Description
Handling memory and I/O access.
EMU68 memory manager assumes that all addresses in the lowest half part of address space are memory access. A simple bit test over most signifiant bit (23) of address allow to choose beetween memory or eventual IO access. In case of memory access, address is masked to fit available 68K onboard memory. Overflow does NOT generate address error. IO access are performed towards quick access tables. There are 6 acccess tables: for each read and write access in 3 sizes (byte, word and long). Each of this 6 tables has 256 entries filled with a pointer to suitable function. At init time, the entries of all tables are initialized to access 68K onboard memory. When an IO is plugged by user, it is mapped somewhere in 68K address space. EMU68 memory manager get bit 8 to 15 of address to make an index to be used in the suitable table (R/W for B/W/L).
Featuring
- Onboard memory byte, word and long read/write access.
- Optimized IO warm mapping/unmapping.
- Optionnal (compile time) enhanced memory control with RWX access tag and hardware breakpoints.
Limitations
- For optimization purposes IO must be mapped in high half memory (bit 23 of address setted).
- Two IO can not shared the same memory location for bit 8 to 15. Conflicts could be resolved by creating an intermediate IO which dispatches to others. This mechanism has not been implemented yet, so users must do it them self if needed.
Atari-ST & Amiga IO areas
FF8800-FF88FF : YM2149 (ST)FF8900-FF89FF : Micro-Wire (STE)FF8200-FF82FF : Shifter (ST)FFFA00-FFFAFF : MFP (ST)DFF000-DFF0DF : Paula (AMIGA)
|
Files |
file | mem68.h |
| 68k memory and IO manager header.
|
Memory access flags for reg68.chk (debug mode only). |
#define | READ_68 1 |
| Memory location has been read.
|
#define | WRITTEN_68 2 |
| Memory location has been written.
|
#define | EXECUTED_68 4 |
| Memory location has been executed.
|
#define | BREAKED_68 8 |
| Memory location has emulator-breakpoint.
|
Memory/IO quick access tables. |
#define | ISIO68(ADDR) ((ADDR)&0x800000) |
| Test for direct memory access or IO quick table access.
|
memrfunc68_t | read_mem_jmp_l [256] |
| Read long.
|
memrfunc68_t | read_mem_jmp_w [256] |
| Read word.
|
memrfunc68_t | read_mem_jmp_b [256] |
| Read byte.
|
memwfunc68_t | write_mem_jmp_l [256] |
| Write long.
|
memwfunc68_t | write_mem_jmp_w [256] |
| Write word.
|
memwfunc68_t | write_mem_jmp_b [256] |
| Write byte.
|
68K onboard memory access. |
#define | read_B(ADDR) read_68000mem_b(ADDR) |
| Read memory byte.
|
#define | read_W(ADDR) read_68000mem_w(ADDR) |
| Read memory word.
|
#define | read_L(ADDR) read_68000mem_l(ADDR) |
| Read memory long.
|
#define | write_B(ADDR, VAL) write_68000mem_b(ADDR,VAL) |
| Write memory byte.
|
#define | write_W(ADDR, VAL) write_68000mem_w(ADDR,VAL) |
| Write memory word.
|
#define | write_L(ADDR, VAL) write_68000mem_l(ADDR,VAL) |
| Write memory long.
|
u32 | read_68000mem_b (u32 addr) |
| Read memory byte.
|
u32 | read_68000mem_w (u32 addr) |
| Read memory word.
|
u32 | read_68000mem_l (u32 addr) |
| Read memory long.
|
void | write_68000mem_b (u32 addr, u32 v) |
| Write memory byte.
|
void | write_68000mem_w (u32 addr, u32 v) |
| Write memory word.
|
void | write_68000mem_l (u32 addr, u32 v) |
| Write memory long.
|
Instruction read. |
s32 | get_nextw (void) |
| Decode word and update PC.
|
s32 | get_nextl (void) |
| Decode long and update PC.
|
Stack access. |
void | pushl (s32 v) |
| Push long.
|
void | pushw (s32 v) |
| Push word.
|
s32 | popl (void) |
| Pop long.
|
s32 | popw (void) |
| Pop word.
|
Functions |
void | EMU68memory_init (void) |
| Init memory quick access table.
|
void | EMU68memory_reset (void) |
| Reset memory quick access table.
|
void | EMU68memory_new_area (u8 area, memrfunc68_t *read_bwl, memwfunc68_t *write_bwl) |
| Add a new memory access control area (for new IO).
|
void | EMU68memory_reset_area (u8 area) |
| Reset memory access control area to default state.
|
Function Documentation
void EMU68memory_init |
( |
void |
|
) |
|
|
void EMU68memory_reset |
( |
void |
|
) |
|
|
|
Reset memory quick access table.
The EMU68memory_reset() function restores all memory access to default. All mapped IO will be discard and replace by onboard memory access. |
|
Add a new memory access control area (for new IO).
- Parameters:
-
area | Which area (bit 16 to 23 of address) to change. |
read_bwl | Read function table (byte, word and long in this order) |
write_bwl | idem read_bwl for write access. |
- See also:
- EMU68memory_reset_area()
|
void EMU68memory_reset_area |
( |
u8 |
area |
) |
|
|
|