Read ROM title.

master
Fabien Freling 2015-02-22 12:50:14 +01:00
parent 10f4fb6e76
commit 840c00e30b
1 changed files with 9 additions and 1 deletions

View File

@ -20,9 +20,17 @@ type t = {
let read_cartridge file =
print_endline file;
let fd = openfile file [Unix.O_RDONLY] 0o644 in
let n_logo = Bytes.create 48 in
let _ = lseek fd 0x0104 SEEK_SET in
let n_logo = Bytes.create 48 in
let _ = read fd n_logo 0 48 in
print_endline "Nintendo logo:";
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