type state = { mutable console_vector : int } module Make () : Uxn.Device.DEVICE with type state = state = struct type nonrec state = state let state = { console_vector = 0 } let can_handle port = port >= 0x10 && port <= 0x1f let dei _ _ = None let dei2 _ _ = None let deo _ port value = match port with | 0x10 -> state.console_vector <- value | 0x18 -> print_char (Char.chr value); Out_channel.flush stdout | 0x19 -> prerr_char (Char.chr value); Out_channel.flush stderr | _ -> () end