/m68kmake.exe
/m68kops.c
/m68kops.h
+/emulator
# this supports ECP5 Evaluation Board
reset_config none
-interface bcm2835gpio
-
-
+adapter driver bcm2835gpio
#bcm2835gpio_peripheral_base 0x20000000
bcm2835gpio_peripheral_base 0x3F000000
-
# Transition delay calculation: SPEED_COEFF/khz - SPEED_OFFSET
# These depend on system clock, calibrated for stock 700MHz
# bcm2835gpio_speed SPEED_COEFF SPEED_OFFSET
#bcm2835gpio_speed_coeffs 146203 36
bcm2835gpio_speed_coeffs 194938 48
-
-
#bcm2835gpio_peripheral_base 0x3F000000
#bcm2835gpio_speed_coeffs 194938 48
reset_config none
-adapter_khz 100
+adapter speed 100
# JTAG tck tms tdi tdo
bcm2835gpio_jtag_nums 26 24 27 25
reset_config srst_only srst_open_drain
transport select jtag
-jtag newtap max2 tap -irlen 11 -expected-id 0x020a20dd
+jtag newtap max2 tap -irlen 11 -expected-id 0x020a20dd
init
svf ./rtl/bitstream.svf -quiet
sleep 200
CC = gcc
WARNINGS = -Wall -Wextra -pedantic
-CFLAGS = $(WARNINGS) -march=armv8-a -mfloat-abi=hard -mfpu=neon-fp-armv8 -O3 -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE
+CFLAGS = $(WARNINGS) -I. -march=armv8-a -mfloat-abi=hard -mfpu=neon-fp-armv8 -O3 -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE
LFLAGS = $(WARNINGS) `sdl2-config --libs`
TARGET = $(EXENAME)$(EXE)
#include <sys/types.h>
#include <unistd.h>
#include <sys/ioctl.h>
-#include "main.h"
+#include "emulator.h"
#include "gpio/gpio.h"
#include "platforms/amiga/gayle-ide/ide.h"
-#include "../platforms/platforms.h"
+#include "platforms/platforms.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
case MAPTYPE_REGISTER:
default:
break;
- break;
}
printf("[MAP %d] Added %s mapping for range %.8lX-%.8lX ID: %s\n", index, map_type_names[type], cfg->map_offset[index], cfg->map_high[index] - 1, cfg->map_id[index] ? cfg->map_id[index] : "None");
goto skip_line;
trim_whitespace(parse_line);
-
+
get_next_string(parse_line, cur_cmd, &str_pos, ' ');
switch (get_config_item_type(cur_cmd)) {
printf("Unknown config item %s on line %d.\n", cur_cmd, cur_line);
break;
}
-
+
skip_line:;
cur_line++;
}
-#include "../m68k.h"
+#ifndef _CONFIG_FILE_H
+#define _CONFIG_FILE_H
+
+#include "m68k.h"
+
+#include <unistd.h>
#define MAX_NUM_MAPPED_ITEMS 8
#define SIZE_KILO 1024
int get_named_mapped_item(struct emulator_config *cfg, char *name);
int get_mapped_item_by_address(struct emulator_config *cfg, uint32_t address);
unsigned int get_int(char *str);
+
+#endif /* _CONFIG_FILE_H */
+#include "m68k.h"
+#include "emulator.h"
+#include "platforms/platforms.h"
+#include "input/input.h"
+
+#include "platforms/amiga/Gayle.h"
+#include "platforms/amiga/gayle-ide/ide.h"
+#include "platforms/amiga/amiga-registers.h"
+#include "platforms/amiga/rtg/rtg.h"
+#include "platforms/amiga/hunk-reloc.h"
+#include "platforms/amiga/piscsi/piscsi.h"
+#include "platforms/amiga/piscsi/piscsi-enums.h"
+#include "platforms/amiga/net/pi-net.h"
+#include "platforms/amiga/net/pi-net-enums.h"
+#include "gpio/ps_protocol.h"
+
#include <assert.h>
#include <dirent.h>
#include <endian.h>
#include <fcntl.h>
+#include <poll.h>
#include <pthread.h>
#include <sched.h>
#include <signal.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include <sys/ioctl.h>
#include <sys/mman.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <unistd.h>
-#include <sys/ioctl.h>
-#include "m68k.h"
-#include "main.h"
-#include "platforms/platforms.h"
-#include "input/input.h"
-#include "platforms/amiga/Gayle.h"
-#include "platforms/amiga/gayle-ide/ide.h"
-#include "platforms/amiga/amiga-registers.h"
-#include "platforms/amiga/rtg/rtg.h"
-#include "platforms/amiga/hunk-reloc.h"
-#include "platforms/amiga/piscsi/piscsi.h"
-#include "platforms/amiga/piscsi/piscsi-enums.h"
-#include "platforms/amiga/net/pi-net.h"
-#include "platforms/amiga/net/pi-net-enums.h"
-#include "gpio/ps_protocol.h"
+#define KEY_POLL_INTERVAL_MSEC 5000
unsigned char read_ranges;
unsigned int read_addr[8];
int mouse_hook_enabled = 0;
int cpu_emulation_running = 1;
-char mouse_dx = 0, mouse_dy = 0;
-char mouse_buttons = 0;
+uint8_t mouse_dx = 0, mouse_dy = 0;
+uint8_t mouse_buttons = 0;
+uint8_t mouse_extra = 0;
extern uint8_t gayle_int;
extern uint8_t gayle_ide_enabled;
extern uint8_t realtime_graphics_debug;
uint8_t realtime_disassembly, int2_enabled = 0;
uint32_t do_disasm = 0, old_level;
+char c = 0, c_code = 0, c_type = 0; // @todo temporary main/cpu_task scope workaround until input moved to a thread
+uint32_t last_irq = 0, last_last_irq = 0;
char disasm_buf[4096];
uint64_t trig_irq = 0, serv_irq = 0;
uint16_t irq_delay = 0;
-void *iplThread(void *args) {
+void *ipl_task(void *args) {
printf("IPL thread running\n");
uint16_t old_irq = 0;
uint32_t value;
return args;
}
+void *cpu_task() {
+ m68k_pulse_reset();
+
+cpu_loop:
+ if (mouse_hook_enabled) {
+ get_mouse_status(&mouse_dx, &mouse_dy, &mouse_buttons, &mouse_extra);
+ }
+
+ if (realtime_disassembly && (do_disasm || cpu_emulation_running)) {
+ m68k_disassemble(disasm_buf, m68k_get_reg(NULL, M68K_REG_PC), cpu_type);
+ printf("REGA: 0:$%.8X 1:$%.8X 2:$%.8X 3:$%.8X 4:$%.8X 5:$%.8X 6:$%.8X 7:$%.8X\n", m68k_get_reg(NULL, M68K_REG_A0), m68k_get_reg(NULL, M68K_REG_A1), m68k_get_reg(NULL, M68K_REG_A2), m68k_get_reg(NULL, M68K_REG_A3), \
+ m68k_get_reg(NULL, M68K_REG_A4), m68k_get_reg(NULL, M68K_REG_A5), m68k_get_reg(NULL, M68K_REG_A6), m68k_get_reg(NULL, M68K_REG_A7));
+ printf("REGD: 0:$%.8X 1:$%.8X 2:$%.8X 3:$%.8X 4:$%.8X 5:$%.8X 6:$%.8X 7:$%.8X\n", m68k_get_reg(NULL, M68K_REG_D0), m68k_get_reg(NULL, M68K_REG_D1), m68k_get_reg(NULL, M68K_REG_D2), m68k_get_reg(NULL, M68K_REG_D3), \
+ m68k_get_reg(NULL, M68K_REG_D4), m68k_get_reg(NULL, M68K_REG_D5), m68k_get_reg(NULL, M68K_REG_D6), m68k_get_reg(NULL, M68K_REG_D7));
+ printf("%.8X (%.8X)]] %s\n", m68k_get_reg(NULL, M68K_REG_PC), (m68k_get_reg(NULL, M68K_REG_PC) & 0xFFFFFF), disasm_buf);
+ if (do_disasm)
+ do_disasm--;
+ m68k_execute(1);
+ }
+ else {
+ if (cpu_emulation_running)
+ m68k_execute(loop_cycles);
+ }
+
+ if (irq) {
+ while (irq) {
+ last_irq = ((read_reg() & 0xe000) >> 13);
+ if (last_irq != last_last_irq) {
+ last_last_irq = last_irq;
+ M68K_SET_IRQ(last_irq);
+ }
+ m68k_execute(5);
+ }
+ if (gayleirq && int2_enabled) {
+ write16(0xdff09c, 0x8000 | (1 << 3) && last_irq != 2);
+ last_last_irq = last_irq;
+ last_irq = 2;
+ M68K_SET_IRQ(2);
+ }
+ M68K_SET_IRQ(0);
+ last_last_irq = 0;
+ }
+ /*else {
+ if (last_irq != 0) {
+ M68K_SET_IRQ(0);
+ last_last_irq = last_irq;
+ last_irq = 0;
+ }
+ }*/
+
+ if (mouse_hook_enabled && (mouse_extra != 0x00)) {
+ // mouse wheel events have occurred; unlike l/m/r buttons, these are queued as keypresses, so add to end of buffer
+ switch (mouse_extra) {
+ case 0xff:
+ // wheel up
+ queue_keypress(0xfe, KEYPRESS_PRESS, PLATFORM_AMIGA);
+ break;
+ case 0x01:
+ // wheel down
+ queue_keypress(0xff, KEYPRESS_PRESS, PLATFORM_AMIGA);
+ break;
+ }
+
+ // dampen the scroll wheel until next while loop iteration
+ mouse_extra = 0x00;
+ }
+ goto cpu_loop;
+
+stop_cpu_emulation:
+ printf("[CPU] End of CPU thread\n");
+}
+
+void *keyboard_task() {
+ struct pollfd kbdfd[1];
+ int kpoll;
+
+ printf("[KBD] Keyboard thread started\n");
+
+ kbdfd[0].fd = keyboard_fd;
+ kbdfd[0].events = POLLIN;
+
+key_loop:
+ kpoll = poll(kbdfd, 1, KEY_POLL_INTERVAL_MSEC);
+ if ((kpoll > 0) && (kbdfd[0].revents & POLLHUP)) {
+ // in the event that a keyboard is unplugged, keyboard_task will whiz up to 100% utilisation
+ // this is undesired, so if the keyboard HUPs, end the thread without ending the emulation
+ printf("[KBD] Keyboard node returned HUP (unplugged?)\n");
+ goto key_end;
+ }
+
+ // if kpoll > 0 then it contains number of events to pull, also check if POLLIN is set in revents
+ if ((kpoll <= 0) || !(kbdfd[0].revents & POLLIN)) {
+ goto key_loop;
+ }
+
+ while (get_key_char(&c, &c_code, &c_type)) {
+ if (c && c == cfg->keyboard_toggle_key && !kb_hook_enabled) {
+ kb_hook_enabled = 1;
+ printf("Keyboard hook enabled.\n");
+ }
+ else if (kb_hook_enabled) {
+ if (c == 0x1B && c_type) {
+ kb_hook_enabled = 0;
+ printf("Keyboard hook disabled.\n");
+ }
+ else {
+ if (queue_keypress(c_code, c_type, cfg->platform->id) && int2_enabled && last_irq != 2) {
+ //last_irq = 0;
+ //M68K_SET_IRQ(2);
+ }
+ }
+ }
+
+ // pause pressed; trigger nmi (int level 7)
+ if (c == 0x01 && c_type) {
+ printf("[INT] Sending NMI\n");
+ M68K_SET_IRQ(7);
+ }
+
+ if (!kb_hook_enabled && c_type) {
+ if (c && c == cfg->mouse_toggle_key) {
+ mouse_hook_enabled ^= 1;
+ printf("Mouse hook %s.\n", mouse_hook_enabled ? "enabled" : "disabled");
+ mouse_dx = mouse_dy = mouse_buttons = mouse_extra = 0;
+ }
+ if (c == 'r') {
+ cpu_emulation_running ^= 1;
+ printf("CPU emulation is now %s\n", cpu_emulation_running ? "running" : "stopped");
+ }
+ if (c == 'g') {
+ realtime_graphics_debug ^= 1;
+ printf("Real time graphics debug is now %s\n", realtime_graphics_debug ? "on" : "off");
+ }
+ if (c == 'R') {
+ cpu_pulse_reset();
+ //m68k_pulse_reset();
+ printf("CPU emulation reset.\n");
+ }
+ // @todo work out how to signal the main process that we want to quit
+ // if (c == 'q') {
+ // printf("Quitting and exiting emulator.\n");
+ // goto stop_cpu_emulation;
+ // }
+ if (c == 'd') {
+ realtime_disassembly ^= 1;
+ do_disasm = 1;
+ printf("Real time disassembly is now %s\n", realtime_disassembly ? "on" : "off");
+ }
+ if (c == 'D') {
+ int r = get_mapped_item_by_address(cfg, 0x08000000);
+ if (r != -1) {
+ printf("Dumping first 16MB of mapped range %d.\n", r);
+ FILE *dmp = fopen("./memdmp.bin", "wb+");
+ fwrite(cfg->map_data[r], 16 * SIZE_MEGA, 1, dmp);
+ fclose(dmp);
+ }
+ }
+ if (c == 's' && realtime_disassembly) {
+ do_disasm = 1;
+ }
+ if (c == 'S' && realtime_disassembly) {
+ do_disasm = 128;
+ }
+ }
+ }
+
+ goto key_loop;
+
+key_end:
+ printf("[KBD] Keyboard thread ending\n");
+}
+
void stop_cpu_emulation(uint8_t disasm_cur) {
M68K_END_TIMESLICE;
if (disasm_cur) {
}
if (cfg->mouse_enabled) {
- mouse_fd = open(cfg->mouse_file, O_RDONLY | O_NONBLOCK);
+ mouse_fd = open(cfg->mouse_file, O_RDWR | O_NONBLOCK);
if (mouse_fd == -1) {
printf("Failed to open %s, can't enable mouse hook.\n", cfg->mouse_file);
cfg->mouse_enabled = 0;
+ } else {
+ /**
+ * *-*-*-* magic numbers! *-*-*-*
+ * great, so waaaay back in the history of the pc, the ps/2 protocol set the standard for mice
+ * and in the process, the mouse sample rate was defined as a way of putting mice into vendor-specific modes.
+ * as the ancient gpm command explains, almost everything except incredibly old mice talk the IntelliMouse
+ * protocol, which reports four bytes. by default, every mouse starts in 3-byte mode (don't report wheel or
+ * additional buttons) until imps2 magic is sent. so, command $f3 is "set sample rate", followed by a byte.
+ */
+ uint8_t mouse_init[] = { 0xf4, 0xf3, 0x64 }; // enable, then set sample rate 100
+ uint8_t imps2_init[] = { 0xf3, 0xc8, 0xf3, 0x64, 0xf3, 0x50 }; // magic sequence; set sample 200, 100, 80
+ if (write(mouse_fd, mouse_init, sizeof(mouse_init)) != -1) {
+ if (write(mouse_fd, imps2_init, sizeof(imps2_init)) == -1)
+ printf("[MOUSE] Couldn't enable scroll wheel events; is this mouse from the 1980s?\n");
+ } else
+ printf("[MOUSE] Mouse didn't respond to normal PS/2 init; have you plugged a brick in by mistake?\n");
}
}
m68k_set_cpu_type(cpu_type);
cpu_pulse_reset();
- char c = 0, c_code = 0, c_type = 0;
- uint32_t last_irq = 0, last_last_irq = 0;
-
- pthread_t id;
+ pthread_t ipl_tid, cpu_tid, kbd_tid;
int err;
- err = pthread_create(&id, NULL, &iplThread, NULL);
+ err = pthread_create(&ipl_tid, NULL, &ipl_task, NULL);
if (err != 0)
- printf("can't create IPL thread :[%s]", strerror(err));
- else
- printf("IPL Thread created successfully\n");
-
- m68k_pulse_reset();
- while (42) {
- if (mouse_hook_enabled) {
- get_mouse_status(&mouse_dx, &mouse_dy, &mouse_buttons);
- }
-
- if (realtime_disassembly && (do_disasm || cpu_emulation_running)) {
- m68k_disassemble(disasm_buf, m68k_get_reg(NULL, M68K_REG_PC), cpu_type);
- printf("REGA: 0:$%.8X 1:$%.8X 2:$%.8X 3:$%.8X 4:$%.8X 5:$%.8X 6:$%.8X 7:$%.8X\n", m68k_get_reg(NULL, M68K_REG_A0), m68k_get_reg(NULL, M68K_REG_A1), m68k_get_reg(NULL, M68K_REG_A2), m68k_get_reg(NULL, M68K_REG_A3), \
- m68k_get_reg(NULL, M68K_REG_A4), m68k_get_reg(NULL, M68K_REG_A5), m68k_get_reg(NULL, M68K_REG_A6), m68k_get_reg(NULL, M68K_REG_A7));
- printf("REGD: 0:$%.8X 1:$%.8X 2:$%.8X 3:$%.8X 4:$%.8X 5:$%.8X 6:$%.8X 7:$%.8X\n", m68k_get_reg(NULL, M68K_REG_D0), m68k_get_reg(NULL, M68K_REG_D1), m68k_get_reg(NULL, M68K_REG_D2), m68k_get_reg(NULL, M68K_REG_D3), \
- m68k_get_reg(NULL, M68K_REG_D4), m68k_get_reg(NULL, M68K_REG_D5), m68k_get_reg(NULL, M68K_REG_D6), m68k_get_reg(NULL, M68K_REG_D7));
- printf("%.8X (%.8X)]] %s\n", m68k_get_reg(NULL, M68K_REG_PC), (m68k_get_reg(NULL, M68K_REG_PC) & 0xFFFFFF), disasm_buf);
- if (do_disasm)
- do_disasm--;
- m68k_execute(1);
- }
- else {
- if (cpu_emulation_running)
- m68k_execute(loop_cycles);
- }
-
- if (irq) {
- while (irq) {
- last_irq = ((read_reg() & 0xe000) >> 13);
- if (last_irq != last_last_irq) {
- last_last_irq = last_irq;
- M68K_SET_IRQ(last_irq);
- }
- m68k_execute(5);
- }
- if (gayleirq && int2_enabled) {
- write16(0xdff09c, 0x8000 | (1 << 3) && last_irq != 2);
- last_last_irq = last_irq;
- last_irq = 2;
- M68K_SET_IRQ(2);
- }
- M68K_SET_IRQ(0);
- last_last_irq = 0;
- }
- /*else {
- if (last_irq != 0) {
- M68K_SET_IRQ(0);
- last_last_irq = last_irq;
- last_irq = 0;
- }
- }*/
+ printf("[ERROR] Cannot create IPL thread: [%s]", strerror(err));
+ else {
+ pthread_setname_np(ipl_tid, "pistorm: ipl");
+ printf("IPL thread created successfully\n");
+ }
- while (get_key_char(&c, &c_code, &c_type)) {
- if (c && c == cfg->keyboard_toggle_key && !kb_hook_enabled) {
- kb_hook_enabled = 1;
- printf("Keyboard hook enabled.\n");
- }
- else if (kb_hook_enabled) {
- if (c == 0x1B && c_type) {
- kb_hook_enabled = 0;
- printf("Keyboard hook disabled.\n");
- }
- else {
- /*printf("Key code: %.2X - ", c_code);
- switch (c_type) {
- case 0:
- printf("released.\n");
- break;
- case 1:
- printf("pressed.\n");
- break;
- case 2:
- printf("repeat.\n");
- break;
- default:
- printf("unknown.\n");
- break;
- }*/
- if (queue_keypress(c_code, c_type, cfg->platform->id) && int2_enabled && last_irq != 2) {
- //last_irq = 0;
- //M68K_SET_IRQ(2);
- }
- }
- }
+ // create keyboard task
+ err = pthread_create(&kbd_tid, NULL, &keyboard_task, NULL);
+ if (err != 0)
+ printf("[ERROR] Cannot create keyboard thread: [%s]", strerror(err));
+ else {
+ pthread_setname_np(kbd_tid, "pistorm: kbd");
+ printf("[MAIN] Keyboard thread created successfully\n");
+ }
- if (!kb_hook_enabled && c_type) {
- if (c && c == cfg->mouse_toggle_key) {
- mouse_hook_enabled ^= 1;
- printf("Mouse hook %s.\n", mouse_hook_enabled ? "enabled" : "disabled");
- mouse_dx = mouse_dy = mouse_buttons = 0;
- }
- if (c == 'r') {
- cpu_emulation_running ^= 1;
- printf("CPU emulation is now %s\n", cpu_emulation_running ? "running" : "stopped");
- }
- if (c == 'g') {
- realtime_graphics_debug ^= 1;
- printf("Real time graphics debug is now %s\n", realtime_graphics_debug ? "on" : "off");
- }
- if (c == 'R') {
- cpu_pulse_reset();
- //m68k_pulse_reset();
- printf("CPU emulation reset.\n");
- }
- if (c == 'q') {
- printf("Quitting and exiting emulator.\n");
- goto stop_cpu_emulation;
- }
- if (c == 'd') {
- realtime_disassembly ^= 1;
- do_disasm = 1;
- printf("Real time disassembly is now %s\n", realtime_disassembly ? "on" : "off");
- }
- if (c == 'D') {
- int r = get_mapped_item_by_address(cfg, 0x08000000);
- if (r != -1) {
- printf("Dumping first 16MB of mapped range %d.\n", r);
- FILE *dmp = fopen("./memdmp.bin", "wb+");
- fwrite(cfg->map_data[r], 16 * SIZE_MEGA, 1, dmp);
- fclose(dmp);
- }
- }
- if (c == 's' && realtime_disassembly) {
- do_disasm = 1;
- }
- if (c == 'S' && realtime_disassembly) {
- do_disasm = 128;
- }
- }
- }
+ // create cpu task
+ err = pthread_create(&cpu_tid, NULL, &cpu_task, NULL);
+ if (err != 0)
+ printf("[ERROR] Cannot create CPU thread: [%s]", strerror(err));
+ else {
+ pthread_setname_np(cpu_tid, "pistorm: cpu");
+ printf("[MAIN] CPU thread created successfully\n");
}
- stop_cpu_emulation:;
+ // wait for cpu task to end before closing up and finishing
+ pthread_join(cpu_tid, NULL);
+ printf("[MAIN] All threads appear to have concluded; ending process\n");
if (mouse_fd != -1)
close(mouse_fd);
if (cfg->platform->handle_reset)
cfg->platform->handle_reset(cfg);
-
m68k_write_memory_16(INTENA, 0x7FFF);
ovl = 1;
m68k_write_memory_8(0xbfe201, 0x0001); // AMIGA OVL
//mouse_buttons -= 1;
return (unsigned int)(result ^ 0x40);
}
- else
- return (unsigned int)result;
+
+ return (unsigned int)result;
}
}
+
if (kb_hook_enabled) {
if (address == CIAAICR) {
if (get_num_kb_queued() && (!send_keypress || send_keypress == 1)) {
}*/
if (address == POTGOR) {
unsigned short result = (unsigned int)read16((uint32_t)address);
- if (mouse_buttons & 0x02) {
- return (unsigned int)(result ^ (0x2 << 9));
+ // bit 1 rmb, bit 2 mmb
+ if (mouse_buttons & 0x06) {
+ return (unsigned int)((result ^ ((mouse_buttons & 0x02) << 9)) // move rmb to bit 10
+ & (result ^ ((mouse_buttons & 0x04) << 6))); // move mmb to bit 8
}
- else
- return (unsigned int)(result & 0xFFFD);
+ return (unsigned int)(result & 0xfffd);
}
}
}*/
if (address == 0xDFF030) {
- char *beb = (char *)&value;
- printf("%c%c", beb[1], beb[0]);
+ char *serdat = (char *)&value;
+ // SERDAT word. see amiga dev docs appendix a; upper byte is control codes, and bit 0 is always 1.
+ // ignore this upper byte as it's not viewable data, only display lower byte.
+ printf("%c", serdat[0]);
}
if (address == 0xDFF09A) {
if (!(value & 0x8000)) {
-//
-// BCM283x SMI interface
-// Derived from Documentation
-// GVL 15-Oct-2014
-//
-#ifndef MAIN__HEADER
-#define MAIN__HEADER
+/**
+ * pistorm
+ * emulator function declarations
+ */
+#ifndef _EMULATOR_H
+#define _EMULATOR_H
+
+// see feature_set_macros(7)
+#define _GNU_SOURCE
#include <stdint.h>
-void setup_io();
-void restore_io();
-int set_pio_timing(int p);
/*
void write16(uint32_t address,uint16_t data);
uint16_t read16(uint32_t address);
uint16_t read8(uint32_t address);
*/
-
void cpu_pulse_reset(void);
void m68ki_int_ack(uint8_t int_level);
int cpu_irq_ack(int level);
void m68k_write_memory_16(unsigned int address, unsigned int value);
void m68k_write_memory_32(unsigned int address, unsigned int value);
-
-
-#endif /* MAIN__HEADER */
-
+#endif /* _EMULATOR_H */
#include <fcntl.h>
#include <sys/mman.h>
#include <sys/ioctl.h>
-#include "../m68k.h"
-#include "../platforms/amiga/Gayle.h"
-#include "../platforms/amiga/gayle-ide/ide.h"
+#include "m68k.h"
+#include "platforms/amiga/Gayle.h"
+#include "platforms/amiga/gayle-ide/ide.h"
#include "gpio_old.h"
// I/O access
/*
Original Copyright 2020 Claude Schwarz
- Code reorganized and rewritten by
+ Code reorganized and rewritten by
Niklas Ekström 2021 (https://github.com/niklasekstrom)
*/
#include <sys/stat.h>
#include <sys/types.h>
#include <unistd.h>
+
#include "ps_protocol.h"
+#include "m68k.h"
volatile unsigned int *gpio;
volatile unsigned int *gpclk;
-#include <termios.h>
-#include <unistd.h>
+#include <linux/input.h>
+#include <pthread.h>
#include <stdint.h>
#include <stdio.h>
#include <string.h>
-#include <linux/input.h>
-#include "../platforms/platforms.h"
+#include <termios.h>
+#include <unistd.h>
+
+#include "platforms/platforms.h"
#include "input.h"
#define NONE 0x80
extern int mouse_fd;
extern int keyboard_fd;
-char keymap_amiga[256] = { \
-/* 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F */ \
-/*00*/ 0x80, 0x45, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x41, 0x42, \
-/*10*/ 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1A, 0x1B, 0x44, 0x63, 0x20, 0x21, \
-/*20*/ 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2A, 0x00, 0x60, 0x2B, 0x31, 0x32, 0x33, 0x34, \
-/*30*/ 0x35, 0x36, 0x37, 0x38, 0x39, 0x3A, 0x61, 0x5D, 0x64, 0x40, NONE, 0x50, 0x51, 0x52, 0x53, 0x54, \
-/*40*/ 0x55, 0x56, 0x57, 0x58, 0x69, 0x5B, NONE, 0x3D, 0x3E, 0x3F, 0x4A, 0x2D, 0x2E, 0x2F, 0x4E, 0x1D, \
-/*50*/ 0x1E, 0x1F, 0x0F, 0x3C, NONE, NONE, 0x30, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, \
-/*60*/ 0x43, NONE, 0x5C, NONE, NONE, NONE, 0x5F, 0x4C, 0x5A, 0x4F, 0x4E, NONE, 0x4D, NONE, 0x0D, 0x46, \
-/*70*/ NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, 0x66, 0x67, NONE, \
-/*80*/ NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, \
-/*90*/ NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, \
-/*A0*/ NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, \
-/*B0*/ NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, \
-/*C0*/ NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, \
-/*D0*/ NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, \
-/*E0*/ NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, \
-/*F0*/ NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE }; \
+// n.b. $fe and $ff are mapped to newmouse standard wheel up/down keycodes, nonexistant on amiga keyboards
+char keymap_amiga[256] = {
+/* 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F */
+/*00*/ 0x80, 0x45, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x41, 0x42,
+/*10*/ 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1A, 0x1B, 0x44, 0x63, 0x20, 0x21,
+/*20*/ 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2A, 0x00, 0x60, 0x2B, 0x31, 0x32, 0x33, 0x34,
+/*30*/ 0x35, 0x36, 0x37, 0x38, 0x39, 0x3A, 0x61, 0x5D, 0x64, 0x40, NONE, 0x50, 0x51, 0x52, 0x53, 0x54,
+/*40*/ 0x55, 0x56, 0x57, 0x58, 0x69, 0x5B, NONE, 0x3D, 0x3E, 0x3F, 0x4A, 0x2D, 0x2E, 0x2F, 0x4E, 0x1D,
+/*50*/ 0x1E, 0x1F, 0x0F, 0x3C, NONE, NONE, 0x30, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE,
+/*60*/ 0x43, NONE, 0x5C, NONE, NONE, NONE, 0x5F, 0x4C, 0x5A, 0x4F, 0x4E, NONE, 0x4D, NONE, 0x0D, 0x46,
+/*70*/ NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, 0x66, 0x67, 0x67,
+/*80*/ NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE,
+/*90*/ NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE,
+/*A0*/ NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE,
+/*B0*/ NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE,
+/*C0*/ NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE,
+/*D0*/ NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE,
+/*E0*/ NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE,
+/*F0*/ NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, 0x7A, 0x7B,
+};
int handle_modifier(struct input_event *ev) {
int *target_modifier = NULL;
#define KEYCASE(a, b, c)case a: return (lshift || rshift) ? c : b;
+/**
+ * translates keycodes back into a simpler enumerable value for handling emulator command events
+ *
+ * @param *struct/input_event ev pointer to input layer event structure
+ * @return char
+ */
char char_from_input_event(struct input_event *ev) {
switch(ev->code) {
KEYCASE(KEY_A, 'a', 'A');
KEYCASE(KEY_9, '9', '(');
KEYCASE(KEY_0, '0', ')');
KEYCASE(KEY_F12, 0x1B, 0x1B);
+ KEYCASE(KEY_PAUSE, 0x01, 0x01);
default:
return 0;
}
return 0;
}
-uint16_t mouse_x = 0, mouse_y = 0, mouse_b = 0;
+uint8_t mouse_x = 0, mouse_y = 0;
-int get_mouse_status(char *x, char *y, char *b) {
- struct input_event ie;
- if (read(mouse_fd, &ie, sizeof(struct input_event)) != -1) {
- *b = ((char *)&ie)[0];
- mouse_x += ((char *)&ie)[1];
+int get_mouse_status(uint8_t *x, uint8_t *y, uint8_t *b, uint8_t *e) {
+ uint8_t mouse_ev[4];
+ if (read(mouse_fd, &mouse_ev, 4) != -1) {
+ *b = ((uint8_t *)&mouse_ev)[0];
+ *e = ((uint8_t *)&mouse_ev)[3];
+
+ mouse_x += ((uint8_t *)&mouse_ev)[1];
*x = mouse_x;
- mouse_y += (-((char *)&ie)[2]);
- *y = mouse_y; //-((char *)&ie)[2];
+ mouse_y += (-((uint8_t *)&mouse_ev)[2]);
+ *y = mouse_y;
return 1;
}
if (keymap != NULL) {
if (keymap[keycode] != NONE) {
if (queued_keypresses < 255) {
- //printf("Keypress queued, matched %.2X to host key code %.2X\n", keycode, keymap[keycode]);
+ // printf("Keypress queued, matched %.2X to host key code %.2X\n", keycode, keymap[keycode]);
queued_keys[queue_output_pos] = keymap[keycode];
queued_events[queue_output_pos] = event_type;
queue_output_pos++;
+#include <stdint.h>
+
enum keypress_type {
KEYPRESS_RELEASE,
KEYPRESS_PRESS,
KEYPRESS_REPEAT,
};
-int get_mouse_status(char *x, char *y, char *b);
+int get_mouse_status(uint8_t *x, uint8_t *y, uint8_t *b, uint8_t *e);
int get_key_char(char *c, char *code, char *event_type);
int queue_keypress(uint8_t keycode, uint8_t event_type, uint8_t platform);
int get_num_kb_queued();
#define M68K_USE_64_BIT OPT_ON
-#include "main.h"
+#include "emulator.h"
//#define m68k_read_memory_8(A) read16(A)
#include <time.h>
#include <endian.h>
-#include "../shared/rtc.h"
-#include "../../config_file/config_file.h"
+#include "platforms/shared/rtc.h"
+#include "config_file/config_file.h"
#include "gayle-ide/ide.h"
#include "amiga-registers.h"
}
if (ide0)
ide_reset_begin(ide0);
-
+
if (num_ide_drives == 0) {
// No IDE drives mounted, disable IDE component of Gayle
printf("No IDE drives mounted, disabling Gayle IDE component.\n");
-#include "../platforms.h"
+#include "platforms/platforms.h"
#include "amiga-autoconf.h"
#include <stdio.h>
#include <stdlib.h>
break;
}
-
+
if ((address & 1) == 0 && (address / 2) < (int)sizeof(ac_fast_ram_rom)) {
if (ac_z2_type[ac_z2_current_pic] == ACTYPE_MAPFAST_Z2 && address / 2 == 1) {
val = get_autoconf_size(cfg->map_size[ac_z2_index[ac_z2_current_pic]]);
val <<= 4;
if (address != 0 && address != 2 && address != 0x40 && address != 0x42)
val ^= 0xff;
-
+
return (unsigned int)val;
}
+#include "config_file/config_file.h"
+
#define AC_Z2_BASE 0xE80000
#define AC_Z3_BASE 0xFF000000
#define AC_SIZE (64 * 1024)
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
-#include "../platforms.h"
#include "amiga-autoconf.h"
#include "amiga-registers.h"
-#include "../shared/rtc.h"
#include "hunk-reloc.h"
-#include "piscsi/piscsi.h"
-#include "piscsi/piscsi-enums.h"
-#include "net/pi-net.h"
#include "net/pi-net-enums.h"
+#include "net/pi-net.h"
+#include "piscsi/piscsi-enums.h"
+#include "piscsi/piscsi.h"
+#include "platforms/platforms.h"
+#include "platforms/shared/rtc.h"
#include "rtg/rtg.h"
int handle_register_read_amiga(unsigned int addr, unsigned char type, unsigned int *val);
index = get_named_mapped_item(cfg, z2_autoconf_id);
if (index != -1)
goto more_z2_fast;
-
+
for (int i = 0; i < MAX_NUM_MAPPED_ITEMS; i ++) {
// Restore any "zapped" autoconf items so they can be reinitialized if needed.
if (cfg->map_id[i] && strcmp(cfg->map_id[i], z2_autoconf_zap_id) == 0) {
fclose(in);
}
}
-
+
return 0;
}
#include "Gayle.h"
-#include "../../config_file/config_file.h"
+#include "config_file/config_file.h"
#include "amiga-registers.h"
uint8_t rtc_emulation_enabled = 1;
#define CIAAPRA 0xBFE001
#define CIAADAT 0xBFEC01
#define CIAAICR 0xBFED01
+#define CIAACRA 0xBFEE01
+#define CIAACRB 0xBFEF01
#define POTGOR 0xDFF016
/* RAMSEY ADDRESSES */
#define RAMSEY_ID 0xDE0043 /* Either 0x0D or 0x0F (most recent version) */
/* RAMSEY TYPES */
#define RAMSEY_REV4 0x0D
-#define RAMSEY_REV7 0x0F
\ No newline at end of file
+#define RAMSEY_REV7 0x0F
#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
-#include "../../config_file/config_file.h"
+#include "config_file/config_file.h"
uint8_t dmac_reg_idx = 0;
uint8_t dmac_reg_values[0xFFFF];
#include <errno.h>
#include <time.h>
#include <arpa/inet.h>
-#include "../../../config_file/config_file.h"
+#include "config_file/config_file.h"
#include "ide.h"
#define IDE_IDLE 0
#define IDE_CMD 1
#define IDE_DATA_IN 2
#define IDE_DATA_OUT 3
-
+
#define DCR_NIEN 2
#define DCR_SRST 4
uint16_t cyl;
if (d->controller->lba4 & DEVH_LBA) {
-/* fprintf(stderr, "XLATE LBA %02X:%02X:%02X:%02X\n",
+/* fprintf(stderr, "XLATE LBA %02X:%02X:%02X:%02X\n",
t->lba4, t->lba3, t->lba2, t->lba1);*/
if (d->lba)
return ((d->header_present) ? 2 : 0) + (((t->drive->controller->lba4 & DEVH_HEAD) << 24) | (t->drive->controller->lba3 << 16) | (t->drive->controller->lba2 << 8) | t->drive->controller->lba1);
c->drive[0].taskfile.status |= ST_BSY;
if (c->drive[1].present)
c->drive[1].taskfile.status |= ST_BSY;
-}
+}
static void ide_srst_end(struct ide_controller *c)
{
if (d->dptr == d->data + 512) {
if (ide_write_sector(d) < 0) {
ide_set_error(d);
- return;
+ return;
}
d->length--;
d->intrq = 1;
t->status |= ST_BSY;
t->error = 0;
t->drive->state = IDE_CMD;
-
+
/* We could complete with delays but don't do so yet */
switch(t->command) {
case IDE_CMD_EDD: /* 0x90 */
c->lba4 = v & (DEVH_HEAD|/*DEVH_DEV|*/DEVH_LBA);
break;
case ide_command_w:
- t->command = v;
+ t->command = v;
ide_issue_command(t);
break;
case ide_devctrl_w:
/*
* Free up and release and IDE controller
- */
+ */
void ide_free(struct ide_controller *c)
{
if (c->drive[0].present)
}
if (reg == ide_data)
d |= (c->data_latch << 8);
- ide_write16(c, reg, d);
+ ide_write16(c, reg, d);
}
static void make_ascii(uint16_t *p, const char *t, int len)
*d = d[1];
d[1] = c;
d += 2;
- }
+ }
}
static void make_serial(uint16_t *p)
if (type < 1 || type > MAX_DRIVE_TYPE)
return -2;
-
+
memset(ident, 0, 512);
memcpy(ident, ide_magic, 8);
if (write(fd, ident, 512) != 512)
ident[47] = 0; /* no read multi for now */
ident[51] = le16(240 /* PIO2 */ << 8); /* PIO cycle time */
ident[53] = le16(1); /* Geometry words are valid */
-
+
switch(type) {
case ACME_ROADRUNNER:
/* 504MB drive with LBA support */
make_ascii(ident + 23, "A001.001", 8);
make_ascii(ident + 27, "ACME ROADRUNNER v0.1", 40);
ident[49] = le16(1 << 9); /* LBA */
- break;
+ break;
case ACME_ULTRASONICUS:
/* 40MB drive with LBA support */
c = 977;
s = 16;
make_ascii(ident + 23, "A001.001", 8);
make_ascii(ident + 27, "ACME COYOTE v0.1", 40);
- break;
+ break;
case ACME_ACCELLERATTI:
c = 1024;
h = 16;
ident[61] = ident[58];
if (write(fd, ident, 512) != 512)
return -1;
-
+
memset(ident, 0xE5, 512);
while(sectors--)
if (write(fd, ident, 512) != 512)
- return -1;
+ return -1;
return 0;
}
+#ifndef _HUNK_RELOC_H
+#define _HUNK_RELOC_H
+
struct hunk_reloc {
uint32_t src_hunk;
uint32_t target_hunk;
void reloc_hunk(struct hunk_reloc *h, uint8_t *buf, struct hunk_info *i);
void process_hunks(FILE *in, struct hunk_info *h_info, struct hunk_reloc *r, uint32_t offset);
void reloc_hunks(struct hunk_reloc *r, uint8_t *buf, struct hunk_info *h_info);
+
+#endif /* _HUNK_RELOC_H */
NewList(&dev_base->read_list);
InitSemaphore(&dev_base->read_list_sem);
-
+
ret = 0;
ok = 1;
//}
uint32_t sz = ((uint32_t)frm[0] << 8) | ((uint32_t)frm[1]);
uint32_t ser = ((uint32_t)frm[2] << 8) | ((uint32_t)frm[3]);
uint16_t tp = ((uint16_t)frm[16] << 8) | ((uint16_t)frm[17]);
-
+
if (req->ios2_Req.io_Flags & SANA2IOF_RAW) {
frame_ptr = frm + 4;
datasize = sz;
req->ios2_Req.io_Error = req->ios2_WireError = 0;
err = 0;
}
-
+
memcpy(req->ios2_SrcAddr, frame+4+6, HW_ADDRFIELDSIZE);
memcpy(req->ios2_DstAddr, frame+4, HW_ADDRFIELDSIZE);
-
+
//D(("RXSZ %ld\n",(LONG)sz));
//D(("RXPT %ld\n",(LONG)tp));
if (broadcast) {
req->ios2_Req.io_Flags |= SANA2IOF_BCAST;
}
-
+
req->ios2_PacketType = tp;*/
return err;
}
void pinet_write_frame(struct IOSana2Req *ioreq) {
-
+
}
void exit(int status) { }
ADDTABL_1(__TermIO,a1);
void __TermIO(struct IORequest *ioreq) {
struct IOSana2Req* ios2 = (struct IOSana2Req*)ioreq;
-
+
if (!(ios2->ios2_Req.io_Flags & SANA2IOF_QUICK)) {
ReplyMsg((struct Message *)ioreq);
} else {
ULONG sz = ((ULONG)frm[0]<<8)|((ULONG)frm[1]);
ULONG ser = ((ULONG)frm[2]<<8)|((ULONG)frm[3]);
USHORT tp = ((USHORT)frm[16]<<8)|((USHORT)frm[17]);
-
+
if (req->ios2_Req.io_Flags & SANA2IOF_RAW) {
frame_ptr = frm+4;
datasize = sz;
req->ios2_Req.io_Error = req->ios2_WireError = 0;
err = 0;
}
-
+
memcpy(req->ios2_SrcAddr, frame+4+6, HW_ADDRFIELDSIZE);
memcpy(req->ios2_DstAddr, frame+4, HW_ADDRFIELDSIZE);
-
+
//D(("RXSZ %ld\n",(LONG)sz));
//D(("RXPT %ld\n",(LONG)tp));
if (broadcast) {
req->ios2_Req.io_Flags |= SANA2IOF_BCAST;
}
-
+
req->ios2_PacketType = tp;
return err;
ULONG rc=0;
struct BufferManagement *bm;
USHORT sz=0;
-
+
if (req->ios2_Req.io_Flags & SANA2IOF_RAW) {
sz = req->ios2_DataLength;
} else {
#include <endian.h>
#include "pi-net.h"
#include "pi-net-enums.h"
-#include "../../../config_file/config_file.h"
-#include "../../../gpio/ps_protocol.h"
+#include "config_file/config_file.h"
+#include "gpio/ps_protocol.h"
uint32_t pinet_u32[4];
static const char *op_type_names[4] = {
#include <fcntl.h>
#include <unistd.h>
#include <endian.h>
-#include "../hunk-reloc.h"
-#include "piscsi.h"
+
+#include "config_file/config_file.h"
+#include "gpio/ps_protocol.h"
#include "piscsi-enums.h"
-#include "../../../config_file/config_file.h"
-#include "../../../gpio/ps_protocol.h"
+#include "piscsi.h"
+#include "platforms/amiga/hunk-reloc.h"
#define BE(val) be32toh(val)
#define BE16(val) be16toh(val)
void piscsi_find_filesystems(struct piscsi_dev *d) {
if (!d->num_partitions)
return;
-
+
uint8_t fs_found = 0;
-
+
uint8_t *fhb_block = malloc(512);
lseek64(d->fd, d->fshd_offs, SEEK_SET);
struct FileSysHeaderBlock *fhb = (struct FileSysHeaderBlock *)fhb_block;
read(d->fd, fhb_block, 512);
-
+
while (BE(fhb->fhb_ID) == FS_IDENTIFIER) {
char *dosID = (char *)&fhb->fhb_DosType;
#ifdef PISCSI_DEBUG
DEBUG("[FSHD] File system %c%c%c/%d already loaded. Skipping.\n", dosID[0], dosID[1], dosID[2], dosID[3]);
if (BE(fhb->fhb_Next) == 0xFFFFFFFF)
goto fs_done;
-
+
goto skip_fs_load_lseg;
}
}
memcpy(dst_data + addr, piscsi_rom_ptr + PISCSI_DRIVER_OFFSET, 0x4000 - PISCSI_DRIVER_OFFSET);
piscsi_hinfo.base_offset = val;
-
+
reloc_hunks(piscsi_hreloc, dst_data + addr, &piscsi_hinfo);
#define PUTNODELONG(val) *(uint32_t *)&dst_data[p_offs] = htobe32(val); p_offs += 4;
skip_disk:;
}
}
-
+
break;
}
case PISCSI_CMD_NEXTPART:
}
return 0;
}
-
+
switch (addr & 0xFFFF) {
case PISCSI_CMD_ADDR1: case PISCSI_CMD_ADDR2: case PISCSI_CMD_ADDR3: case PISCSI_CMD_ADDR4: {
int i = ((addr & 0xFFFF) - PISCSI_CMD_ADDR1) / 4;
+#include <stdint.h>
+
+#include "platforms/amiga/hunk-reloc.h"
+
#define TDF_EXTCOM (1<<15)
#define CMD_INVALID 0
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
-#include "../../../config_file/config_file.h"
+#include "config_file/config_file.h"
#ifndef FAKESTORM
-#include "../../../gpio/ps_protocol.h"
+#include "gpio/ps_protocol.h"
#endif
#include "rtg.h"
else {
SET_RTG_PIXELS2_COND_MASK(&dptr[xs << format], fg_color[format], bg_color[format], format);
}
-
+
xs += 7;
}
else {
else {
SET_RTG_PIXELS2_COND_MASK(&dptr[xs << format], fg_color[format], bg_color[format], format);
}
-
+
xs += 7;
}
else {
+#include "emulator.h"
+#include "rtg.h"
+
+#include <pthread.h>
#include <SDL2/SDL.h>
-#include <stdio.h>
#include <stdint.h>
+#include <stdio.h>
#include <stdlib.h>
-#include <unistd.h>
-#include <pthread.h>
#include <string.h>
-#include "rtg.h"
+#include <unistd.h>
#define RTG_INIT_ERR(a) { printf(a); *data->running = 0; }
if (reinit)
goto reinit_sdl;
-
+
if (indexed_buf)
free(indexed_buf);
}
else {
rtg_initialized = 1;
+ pthread_setname_np(thread_id, "pistorm: rtg");
printf("RTG Thread created successfully\n");
}
}
#include <string.h>
#include <time.h>
#include "rtg.h"
-#include "../../../config_file/config_file.h"
+#include "config_file/config_file.h"
uint8_t rtg_u8[4];
uint16_t rtg_x[8], rtg_y[8];
-#include "../platforms.h"
#include <stdlib.h>
#include <string.h>
+#include "platforms/platforms.h"
+
int handle_register_read_dummy(unsigned int addr, unsigned char type, unsigned int *val);
int handle_register_write_dummy(unsigned int addr, unsigned int value, unsigned char type);
-#include "../config_file/config_file.h"
+#include "config_file/config_file.h"
enum base_platforms {
PLATFORM_NONE,
=============================================================================*/
-#include "../m68kcpu.h" // which includes softfloat.h after defining the basic types
+#include "m68kcpu.h" // which includes softfloat.h after defining the basic types
/*----------------------------------------------------------------------------
| Floating-point rounding mode, extended double-precision rounding precision,