Read ROM title.
This commit is contained in:
parent
10f4fb6e76
commit
840c00e30b
|
@ -20,9 +20,17 @@ type t = {
|
||||||
let read_cartridge file =
|
let read_cartridge file =
|
||||||
print_endline file;
|
print_endline file;
|
||||||
let fd = openfile file [Unix.O_RDONLY] 0o644 in
|
let fd = openfile file [Unix.O_RDONLY] 0o644 in
|
||||||
let n_logo = Bytes.create 48 in
|
|
||||||
let _ = lseek fd 0x0104 SEEK_SET in
|
let _ = lseek fd 0x0104 SEEK_SET in
|
||||||
|
|
||||||
|
let n_logo = Bytes.create 48 in
|
||||||
let _ = read fd n_logo 0 48 in
|
let _ = read fd n_logo 0 48 in
|
||||||
print_endline "Nintendo logo:";
|
print_endline "Nintendo logo:";
|
||||||
Hexa.print_bytes n_logo ~width:16;
|
Hexa.print_bytes n_logo ~width:16;
|
||||||
|
|
||||||
|
let title_b = Bytes.create 16 in
|
||||||
|
let _ = read fd title_b 0 16 in
|
||||||
|
let title = Bytes.to_string title_b in
|
||||||
|
printf "ROM title: %s\n" title;
|
||||||
|
|
||||||
Unix.close fd
|
Unix.close fd
|
||||||
|
|
Loading…
Reference in a new issue