30 lines
901 B
OCaml
30 lines
901 B
OCaml
type stack = Stack of { data : bytes; mutable sp : int }
|
|
type mode = Mode of { short : bool; keep : bool; mutable temp : int }
|
|
|
|
val stack_create : unit -> stack
|
|
val peek : mode -> stack -> int
|
|
val pop : mode -> stack -> int
|
|
val push : mode -> stack -> int -> unit
|
|
val pushbyte : mode -> stack -> int -> unit
|
|
val pushshort : mode -> stack -> int -> unit
|
|
val popbyte : mode -> stack -> int
|
|
val popshort : mode -> stack -> int
|
|
|
|
type machine
|
|
|
|
val ram : machine -> bytes
|
|
val dev : machine -> bytes
|
|
val wst : machine -> stack
|
|
val rst : machine -> stack
|
|
|
|
type machine_state = Break | Next of int
|
|
|
|
type _ Effect.t +=
|
|
| BRK : int Effect.t
|
|
| DEI : ([ `Byte | `Short ] * int) -> int Effect.t
|
|
| DEO : (int * int) -> unit Effect.t
|
|
| Trace : (int * Instr.t * int list) -> unit Effect.t
|
|
| Breakpoint : int -> unit Effect.t
|
|
|
|
val create : string -> machine
|
|
val dispatch : ?trace:bool -> machine -> int -> 'a
|