FWIW here is what the diff's are in my current binary build...
Code: Select all
diff -ruN sdl/build.cmd sdl-w32/build.cmd
--- sdl/build.cmd 1970-01-01 08:00:00 +0800
+++ sdl-w32/build.cmd 2014-06-12 16:55:57 +0800
@@ -0,0 +1,9 @@
+@ECHO OFF
+REM copy "Apple AUX 2.0\AUX_2.0.iso" disk.iso
+copy root.bak root.dmg
+del shoebill.exe
+del *.o
+gcc -O2 sdl.c ..\intermediates\*.o -lmingw32 -lsdl2main -lsdl2 -lopengl32 -lws2_32 -o shoebill.exe
+rem shoebill.exe verbose=1 ram=16 disk0=root.dmg
+rem gdb shoebill.exe
+rem StartAffinity.exe shoebill.exe 0
diff -ruN sdl/sdl.c sdl-w32/sdl.c
--- sdl/sdl.c 2014-06-10 04:21:12 +0800
+++ sdl-w32/sdl.c 2014-06-12 12:07:10 +0800
@@ -31,6 +31,7 @@
#include <SDL2/SDL_opengl.h>
#include "../core/shoebill.h"
+
rb_tree *keymap;
static void _init_keyboard_map (void)
{
@@ -210,10 +211,11 @@
user_params.rom_path = "macii.rom";
user_params.relative_unix_path = "/unix";
- user_params.height = 640;
- user_params.width = 800;
- user_params.ram_megabytes = 16;
+ user_params.height = 480;
+ user_params.width = 640;
+ user_params.ram_megabytes = 8;
user_params.verbose = 1;
+ user_params.scsi_path[0]="root.dmg";
for (i=1; i<argc; i++) {
@@ -269,7 +271,7 @@
uint32_t i;
shoebill_config_t config;
- bzero(&config, sizeof(shoebill_config_t));
+ memset(&config,0x0, sizeof(shoebill_config_t));
config.aux_verbose = user_params.verbose;
config.ram_size = user_params.ram_megabytes * 1024 * 1024;
@@ -372,7 +374,7 @@
switch (event.type) {
case SDL_QUIT:
- exit(0);
+ exit(1);
case SDL_MOUSEBUTTONDOWN: {
if ((event.button.button == SDL_BUTTON_LEFT) && capture_cursor)
Code: Select all
diff -ruN core/core_api.c core-w32/core_api.c
--- core/core_api.c 2014-06-10 04:21:12 +0800
+++ core-w32/core_api.c 2014-06-12 13:18:44 +0800
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright (c) 2013, Peter Rutenbar <pruten@gmail.com>
* All rights reserved.
*
@@ -33,6 +33,12 @@
#include <signal.h>
#include <stdarg.h>
#include "../core/shoebill.h"
+#ifdef WIN32
+ #define SIGUSR2 26
+#define fseeko fseek
+
+#include <windows.h>
+#endif
void shoebill_start()
@@ -54,7 +60,7 @@
pthread_mutex_unlock(&shoe.via_clock_thread_lock);
pthread_join(shoe.via_thread_pid, NULL);
pthread_mutex_destroy(&shoe.via_clock_thread_lock);
-
+
pthread_kill(shoe.cpu_thread_pid, SIGUSR2); // wake up the CPU thread if it was STOPPED
pthread_mutex_lock(&shoe.cpu_thread_lock);
pthread_mutex_unlock(&shoe.cpu_thread_lock);
@@ -87,7 +93,6 @@
void *_cpu_thread (void *arg)
{
signal(SIGUSR2, _sigusr2);
-
pthread_mutex_lock(&shoe.cpu_thread_lock);
while (1) {
@@ -105,7 +110,11 @@
}
if (shoe.cpu_thread_notifications & SHOEBILL_STATE_STOPPED) {
+#ifdef UNIX
sleep(1);
+#else
+ //Sleep(1);
+#endif
continue;
}
}
@@ -364,7 +373,7 @@
{
uint32_t i, rom_size;
uint8_t *rom_data = (uint8_t*)p_alloc(shoe.pool, 64 * 1024);
- FILE *f = fopen(config->rom_path, "r");
+ FILE *f = fopen(config->rom_path, "rb");
if (f == NULL) {
sprintf(config->error_msg, "Couldn't open rom path [%s]\n", config->rom_path);
@@ -429,7 +438,7 @@
if (!path) continue;
- FILE *f = fopen(path, "r+");
+ FILE *f = fopen(path, "rb+");
if (f == NULL) {
sprintf(config->error_msg, "Couldn't open scsi id #%u disk [%s]\n", i, path);
@@ -861,7 +870,7 @@
assert(coff && "can't parse the kernel");
// Re-open the root disk image
- shoe.scsi_devices[0].f = fopen(shoe.scsi_devices[0].image_path, "r+");
+ shoe.scsi_devices[0].f = fopen(shoe.scsi_devices[0].image_path, "rb+");
assert(shoe.scsi_devices[0].f && "couldn't reopen the disk image at scsi id #0"); // FIXME: and this
shoe.coff = coff;
diff -ruN core/filesystem.c core-w32/filesystem.c
--- core/filesystem.c 2014-06-10 04:21:12 +0800
+++ core-w32/filesystem.c 2014-06-11 00:23:34 +0800
@@ -29,6 +29,10 @@
#include <assert.h>
#include <string.h>
#include "../core/shoebill.h"
+#ifdef WIN32
+#include <winsock2.h>
+#define fseeko fseek
+#endif
#define fix_endian(x) do { \
if (ntohs(1) == 1) \
@@ -207,7 +211,7 @@
disk->error_str = error_str;
disk->path = disk_path;
- f = fopen(disk_path, "r");
+ f = fopen(disk_path, "rb");
if (f == NULL) {
sprintf(error_str, "Can't open that path");
goto fail;
@@ -1306,7 +1310,7 @@
if (!buf)
return 0;
- FILE *f = fopen("result", "w");
+ FILE *f = fopen("result", "wb");
fwrite(buf, size, 1, f);
fclose(f);
diff -ruN core/macro.pl core-w32/macro.pl
--- core/macro.pl 2014-06-10 04:21:12 +0800
+++ core-w32/macro.pl 2014-06-11 00:13:08 +0800
@@ -58,7 +58,7 @@
parse($ctx);
open(OUTPUT, '>'.$ARGV[1]);
- print OUTPUT "/* Generated from $ARGV[0] */\n\n";
+# print OUTPUT "/* Generated from $ARGV[0] */\n\n";
print OUTPUT $ctx->{out};
close(OUTPUT);
}
diff -ruN core/mc68851.c core-w32/mc68851.c
--- core/mc68851.c 2014-06-10 04:21:12 +0800
+++ core-w32/mc68851.c 2014-06-12 12:05:44 +0800
@@ -81,15 +81,15 @@
verify_supervisor();
slog("pflushr!");
// Just nuke the entire cache
- bzero(shoe.pmmu_cache[0].valid_map, PMMU_CACHE_SIZE/8);
- bzero(shoe.pmmu_cache[1].valid_map, PMMU_CACHE_SIZE/8);
+ memset(shoe.pmmu_cache[0].valid_map,0x0, PMMU_CACHE_SIZE/8);
+ memset(shoe.pmmu_cache[1].valid_map,0x0, PMMU_CACHE_SIZE/8);
}
void inst_mc68851_pflush(uint16_t ext){
verify_supervisor();
slog("pflush!");
- bzero(shoe.pmmu_cache[0].valid_map, PMMU_CACHE_SIZE/8);
- bzero(shoe.pmmu_cache[1].valid_map, PMMU_CACHE_SIZE/8);
+ memset(shoe.pmmu_cache[0].valid_map,0x0, PMMU_CACHE_SIZE/8);
+ memset(shoe.pmmu_cache[1].valid_map,0x0, PMMU_CACHE_SIZE/8);
// slog("%s: Error, not implemented!\n", __func__);
}
diff -ruN core/mem.c core-w32/mem.c
--- core/mem.c 2014-06-10 04:21:12 +0800
+++ core-w32/mem.c 2014-06-11 00:16:18 +0800
@@ -24,11 +24,18 @@
*/
#include <stdio.h>
+#ifdef UNIX
#include <arpa/inet.h>
+#endif
#include <assert.h>
#include <stdlib.h>
#include "../core/shoebill.h"
+#ifdef WIN32
+#include <winsock2.h>
+#define ntohll(_x) ({uint64_t x = (_x); (((uint64_t)ntohl((uint32_t)x))<<32) | ntohl(x>>32);})
+#else
+
#ifdef __APPLE__
#include <machine/endian.h>
#include <libkern/OSByteOrder.h>
@@ -38,6 +45,8 @@
#define ntohll(_x) ({uint64_t x = (_x); (((uint64_t)ntohl((uint32_t)x))<<32) | ntohl(x>>32);})
#endif
+#endif//end win32
+
/* --- Physical_get jump table --- */
#pragma mark Physical_get jump table
diff -ruN core/scsi.c core-w32/scsi.c
--- core/scsi.c 2014-06-10 04:21:12 +0800
+++ core-w32/scsi.c 2014-06-11 00:20:50 +0800
@@ -28,6 +28,9 @@
#include <assert.h>
#include <ctype.h>
#include "shoebill.h"
+#ifdef WIN32
+#define fseeko fseek
+#endif
// Target command register bits
#define TARGET_COMM_LAST_BYTE_SENT (1<<7)
diff -ruN core/via.c core-w32/via.c
--- core/via.c 2014-06-10 04:21:12 +0800
+++ core-w32/via.c 2014-06-12 13:12:12 +0800
@@ -32,6 +32,9 @@
#include <string.h>
#include <signal.h>
#include "../core/shoebill.h"
+#ifdef WIN32
+ #define SIGUSR2 26
+#endif
char *via_reg_str[16] = {
"regb",
@@ -68,7 +71,7 @@
// Only if the bit is enabled in IER do we raise a cpu interrupt
if (via->ier & (1 << ifr_bit))
set_pending_interrupt(vianum);
-
+
// if the CPU was stopped, wake it up
if (shoe.cpu_thread_notifications & SHOEBILL_STATE_STOPPED) {
if (!shoe.config_copy.debug_mode)
diff -ruN core/video.c core-w32/video.c
--- core/video.c 2014-06-10 04:21:12 +0800
+++ core-w32/video.c 2014-06-12 12:06:04 +0800
@@ -30,6 +30,10 @@
#include "video_rom/rom.c"
+#ifdef WIN32
+#include <winsock.h>
+#endif
+
typedef struct __attribute__ ((__packed__)) {
uint32_t structure_size;
uint32_t offset_to_ram;
@@ -97,7 +101,7 @@
// Set the depth and clut for B&W
_switch_depth(ctx, 1);
- bzero(ctx->clut, 256 * 4);
+ memset(ctx->clut,0x0, 256 * 4);
ctx->clut[0].r = 0xff;
ctx->clut[0].g = 0xff;
ctx->clut[0].b = 0xff;