Skip to content

Commit

Permalink
Revert "[Rescript support] some changes to support Rescript's outdate…
Browse files Browse the repository at this point in the history
…d OCaml compiler"

This reverts commit 0827de3.
  • Loading branch information
linoscope committed Dec 1, 2021
1 parent b752fc8 commit 07e3902
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
8 changes: 3 additions & 5 deletions lib/cpu/cpu.ml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ module Make (Bus : Word_addressable_intf.S) = struct
~(inst : Instruction.t) : int =
let set_flags = Registers.set_flags t.registers in
let read : type a. a Instruction.arg -> a = fun arg ->
let open Instruction in
match arg with
| Immediate8 n -> n
| Immediate16 n -> n
Expand Down Expand Up @@ -76,7 +75,6 @@ module Make (Bus : Word_addressable_intf.S) = struct
sp + n |> Uint16.of_int
in
let write : type a. a Instruction.arg -> a -> unit = fun x y ->
let open Instruction in
match x with
| R r -> Registers.write_r t.registers r y
| RR rr -> Registers.write_rr t.registers rr y
Expand All @@ -101,9 +99,9 @@ module Make (Bus : Word_addressable_intf.S) = struct
| Direct8 addr -> Bus.write_byte t.bus ~addr ~data:y
| Direct16 addr -> Bus.write_word t.bus ~addr ~data:y
| SP -> t.sp <- y
| SP_offset _ -> failwith @@ Printf.sprintf "Invalid arugment"
| Immediate16 _ -> failwith @@ Printf.sprintf "Invalid arugment"
| Immediate8 _ -> failwith @@ Printf.sprintf "Invalid arugment"
| SP_offset _
| Immediate16 _
| Immediate8 _ -> failwith @@ Printf.sprintf "Invalid arugment"
in
let (<--) x y = write x y in
let check_condition t : Instruction.condition -> bool = function
Expand Down
2 changes: 1 addition & 1 deletion lib/cpu/instruction.ml
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ let show t =
let show_arg : type a. a arg -> string = function
| Immediate8 n -> Uint8.show n
| Immediate16 n -> Uint16.show n
| Direct8 n -> Printf.sprintf "(%s)" (Uint16.show n)
| Direct8 n
| Direct16 n -> Printf.sprintf "(%s)" (Uint16.show n)
| R r -> Registers.show_r r
| RR rr -> Registers.show_rr rr
Expand Down

0 comments on commit 07e3902

Please sign in to comment.