Sonic the Hedgehog for the Sega 32x

So I was stumbling around the internet, and wondered if there was any good SEGA 32x emulators, as I recently found the Jaguar port of DOOM, and there is some mention of MARS stuff (32x) buried in there.

Then I came across this post from dcemu.co.uk

A split disassembly for Sonic 1 converted to 32x format has been released.
With that, you can edit anything in Sonic 1 to be how you want. It is very possible to recreate Sonic Mars with it, but that would take a lot of time and effort. And there’s no guarantee you’ll be able to play it on your 32x system.

Whoa, that’s pretty amazing! So with a little google-fu I find the mentioned split disassembly, on sonicretro.org

This is pretty amazing stuff, so it also turns out the emulator in question to use is Kega Fusion, which does Genesis, Sega CD and of course 32x.

And the best part is the sonic disassembly includes the tools that you need to gen your own sonic rom! simply extract the source, and run the ‘build.bat’ and it’ll assemble the SH2 code, bind it to a blob, assemble the m68k code, and strap it all into a ROM.  Honestly you’d be hard pressed to even tell if there any difference between this, and the original ROM. Other then it won’t run on a standard Genesis (Megadrive).

Since this is done with off the shelf tools, there is of course, a demo scene, gendev, which include a MOD player, and Wolfenstein!

It’s a damned shame the 32x only has 256kb of ram… If it had the 2MB the Jaguar had, or even more, things could have been.. different, but then again after MARS it was off to Saturn.

Duke Nukem 3D for the Macintosh (68020)

mini vmac II duke nukem

mini vmac II duke nukem

I had no idea this even existed… I guess it’s to be expected, all the popular games of the time (doom) were ported to pretty much everything and anything.

So after stubmling across this site, Emacualtion, I had to fire this thing up!

The first thing I needed to do was get the latest source to Mini vMac. What is different about this is that you get the source from within the emulator. Basically you pass a program what config you want and it’ll spit out source code. So for me to build on windows, a mac II with 256 colors, I gave it..

-t wx86 -m II -depth 3

Easy right?

There is some help on the mini vmac site, but it’s kind of in places.

With the emulator built, the next fun filled thing was to dump the ROM from my SE/30, which was.. an exciting adventure in floppy disks, but with it in hand I was ready!

The next part of the puzzle was System 7.5.3, which apple still thankfully provides, along with HFVExplorer, and Stuffit, and I was all set to go!

I created a target diskette of 100MB, then used hfvexplorer to copy 7.5.3 and it’s 19 segments into the disk. Then I booted the emulator with a minimal System 7 floppy. I then installed 7.5.3 into the 100mb disk, then shut down the emulator. Then using hfv explorer, copy over Duke and stuffit.

Boot back into MacOS, install stuffit, and expand Duke and away we GO!

Naturally with the speed limits dropped it’s quite FAST! vMac doesn’t have sound yet, so it’s a silent experience but it works quite well.

mini vmac II duke

mini vmac II duke

The sad thing is that Doom requires 32bit mode, which it seems that Mini vMac can’t do just yet.

MacMinix

MacMinix

Once upon a time, I bought a Mac Plus, and decked it out with 4MB of ram, and a 40MB SCSI hard disk. I thought it was so cool, I even got a cable to talk to a normal external modem, and used it as a compact terminal to BBS, although the 800Kb floppies were a bit of a pain….

Anyways it was OK for a while but system 6 is so… limiting. Then I started using it for a foot rest, as I couldn’t do anything really more with it. Then someone at college pointed out that Minix actually supported a bunch of 68000 based machines, namely the Amiga, Atari ST, and the Macintosh!!!

The best part of the Mac port being that you didn’t have to format, repartition or anything, as it was essentially and operating environment!

The best parts being, that it had vi, and even a C compiler! Although without documentation getting things in & out of the Mac seemed impossible, and I kind of gave up on it.

But after digging around these ancient Linux things, I thought I’d take a look at MacMinix again.

To start, Brad Pliner has an excellent site, with lots of documentation for this port of Minix, including some PDF’s of the instructions.

I’ve detailed some of the install steps on gunkies.

The only real downside will be that the C compiler is ancient… It really can’t compare to MINT’s GCC.

The Commodore Amiga

I was enjoying that great site, stumbleupon when I came across a commented listing of the Amiga 1.2 ROM. Then it hat hit me, I’ve never really written about some of the great emulators for the Commodore Amiga.

Back when I was in highschool I wanted a Commodore Amiga, as at the time I was stuck with a Commodore 64. However the world was starting to accept the IBM PC swing of things. Windows 3.0 was out, suddenly the protected mode of the 80286 could be exploited for only a few hundred dollars, vs the thousands for a UNIX port, or what OS/2 cost. And of course the big appeal at the time was that you could build your own PC in a kit fashion (well it still is!). So I was toying with the idea of buying this 286 8Mhz board for $30 CDN when I saw this program that a kid had brought in… It needed VGA, but it could apparently emulate a Commodore Amiga!

You can still download it here.

Running it just simply threw up a picture of the Amiga’s insert a workbench diskette, and clicked the drive madly.. Passing it through a hex editor showed a copy of an Amiga ROM tacked on the end, but it didn’t actually emulate anything.

But I didn’t realize it at the time, and it cemented my decision to buy the 286.

Years later and the topic of m68k emulation came up, as there were simple cross assemblers and simulators, and I can remember in college searching to see if anyone had started an Amiga emulator… And there was one project!

UAE

Originally it stood for “Unusable Amiga Emulator” and well it was unusable. But then with enough people starting to flock to the project it suddenly could boot AmigaDOS. I used to use this on MS-DOS back in the day for ‘maximum’ speed. I was able to find one ancient version of this 0.65 that still has an MS-DOS exe. And it runs great under DOSBOX. You can find it here.

And for the heck of it, here is a screen shot with a 1.3 ROM.

UAE 0.65 under DOSBOX

UAE 0.65 under DOSBOX

Naturally transferring disks was a major pain in the butt… I luckily had a friend with a working Amiga and cross dos for AmigaDOS all configured so I could transfer some terminal emulator to my poor Amiga 500 I had picked up at a used hardware store in college. Then I used what I could of ramdisks, compression programs and whatnot to upload via some 50 foot nullmodem cable I had to transfer ADF’s of my workbench disks and an old favorite game of mine, Captain Blood. Even back at the time, Commodore was bankrupt their future was bleak. Getting spare parts then was becoming hard for my Amiga 500. And my 486SX-20 could almost run at an acceptable speed in emulation..

But time marches on.

UAE was then ported to Linux & X11, and the SVGA lib. I had some old RS232 terminal so I could keep on using my machine to ‘work’ and still play console vga stuff like doom for SVGAlib and of course UAE. Now with CPUs in the GHz++ speed range, emulation of a 8Mhz machine with 3 custom chips is more in software then raw cpu speed. The UAE project kind of died off, there hasn’t been any big updates in years, but the CPU core work lives on in all kinds of m68k derived work.

There is no doubt that there is still a few closeted Amiga users out there, but I suspect that we don’t kick up UAE all that much these days.. But it’s still cool to watch it in action.

And of course the demos! One of my favorites was the fairlight 242 demo. Which UAE with a Kickstart 1.3 ROM will run. Even the MS-DOS version!

fairlight 242 UAE for DOS on DOSBOX

fairlight 242 UAE for DOS on DOSBOX

I should add you can find more demos here, and a Win32 version of UAE here.

easy68k & sozobon

Easy68k

I know this is a little weird to follow, but I thought it was somewhat interesting. Anyways I’ve been reading up on some CP/M stuff, and found some interesting m68k stuff. There is this really cool m68k simulator/test environment called easy68k. Ok so the 68000 isn’t exactly the hottest chip, but for anyone that’s used a Mac, Amiga, Atari ST, SEGA Genesis, or old SUN the m68000 was the end all be all CPU. Anyways you can download the easy68k simulator from here:

http://www.easy68k.com/

Now I’ve never been really all that good with assembly. I know one day I should learn, but until then, there is higher level languages, and of course the best ‘medium’ level language C. Back in the day the ‘sozobon’ compiler was somewhat portable, and a good & easy 16 bit C compiler. Now as far as I know there really hasn’t been any activity on this since 1991, so it’s getting hard to find, and of course the archived copies I found needed LZH.. You can find some archived copies here:

http://umich.edu/~archive/atari/Languages/Sozo2/

Since I didn’t want to go thru a big ordeal, I found an extracted copy of the sources here:

http://cd.textfiles.com/crawlycrypt1/program/compiler/sozobon/

Building the sozobon compiler

Using wget I pulled down the source code. It’s worth noting that unlike GCC this is SMALL… although it only targets the 68000 cpu. The only source that I’m using is the actual C compiler. I suppose if I were better I could map the simulator, and setup the assembler & linker to target the environment all the way… However for now I’m just interested in showing the relationship between a compiler, to the assembler. Now the source is old enough that it uses the reserved word inline in gunk.c I simply changed it to Xinline. I’ve attached a diff for those who like diff’s however as you can see it’s really simple, I just renamed them, so they don’t conflict.


--- gunk.c Fri Feb 22 05:33:34 1991
+++ gunk-fix.c Mon Mar 9 14:35:33 2009
@@ -37,7 +37,7 @@
int (rewri)(); / rewrite function */
};

-int m_unfold(), unfold(), m_cast(), cast(), m_inline(), inline();
+int m_unfold(), unfold(), m_cast(), cast(), m_inline(), Xinline();
int m_hardas(), hardas(), m_fcmp(), fcmp(), m_md_shf(), md_shf();
int m_eident(), eident(), m_incdec(), incdec(), m_fldas(), fldas();

@@ -48,7 +48,7 @@
{m_eident, eident},
{m_incdec, incdec},
{m_hardas, hardas},
- {m_inline, inline}, /* must cast before inline /
+ {m_inline, Xinline}, /
must cast before inline */
{m_fcmp, fcmp},
{m_fldas, fldas},
{0}
@@ -424,7 +424,7 @@
return 0;
}

-inline(np)
+Xinline(np)
NODEP np;
{
register NODEP nmp, cmap;
@@ -782,7 +782,7 @@
register NODEP tp;

spar1 = "%fpcmp";
- inline(np);
+ Xinline(np);

tp = copyone(np);
tp->n_left = np->n_left;

Now with that out of the way, you should be able to build with the make.unx


% make -f make.unx
gcc -DUNIX -O -c d2.c
gcc -DUNIX -O -c decl.c
gcc -DUNIX -O -c expr.c
gcc -DUNIX -O -c fix.c
gcc -DUNIX -O -c fun.c
gcc -DUNIX -O -c g2.c
gcc -DUNIX -O -c gen.c
gcc -DUNIX -O -c gsub.c
gcc -DUNIX -O -c gunk.c
gcc -DUNIX -O -c main.c
main.c:424: warning: 'optnl' was declared implicitly 'extern' and later 'static'
main.c:417: warning: previous declaration of 'optnl'
gcc -DUNIX -O -c md.c
gcc -DUNIX -O -c nodes.c
gcc -DUNIX -O -c out_st.c
gcc -DUNIX -O -c p2.c
gcc -DUNIX -O -c pre.c
gcc -DUNIX -O -c tok.c
gcc -DUNIX -O -c subs_c.c
gcc -o xhcc d2.o decl.o expr.o fix.o fun.o g2.o gen.o gsub.o gunk.o main.o md.o nodes.o out_st.o p2.o pre.o tok.o subs_c.o

Writing hello world!

OK, with the compiler built, let’s write a simple C program. I’ve setup a simple main, and calls to a ‘putc’ and an ‘exit’ that currently don’t do anything. We will have to fix that in the assembly source.. but for now it’s nice as it sets up a place holder.



char MESSAGE[]="this is a message";
void putc(c)
char *c;
{

}
void exit()
{}

void main()
{
int j;
j=0;
putc(MESSAGE);
exit();
}

Now we can compile the source file (x.c) and use the -S flag, so it only outputs an assembly source, that we can then massage to work with easy68k.


% ./xhcc -S x.c ; cat x.s
.data
.globl _MESSAGE
_MESSAGE:
.dc.b $74,$68,$69,$73,$20,$69,$73,$20,$61,$20,$6d
.dc.b $65,$73,$73,$61,$67,$65
.dc.b 0
.text
.globl _putc
_putc:
bra L1
L0:
;var 4 8 _c
L2:
unlk a6
rts
L1:
link a6,#-0
bra L0
.globl _exit
_exit:
bra L4
L3:
L5:
unlk a6
rts
L4:
link a6,#-0
bra L3
.globl _main
_main:
bra L7
L6:
;var 2 -2 _j
clr.w -2(a6)
move.l #_MESSAGE,-(sp)
jsr _putc
add.w #4,sp
jsr _exit
L8:
unlk a6
rts
L7:
link a6,#-2
bra L6
.data

As you can see from the source below the following changes were made:

-Added the ORG $1000
-Changed the formatting of the _MESSAGE into a format that easy68k’s assembler likes.
-Removed all the .globl statements.
-Renamed the _main section to START & and add the end start tags.
-Populated the exit procedure with the ‘exit’ code from easy68k’s example
-Changed putc to use the d0 register instead of d6, and added the print string code from easy68k.


ORG $1000

_MESSAGE dc.b $74,$68,$69,$73,$20,$69,$73,$20,$61,$20,$6d
dc.b $65,$73,$73,$61,$67,$65
dc.b 0

_putc:
bra L1
L0:
;var 4 8 _c
move.b #14,d0
trap #15

L2:
unlk a0
rts
L1:
link a0,#-0
bra L0

_exit:
bra L4
L3:
L5:
unlk a6
rts
L4:
move.b #9,d0
trap #15
link a6,#-0
bra L3

START:
bra L7
L6:
;var 2 -2 _j
clr.w -2(a6)
move.l #_MESSAGE,-(sp)
jsr _putc
add.w #4,sp
jsr _exit
L8:
unlk a6
rts
L7:
link a6,#-2
bra L6
end start

conclusion

Now you can run the code in the simulator, and watch it enter the ‘start’ section, call the putc with the address of _MESSAGE, return to the main, and then call the _exit procedure, which calls the sim68k exit program interrupt. I’ll leave this as an exercise to the read for any real value…. I just thought it was cool, that without really learning any assembly I was able to write a basic ‘hello world’ type program in an hour….

Aranym, Atari 68040/mmu emulator!

Well it was the weekend, and I was playing with FORTRAN (Language systems fotran to be exact, all 30lb of it!) and anyways to check to FPU & crash issues I though I’d check it out on an actual m68k Macintosh. So as I was using Basilisk II for some stuff, I was wondering if anyone ever did upgrade the CPU emulation to 68040/mmu emulation. And it turns out that the Basilisk II emulation is taken from UAE, which in turn has been used in a few other emulators including aranym.Aranym is “Atari runs on any machine”, and what these guys have done, is fleshed out the UAE 68000 emulation enough to where it will run m68k linux!

Both a windows version and the source can be found here.

Now for the fun part!

You can download a patched kernel here that supports the virtual Ethernet, or just run a stock kernel (no networking though!)

Next you’ll want some kind of root filesystem, I would recommend the ‘etch’ disk which can be downloaded here.

Naturally, you’ll need a config, here is what I’m using..

—8<——8<——8<—

[GLOBAL]
FastRAM = 256
Floppy =
TOS =
EmuTOS =
AutoGrabMouse = No

[LILO]
Kernel = ./vmlinux
Args = root=/dev/hda1 video=atafb:vga16 stram_swap=0
debug=par
Ramdisk =

[ETH0]
Type = bridge
Tunnel = tap0

[STARTUP]
GrabMouse = No Debugger = No

[IDE0]
Present = Yes
IsCDROM = No
ByteSwap = No
ReadOnly = No
Path = etch.img
Cylinders = 2102
Heads = 16 SectorsPerTrack = 63
ModelName = Master

—8<——8<——8<—

Then finally run it like this:

aranym-mmu.exe -l -c linux.conf

I’ll have to play some with the networking to get it going, it seemed straight forward the FAQ here, however I had no luck.

Anyways, it’s no A/UX, but it’s a *NIX like thing on the m68k. Now we just have to beg the Mac people to flesh out the hardware on their emulators to support Linux, OpenBSD, NetBSD & A/UX….

Linux on Aranym

Linux on Aranym

 

vMac/Mini vMac

Simply put vMac is a quick & fast Mac Plus emulator. That being said, it will emulate a 68000 cpu with 4 (yes, FOUR) megabytes of ram.

Now you will need a ROM from a plus Macintosh in order to run this. I actually did own a plus (it made a good foot rest), but before I moved I ripped the ROM, and trashed it.

vMac started in the late 1990’s but has been largely abandoned. But not to worry, this is where mini vMac stepped in, and took over the torch as it were.

Mini vMac can be downloaded here:

http://minivmac.sourceforge.net/download.html

The good news is that it’s small, and portable so you can pick this up for several platforms. And yes, there is a version for PowerPC Macs so you can run some super ancient software with system 6 and prior on System 8/9 PowerMacs.

Assuming you have your rom in a file called vmac.rom you are almost ready to go! Now you need a copy of the operating system. Luckily Apple has made systems prior to 7.6 free, and you can download them from here:

http://download.info.apple.com/Apple_Support_Area/Apple_Software_Updates/English-North_American/Macintosh/System/Older_System/System_6.0.x/

http://download.info.apple.com/Apple_Support_Area/Apple_Software_Updates/English-North_American/Macintosh/System/Older_System/System_7.0.x/

And the System 7.5.3 updater:

http://download.info.apple.com/Apple_Support_Area/Apple_Software_Updates/English-North_American/Macintosh/System/Older_System/System_7.5_Version_7.5.3/

Although for the first timer, I ‘d recommend something like this:

http://www.math.harvard.edu/~knill/various/continuum/System7.dsk

to get up & running quickly.

Now I’d highly recommend a utility called HFVExplorer. This will let you create a ‘hardfile’ to simulate a hard disk, and allow you to move files you’ve downloaded into your hardfile. You can find a copy here:

http://www.fenestrated.net/~macman/stuff/HFVExplorer/

A good utility to have on the mac side is DiskCopy. You can download a copy from Apple here:

http://download.info.apple.com/Apple_Support_Area/Apple_Software_Updates/English-North_American/Macintosh/Utilities/Disk_Copy/

If you still have legacy 400k, 800k floppies you will require a real Mac to read them. They are formatted in a different method that a PC cannot read. However this changed with the high density drives (super drivers they were called) which a PC can at least read/write raw disk images of them.

Putting it all together:

Ok with mini vMac, your rom, a hard disk file & the system 7 boot disk you should have enough to have a booting instance. It should be about that simple.

I happen to love this game Captain Blood, and I found a copy for the Macintosh and using HFVExplorer I just move it into my disk file, unstuff & run.

The whole point is that this ancient game bypasses the toolbox for video calls and will crash on the Powermac I just bought, however it’ll run fine in emulation.

Next up we’ll cover the PowerMac emulation…!

MacMiNT

MacMint

MacMint

Recently I came across a Power Macintosh 5400/120 at a garage sale for the bargain price of $12! I couldn’t believe my luck, for under $20 I had a fully working computer!

Except that it won’t run OS X 1.0
And it only has 8Mb of ram.

Because of its memory restrictions it can only run Mac OS 7.6

What to do….

MacMINT!

MINT back in the day for AtariST’s was a UNIX like layer that ran on top of TOS (The Atari MS-DOS like OS) and provided basic Unix services. With the program aptly called JET (Just Enough TOS), the Macintosh 68000’s can setup a TOS compatible interrupt vector table, and run TOS procedure emulation to run the MINT binaries under MacOS!

So, it’s UNIX!

Sort of.

First you need to disable Virtual Memory… That’s bad.
Next it doesn’t support TCP/IP so it’s like being on Unix v6. But it’s fun at any rate.

You can find the binaries at my mirror of sra.co.jp here.

It includes gcc 2.5.8, and a somewhat basic environment. It does have lots of potential, but the biggest gripe is that 8Mb of ram just isn’t enough to do any serious compiling, and yes it will crash with virtual memory enabled. Also since it is 68000 programs it is running under emulation.. I have to admit that I am tempted to buy some kind of 68000 based Macintosh to run MacMiNT.

I know this may not be terribly useful to people, but then again someone has to do something fun/weird on a $12 machine. I fully expect to either get a ‘bigger’ 68000 box, or more ram and run something like simh on it. I can only wonder how usable the PDP11 or the Interdata32 are.

And for anyone, like me wants a ‘clear’ program, just because, here is a simple one, just remember to link with -ltermcap.

#include <stdio.h>
#include <stdlib.h>
#include <termcap.h>

void main()

{

char buf[1024];
char buf2[30];
char *ap;
char *clearstr;

ap=buf2;
tgetent(buf,getenv(“TERM”));
clearstr=tgetstr(“cl”,&ap);
fputs(clearstr,stdout);

}

GLFrontier

Frontier Elite

GLFrontier

While on the topic of Frontier Elite this week, I was wondering if they by any chance ever released the source code… It appears not, however there were largely two versions the original being in 68000 assembly then a port to 80286 real mode ASM.
But then I found this:
Tom Morton has taken the Atari ST version of Frontier, and removed the hardware access from the assembly, then tweaked a m68k assembler to either output in C or i386 asm… So he’s basically reversed a copy of Frontier to allow it to run natively!
And he’s added OpenGL support to some degree! It’s VERY cool!
At a minimum I bet there are people out there that would LOVE this guys programs to convert m68k assembly listings into either C or i386 asm. Or a chance to hack the ‘source’ like crazy.
I’ve also come across this great site http://www.jongware.com/galaxy1.html which goes over various algorithms from the game.