add basic 68k emulation callbacks

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 3
916a2c764bde
child 5
6a0c1ee6f6ca

add basic 68k emulation callbacks

src/main.c file | annotate | diff | revisions
     1.1 diff -r 916a2c764bde -r 21a7b07b6310 src/main.c
     1.2 --- a/src/main.c	Sun Nov 28 03:03:34 2010 +0000
     1.3 +++ b/src/main.c	Sun Nov 28 03:14:37 2010 +0000
     1.4 @@ -1,4 +1,43 @@
     1.5  #include <stdio.h>
     1.6 +#include <stdint.h>
     1.7 +#include "musashi/m68k.h"
     1.8 +
     1.9 +// m68k memory
    1.10 +//uint32_t rom[32768/4];
    1.11 +uint32_t ram[512*1024/4];
    1.12 +
    1.13 +// read m68k memory
    1.14 +uint32_t m68k_read_memory_32(uint32_t address)
    1.15 +{
    1.16 +	return ram[address];
    1.17 +}
    1.18 +
    1.19 +uint32_t m68k_read_memory_16(uint32_t address)
    1.20 +{
    1.21 +	return ram[address] & 0xFFFF;
    1.22 +}
    1.23 +
    1.24 +uint32_t m68k_read_memory_8(uint32_t address)
    1.25 +{
    1.26 +	return ram[address] & 0xFF;
    1.27 +}
    1.28 +
    1.29 +// write m68k memory
    1.30 +void m68k_write_memory_32(uint32_t address, uint32_t value)
    1.31 +{
    1.32 +	ram[address] = value;
    1.33 +}
    1.34 +
    1.35 +void m68k_write_memory_16(uint32_t address, uint32_t value)
    1.36 +{
    1.37 +	ram[address] = (ram[address] & 0xFFFF0000) | (value & 0xFFFF);
    1.38 +}
    1.39 +
    1.40 +void m68k_write_memory_8(uint32_t address, uint32_t value)
    1.41 +{
    1.42 +	ram[address] = (ram[address] & 0xFFFFFF00) | (value & 0xFF);
    1.43 +}
    1.44 +
    1.45  
    1.46  int main(void)
    1.47  {