summaryrefslogtreecommitdiff
path: root/ines2.c
diff options
context:
space:
mode:
authorPeter Fors <peter.fors@mindkiller.com>2025-03-31 20:31:05 +0200
committerPeter Fors <peter.fors@mindkiller.com>2025-03-31 20:31:05 +0200
commita386ef64f6376b3ef8434a6cdf456495287fcbca (patch)
treee2da9f72ce0a565b4fac2fc8be19ab3497286b36 /ines2.c
parentd5486a5af100fb37fac08b60d862ac14943853ce (diff)
currently 90% working
Diffstat (limited to 'ines2.c')
-rw-r--r--ines2.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/ines2.c b/ines2.c
index 450c22e..7e3c17e 100644
--- a/ines2.c
+++ b/ines2.c
@@ -27,7 +27,7 @@
#define MIRROR_FOUR_SCREEN 2
-static int load_ines2(struct nes_state *state, const char *path) {
+static int ines2_load(struct nes_state *state, char *path) {
FILE *f = fopen(path, "rb");
if(!f) {
return -1;
@@ -55,8 +55,8 @@ static int load_ines2(struct nes_state *state, const char *path) {
// Extract mapper
uint8_t mapper_low = (header[INES_FLAGS6] >> 4);
uint8_t mapper_high = (header[INES_FLAGS7] & 0xf0);
- uint8_t mapper_ext = (header[INES_PRG_CHR_MSB] & 0x0f) << 8;
- state->ines.mapper = mapper_low | mapper_high | mapper_ext;
+ uint8_t mapper_ext = (header[INES_PRG_CHR_MSB] & 0x0f);
+ state->ines.mapper = mapper_low | mapper_high | (mapper_ext << 8);
// Extract mirroring
if(header[INES_FLAGS6] & FLAG6_FOUR_SCREEN) {
@@ -76,11 +76,11 @@ static int load_ines2(struct nes_state *state, const char *path) {
}
// Read PRG
- fread(state->rom, 1, prg_size, f);
+ printf("prgsize_read: %ld\n", fread(state->rom, 1, prg_size, f));
// Read CHR if present
if(chr_size > 0) {
- fread(state->chrrom, 1, chr_size, f);
+ printf("chrsize_read: %ld\n", fread(state->chrrom, 1, chr_size, f));
}
fclose(f);