Sozobon source code changes?

Talk about development tools here

Moderator: BigEvilCorporation

neozeed
Interested
Posts: 11
Joined: Fri Sep 27, 2013 12:29 am
Location: hong kong
Contact:

Sozobon source code changes?

Post by neozeed » Fri Mar 25, 2016 5:23 pm

I was wondering if the changes to the linker, and assembler to the Sozobon compiler were ever posted anywhere?

I figured the linker just omits the headder, since it is making a raw image. But the real fun is in JAS or namely how the modified version can assemble stuff greater than 32kb.

I know I can hear the call of "just run gcc" but in my insane experiments, I want to actually run sozobon on 68k hardware as well, and getting it to run will be a heck of a lot easier than bootstrapping up GCC. Not to mention requiring a lot less precious stack ram.

The email address for PLee was @enron and I don't think that works anymore... :oops:

Sik
Very interested
Posts: 939
Joined: Thu Apr 10, 2008 3:03 pm
Contact:

Re: Sozobon source code changes?

Post by Sik » Sat Mar 26, 2016 12:54 am

Was it ever updated? And I recall that most of those changes were specific to x86. The 68000 version had the 32KB limit because it was using word-sized offsets (which with sign extension gives you a 15-bit range in either direction, hence 32KB). I guess you could change it to use long-sized offsets instead but that'll take quite a while to update it.

Note that you can always just split the code into several smaller files instead. Sozobon has no problem with that.
Sik is pronounced as "seek", not as "sick".

neozeed
Interested
Posts: 11
Joined: Fri Sep 27, 2013 12:29 am
Location: hong kong
Contact:

Re: Sozobon source code changes?

Post by neozeed » Sat Mar 26, 2016 2:26 am

From the included 'readme' of soz_3.zip
Sozobon C Compiler, release 3.0

03 Jan 2001

by P.Lee

Distribued by Kaneda



Compiler Limits

Some limits imposed by the Sozobon compiler were:

* Include files may not be nested more than 8 deep.

* The assembler will have problems with extremely large
source files that produce more than 32K of code from a
single file.


Now they are

* Include files may not be nested more than 32 deep.

* The assembler have been tested on large source files without errors.
And inside jas.h there is this gem:
/* i don't know why we need this ...
#define short int
... */
so on a 32bit machine, this makes the defined 'shorts' 'ints'... I'm such a n00b when it comes to messing with sozobon... Since I'm not trying to build this with some real mode 16bit compiler, but rather MinGW.

KanedaFr
Administrateur
Posts: 1139
Joined: Tue Aug 29, 2006 10:56 am
Contact:

Re: Sozobon source code changes?

Post by KanedaFr » Sat Mar 26, 2016 10:11 pm

I looked in my archive : got only the binaries
I think paul never released the source...

All I have is on the readme.txt

Code: Select all

I have modified a version Sozobon C Compiler to work 'somewhat' with the
Sega Genesis.  What do you mean by 'somewhat'?  Well, there are still
some limitiations which the programmer must be aware of.  I have made
two changes to the Linker (ld) which allow the following:

1) All variables will start at $FF0000.
2) A new -g option will pad the output file with $FF on 128K boundaries.

neozeed
Interested
Posts: 11
Joined: Fri Sep 27, 2013 12:29 am
Location: hong kong
Contact:

Re: Sozobon source code changes?

Post by neozeed » Sun Mar 27, 2016 4:31 am

KanedaFr wrote:I looked in my archive : got only the binaries
I think paul never released the source...
Oh well it was worth a shot. I'll either have to run JAS under a debugger to figure out why it has issues with 32k, or just find another assembler capable of assembling Sozobon... Or see just how hard it is to run GCC. I guess the DJGPP port ought to have cut down dependencies for things like pipes, and anything multitasking. I know GCC 1.3 was easy enough to get running on MinGW, so maybe there is a way with really old GCC 2.x?

With any luck, maybe oneday patches will surface somehow.

Stef
Very interested
Posts: 3131
Joined: Thu Nov 30, 2006 9:46 pm
Location: France - Sevres
Contact:

Re: Sozobon source code changes?

Post by Stef » Sun Mar 27, 2016 10:08 am

What Operating are you using ? If you are on Windows you can pick up the bin folder of SGDK, it includes a minimalist GCC 3.4.6 version which allow you to compile C code for Sega Genesis. You will have to remove all useless files / tools used by SGDK.

Sik
Very interested
Posts: 939
Joined: Thu Apr 10, 2008 3:03 pm
Contact:

Re: Sozobon source code changes?

Post by Sik » Sun Mar 27, 2016 11:49 am

Nope:
neozeed wrote:I want to actually run sozobon on 68k hardware as well
Sik is pronounced as "seek", not as "sick".

neozeed
Interested
Posts: 11
Joined: Fri Sep 27, 2013 12:29 am
Location: hong kong
Contact:

Re: Sozobon source code changes?

Post by neozeed » Sun Mar 27, 2016 5:00 pm

Stef wrote:What Operating are you using ? If you are on Windows you can pick up the bin folder of SGDK, it includes a minimalist GCC 3.4.6 version which allow you to compile C code for Sega Genesis. You will have to remove all useless files / tools used by SGDK.
CP/M 68k, or something more bare/raw. I really really really don't want to run GCC. It's far too big and unwieldy.

Stef
Very interested
Posts: 3131
Joined: Thu Nov 30, 2006 9:46 pm
Location: France - Sevres
Contact:

Re: Sozobon source code changes?

Post by Stef » Mon Mar 28, 2016 10:50 am

Oh yeah sorry i didn't saw you wanted something running on M68K, i guess you can dig in the Amiga / Atari C compiler.
VBCC is a nice compiler and you can get the sources from here:
http://www.ibaug.de/vbcc/vbcc.tar.gz
VBCC hompage :
http://www.compilers.de/vbcc.html

The problem with Sobozon C compiler is that it's really broken, I started Genesis development with that compiler but quickly realized it suffers from too much bugs so i had to get back to GCC :-/

neozeed
Interested
Posts: 11
Joined: Fri Sep 27, 2013 12:29 am
Location: hong kong
Contact:

Re: Sozobon source code changes?

Post by neozeed » Mon Mar 28, 2016 4:43 pm

Stef wrote:Oh yeah sorry i didn't saw you wanted something running on M68K, i guess you can dig in the Amiga / Atari C compiler.
VBCC is a nice compiler and you can get the sources from here:
http://www.ibaug.de/vbcc/vbcc.tar.gz
VBCC hompage :
http://www.compilers.de/vbcc.html

The problem with Sobozon C compiler is that it's really broken, I started Genesis development with that compiler but quickly realized it suffers from too much bugs so i had to get back to GCC :-/
I know the Amiga folks patched it at some point to do 32bit ints instead of 16bit, as AmigaDOS is 32bit, while TOS is 16bit. Funny I was just reading about vbcc, and it's enormous ~900kb compiler size.. ugh I know it's far from perfect but sozo is so damned small, and relatively portable.

There is no doubt, the bigger machines got, the seemingly impractical size of GCC became moot.

It's just such a damned shame SEGA was so freaking cheap with the RAM. the best fit seems to be the 32x with it's glorious 256kb of ram, or the megaCD with it's 128kb shareable pages between the CD and main cpu. sigh

ehaliewicz
Very interested
Posts: 50
Joined: Tue Dec 24, 2013 1:00 am

Re: Sozobon source code changes?

Post by ehaliewicz » Tue Mar 29, 2016 10:40 pm

Do you specifically need a C compiler or just runtime code generation of some sort?

neozeed
Interested
Posts: 11
Joined: Fri Sep 27, 2013 12:29 am
Location: hong kong
Contact:

Re: Sozobon source code changes?

Post by neozeed » Wed Mar 30, 2016 3:47 am

ehaliewicz wrote:Do you specifically need a C compiler or just runtime code generation of some sort?

I wanted a tiny and portable c compiler (linker and assembler ).

I may just give up, or start debugging.

ehaliewicz
Very interested
Posts: 50
Joined: Tue Dec 24, 2013 1:00 am

Re: Sozobon source code changes?

Post by ehaliewicz » Thu Mar 31, 2016 6:06 pm

neozeed wrote:
ehaliewicz wrote:Do you specifically need a C compiler or just runtime code generation of some sort?

I wanted a tiny and portable c compiler (linker and assembler ).

I may just give up, or start debugging.
Or write your own :D

Sik
Very interested
Posts: 939
Joined: Thu Apr 10, 2008 3:03 pm
Contact:

Re: Sozobon source code changes?

Post by Sik » Thu Mar 31, 2016 9:45 pm

That'd be harder than fixing Sozobon though =P (an assembler only, on the other hand, may be easier)
Sik is pronounced as "seek", not as "sick".

neozeed
Interested
Posts: 11
Joined: Fri Sep 27, 2013 12:29 am
Location: hong kong
Contact:

Re: Sozobon source code changes?

Post by neozeed » Tue Jun 07, 2016 11:50 am

I put my crap work up on sourceforge.

The linker is doing something different at relocations I think. Maybe it is the stack/ram being at 0xff0000? I can't figure out what 004926 is...

Code: Select all

Comparing files demo5.bin and WORKING\DEMO5.BIN
0000035D: 00 FF
0000035E: 49 00
0000035F: 26 00
000006EB: 00 FF
000006EC: 49 00
000006ED: 26 00
000006F1: 00 FF
000006F2: 49 00
000006F3: 26 00
or

Code: Select all

Comparing files busted.bin and FVR_TECH_DEMO.BIN
00000325: 00 FF
00000326: 7F 00
00000327: 6C 1E
00000901: 00 FF
00000902: 7F 00
00000903: 4E 00
00000937: 00 FF
00000938: 7F 00
00000939: 4F 01
0000096D: 00 FF
0000096E: 7F 00
0000096F: 50 02
00000973: 00 FF
00000974: 7F 00
00000975: 51 03
00000979: 00 FF
0000097A: 7F 00
0000097B: 52 04
No doubt FF001E or FF0000 is something important... lol

But I could build the other sozo examples, and even the Fvr technical demo.

Post Reply