|
Xemu [doxygen]
hyppo 0a42be3a057156924bc1b626a687bd6e27349c45 @ Sat 19 Mar 02:15:11 CET 2022
|
Go to the documentation of this file.
33 #define IODEBUGPRINT DEBUG
36 #define SCREEN_WIDTH 640
37 #define SCREEN_HEIGHT 480
42 #define CYCLES_PER_SCANLINE 254
44 static Uint8 lo_ram[0x9F00];
45 static Uint8 hi_ram[256 * 8192];
46 static Uint8 rom[0x20000];
47 static int hi_ram_banks;
48 static int hi_ram_access_offset;
49 static int hi_rom_access_offset;
55 #define VIRTUAL_SHIFT_POS 0x31
85 switch ((
addr >> 4) & 0xF) {
88 IODEBUGPRINT(
"IO_W: writing to reg $%04X (data=$%02X), audio controller @ PC=$%04X" NL,
addr,
data, cpu65.old_pc);
92 IODEBUGPRINT(
"IO_W: writing to reg $%04X (data=$%02X), VERA video controller @ PC=$%04X" NL,
addr,
data, cpu65.old_pc);
108 IODEBUGPRINT(
"IO_W: writing to reg $%04X (data=$%02X), UNKNOWN/RESERVED @ PC=$%04X" NL,
addr,
data, cpu65.old_pc);
115 hi_ram[hi_ram_access_offset +
addr - 0xA000] =
data;
133 switch ((
addr >> 4) & 0xF) {
136 IODEBUGPRINT(
"IO_R: reading from reg $%04X (data=$%02X), audio controller @ PC=$%04X" NL,
addr,
data, cpu65.old_pc);
141 IODEBUGPRINT(
"IO_R: reading from reg $%04X (data=$%02X), VERA video controller @ PC=$%04X" NL,
addr,
data, cpu65.old_pc);
156 IODEBUGPRINT(
"IO_R: reading from reg $%04X (data=$%02X), UNKNOWN/RESERVED @ PC=$%04X" NL,
addr,
data, cpu65.old_pc);
163 return hi_ram[hi_ram_access_offset +
addr - 0xA000];
165 return rom[hi_rom_access_offset +
addr - 0xC000];
172 hi_rom_access_offset = bank << 14;
178 hi_ram_access_offset = (bank % hi_ram_banks) << 13;
184 static int load_rom (
const char *
fn )
186 if (
xemu_load_file(
fn, rom,
sizeof rom,
sizeof rom,
"Cannot load ROM") !=
sizeof rom)
193 static void init_ram (
int hi_ram_size )
195 if (hi_ram_size > 2048)
199 hi_ram_banks = hi_ram_size >> 3;
200 DEBUGPRINT(
"Setting (hi-)RAM size memtop to %dK, %d banks." NL, hi_ram_size, hi_ram_banks);
201 memset(lo_ram, 0,
sizeof lo_ram);
202 memset(hi_ram, 0xFF,
sizeof hi_ram);
236 static void via1_setint (
int level )
239 cpu65.irqLevel |= 0x100;
241 cpu65.irqLevel &= ~0x100;
245 static void via2_setint (
int level )
248 cpu65.irqLevel |= 0x200;
250 cpu65.irqLevel &= ~0x200;
261 static void update_emulator (
void )
280 static void emulation_loop (
void )
310 FILE *f = fopen(
fn,
"w");
312 int r = fwrite(mem,
size, 1, f) != 1;
325 static void emulator_shutdown (
void )
329 dump_stuff(
"loram.dump", lo_ram,
sizeof lo_ram);
331 dump_stuff(
"hiram.dump", hi_ram, hi_ram_banks << 13);
336 int main (
int argc,
char **argv )
371 memset(rom, 0,
sizeof rom);
412 #ifdef __EMSCRIPTEN__
417 DEBUGPRINT(
"CPU: starting exection at $%04X" NL, cpu65.pc);
#define CYCLES_PER_SCANLINE
#define USE_LOCKED_TEXTURE
void via_tick(struct Via65c22 *via, int ticks)
int vera_dump_vram(const char *fn)
int vera_render_line(void)
Uint8 cpu65_read_callback(Uint16 addr)
int dump_stuff(const char *fn, void *mem, int size)
void via_init(struct Via65c22 *via, const char *name, void(*outa)(Uint8 mask, Uint8 data), void(*outb)(Uint8 mask, Uint8 data), void(*outsr)(Uint8 data), Uint8(*ina)(Uint8 mask), Uint8(*inb)(Uint8 mask), Uint8(*insr)(void), void(*setint)(int level))
struct configdb_st configdb
Uint8 vera_read_cpu_register(int reg)
Uint8 via_read(struct Via65c22 *via, int addr)
void clear_emu_events(void)
void cpu65_write_callback(Uint16 addr, Uint8 data)
#define RENDER_SCALE_QUALITY
#define VIRTUAL_SHIFT_POS
void via_write(struct Via65c22 *via, int addr, Uint8 data)
int main(int argc, char **argv)
void vera_write_cpu_register(int reg, Uint8 data)