Mercurial > vba-clojure
view java/src/com/aurellem/gb/Gb.java @ 73:8a895ed4c0f9
added history facilities
author | Robert McIntyre <rlm@mit.edu> |
---|---|
date | Thu, 08 Mar 2012 04:37:10 -0600 |
parents | 4699c7bab77d |
children | d7c38ce83421 |
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 rom20 * @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 final int NUM_REGISTERS = 27;65 public static native void getRAM(int[] store);67 public static native void getROM(int[] store);69 public static native void getWRAM(int[] store);71 public static native void getVRAM(int[] store);73 public static native void getRegisters(int[] store);74 }