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 val stack : machine -> bool -> stack type machine_state = Break | Next of int type _ Effect.t += | BRK : int Effect.t (* Returns a new PC if handled *) | DEI : int -> int Effect.t | DEI2 : int -> int Effect.t | DEO : (int * int) -> unit Effect.t val create : string -> machine val dispatch : ?dbg:(machine -> Instr.t -> int -> unit) option -> ?cycles:int -> machine -> int -> unit