Move signed_byte to Bit
This commit is contained in:
parent
845d4fff8b
commit
54def17c26
|
@ -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
|
||||
|
|
10
src/cpu.ml
10
src/cpu.ml
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue