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