<commit_before>#include "config.h"	// macros, uint[XX]_t
#include <assert.h>	// assert
#include <string.h>	// memmove

#include "sgherm.h"	// emu_state
#include "ctl_unit.h"	// int_flag_*
#include "input.h"	// joypad_*
#include "lcdc.h"	// lcdc_read
#include "memory.h"	// Constants and what have you
#include "print.h"	// fatal
#include "rom_read.h"	// OFF_CART_TYPE
#include "serio.h"	// serial_*
#include "sound.h"	// sound_*
#include "timer.h"	// timer_*
#include "util.h"	// likely/unlikely


/***********************************************************************
 * readers
 ***********************************************************************/
typedef uint8_t (*mem_read_fn)(emu_state *restrict, uint16_t);

/*!
 * @brief hardware read catch-all for no hardware present at a port
 * @result emulation stopped because some doofus read from a non-existant
 * 	   device.
 */
uint8_t no_hardware(emu_state *restrict state, uint16_t location)
{
	printf("%X\n", REG_PC(state));
	warning("no device present at %04X (emulator bug?  incompatible GB?) (a real GB wouldn't care)",
		location);
	return 0xFF;
}

static inline uint8_t vram_bank_switch_read(emu_state *restrict state, uint16_t location unused)
{
	return state->lcdc.vram_bank;
}

/*! a table of hardware register read methods */
static mem_read_fn hw_reg_read[0x80] =
{
	joypad_read, /* 00 - P1 - joypad */
	serial_read, /* 01 - SB - serial data */
	serial_read, /* 02 - SC - serial control */
	no_hardware, /* 03 - NO HARDWARE */
	timer_read,  /* 04 - DIV */
	timer_read,  /* 05 - TIMA - timer step */
	timer_read,  /* 06 - TMA - timer count */
	timer_read,  /* 07 - TAC - timer frequency / enable */

	/* 08..0E - NO HARDWARE */
	no_hardware, no_hardware, no_hardware, no_hardware,<commit_msg>Clarify a thingy<commit_after>#include "config.h"	// macros, uint[XX]_t
#include <assert.h>	// assert
#include <string.h>	// memmove

#include "sgherm.h"	// emu_state
#include "ctl_unit.h"	// int_flag_*
#include "input.h"	// joypad_*
#include "lcdc.h"	// lcdc_read
#include "memory.h"	// Constants and what have you
#include "print.h"	// fatal
#include "rom_read.h"	// OFF_CART_TYPE
#include "serio.h"	// serial_*
#include "sound.h"	// sound_*
#include "timer.h"	// timer_*
#include "util.h"	// likely/unlikely


/***********************************************************************
 * readers
 ***********************************************************************/
typedef uint8_t (*mem_read_fn)(emu_state *restrict, uint16_t);

/*!
 * @brief hardware read catch-all for no hardware present at a port
 * @result emulation stopped because some doofus read from a non-existant
 * 	   device.
 */
uint8_t no_hardware(emu_state *restrict state, uint16_t location)
{
	printf("%X\n", REG_PC(state));
	warning("no device present at %04X (emulator bug? incompatible GB?) (a real GB spews 0xFF)",
		location);
	return 0xFF;
}

static inline uint8_t vram_bank_switch_read(emu_state *restrict state, uint16_t location unused)
{
	return state->lcdc.vram_bank;
}

/*! a table of hardware register read methods */
static mem_read_fn hw_reg_read[0x80] =
{
	joypad_read, /* 00 - P1 - joypad */
	serial_read, /* 01 - SB - serial data */
	serial_read, /* 02 - SC - serial control */
	no_hardware, /* 03 - NO HARDWARE */
	timer_read,  /* 04 - DIV */
	timer_read,  /* 05 - TIMA - timer step */
	timer_read,  /* 06 - TMA - timer count */
	timer_read,  /* 07 - TAC - timer frequency / enable */

	/* 08..0E - NO HARDWARE */
	no_hardware, no_hardware, no_hardware, no_hardware,
{'fraction_non_alphanumeric': 0.21442771939789831, 'fraction_numerical': 0.020164725930133486, 'mean_word_length': 3.9189944134078214, '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': '6089193', 'n_tokens_mistral': 1304, 'n_tokens_neox': 1222, 'n_words': 331}