make #010e DEO print stack in the recommended repr

This commit is contained in:
Lobo 2025-12-18 15:50:34 -03:00
parent b71cf4343e
commit bc1bae5977
8 changed files with 837 additions and 52 deletions

View file

@ -9,9 +9,13 @@ module Make () : Uxn.Device.DEVICE with type state = state = struct
let can_handle port = port >= 0x00 && port <= 0x0f
let print_stack ~name (Machine.Stack { data; sp }) =
Fmt.epr "%s: @[%a@]@." name
(Fmt.on_bytes (Fmt.octets ()))
(Bytes.sub data 0 sp)
Printf.eprintf "%s " name;
for i = sp - 8 to sp - 1 do
Printf.eprintf "%02x%s"
(Bytes.get_uint8 data (i land 0xff))
(if i land 0xff == 0xff then "|" else " ")
done;
Printf.eprintf "<%02x\n" sp
let get_bank mach bank =
if bank = 0 then Machine.ram mach