src/main.c

Sun, 28 Nov 2010 03:14:37 +0000

author
Philip Pemberton <philpem@philpem.me.uk>
date
Sun, 28 Nov 2010 03:14:37 +0000
changeset 4
21a7b07b6310
parent 0
8bf1bf91a36d
child 7
7b98c7665aae
permissions
-rw-r--r--

add basic 68k emulation callbacks

philpem@0 1 #include <stdio.h>
philpem@4 2 #include <stdint.h>
philpem@4 3 #include "musashi/m68k.h"
philpem@4 4
philpem@4 5 // m68k memory
philpem@4 6 //uint32_t rom[32768/4];
philpem@4 7 uint32_t ram[512*1024/4];
philpem@4 8
philpem@4 9 // read m68k memory
philpem@4 10 uint32_t m68k_read_memory_32(uint32_t address)
philpem@4 11 {
philpem@4 12 return ram[address];
philpem@4 13 }
philpem@4 14
philpem@4 15 uint32_t m68k_read_memory_16(uint32_t address)
philpem@4 16 {
philpem@4 17 return ram[address] & 0xFFFF;
philpem@4 18 }
philpem@4 19
philpem@4 20 uint32_t m68k_read_memory_8(uint32_t address)
philpem@4 21 {
philpem@4 22 return ram[address] & 0xFF;
philpem@4 23 }
philpem@4 24
philpem@4 25 // write m68k memory
philpem@4 26 void m68k_write_memory_32(uint32_t address, uint32_t value)
philpem@4 27 {
philpem@4 28 ram[address] = value;
philpem@4 29 }
philpem@4 30
philpem@4 31 void m68k_write_memory_16(uint32_t address, uint32_t value)
philpem@4 32 {
philpem@4 33 ram[address] = (ram[address] & 0xFFFF0000) | (value & 0xFFFF);
philpem@4 34 }
philpem@4 35
philpem@4 36 void m68k_write_memory_8(uint32_t address, uint32_t value)
philpem@4 37 {
philpem@4 38 ram[address] = (ram[address] & 0xFFFFFF00) | (value & 0xFF);
philpem@4 39 }
philpem@4 40
philpem@0 41
philpem@0 42 int main(void)
philpem@0 43 {
philpem@0 44 return 0;
philpem@0 45 }