revise File device according to new tests

This commit is contained in:
Lobo 2025-12-23 18:02:22 -03:00
parent cf31dc5564
commit 35b0a4f6dd
5 changed files with 106 additions and 57 deletions

View file

@ -68,7 +68,8 @@ type machine =
type _ Effect.t +=
| BRK : int Effect.t
| DEI : ([ `Byte | `Short ] * int) -> int Effect.t
| DEI : int -> int Effect.t
| DEI2 : int -> int Effect.t
| DEO : (int * int) -> unit Effect.t
let ram (Machine { data; _ }) = data
@ -226,7 +227,7 @@ let dispatch (Machine m) (pc : int) =
| 0x16 (* DEI *) ->
let port = popbyte mode stk in
push mode stk
(perform (DEI ((if short then `Short else `Byte), port)))
(if short then perform (DEI2 port) else perform (DEI port))
| 0x17 (* DEO *) ->
let port = popbyte mode stk in
let value = pop mode stk in