<commit_before>#include <cstdint>

#include <Mapper0.h>

uint8_t Mapper0::readPrg(uint16_t addr) {
    int index = addr % cartMemory.prg.size();
    return cartMemory.prg[index];
}

uint8_t Mapper0::readChr(uint16_t addr) {
    int index = addr % cartMemory.chr.size();
    return cartMemory.chr[index];
}

void Mapper0::writeChr(uint16_t addr, uint8_t value) {
    if (cartMemory.chrIsRam) {
	int index = addr % cartMemory.chr.size();
        cartMemory.chr[index] = value;
    }
}
<commit_msg>Fix mapper0 readPrg ignoring ram<commit_after>#include <cstdint>

#include <Mapper0.h>

uint8_t Mapper0::readPrg(uint16_t addr) {
    if (addr >= 0x8000) {
	int index = addr % cartMemory.prg.size();
	return cartMemory.prg[index];
    }
    else if (addr >= 0x6000) {
	int index = addr % 0x2000;
	return cartMemory.ram[index];
    }
    else {
	return 0;
    }
}

uint8_t Mapper0::readChr(uint16_t addr) {
    int index = addr % cartMemory.chr.size();
    return cartMemory.chr[index];
}

void Mapper0::writeChr(uint16_t addr, uint8_t value) {
    if (cartMemory.chrIsRam) {
	int index = addr % cartMemory.chr.size();
        cartMemory.chr[index] = value;
    }
}

{'fraction_non_alphanumeric': 0.1363244176013805, 'fraction_numerical': 0.03710094909404659, 'mean_word_length': 3.6586345381526106, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '570308', 'n_tokens_mistral': 470, 'n_tokens_neox': 448, 'n_words': 90}