Index: Makefile
===================================================================
--- Makefile	(revision f9963876d9494b72796d2cebe041b8724fd0e301)
+++ Makefile	(revision a06aa8be3631490d2ce602f681044034ba655137)
@@ -69,5 +69,6 @@
 				gcc $(FLAGS_CPU) -c -o $@ $<
 
-EMU_C :=		main.c cpu.c sdl.c
+EMU_C :=		main.c cpu.c vid.c fpu.c tim.c lcd.c ser.c mid.c fdd.c snd.c \
+				led.c kbd.c sdl.c
 EMU_O :=		$(EMU_C:.c=.o)
 EMU_OP :=		$(EMU_O:%=build/%)
Index: copying.txt
===================================================================
--- copying.txt	(revision f9963876d9494b72796d2cebe041b8724fd0e301)
+++ copying.txt	(revision a06aa8be3631490d2ce602f681044034ba655137)
@@ -4,5 +4,5 @@
 (Applicable to the source code in the "emu" subdirectory.)
 
-Copyright (C) 2017 The Emulator Developers
+Copyright (C) 2017 The Contributors
 
 This program is free software: you can redistribute it and/or modify
@@ -17,5 +17,5 @@
 
 A copy of the GNU General Public License can be found in the file
-"gpl-v3.txt" in this directory.
+"gpl-v3.txt" in the top directory of this repository.
 
 
Index: emu/all.h
===================================================================
--- emu/all.h	(revision f9963876d9494b72796d2cebe041b8724fd0e301)
+++ emu/all.h	(revision a06aa8be3631490d2ce602f681044034ba655137)
@@ -1,2 +1,19 @@
+/*
+ *  Copyright (C) 2017 The Contributors
+ *
+ *  This program is free software: you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation, either version 3 of the License, or (at
+ *  your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful, but
+ *  WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ *  General Public License for more details.
+ *
+ *  A copy of the GNU General Public License can be found in the file
+ *  "gpl-v3.txt" in the top directory of this repository.
+ */
+
 #include <stdbool.h>
 #include <stddef.h>
@@ -17,6 +34,18 @@
 }
 
+#define ARRAY_COUNT(_a) (int32_t)(sizeof (_a) / sizeof (_a)[0])
+
+extern bool sdl_verbose;
 extern bool cpu_verbose;
-extern bool sdl_verbose;
+extern bool fpu_verbose;
+extern bool vid_verbose;
+extern bool tim_verbose;
+extern bool lcd_verbose;
+extern bool ser_verbose;
+extern bool mid_verbose;
+extern bool fdd_verbose;
+extern bool snd_verbose;
+extern bool led_verbose;
+extern bool kbd_verbose;
 
 extern void sdl_init(void);
@@ -24,2 +53,62 @@
 
 extern void cpu_loop(void);
+
+extern void fpu_init(void);
+extern void fpu_quit(void);
+extern void fpu_exec(void);
+extern uint32_t fpu_read(uint32_t off, int32_t sz);
+extern void fpu_write(uint32_t off, int32_t sz, uint32_t val);
+
+extern void vid_init(void);
+extern void vid_quit(void);
+extern void vid_exec(void);
+extern uint32_t vid_read(uint32_t off, int32_t sz);
+extern void vid_write(uint32_t off, int32_t sz, uint32_t val);
+
+extern void tim_init(void);
+extern void tim_quit(void);
+extern void tim_exec(void);
+extern uint32_t tim_read(uint32_t off, int32_t sz);
+extern void tim_write(uint32_t off, int32_t sz, uint32_t val);
+
+extern void lcd_init(void);
+extern void lcd_quit(void);
+extern void lcd_exec(void);
+extern uint32_t lcd_read(uint32_t off, int32_t sz);
+extern void lcd_write(uint32_t off, int32_t sz, uint32_t val);
+
+extern void ser_init(void);
+extern void ser_quit(void);
+extern void ser_exec(void);
+extern uint32_t ser_read(uint32_t off, int32_t sz);
+extern void ser_write(uint32_t off, int32_t sz, uint32_t val);
+
+extern void mid_init(void);
+extern void mid_quit(void);
+extern void mid_exec(void);
+extern uint32_t mid_read(uint32_t off, int32_t sz);
+extern void mid_write(uint32_t off, int32_t sz, uint32_t val);
+
+extern void fdd_init(void);
+extern void fdd_quit(void);
+extern void fdd_exec(void);
+extern uint32_t fdd_read(uint32_t off, int32_t sz);
+extern void fdd_write(uint32_t off, int32_t sz, uint32_t val);
+
+extern void snd_init(void);
+extern void snd_quit(void);
+extern void snd_exec(void);
+extern uint32_t snd_read(uint32_t off, int32_t sz);
+extern void snd_write(uint32_t off, int32_t sz, uint32_t val);
+
+extern void led_init(void);
+extern void led_quit(void);
+extern void led_exec(void);
+extern uint32_t led_read(uint32_t off, int32_t sz);
+extern void led_write(uint32_t off, int32_t sz, uint32_t val);
+
+extern void kbd_init(void);
+extern void kbd_quit(void);
+extern void kbd_exec(void);
+extern uint32_t kbd_read(uint32_t off, int32_t sz);
+extern void kbd_write(uint32_t off, int32_t sz, uint32_t val);
Index: emu/cpu.c
===================================================================
--- emu/cpu.c	(revision f9963876d9494b72796d2cebe041b8724fd0e301)
+++ emu/cpu.c	(revision a06aa8be3631490d2ce602f681044034ba655137)
@@ -1,2 +1,19 @@
+/*
+ *  Copyright (C) 2017 The Contributors
+ *
+ *  This program is free software: you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation, either version 3 of the License, or (at
+ *  your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful, but
+ *  WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ *  General Public License for more details.
+ *
+ *  A copy of the GNU General Public License can be found in the file
+ *  "gpl-v3.txt" in the top directory of this repository.
+ */
+
 #include <all.h>
 
@@ -7,48 +24,154 @@
 }
 
+bool cpu_verbose = false;
+
 #define CYCLES 10
 
-#define RESET_PC 0x100000
-#define RESET_SP 0x100000
-
-bool cpu_verbose = false;
+#define RAM_START 0x0
+#define RAM_SIZE 0x100000
+
+#define ROM_START 0x100000
+#define ROM_SIZE 0x10000
+
+#define RESET_SP ROM_START
+#define RESET_PC ROM_START
+
+typedef void (*hw_init_t)(void);
+typedef void (*hw_quit_t)(void);
+typedef void (*hw_exec_t)(void);
+typedef uint32_t (*hw_read_t)(uint32_t off, int32_t sz);
+typedef void (*hw_write_t)(uint32_t off, int32_t sz, uint32_t val);
+
+typedef struct {
+	uint32_t addr_beg;
+	uint32_t addr_end;
+	hw_init_t init;
+	hw_quit_t quit;
+	hw_exec_t exec;
+	hw_read_t read;
+	hw_write_t write;
+} hw_t;
+
 static bool reset = true;
 
+static uint8_t ram_data[RAM_SIZE];
+static uint8_t rom_data[ROM_SIZE];
+
+static uint32_t ram_rd_beg;
+static uint32_t ram_rd_end;
+static uint32_t ram_wr_beg;
+static uint32_t ram_wr_end;
+
+static uint32_t rom_rd_beg;
+static uint32_t rom_rd_end;
+static uint32_t rom_wr_beg;
+static uint32_t rom_wr_end;
+
+static hw_t hw_map[] = {
+	{ 0x180000, 0x200000, fpu_init, fpu_quit, fpu_exec, fpu_read, fpu_write },
+	{ 0x200000, 0x280000, vid_init, vid_quit, vid_exec, vid_read, vid_write },
+	{ 0x3a0001, 0x3a4001, tim_init, tim_quit, tim_exec, tim_read, tim_write },
+	{ 0x3a4001, 0x3a8001, lcd_init, lcd_quit, lcd_exec, lcd_read, lcd_write },
+	{ 0x3a8001, 0x3ac001, ser_init, ser_quit, ser_exec, ser_read, ser_write },
+	{ 0x3ac001, 0x3b0001, mid_init, mid_quit, mid_exec, mid_read, mid_write },
+	{ 0x3b0001, 0x3b4001, fdd_init, fdd_quit, fdd_exec, fdd_read, fdd_write },
+	{ 0x3b4001, 0x3b8001, snd_init, snd_quit, snd_exec, snd_read, snd_write },
+	{ 0x3b8001, 0x3bc001, led_init, led_quit, led_exec, led_read, led_write },
+	{ 0x3bc001, 0x3c0001, kbd_init, kbd_quit, kbd_exec, kbd_read, kbd_write }
+};
+
+static hw_t *hw_by_addr(uint32_t addr)
+{
+	for (int32_t i = 0; i < ARRAY_COUNT(hw_map); ++i) {
+		if (addr >= hw_map[i].addr_beg && addr < hw_map[i].addr_end) {
+			return hw_map + i;
+		}
+	}
+
+	return NULL;
+}
+
+static void hw_init(void)
+{
+	for (int32_t i = 0; i < ARRAY_COUNT(hw_map); ++i) {
+		hw_map[i].init();
+	}
+}
+
+static void hw_exec(void)
+{
+	for (int32_t i = 0; i < ARRAY_COUNT(hw_map); ++i) {
+		hw_map[i].exec();
+	}
+}
+
+static uint32_t hw_off(hw_t *hw, uint32_t addr)
+{
+	if ((hw->addr_beg & 0x1) == 0) {
+		return addr - hw->addr_beg;
+	}
+
+	return (addr - hw->addr_beg) / 2;
+}
+
 uint32_t m68k_read_disassembler_8(uint32_t addr)
 {
+	return m68k_read_memory_8(addr);
+}
+
+uint32_t m68k_read_disassembler_16(uint32_t addr)
+{
+	return m68k_read_memory_16(addr);
+}
+
+uint32_t m68k_read_disassembler_32(uint32_t addr)
+{
+	return m68k_read_memory_32(addr);
+}
+
+uint32_t m68k_read_memory_8(uint32_t addr)
+{
 	ver("mem rd 0x%08x:8", addr);
-	return 0;
-}
-
-uint32_t m68k_read_disassembler_16(uint32_t addr)
+
+	if (addr >= ram_rd_beg && addr <= ram_rd_end - 1) {
+		return ram_data[addr - RAM_START];
+	}
+
+	if (addr >= rom_rd_beg && addr <= rom_rd_end - 1) {
+		return rom_data[addr - ROM_START];
+	}
+
+	hw_t *hw = hw_by_addr(addr);
+
+	if (hw != NULL) {
+		return hw->read(hw_off(hw, addr), 1);
+	}
+
+	fail("invalid read 0x%08x:8", addr);
+}
+
+uint32_t m68k_read_memory_16(uint32_t addr)
 {
 	ver("mem rd 0x%08x:16", addr);
-	return 0;
-}
-
-uint32_t m68k_read_disassembler_32(uint32_t addr)
-{
-	ver("mem rd 0x%08x:32", addr);
-	return 0;
-}
-
-uint32_t m68k_read_memory_8(uint32_t addr)
-{
-	ver("mem rd 0x%08x:8", addr);
-	return 0;
-}
-
-uint32_t m68k_read_memory_16(uint32_t addr)
-{
-	ver("mem rd 0x%08x:16", addr);
-
-	if (addr < 0x100000) {
-	}
-
-	if (addr < 0x110000) {
-		return 0x60fe;
-	}
-
-	return 0;
+
+	if (addr >= ram_rd_beg && addr <= ram_rd_end - 2) {
+		return
+				((uint32_t)ram_data[addr - RAM_START + 0] << 8) |
+				((uint32_t)ram_data[addr - RAM_START + 1] << 0);
+	}
+
+	if (addr >= rom_rd_beg && addr <= rom_rd_end - 2) {
+		return
+				((uint32_t)rom_data[addr - ROM_START + 0] << 8) |
+				((uint32_t)rom_data[addr - ROM_START + 1] << 0);
+	}
+
+	hw_t *hw = hw_by_addr(addr);
+
+	if (hw != NULL) {
+		return hw->read(hw_off(hw, addr), 2);
+	}
+
+	fail("invalid read 0x%08x:16", addr);
 }
 
@@ -70,5 +193,27 @@
 	}
 
-	return 0;
+	if (addr >= ram_rd_beg && addr <= ram_rd_end - 4) {
+		return
+				((uint32_t)ram_data[addr - RAM_START + 0] << 24) |
+				((uint32_t)ram_data[addr - RAM_START + 1] << 16) |
+				((uint32_t)ram_data[addr - RAM_START + 2] <<  8) |
+				((uint32_t)ram_data[addr - RAM_START + 3] <<  0);
+	}
+
+	if (addr >= rom_rd_beg && addr <= rom_rd_end - 4) {
+		return
+				((uint32_t)rom_data[addr - ROM_START + 0] << 24) |
+				((uint32_t)rom_data[addr - ROM_START + 1] << 16) |
+				((uint32_t)rom_data[addr - ROM_START + 2] <<  8) |
+				((uint32_t)rom_data[addr - ROM_START + 3] <<  0);
+	}
+
+	hw_t *hw = hw_by_addr(addr);
+
+	if (hw != NULL) {
+		return hw->read(hw_off(hw, addr), 4);
+	}
+
+	fail("invalid read 0x%08x:32", addr);
 }
 
@@ -76,4 +221,24 @@
 {
 	ver("mem wr 0x%08x:8 0x%02x", addr, val);
+
+	if (addr >= ram_wr_beg && addr <= ram_wr_end - 1) {
+		ram_data[addr - RAM_START] = (uint8_t)val;
+		return;
+	}
+
+	if (addr >= rom_wr_beg && addr <= rom_wr_end - 1) {
+		// ROM has its BSS section in RAM.
+		ram_data[addr - RAM_START] = (uint8_t)val;
+		return;
+	}
+
+	hw_t *hw = hw_by_addr(addr);
+
+	if (hw != NULL) {
+		hw->write(hw_off(hw, addr), 1, val);
+		return;
+	}
+
+	fail("invalid write 0x%08x:8 0x%02x", addr, val);
 }
 
@@ -81,4 +246,26 @@
 {
 	ver("mem wr 0x%08x:16 0x%04x", addr, val);
+
+	if (addr >= ram_wr_beg && addr <= ram_wr_end - 2) {
+		ram_data[addr - RAM_START + 0] = (uint8_t)(val >> 8);
+		ram_data[addr - RAM_START + 1] = (uint8_t)(val >> 0);
+		return;
+	}
+
+	if (addr >= rom_wr_beg && addr <= rom_wr_end - 2) {
+		// ROM has its BSS section in RAM.
+		ram_data[addr - RAM_START + 0] = (uint8_t)(val >> 8);
+		ram_data[addr - RAM_START + 1] = (uint8_t)(val >> 0);
+		return;
+	}
+
+	hw_t *hw = hw_by_addr(addr);
+
+	if (hw != NULL) {
+		hw->write(hw_off(hw, addr), 2, val);
+		return;
+	}
+
+	fail("invalid write 0x%08x:16 0x%04x", addr, val);
 }
 
@@ -86,16 +273,45 @@
 {
 	ver("mem wr 0x%08x:32 0x%08x", addr, val);
+
+	if (addr >= ram_wr_beg && addr <= ram_wr_end - 4) {
+		ram_data[addr - RAM_START + 0] = (uint8_t)(val >> 24);
+		ram_data[addr - RAM_START + 1] = (uint8_t)(val >> 16);
+		ram_data[addr - RAM_START + 2] = (uint8_t)(val >>  8);
+		ram_data[addr - RAM_START + 3] = (uint8_t)(val >>  0);
+		return;
+	}
+
+	if (addr >= rom_wr_beg && addr <= rom_wr_end - 4) {
+		// ROM has its BSS section in RAM.
+		ram_data[addr - RAM_START + 0] = (uint8_t)(val >> 24);
+		ram_data[addr - RAM_START + 1] = (uint8_t)(val >> 16);
+		ram_data[addr - RAM_START + 2] = (uint8_t)(val >>  8);
+		ram_data[addr - RAM_START + 3] = (uint8_t)(val >>  0);
+		return;
+	}
+
+	hw_t *hw = hw_by_addr(addr);
+
+	if (hw != NULL) {
+		hw->write(hw_off(hw, addr), 4, val);
+		return;
+	}
+
+	fail("invalid write 0x%08x:32 0x%08x", addr, val);
 }
 
 void cpu_loop(void)
 {
-	ver("entering CPU loop");
-
+	ver("initializing hardware");
+	hw_init();
+
+	ver("starting CPU");
 	m68k_init();
 	m68k_set_cpu_type(M68K_CPU_TYPE_68000);
 	m68k_pulse_reset();
 
-	for (int32_t i = 0; i < 5; ++i) {
+	for (int32_t c = 0; c < 5; ++c) {
 		m68k_execute(CYCLES);
-	}
-}
+		hw_exec();
+	}
+}
Index: emu/fdd.c
===================================================================
--- emu/fdd.c	(revision a06aa8be3631490d2ce602f681044034ba655137)
+++ emu/fdd.c	(revision a06aa8be3631490d2ce602f681044034ba655137)
@@ -0,0 +1,52 @@
+/*
+ *  Copyright (C) 2017 The Contributors
+ *
+ *  This program is free software: you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation, either version 3 of the License, or (at
+ *  your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful, but
+ *  WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ *  General Public License for more details.
+ *
+ *  A copy of the GNU General Public License can be found in the file
+ *  "gpl-v3.txt" in the top directory of this repository.
+ */
+
+#include <all.h>
+
+#define ver(...) { \
+	if (fdd_verbose) { \
+		SDL_LogVerbose(SDL_LOG_CATEGORY_APPLICATION, __VA_ARGS__); \
+	} \
+}
+
+bool fdd_verbose = false;
+
+void fdd_init(void)
+{
+	ver("fdd init");
+}
+
+void fdd_quit(void)
+{
+	ver("fdd quit");
+}
+
+void fdd_exec(void)
+{
+	ver("fdd exec");
+}
+
+uint32_t fdd_read(uint32_t off, int32_t sz)
+{
+	ver("fdd rd %u:%d", off, sz * 8);
+	return 0;
+}
+
+void fdd_write(uint32_t off, int32_t sz, uint32_t val)
+{
+	ver("fdd wr %u:8 0x%0*x", off, sz * 2, val);
+}
Index: emu/fpu.c
===================================================================
--- emu/fpu.c	(revision a06aa8be3631490d2ce602f681044034ba655137)
+++ emu/fpu.c	(revision a06aa8be3631490d2ce602f681044034ba655137)
@@ -0,0 +1,52 @@
+/*
+ *  Copyright (C) 2017 The Contributors
+ *
+ *  This program is free software: you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation, either version 3 of the License, or (at
+ *  your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful, but
+ *  WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ *  General Public License for more details.
+ *
+ *  A copy of the GNU General Public License can be found in the file
+ *  "gpl-v3.txt" in the top directory of this repository.
+ */
+
+#include <all.h>
+
+#define ver(...) { \
+	if (fpu_verbose) { \
+		SDL_LogVerbose(SDL_LOG_CATEGORY_APPLICATION, __VA_ARGS__); \
+	} \
+}
+
+bool fpu_verbose = false;
+
+void fpu_init(void)
+{
+	ver("fpu init");
+}
+
+void fpu_quit(void)
+{
+	ver("fpu quit");
+}
+
+void fpu_exec(void)
+{
+	ver("fpu exec");
+}
+
+uint32_t fpu_read(uint32_t off, int32_t sz)
+{
+	ver("fpu rd 0x%04x:%d", off, sz * 8);
+	return 0;
+}
+
+void fpu_write(uint32_t off, int32_t sz, uint32_t val)
+{
+	ver("fpu wr 0x%04x:8 0x%0*x", off, sz * 2, val);
+}
Index: emu/kbd.c
===================================================================
--- emu/kbd.c	(revision a06aa8be3631490d2ce602f681044034ba655137)
+++ emu/kbd.c	(revision a06aa8be3631490d2ce602f681044034ba655137)
@@ -0,0 +1,52 @@
+/*
+ *  Copyright (C) 2017 The Contributors
+ *
+ *  This program is free software: you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation, either version 3 of the License, or (at
+ *  your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful, but
+ *  WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ *  General Public License for more details.
+ *
+ *  A copy of the GNU General Public License can be found in the file
+ *  "gpl-v3.txt" in the top directory of this repository.
+ */
+
+#include <all.h>
+
+#define ver(...) { \
+	if (kbd_verbose) { \
+		SDL_LogVerbose(SDL_LOG_CATEGORY_APPLICATION, __VA_ARGS__); \
+	} \
+}
+
+bool kbd_verbose = false;
+
+void kbd_init(void)
+{
+	ver("kbd init");
+}
+
+void kbd_quit(void)
+{
+	ver("kbd quit");
+}
+
+void kbd_exec(void)
+{
+	ver("kbd exec");
+}
+
+uint32_t kbd_read(uint32_t off, int32_t sz)
+{
+	ver("kbd rd %u:%d", off, sz * 8);
+	return 0;
+}
+
+void kbd_write(uint32_t off, int32_t sz, uint32_t val)
+{
+	ver("kbd wr %u:8 0x%0*x", off, sz * 2, val);
+}
Index: emu/lcd.c
===================================================================
--- emu/lcd.c	(revision a06aa8be3631490d2ce602f681044034ba655137)
+++ emu/lcd.c	(revision a06aa8be3631490d2ce602f681044034ba655137)
@@ -0,0 +1,52 @@
+/*
+ *  Copyright (C) 2017 The Contributors
+ *
+ *  This program is free software: you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation, either version 3 of the License, or (at
+ *  your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful, but
+ *  WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ *  General Public License for more details.
+ *
+ *  A copy of the GNU General Public License can be found in the file
+ *  "gpl-v3.txt" in the top directory of this repository.
+ */
+
+#include <all.h>
+
+#define ver(...) { \
+	if (lcd_verbose) { \
+		SDL_LogVerbose(SDL_LOG_CATEGORY_APPLICATION, __VA_ARGS__); \
+	} \
+}
+
+bool lcd_verbose = false;
+
+void lcd_init(void)
+{
+	ver("lcd init");
+}
+
+void lcd_quit(void)
+{
+	ver("lcd quit");
+}
+
+void lcd_exec(void)
+{
+	ver("lcd exec");
+}
+
+uint32_t lcd_read(uint32_t off, int32_t sz)
+{
+	ver("lcd rd %u:%d", off, sz * 8);
+	return 0;
+}
+
+void lcd_write(uint32_t off, int32_t sz, uint32_t val)
+{
+	ver("lcd wr %u:8 0x%0*x", off, sz * 2, val);
+}
Index: emu/led.c
===================================================================
--- emu/led.c	(revision a06aa8be3631490d2ce602f681044034ba655137)
+++ emu/led.c	(revision a06aa8be3631490d2ce602f681044034ba655137)
@@ -0,0 +1,52 @@
+/*
+ *  Copyright (C) 2017 The Contributors
+ *
+ *  This program is free software: you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation, either version 3 of the License, or (at
+ *  your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful, but
+ *  WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ *  General Public License for more details.
+ *
+ *  A copy of the GNU General Public License can be found in the file
+ *  "gpl-v3.txt" in the top directory of this repository.
+ */
+
+#include <all.h>
+
+#define ver(...) { \
+	if (led_verbose) { \
+		SDL_LogVerbose(SDL_LOG_CATEGORY_APPLICATION, __VA_ARGS__); \
+	} \
+}
+
+bool led_verbose = false;
+
+void led_init(void)
+{
+	ver("led init");
+}
+
+void led_quit(void)
+{
+	ver("led quit");
+}
+
+void led_exec(void)
+{
+	ver("led exec");
+}
+
+uint32_t led_read(uint32_t off, int32_t sz)
+{
+	ver("led rd %u:%d", off, sz * 8);
+	return 0;
+}
+
+void led_write(uint32_t off, int32_t sz, uint32_t val)
+{
+	ver("led wr %u:8 0x%0*x", off, sz * 2, val);
+}
Index: emu/main.c
===================================================================
--- emu/main.c	(revision f9963876d9494b72796d2cebe041b8724fd0e301)
+++ emu/main.c	(revision a06aa8be3631490d2ce602f681044034ba655137)
@@ -1,2 +1,19 @@
+/*
+ *  Copyright (C) 2017 The Contributors
+ *
+ *  This program is free software: you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation, either version 3 of the License, or (at
+ *  your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful, but
+ *  WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ *  General Public License for more details.
+ *
+ *  A copy of the GNU General Public License can be found in the file
+ *  "gpl-v3.txt" in the top directory of this repository.
+ */
+
 #include <all.h>
 
Index: emu/mid.c
===================================================================
--- emu/mid.c	(revision a06aa8be3631490d2ce602f681044034ba655137)
+++ emu/mid.c	(revision a06aa8be3631490d2ce602f681044034ba655137)
@@ -0,0 +1,52 @@
+/*
+ *  Copyright (C) 2017 The Contributors
+ *
+ *  This program is free software: you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation, either version 3 of the License, or (at
+ *  your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful, but
+ *  WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ *  General Public License for more details.
+ *
+ *  A copy of the GNU General Public License can be found in the file
+ *  "gpl-v3.txt" in the top directory of this repository.
+ */
+
+#include <all.h>
+
+#define ver(...) { \
+	if (mid_verbose) { \
+		SDL_LogVerbose(SDL_LOG_CATEGORY_APPLICATION, __VA_ARGS__); \
+	} \
+}
+
+bool mid_verbose = false;
+
+void mid_init(void)
+{
+	ver("mid init");
+}
+
+void mid_quit(void)
+{
+	ver("mid quit");
+}
+
+void mid_exec(void)
+{
+	ver("mid exec");
+}
+
+uint32_t mid_read(uint32_t off, int32_t sz)
+{
+	ver("mid rd %u:%d", off, sz * 8);
+	return 0;
+}
+
+void mid_write(uint32_t off, int32_t sz, uint32_t val)
+{
+	ver("mid wr %u:8 0x%0*x", off, sz * 2, val);
+}
Index: emu/sdl.c
===================================================================
--- emu/sdl.c	(revision f9963876d9494b72796d2cebe041b8724fd0e301)
+++ emu/sdl.c	(revision a06aa8be3631490d2ce602f681044034ba655137)
@@ -1,2 +1,19 @@
+/*
+ *  Copyright (C) 2017 The Contributors
+ *
+ *  This program is free software: you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation, either version 3 of the License, or (at
+ *  your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful, but
+ *  WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ *  General Public License for more details.
+ *
+ *  A copy of the GNU General Public License can be found in the file
+ *  "gpl-v3.txt" in the top directory of this repository.
+ */
+
 #include <all.h>
 
Index: emu/ser.c
===================================================================
--- emu/ser.c	(revision a06aa8be3631490d2ce602f681044034ba655137)
+++ emu/ser.c	(revision a06aa8be3631490d2ce602f681044034ba655137)
@@ -0,0 +1,52 @@
+/*
+ *  Copyright (C) 2017 The Contributors
+ *
+ *  This program is free software: you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation, either version 3 of the License, or (at
+ *  your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful, but
+ *  WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ *  General Public License for more details.
+ *
+ *  A copy of the GNU General Public License can be found in the file
+ *  "gpl-v3.txt" in the top directory of this repository.
+ */
+
+#include <all.h>
+
+#define ver(...) { \
+	if (ser_verbose) { \
+		SDL_LogVerbose(SDL_LOG_CATEGORY_APPLICATION, __VA_ARGS__); \
+	} \
+}
+
+bool ser_verbose = false;
+
+void ser_init(void)
+{
+	ver("ser init");
+}
+
+void ser_quit(void)
+{
+	ver("ser quit");
+}
+
+void ser_exec(void)
+{
+	ver("ser exec");
+}
+
+uint32_t ser_read(uint32_t off, int32_t sz)
+{
+	ver("ser rd %u:%d", off, sz * 8);
+	return 0;
+}
+
+void ser_write(uint32_t off, int32_t sz, uint32_t val)
+{
+	ver("ser wr %u:8 0x%0*x", off, sz * 2, val);
+}
Index: emu/snd.c
===================================================================
--- emu/snd.c	(revision a06aa8be3631490d2ce602f681044034ba655137)
+++ emu/snd.c	(revision a06aa8be3631490d2ce602f681044034ba655137)
@@ -0,0 +1,52 @@
+/*
+ *  Copyright (C) 2017 The Contributors
+ *
+ *  This program is free software: you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation, either version 3 of the License, or (at
+ *  your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful, but
+ *  WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ *  General Public License for more details.
+ *
+ *  A copy of the GNU General Public License can be found in the file
+ *  "gpl-v3.txt" in the top directory of this repository.
+ */
+
+#include <all.h>
+
+#define ver(...) { \
+	if (snd_verbose) { \
+		SDL_LogVerbose(SDL_LOG_CATEGORY_APPLICATION, __VA_ARGS__); \
+	} \
+}
+
+bool snd_verbose = false;
+
+void snd_init(void)
+{
+	ver("snd init");
+}
+
+void snd_quit(void)
+{
+	ver("snd quit");
+}
+
+void snd_exec(void)
+{
+	ver("snd exec");
+}
+
+uint32_t snd_read(uint32_t off, int32_t sz)
+{
+	ver("snd rd %u:%d", off, sz * 8);
+	return 0;
+}
+
+void snd_write(uint32_t off, int32_t sz, uint32_t val)
+{
+	ver("snd wr %u:8 0x%0*x", off, sz * 2, val);
+}
Index: emu/tim.c
===================================================================
--- emu/tim.c	(revision a06aa8be3631490d2ce602f681044034ba655137)
+++ emu/tim.c	(revision a06aa8be3631490d2ce602f681044034ba655137)
@@ -0,0 +1,52 @@
+/*
+ *  Copyright (C) 2017 The Contributors
+ *
+ *  This program is free software: you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation, either version 3 of the License, or (at
+ *  your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful, but
+ *  WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ *  General Public License for more details.
+ *
+ *  A copy of the GNU General Public License can be found in the file
+ *  "gpl-v3.txt" in the top directory of this repository.
+ */
+
+#include <all.h>
+
+#define ver(...) { \
+	if (tim_verbose) { \
+		SDL_LogVerbose(SDL_LOG_CATEGORY_APPLICATION, __VA_ARGS__); \
+	} \
+}
+
+bool tim_verbose = false;
+
+void tim_init(void)
+{
+	ver("tim init");
+}
+
+void tim_quit(void)
+{
+	ver("tim quit");
+}
+
+void tim_exec(void)
+{
+	ver("tim exec");
+}
+
+uint32_t tim_read(uint32_t off, int32_t sz)
+{
+	ver("tim rd %u:%d", off, sz * 8);
+	return 0;
+}
+
+void tim_write(uint32_t off, int32_t sz, uint32_t val)
+{
+	ver("tim wr %u:8 0x%0*x", off, sz * 2, val);
+}
Index: emu/vid.c
===================================================================
--- emu/vid.c	(revision a06aa8be3631490d2ce602f681044034ba655137)
+++ emu/vid.c	(revision a06aa8be3631490d2ce602f681044034ba655137)
@@ -0,0 +1,52 @@
+/*
+ *  Copyright (C) 2017 The Contributors
+ *
+ *  This program is free software: you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation, either version 3 of the License, or (at
+ *  your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful, but
+ *  WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ *  General Public License for more details.
+ *
+ *  A copy of the GNU General Public License can be found in the file
+ *  "gpl-v3.txt" in the top directory of this repository.
+ */
+
+#include <all.h>
+
+#define ver(...) { \
+	if (vid_verbose) { \
+		SDL_LogVerbose(SDL_LOG_CATEGORY_APPLICATION, __VA_ARGS__); \
+	} \
+}
+
+bool vid_verbose = false;
+
+void vid_init(void)
+{
+	ver("vid init");
+}
+
+void vid_quit(void)
+{
+	ver("vid quit");
+}
+
+void vid_exec(void)
+{
+	ver("vid exec");
+}
+
+uint32_t vid_read(uint32_t off, int32_t sz)
+{
+	ver("vid rd 0x%05x:%d", off, sz * 8);
+	return 0;
+}
+
+void vid_write(uint32_t off, int32_t sz, uint32_t val)
+{
+	ver("vid wr 0x%05x:8 0x%0*x", off, sz * 2, val);
+}
