old-computer-simulator

godot game
git clone git://git.evenfri.xyz/old-computer-simulator.git
Log | Files | Refs

emulator.cs (1294B)


      1 using System.Runtime.InteropServices;
      2 using System;
      3 
      4 public static class emulator {
      5 
      6 const string lib_name = "emulator/emu.so";
      7 
      8 [DllImport(lib_name, CallingConvention = CallingConvention.Cdecl)]
      9 public static extern IntPtr emu_create();
     10 
     11 [DllImport(lib_name, CallingConvention = CallingConvention.Cdecl)]
     12 public static extern int emu_load_program(IntPtr emu, [MarshalAs(UnmanagedType.LPStr)] string filename);
     13 
     14 [DllImport(lib_name, CallingConvention = CallingConvention.Cdecl)]
     15 public static extern void emu_destroy(IntPtr emu);
     16 
     17 [DllImport(lib_name, CallingConvention = CallingConvention.Cdecl)]
     18 public static extern int emu_get_pc(IntPtr emu);
     19 
     20 [DllImport(lib_name, CallingConvention = CallingConvention.Cdecl)]
     21 public static extern void emu_set_pc(IntPtr emu, int pc);
     22 
     23 [DllImport(lib_name, CallingConvention = CallingConvention.Cdecl)]
     24 public static extern int emu_step(IntPtr emu);
     25 
     26 [DllImport(lib_name, CallingConvention = CallingConvention.Cdecl)]
     27 public static extern void emu_mem_write(IntPtr emu, ushort addr, byte val);
     28 
     29 [DllImport(lib_name, CallingConvention = CallingConvention.Cdecl)]
     30 public static extern byte emu_mem_read(IntPtr emu, ushort addr);
     31 
     32 [DllImport(lib_name, CallingConvention = CallingConvention.Cdecl)]
     33 public static extern byte emu_get_reg(IntPtr emu, byte c);
     34 
     35 }