Commit 54def17c authored by Fabien Freling's avatar Fabien Freling

Move signed_byte to Bit

parent 845d4fff
......@@ -4,3 +4,9 @@ let is_set num i =
else
(num lsr i) land 0b00000001 <> 0
let two_complement n =
(lnot n) + 1
let signed_byte n =
if n land 0x80 <> 0 then -((two_complement n) land 0xFF)
else n
......@@ -127,14 +127,6 @@ let pop_stack cpu mem =
cpu.reg.sp <- (cpu.reg.sp + 1) mod 0xFFFF;
merge_bytes low high
let two_complement n =
(lnot n) + 1
let signed_byte n =
if n land 0x80 <> 0 then -((two_complement n) land 0xFF)
else n
(**
http://imrannazar.com/GameBoy-Z80-Opcode-Map
......@@ -172,7 +164,7 @@ let run cpu (mem: Memory.map) =
(* jump *)
| '\x20' -> let n = read_pc_byte cpu mem in
let s = signed_byte n in
let s = Bit.signed_byte n in
let inst = sprintf "JR \tNZ, 0x%02X (%d)" n s in
if cpu.flag.z = false then
begin
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment