Login  •  Register


The time is now: Mon Sep 25, 2017 6:52 pm

Emaculation wiki  •  Delete all board cookies



Post new topic  Reply to topic Page 5 of 13 [ 318 posts ]    Go to page Previous  1, 2, 3, 4, 5, 6, 7, 8 ... 13  Next
Print view Previous topic  |  Next topic
Author Message
PostPosted: Wed Jun 11, 2014 1:46 am 
Offline
Tinkerer

Joined: Thu Feb 27, 2014 3:10 am
Posts: 66
neozeed wrote:
so I purged everything, and rebuilt. again and again.. and now it's working!!!!!! turns out that signals on windows just aren't needed.

Image

Binary is here, and source code is here.

Sorry for anyone who wants to download, you have to deal with the idiotic password system :(


Wow! Thanks a bunch, neozeed! If I had had to figure out all those little Windows/mingw build system differences, I would have been more than a little bit frustrated XD. Gotta scrounge up a Windows machine somewhere to try this binary out. When I do, I'll be sure to incorporate these hard-won lessons into the SDL client :)
1) replace bzero() with memset(,0,)
2) find better pthread library and/or change thread signaling mechanism
3) use -mno-ms-bitfields
4) change fopen() to use binary-mode, etc.
5) check whether ntohl/etc. are available, and provide little macros if not. GCC should be able to figure out how to optimize them

That pthread_kill(SIGUSR,...) call wakes up the CPU thread when it's sleeping (when the A/UX scheduler calls the 'stop' instruction) -- but hey, if it works, then whatever :) Worst case scenario, there'll be some random 1-second lags.

And also thanks for reverse engineering the CLI arguments for emendelson. XD I'll dump a help string to stderr / document it on the wiki once 0.0.4 is released. Guess I'll be able to release a windows build simultaneously! :)


Top
 Profile  
Reply with quote Post a reply  
PostPosted: Wed Jun 11, 2014 2:21 am 
Offline
Apple Corer

Joined: Sun Aug 25, 2013 3:25 am
Posts: 284
Location: Hong Kong
pruten wrote:
Wow! Thanks a bunch, neozeed! If I had had to figure out all those little Windows/mingw build system differences, I would have been more than a little bit frustrated XD. Gotta scrounge up a Windows machine somewhere to try this binary out. When I do, I'll be sure to incorporate these hard-won lessons into the SDL client :)
1) replace bzero() with memset(,0,)
2) find better pthread library and/or change thread signaling mechanism
3) use -mno-ms-bitfields
4) change fopen() to use binary-mode, etc.
5) check whether ntohl/etc. are available, and provide little macros if not. GCC should be able to figure out how to optimize them

That pthread_kill(SIGUSR,...) call wakes up the CPU thread when it's sleeping (when the A/UX scheduler calls the 'stop' instruction) -- but hey, if it works, then whatever :) Worst case scenario, there'll be some random 1-second lags.

And also thanks for reverse engineering the CLI arguments for emendelson. XD I'll dump a help string to stderr / document it on the wiki once 0.0.4 is released. Guess I'll be able to release a windows build simultaneously! :)



No problem! .. I think the pthread is mostly ok, it should be portable by design. The issue is that the threads don't go to sleep or wake up so it runs 100% CPU utilization I honestly doubt this is the first ever pthreads ported program, so I'm sure somewhere someone has a better 'fix', but #ifdef'ing them works too....

Oh ntohl are in winsock, I had to include the winsock header, and link against the winsock library (it provides TCP/IP for windows programs).

I've run shoebill.exe under wine, lol it works great!

I ended up hacking up the makefile a bit, and making a 'build' script for the final exe, but it's nothing terribly complicated. One strange thing is your fixup perl script, when it tries to insert comments in the fixed up core file, it puts something binary in there, and corrupts the C file... so I commented out that section of the script and it works fine.

I'll cook up a diff of the source changes, they were rather minimal, as always it's knowing where to make the changes ;)

Now we just need PRAM to get saved/restored in a way that the mouse double clicks live between reboots.... and Ethernet so we can network this bad boy!

_________________
don't do today what you can put off until tomorrow.


Top
 Profile  
Reply with quote Post a reply  
PostPosted: Wed Jun 11, 2014 2:27 am 
Offline
Apple Corer

Joined: Sun Aug 25, 2013 3:25 am
Posts: 284
Location: Hong Kong
core diff's

Code:
# diff -ruN core-orig core
diff -ruN core-orig/core_api.c core/core_api.c
--- core-orig/core_api.c        2014-06-10 04:21:12.000000000 +0800
+++ core/core_api.c     2014-06-11 00:30:50.000000000 +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,8 +60,10 @@
     pthread_mutex_unlock(&shoe.via_clock_thread_lock);
     pthread_join(shoe.via_thread_pid, NULL);
     pthread_mutex_destroy(&shoe.via_clock_thread_lock);
-
+
+#ifdef UNIX
     pthread_kill(shoe.cpu_thread_pid, SIGUSR2); // wake up the CPU thread if it was STOPPED
+#endif
     pthread_mutex_lock(&shoe.cpu_thread_lock);
     pthread_mutex_unlock(&shoe.cpu_thread_lock);
     pthread_join(shoe.cpu_thread_pid, NULL);
@@ -86,8 +94,9 @@

 void *_cpu_thread (void *arg)
 {
+#ifdef UNIX
     signal(SIGUSR2, _sigusr2);
-
+#endif
     pthread_mutex_lock(&shoe.cpu_thread_lock);

     while (1) {
@@ -105,7 +114,11 @@
             }

             if (shoe.cpu_thread_notifications & SHOEBILL_STATE_STOPPED) {
+#ifdef UNIX
                 sleep(1);
+#else
+               Sleep(1);
+#endif
                 continue;
             }
         }
@@ -364,7 +377,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 +442,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 +874,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-orig/filesystem.c core/filesystem.c
--- core-orig/filesystem.c      2014-06-10 04:21:12.000000000 +0800
+++ core/filesystem.c   2014-06-11 00:23:32.000000000 +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-orig/macro.pl core/macro.pl
--- core-orig/macro.pl  2014-06-10 04:21:12.000000000 +0800
+++ core/macro.pl       2014-06-11 00:13:06.000000000 +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-orig/mem.c core/mem.c
--- core-orig/mem.c     2014-06-10 04:21:12.000000000 +0800
+++ core/mem.c  2014-06-11 00:16:16.000000000 +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-orig/scsi.c core/scsi.c
--- core-orig/scsi.c    2014-06-10 04:21:12.000000000 +0800
+++ core/scsi.c 2014-06-11 00:20:48.000000000 +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-orig/via.c core/via.c
--- core-orig/via.c     2014-06-10 04:21:12.000000000 +0800
+++ core/via.c  2014-06-11 00:31:22.000000000 +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,12 +71,14 @@
     // Only if the bit is enabled in IER do we raise a cpu interrupt
     if (via->ier & (1 << ifr_bit))
         set_pending_interrupt(vianum);
-
+
+#ifdef UNIX
     // if the CPU was stopped, wake it up
     if (shoe.cpu_thread_notifications & SHOEBILL_STATE_STOPPED) {
         if (!shoe.config_copy.debug_mode)
             pthread_kill(shoe.cpu_thread_pid, SIGUSR2);
     }
+#endif
 }


diff -ruN core-orig/video.c core/video.c
--- core-orig/video.c   2014-06-10 04:21:12.000000000 +0800
+++ core/video.c        2014-06-11 00:42:16.000000000 +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;



SDL driver bit
Code:
# diff -ruN sdl-orig.c sdl.c
--- sdl-orig.c  2014-06-10 04:21:12.000000000 +0800
+++ sdl.c       2014-06-11 00:37:42.000000000 +0800
@@ -31,6 +31,10 @@
 #include <SDL2/SDL_opengl.h>
 #include "../core/shoebill.h"

+#ifdef WIN32
+void bzero (char *to, int count);
+#endif
+
 rb_tree *keymap;
 static void _init_keyboard_map (void)
 {
@@ -210,10 +214,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++) {
@@ -372,7 +377,7 @@

         switch (event.type) {
             case SDL_QUIT:
-                exit(0);
+                exit(1);

             case SDL_MOUSEBUTTONDOWN: {
                 if ((event.button.button == SDL_BUTTON_LEFT) && capture_cursor)


core makefile
Code:
CC = gcc
#CFLAGS =-O2 -Wno-deprecated-declarations -mno-ms-bitfields
CFLAGS =-O0 -g -Wno-deprecated-declarations -mno-ms-bitfields


DEPS = mc68851.h shoebill.h Makefile macro.pl
NEED_DECODER = cpu dis
NEED_PREPROCESSING = adb fpu mc68851 mem via floppy core_api
NEED_NOTHING = atrap_tab coff exception macii_symbols redblack scsi video filesystem alloc_pool

# Object files that can be compiled directly from the source
OBJ_NEED_NOTHING = $(patsubst %,$(TEMP)/%.o,$(NEED_NOTHING))

# Object files than need preprocessing with macro.pl
OBJ_NEED_PREPROCESSING = $(patsubst %,$(TEMP)/%.o,$(NEED_PREPROCESSING))

# Object files that depend on the instruction decoder
OBJ_NEED_DECODER = $(patsubst %,$(TEMP)/%.o,$(NEED_DECODER))

# Files that NEED_DECODER also NEED_PREPROCESSING
POST_PREPROCESSING = $(patsubst %,$(TEMP)/%.post.c,$(NEED_PREPROCESSING)) $(patsubst %,$(TEMP)/%.post.c,$(NEED_DECODER))



# All the object files compiled for x86_64
OBJ_x86_64 = $(OBJ_NEED_NOTHING) $(OBJ_NEED_PREPROCESSING) $(OBJ_NEED_DECODER)

# The object files compiled for i386 (the same as x86_64 files, but with .i386 appended)
OBJ_i386 = $(patsubst %,%.i386,$(OBJ_x86_64))


MACRO = perl macro.pl

TEMP = ../intermediates


all: $(TEMP)/libshoebill_core.a

$(TEMP)/libshoebill_core.a: $(TEMP) $(DEPS) $(OBJ_x86_64)
                ar -rvs $(TEMP)/libshoebill_core.a $(OBJ_x86_64)

# Build object files
$(OBJ_NEED_NOTHING): $(TEMP)/%.o: %.c $(DEPS)
        $(CC) -c $(CFLAGS) $< -o $@

$(OBJ_NEED_PREPROCESSING): $(TEMP)/%.o: $(TEMP)/%.post.c $(DEPS)
        $(CC) -c $(CFLAGS) $< -o $@

$(OBJ_NEED_DECODER): $(TEMP)/%.o: $(TEMP)/%.post.c $(DEPS) $(TEMP)/dis_decoder_g
uts.c $(TEMP)/inst_decoder_guts.c
        $(CC) -c $(CFLAGS) $< -o $@

# Preprocess C files
$(POST_PREPROCESSING): $(TEMP)/%.post.c: %.c $(DEPS)
        $(MACRO) $< $@

# Generate instruction decoders
$(TEMP)/inst_decoder_guts.c: $(TEMP)/decoder_gen $(DEPS)
        $(TEMP)/decoder_gen inst $(TEMP)/
$(TEMP)/dis_decoder_guts.c: $(TEMP)/decoder_gen $(DEPS)
        $(TEMP)/decoder_gen dis $(TEMP)/

# Compile the decoder generator
$(TEMP)/decoder_gen: decoder_gen.c $(DEPS)
        $(CC) decoder_gen.c -o $(TEMP)/decoder_gen


$(TEMP):
        mkdir -p $(TEMP)

clean:
        rm -rf $(TEMP)


And how I build the executable
Code:
gcc sdl.c ..\intermediates\*.o bzero.o -lmingw32 -lsdl2main -lsdl2 -lopengl32 -lws2_32 -o shoebill.exe


So as you can see I didn't change all that much.

_________________
don't do today what you can put off until tomorrow.


Top
 Profile  
Reply with quote Post a reply  
PostPosted: Wed Jun 11, 2014 4:03 am 
Offline
Tinkerer

Joined: Thu Feb 27, 2014 3:10 am
Posts: 66
neozeed wrote:
.... and Ethernet so we can network this bad boy!


working on it ;)


Top
 Profile  
Reply with quote Post a reply  
PostPosted: Wed Jun 11, 2014 4:36 am 
Offline
Apple Corer

Joined: Sun Aug 25, 2013 3:25 am
Posts: 284
Location: Hong Kong
I don't know what I did, but sleeping is now working with the signals! .. on AUX 2 only though, 3.0.0 hammers the CPU like crazy... maybe it's me.

also how do you do wallappers in system7?? when I had a quadra with aux, I mostly used the unix side, with the occasional use of ms word of all things :(

_________________
don't do today what you can put off until tomorrow.


Top
 Profile  
Reply with quote Post a reply  
PostPosted: Wed Jun 11, 2014 4:56 am 
Offline
Tinkerer

Joined: Thu Feb 27, 2014 3:10 am
Posts: 66
neozeed wrote:
I don't know what I did, but sleeping is now working with the signals! .. on AUX 2 only though, 3.0.0 hammers the CPU like crazy... maybe it's me.

also how do you do wallappers in system7?? when I had a quadra with aux, I mostly used the unix side, with the occasional use of ms word of all things :(


I think I'll just replace signals with pthread_cond_wait(). That should better support non-UNIXy platforms.

Systems < 8 don't natively support desktop pictures. But there are 3rd party extensions, and Décor is definitely the best. 24-bit color desktop pictures really make A/UX feel like a modern OS :)

-- update:

It's available on the MacAddict #1 disc, which might be an easier way to get it into Shoebill (already wrapped in an apple partition map)

https://archive.org/details/macaddict-cd-001


Last edited by pruten on Wed Jun 11, 2014 5:05 am, edited 1 time in total.


Top
 Profile  
Reply with quote Post a reply  
PostPosted: Wed Jun 11, 2014 5:05 am 
Offline
Apple Corer

Joined: Sun Aug 25, 2013 3:25 am
Posts: 284
Location: Hong Kong
cool, I'll check it out!

also my build with signals inside locks tight after a few minutes.... I need to re-test the one without now.

_________________
don't do today what you can put off until tomorrow.


Top
 Profile  
Reply with quote Post a reply  
PostPosted: Wed Jun 11, 2014 5:41 am 
Offline
Expert User
User avatar

Joined: Fri Feb 13, 2004 8:59 am
Posts: 4173
Location: Sittard, The Netherlands
Hi,

Great to see a Windows build!
I can get to the desktop with it using AUX 2.0 (but then hangs). Not with 3.0.1.

Best,
Cat_7


Top
 Profile  
Reply with quote Post a reply  
PostPosted: Wed Jun 11, 2014 6:28 am 
Offline
Apple Corer

Joined: Sun Aug 25, 2013 3:25 am
Posts: 284
Location: Hong Kong
Cat_7 wrote:
Hi,

Great to see a Windows build!
I can get to the desktop with it using AUX 2.0 (but then hangs). Not with 3.0.1.

Best,
Cat_7


It's not you, it does the same thing with me... and 2 actually idles, while 3 runs 100% .... I havent tried 1.1.1 yet, but at this point I think we are at the 'wow it compiled' phase... at least it isn't 0xc0000005'ing.

Actually, the command shell on 3.0.0 will soak 100% of the CPU. huh. Anyways either close it, or logon to a full screen console, and CPU utilization on 3.0.0 is near nill.

_________________
don't do today what you can put off until tomorrow.


Top
 Profile  
Reply with quote Post a reply  
PostPosted: Wed Jun 11, 2014 2:09 pm 
Offline
Tinkerer

Joined: Thu Feb 27, 2014 3:10 am
Posts: 66
neozeed wrote:
Cat_7 wrote:
Hi,

Great to see a Windows build!
I can get to the desktop with it using AUX 2.0 (but then hangs). Not with 3.0.1.

Best,
Cat_7


It's not you, it does the same thing with me... and 2 actually idles, while 3 runs 100% .... I havent tried 1.1.1 yet, but at this point I think we are at the 'wow it compiled' phase... at least it isn't 0xc0000005'ing.

Actually, the command shell on 3.0.0 will soak 100% of the CPU. huh. Anyways either close it, or logon to a full screen console, and CPU utilization on 3.0.0 is near nill.


If the missing pthread_kill() is at fault, then there's an easy solution: comment out the Sleep(1) in cpu_thread as well. That'll drive up CPU use to 100% all the time, but otherwise work "correctly" from A/UX's perspective.

Even when "stop" actually stops the CPU thread, certain Mac OS apps eat up all the cycles anyways. So it's of limited use.


Top
 Profile  
Reply with quote Post a reply  
PostPosted: Thu Jun 12, 2014 5:36 am 
Offline
Apple Corer

Joined: Sun Aug 25, 2013 3:25 am
Posts: 284
Location: Hong Kong
I put the signals back in, left in the usleep, and commented out the sleep in the core....

if you force it's affinity to one core it is SO SLOW, like the mouse is a good 5-10 seconds behind... but running on all cores, it's nice like before, just it takes a good bit of CPU to run...

From a feeble gdb session all the threads were sleeping waiting for something.. Almost like too much sleep and everything falls apart. AUX 2 certainly sleeps more than 3 (the console window..... grr) so I guess thats why 2 feels worse than 3. Maybe a mutex around the sleep? I donno, I never was that good with multithreaded stuff.... by the time I got a C compiler and a threaded OS (lol OS/2) it didn't matter I was working. :(

Anyways AUX 2 has been running for over 2 hours now, so I've replaced the binary/source on my site. the changes are now even less significant.... but im happy it's working!

_________________
don't do today what you can put off until tomorrow.


Top
 Profile  
Reply with quote Post a reply  
PostPosted: Thu Jun 12, 2014 3:54 pm 
Offline
Tinkerer

Joined: Thu Feb 27, 2014 3:10 am
Posts: 66
neozeed wrote:
if you force it's affinity to one core it is SO SLOW, like the mouse is a good 5-10 seconds behind... but running on all cores, it's nice like before, just it takes a good bit of CPU to run...


Sounds like the CPU thread isn't waking up when it's supposed to. I just went with sleep(1) and pthread_kill() as a method for pausing the CPU thread because it's simpler (and therefore maybe faster?) than using regular pthread condition variables. But since it's making cross-platform life difficult, I'll just switch over to pthread_cond_wait()/pthread_cond_signal().

Been busy with work stuff lately, but I'll definitely get around to implementing PRAM/config files, as well as all these windows fixes for the weekend. Maybe get a working build system too :)


Top
 Profile  
Reply with quote Post a reply  
PostPosted: Thu Jun 12, 2014 3:58 pm 
Offline
Apple Corer

Joined: Sun Aug 25, 2013 3:25 am
Posts: 284
Location: Hong Kong
pruten wrote:
neozeed wrote:
if you force it's affinity to one core it is SO SLOW, like the mouse is a good 5-10 seconds behind... but running on all cores, it's nice like before, just it takes a good bit of CPU to run...


Sounds like the CPU thread isn't waking up when it's supposed to. I just went with sleep(1) and pthread_kill() as a method for pausing the CPU thread because it's simpler (and therefore maybe faster?) than using regular pthread condition variables. But since it's making cross-platform life difficult, I'll just switch over to pthread_cond_wait()/pthread_cond_signal().

Been busy with work stuff lately, but I'll definitely get around to implementing PRAM/config files, as well as all these windows fixes for the weekend. Maybe get a working build system too :)


No problem. I'm still amazed from your first public release.. I'd felt so bad having to give up my quadra 700 years ago, as I figured I'd never boot A/UX again... but here we are!

I'm using a mingw toolset that I found for building PCem (another fine emulator, if I do say so) it's something I snagged from here, 23MB or so, kind of tiny. I just had to add in the SDL2 stuff.

_________________
don't do today what you can put off until tomorrow.


Top
 Profile  
Reply with quote Post a reply  
PostPosted: Thu Jun 12, 2014 4:09 pm 
Offline
Apple Corer

Joined: Sun Aug 25, 2013 3:25 am
Posts: 284
Location: Hong Kong
FWIW here is what the diff's are in my current binary build...


sdl:
Code:
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)


core
Code:
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;


So as you can see it's quite minimal!

_________________
don't do today what you can put off until tomorrow.


Top
 Profile  
Reply with quote Post a reply  
PostPosted: Thu Jun 12, 2014 4:38 pm 
Offline
Mac Mechanic
User avatar

Joined: Fri Aug 27, 2010 1:02 am
Posts: 191
Woah, great progress! This website's email notifications was broken, so I couldn't see the progress on getting this to run on Windows.

Cross platform yay :-)


Top
 Profile  
Reply with quote Post a reply  
PostPosted: Fri Jun 13, 2014 1:46 am 
Offline
Apple Corer

Joined: Sun Aug 25, 2013 3:25 am
Posts: 284
Location: Hong Kong
julialy wrote:
Woah, great progress! This website's email notifications was broken, so I couldn't see the progress on getting this to run on Windows.

Cross platform yay :-)


Yeah I kept on seeing people wanting a Windows version of Shoebill, and luckily it's written well enough with a few trivial changes it works! I hope one day we get Ethernet so we can setup httpd, mud, irc and maybe even quakeworld servers! It's going to be awesome!

_________________
don't do today what you can put off until tomorrow.


Top
 Profile  
Reply with quote Post a reply  
PostPosted: Fri Jun 13, 2014 6:19 am 
Offline
Apple Corer

Joined: Sun Aug 25, 2013 3:25 am
Posts: 284
Location: Hong Kong
If anyone wants them, I found the A/UX 1.0 installation manual, and the A/UX 2.0 installation manual.

I haven't seen a 3.0 one.. yet.

_________________
don't do today what you can put off until tomorrow.


Top
 Profile  
Reply with quote Post a reply  
PostPosted: Fri Jun 13, 2014 3:27 pm 
Offline
Tinkerer

Joined: Thu Feb 27, 2014 3:10 am
Posts: 66
neozeed wrote:
If anyone wants them, I found the A/UX 1.0 installation manual, and the A/UX 2.0 installation manual.


Yes, please! Now if only someone could find an actual copy of A/UX 1.0.0 floating around...


Top
 Profile  
Reply with quote Post a reply  
PostPosted: Sun Jun 15, 2014 9:00 am 
Offline
Apple Corer

Joined: Sun Aug 25, 2013 3:25 am
Posts: 284
Location: Hong Kong
I finally got that ancient "aux-0.7-bin.tar.gz" thing floating around onto A/UX 3.0.0, and much to my amazement, the userland stuff that I tested (df, ls).. actually work.

Now to see if I can get it to boot.. or self host!

Oh yeah, and without a network, the easiest way to move stuff around is uuencode. its the only thing I could use BasiliskII to copy to the HFS volume, and then get finder to copy reliably to the UNIX side of A/UX.

_________________
don't do today what you can put off until tomorrow.


Top
 Profile  
Reply with quote Post a reply  
PostPosted: Sun Jun 15, 2014 11:12 pm 
Offline
Apple Corer

Joined: Sun Aug 25, 2013 3:25 am
Posts: 284
Location: Hong Kong
I accidentally tried to boot 3.0.1, and it got me thinking the UNIX kernel boots up ok, it's the toolbox side of things that doesn't work.

So what happens when you replace /mac from a 3.0.0 install onto a 3.0.1 setup?

Image

tada?

I did the dump/restore shuffle, and got a booting system.

my feeble attempts at mixing and matching 3.0.1 and 3.0.0 has just left it unbootable, I dont even know which process locks when trying to do the login screen, but yeah if you want a newer kernel this works.

I don't think the II is supported on later patches though.

_________________
don't do today what you can put off until tomorrow.


Top
 Profile  
Reply with quote Post a reply  
PostPosted: Mon Jun 16, 2014 8:36 am 
Offline
Apple Corer

Joined: Sun Aug 25, 2013 3:25 am
Posts: 284
Location: Hong Kong
I just noticed I goofed when creating the empty disks... I ran the newfs all wrong...

Quote:
newfs /dev/rdsk/c1d0s0 other


Is how I should have done it... I was always getting dup alloc 1 failures if shoebill or aux crashed on reboot.

I'll update the blank disk images later.

sorry about that.

_________________
don't do today what you can put off until tomorrow.


Top
 Profile  
Reply with quote Post a reply  
PostPosted: Thu Jun 19, 2014 2:17 am 
Offline
Apple Corer

Joined: Sun Aug 25, 2013 3:25 am
Posts: 284
Location: Hong Kong
Expanding on what I did with 3.0.1, I manually unpacked 3.1's CPIO archive, and then placed in the MacOS system files where needed...

Image

I have to say that 3.1 feels faster than 3.0.0 or 3.0.1, and it sure is a LOT more stable than 3.0.1 ... Although if you hammer the disk, you'll still get

Assertion failed: fwrite(shoe.scsi.buf, shoe.scsi.out_len, 1, dev->f) == 1, file scsi.c, line 662

so yeah... :???:

I know it's a known issue, but I thought it was at least somewhat interesting the kernel boots!

_________________
don't do today what you can put off until tomorrow.


Top
 Profile  
Reply with quote Post a reply  
PostPosted: Thu Jun 19, 2014 3:27 am 
Offline
Tinkerer

Joined: Thu Feb 27, 2014 3:10 am
Posts: 66
neozeed wrote:
Expanding on what I did with 3.0.1, I manually unpacked 3.1's CPIO archive, and then placed in the MacOS system files where needed...

I have to say that 3.1 feels faster than 3.0.0 or 3.0.1, and it sure is a LOT more stable than 3.0.1


Whoa! I think this suggests that shoebill's just a small number of bugs away from supporting every existent version of A/UX :)


Top
 Profile  
Reply with quote Post a reply  
PostPosted: Thu Jun 19, 2014 3:11 pm 
Offline
Apple Corer

Joined: Sun Aug 25, 2013 3:25 am
Posts: 284
Location: Hong Kong
pruten wrote:
neozeed wrote:
Expanding on what I did with 3.0.1, I manually unpacked 3.1's CPIO archive, and then placed in the MacOS system files where needed...

I have to say that 3.1 feels faster than 3.0.0 or 3.0.1, and it sure is a LOT more stable than 3.0.1


Whoa! I think this suggests that shoebill's just a small number of bugs away from supporting every existent version of A/UX :)


Yeah, your 68020 emulation is pretty commendable!

I'm still amazed it runs SoftPC! I'm glad I kept a copy of that ancient thing hanging around!

_________________
don't do today what you can put off until tomorrow.


Top
 Profile  
Reply with quote Post a reply  
PostPosted: Thu Jun 19, 2014 11:20 pm 
Online
Forum All-Star
User avatar

Joined: Fri Nov 27, 2009 5:11 am
Posts: 1761
Once you get it running every version of A/UX, do you have any further goals, such as accurate sound/network emulation, Mac OS support for every OS version the Mac II supported, Rudimentary MIDI support, etc?

I know sound and MIDI would be hard, as it depends on timings which would likely slow emulation down too much. But thought I'd ask :)


Top
 Profile  
Reply with quote Post a reply  
Display posts from previous:  Sort by  
Post new topic  Reply to topic Page 5 of 13 [ 318 posts ]    Go to page Previous  1, 2, 3, 4, 5, 6, 7, 8 ... 13  Next


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
 

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group