2017-09-25 20:47:58 -04:00
|
|
|
/*
|
2023-01-06 15:36:05 -05:00
|
|
|
* 86Box A hypervisor and IBM PC system emulator that specializes in
|
|
|
|
|
* running old operating systems and software designed for IBM
|
|
|
|
|
* PC systems and compatibles from 1981 through fairly recent
|
|
|
|
|
* system designs based on the PCI bus.
|
2017-09-25 20:47:58 -04:00
|
|
|
*
|
2023-01-06 15:36:05 -05:00
|
|
|
* This file is part of the 86Box distribution.
|
2017-09-25 20:47:58 -04:00
|
|
|
*
|
2023-01-06 15:36:05 -05:00
|
|
|
* Definitions for the ROM image handler.
|
2017-09-25 20:47:58 -04:00
|
|
|
*
|
2020-03-25 00:46:02 +02:00
|
|
|
*
|
2017-09-25 20:47:58 -04:00
|
|
|
*
|
2023-01-06 15:36:05 -05:00
|
|
|
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
|
2023-01-06 15:36:29 -05:00
|
|
|
*
|
|
|
|
|
* Copyright 2018-2019 Fred N. van Kempen.
|
2017-09-25 20:47:58 -04:00
|
|
|
*/
|
2022-02-18 19:42:21 -05:00
|
|
|
|
2017-09-25 04:31:20 -04:00
|
|
|
#ifndef EMU_ROM_H
|
2022-09-18 17:15:38 -04:00
|
|
|
#define EMU_ROM_H
|
|
|
|
|
|
|
|
|
|
#define FLAG_INT 1
|
|
|
|
|
#define FLAG_INV 2
|
|
|
|
|
#define FLAG_AUX 4
|
|
|
|
|
#define FLAG_REP 8
|
|
|
|
|
|
|
|
|
|
#define bios_load_linear(a, b, c, d) bios_load(a, NULL, b, c, d, 0)
|
|
|
|
|
#define bios_load_linearr(a, b, c, d) bios_load(a, NULL, b, c, d, FLAG_REP)
|
|
|
|
|
#define bios_load_aux_linear(a, b, c, d) bios_load(a, NULL, b, c, d, FLAG_AUX)
|
|
|
|
|
#define bios_load_linear_inverted(a, b, c, d) bios_load(a, NULL, b, c, d, FLAG_INV)
|
|
|
|
|
#define bios_load_aux_linear_inverted(a, b, c, d) bios_load(a, NULL, b, c, d, FLAG_INV | FLAG_AUX)
|
|
|
|
|
#define bios_load_interleaved(a, b, c, d, e) bios_load(a, b, c, d, e, FLAG_INT)
|
|
|
|
|
#define bios_load_interleavedr(a, b, c, d, e) bios_load(a, b, c, d, e, FLAG_INT | FLAG_REP)
|
|
|
|
|
#define bios_load_aux_interleaved(a, b, c, d, e) bios_load(a, b, c, d, e, FLAG_INT | FLAG_AUX)
|
2017-09-25 04:31:20 -04:00
|
|
|
|
|
|
|
|
typedef struct {
|
2022-09-18 17:15:38 -04:00
|
|
|
uint8_t *rom;
|
|
|
|
|
int sz;
|
|
|
|
|
uint32_t mask;
|
|
|
|
|
mem_mapping_t mapping;
|
2016-06-26 00:34:39 +02:00
|
|
|
} rom_t;
|
|
|
|
|
|
2022-04-05 02:16:23 +06:00
|
|
|
typedef struct rom_path_t {
|
2022-09-18 17:15:38 -04:00
|
|
|
char path[1024];
|
|
|
|
|
struct rom_path_t *next;
|
2022-04-05 02:16:23 +06:00
|
|
|
} rom_path_t;
|
|
|
|
|
|
|
|
|
|
extern rom_path_t rom_paths;
|
|
|
|
|
|
2022-09-18 17:15:38 -04:00
|
|
|
extern void rom_add_path(const char *path);
|
|
|
|
|
|
|
|
|
|
extern uint8_t rom_read(uint32_t addr, void *p);
|
|
|
|
|
extern uint16_t rom_readw(uint32_t addr, void *p);
|
|
|
|
|
extern uint32_t rom_readl(uint32_t addr, void *p);
|
|
|
|
|
|
2022-11-19 12:34:31 +06:00
|
|
|
extern FILE *rom_fopen(const char *fn, char *mode);
|
2022-09-18 17:15:38 -04:00
|
|
|
extern int rom_getfile(char *fn, char *s, int size);
|
|
|
|
|
extern int rom_present(char *fn);
|
|
|
|
|
|
2022-11-19 12:34:31 +06:00
|
|
|
extern int rom_load_linear_oddeven(const char *fn, uint32_t addr, int sz,
|
2022-09-18 17:15:38 -04:00
|
|
|
int off, uint8_t *ptr);
|
2022-11-19 12:34:31 +06:00
|
|
|
extern int rom_load_linear(const char *fn, uint32_t addr, int sz,
|
2022-09-18 17:15:38 -04:00
|
|
|
int off, uint8_t *ptr);
|
2022-11-19 12:34:31 +06:00
|
|
|
extern int rom_load_interleaved(const char *fnl, const char *fnh, uint32_t addr,
|
2022-09-18 17:15:38 -04:00
|
|
|
int sz, int off, uint8_t *ptr);
|
|
|
|
|
|
|
|
|
|
extern uint8_t bios_read(uint32_t addr, void *priv);
|
|
|
|
|
extern uint16_t bios_readw(uint32_t addr, void *priv);
|
|
|
|
|
extern uint32_t bios_readl(uint32_t addr, void *priv);
|
|
|
|
|
|
2022-11-19 12:34:31 +06:00
|
|
|
extern int bios_load(const char *fn1, const char *fn2, uint32_t addr, int sz,
|
2022-09-18 17:15:38 -04:00
|
|
|
int off, int flags);
|
2022-11-19 12:34:31 +06:00
|
|
|
extern int bios_load_linear_combined(const char *fn1, const char *fn2,
|
2022-09-18 17:15:38 -04:00
|
|
|
int sz, int off);
|
2022-11-19 12:34:31 +06:00
|
|
|
extern int bios_load_linear_combined2(const char *fn1, const char *fn2,
|
|
|
|
|
const char *fn3, const char *fn4, const char *fn5,
|
2022-09-18 17:15:38 -04:00
|
|
|
int sz, int off);
|
2022-11-19 12:34:31 +06:00
|
|
|
extern int bios_load_linear_combined2_ex(const char *fn1, const char *fn2,
|
|
|
|
|
const char *fn3, const char *fn4, const char *fn5,
|
2022-09-18 17:15:38 -04:00
|
|
|
int sz, int off);
|
|
|
|
|
|
2022-11-19 12:34:31 +06:00
|
|
|
extern int rom_init(rom_t *rom, const char *fn, uint32_t address, int size,
|
2022-09-18 17:15:38 -04:00
|
|
|
int mask, int file_offset, uint32_t flags);
|
2022-11-19 12:34:31 +06:00
|
|
|
extern int rom_init_oddeven(rom_t *rom, const char *fn, uint32_t address, int size,
|
2022-09-18 17:15:38 -04:00
|
|
|
int mask, int file_offset, uint32_t flags);
|
2022-11-19 12:34:31 +06:00
|
|
|
extern int rom_init_interleaved(rom_t *rom, const char *fn_low,
|
|
|
|
|
const char *fn_high, uint32_t address,
|
2022-09-18 17:15:38 -04:00
|
|
|
int size, int mask, int file_offset,
|
|
|
|
|
uint32_t flags);
|
|
|
|
|
|
|
|
|
|
#endif /*EMU_ROM_H*/
|