comparison java/src/com/aurellem/gb/Gb.java @ 56:ba4fdfb722ed

emabled loading and saving CPU state from clojure.
author Robert McIntyre <rlm@mit.edu>
date Wed, 07 Mar 2012 14:18:44 -0600
parents 719d910c90f8
children 431ee7ee12de
comparison
equal deleted inserted replaced
55:719d910c90f8 56:ba4fdfb722ed
1 package com.aurellem.gb; 1 package com.aurellem.gb;
2 2
3 import java.nio.ByteBuffer; 3 import java.nio.ByteBuffer;
4 4 import java.nio.ByteOrder;
5 5
6 public class Gb { 6 public class Gb {
7 7
8 8
9 public Gb(){} 9 public Gb(){}
23 23
24 public static void loadVBA(){ 24 public static void loadVBA(){
25 System.loadLibrary("vba"); 25 System.loadLibrary("vba");
26 } 26 }
27 27
28
29 public static native void step(); 28 public static native void step();
30 29
31 public static native void step(int keymask); 30 public static native void step(int keymask);
32 31
33 public static native void shutdown(); 32 public static native void shutdown();
34 33
34 public static native void saveState(ByteBuffer buffer, int size);
35
36 public static native void loadState(ByteBuffer buffer, int size);
37
38 public static final int SAVE_SIZE = 9000;
39
40 public static ByteBuffer saveState(){
41 ByteBuffer buf =
42 ByteBuffer.allocateDirect(SAVE_SIZE)
43 .order(ByteOrder.nativeOrder());
44 buf.clear();
45 saveState(buf, SAVE_SIZE);
46 buf.flip();
47 return buf;
48 }
49
50 public static void loadState(ByteBuffer saveState){
51 loadState(saveState, SAVE_SIZE);
52 }
53
35 } 54 }