view java/src/com/aurellem/gb/Gb.java @ 60:ef59aee6d715

added function to retrieve main RAM
author Robert McIntyre <rlm@mit.edu>
date Wed, 07 Mar 2012 19:29:51 -0600
parents 3ce48d803e74
children 4699c7bab77d
line wrap: on
line source
1 package com.aurellem.gb;
3 import java.nio.ByteBuffer;
4 import java.nio.IntBuffer;
5 import java.nio.ByteOrder;
7 public class Gb {
10 public Gb(){}
13 /**
14 * Hello World! This is just to test the native interface.
15 */
16 public static native void sayHello();
18 /**
19 * Run the emulator on a given rom
20 * @param rom - the name of the rom.
21 */
22 public static native void startEmulator(String rom);
25 public static void loadVBA(){
26 System.loadLibrary("vba");
27 }
29 public static native void step();
31 public static native void step(int keymask);
33 public static native void shutdown();
35 public static native void saveState(ByteBuffer buffer, int size);
37 public static native void loadState(ByteBuffer buffer, int size);
39 public static final int SAVE_SIZE = 90000;
41 public static ByteBuffer saveState(){
42 ByteBuffer buf =
43 ByteBuffer.allocateDirect(SAVE_SIZE)
44 .order(ByteOrder.nativeOrder());
45 buf.clear();
46 saveState(buf, SAVE_SIZE);
47 buf.flip();
48 return buf;
49 }
51 public static void loadState(ByteBuffer saveState){
52 loadState(saveState, SAVE_SIZE);
53 }
55 public static native int getROMSize();
56 public static native int getRAMSize();
59 public static final int WRAM_SIZE = 0x8000;
61 public static final int VRAM_SIZE = 0x4000;
63 public static native void getRAM(int[] store);
65 public static native void getROM(int[] store);
67 public static native void getWRAM(int[] store);
69 public static native void getVRAM(int[] store);
71 }