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

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