add datetime device, revise device handling, remove tracing code
This commit is contained in:
parent
56a3398c8f
commit
cf31dc5564
8 changed files with 115 additions and 119 deletions
|
|
@ -19,7 +19,18 @@ module Make (Addr : ADDR) : Uxn.Device.DEVICE with type state = state = struct
|
|||
type nonrec state = state
|
||||
|
||||
let state = { filepath = None; state = Idle; length = 0 }
|
||||
let can_handle port = port >= Addr.start && port <= Addr.start + 0x0f
|
||||
let dei_ports = Uxn.Device.Int_set.empty
|
||||
|
||||
let deo_ports =
|
||||
Uxn.Device.Int_set.of_list
|
||||
[
|
||||
Addr.start + 0x0a;
|
||||
Addr.start + 0x04;
|
||||
Addr.start + 0x06;
|
||||
Addr.start + 0x08;
|
||||
Addr.start + 0x0c;
|
||||
Addr.start + 0x0e;
|
||||
]
|
||||
|
||||
let read_cstring ram addr =
|
||||
let buf = Buffer.create 256 in
|
||||
|
|
@ -194,8 +205,8 @@ module Make (Addr : ADDR) : Uxn.Device.DEVICE with type state = state = struct
|
|||
with Unix.Unix_error _ -> -1)
|
||||
|
||||
let file_success dev port value = Bytes.set_uint16_be dev port value
|
||||
let dei _ _ = None
|
||||
let dei2 _ _ = None
|
||||
let dei _ _ = assert false
|
||||
let dei2 _ _ = assert false
|
||||
|
||||
let deo mach port value =
|
||||
let open Uxn in
|
||||
|
|
@ -211,5 +222,5 @@ module Make (Addr : ADDR) : Uxn.Device.DEVICE with type state = state = struct
|
|||
| 0x0e ->
|
||||
let append = Bytes.get_uint8 dev (Addr.start + 0x07) in
|
||||
file_write ram value state.length append |> with_success
|
||||
| _ -> ()
|
||||
| _ -> failwith (Printf.sprintf "%02x" port)
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue