Sunday, December 21, 2014

8Mhz "On Semiconductors" 68008 runs at 12.5Mhz

From several sources I know that Motorola MC68k parts do not like to run on higher freqs then nominal.
At least that's not true for "On Semiconductors" parts.

Friday, December 19, 2014

Mathew Brandt's c68 and CP/M 68

While looking for C compiler for CP/M 68 looks I've found something that looks quite fine.
As for version "5.1 (beta)/25 Apr 2002" c68 taken from http://homepage.ntlworld.com/itimpi/compsrc.htm has
-cpm68 option and it somehow work. It even claims that it generates AS68compatible source.
There are a lot of versions of this compiler on the net, but this one is surely the best I've tried (but as I understand it's unable to compile itself, what a pity)
The way it does not work is writing hex as 0xXX, not as $XX, so here is a fix:
out68k_c.c:
PRIVATE void put_byte P1 (UVAL,val)
{        
    put_header (bytegen, alignment_of_type (tp_char));
    oprintf ("$%lx", (unsigned long) (val & OxffUL));
/*DtZ     oprintf ("0x%lx", (unsigned long) (val & OxffUL)); */
    outcol += 4; /* or  should be changed to +3 ? */
}

PRIVATE void put_word P1 (UVAL, val)
{
   put_header (wordgen, alignment_of_type (tp_short));
/*DtZ     oprintf ("0x%lx", (unsigned long) (val & OxffffUL)); */
    oprintf ("$%lx", (unsigned long) (val & OxffffUL));
    outcol += 6; /* or should be changed to +7? */
} 

Next, AS68 does not need/want "\t.sect", it accepts .data and .text directly.
out68k_c.c:
static void seg P3 (enum e_sg, segtype, const char *, segname, SIZE, al)
{
 nl();
 if (curseg != segtype) {                                                                                     
/*DtZ   oprintf ("\t.sect\t%s%s", segname, newline);*/                                                        
        oprintf ("\t%s * Segment %s", segname, newline);                                                       

And you should edit config.h the way it can generate for 68000 and to check the compiler binary you get can do -cpm68k and -int=16.
Next, remember that's just compiler, not even preprocessor: so on unix side I had to do
cc -E -I/home/dtz/8BIT/68K/CPM1.3/DISK4 main.c > p_main.c
./cc68 -int=16 -cpm68k -v p_main.c > main.s
Also, note that standard CP/M 68's headers lacks most of the C functions; so I had to copy them from "C language programming manual" (do not forget to add link link there!)
On CP/M system, assemble the file with AS68 -U file.o, and then link it with CLINK.SUB
UPD: More, the code it generates can be feed to jas assembler mentioned some time ago.
UPDD: Looks like optimization code is faulty.
UPDDD: 201607 Mirrored Here

Monday, December 8, 2014

Sozobon's JAS runs at CP/M 68K

As I expected, JAS from Sozobon C compiler for Atari was easy to port back to CP/M 68 and it works natively.
To do it, do the following: compile Sozobon C on unix host (see virtuallyfun.superglobalmegacorp.com/?p=97 (or mirrored on my site), then compile jas by xhcc, now using makefile , not make.unx.
First, make a small patch in main.c:
        if ( freopb( ofile, "w", stdout ) ==  NULL )
                error( 0, "can't open object file for writing" );
      if ( freopen( ofile, "bw", stdout ) == (FILE *) NULL )
             error( 0, "can't open object file for writing" );


Then take CP/M-68 1.3 distribution files; here you'll find DISK4 and header files on it. You have to convert them to lowercase and erase all symbols after (and including) ^Z.
Then edit makefile to became smth like that:
CC = ./xhcc
CFLAGS = -c -v -O -I/home/dtz/8BIT/68K/CPM1.3/DISK4
Run make, you'll get 10 *.s files; then assemble them by jas:
#!/usr/local/bin/tclsh
foreach f [glob *.s] {
 exec ./xjas -8 $f
}
You'll get 10 .o files. Transfer them to CP/M 68K host and link by DRI's LO68: c:lo68 -R -u_nofloat -o jas.68k c:s.o CBUF.O CPY.O GEN.O HDR.O LEX.O MAIN.O OPS.O OPT.O PARSE.O PASS.O SCAN.O SYM.O c:clib And know what? It works! (do not forget to add -8 switch when calling jas). However, that's not very useful as assembler, but better to have an assembler with SOURCE as alternative to AS68.
Get it from here ;-) [ok from here]

Sunday, December 7, 2014

Use of Sozobon C on CP/M 68

I've tried to make some use of Sozobon C compiler to be somehow-used on[or together with] CP/M 68.
First, it can be compiled on modern Linux/MacOSX; that's good. And the thing that is useful is xjas assembler. At least with -8 flag it generates .o files with can be linked natively on CP/M'68 lo68.

And, what I say? I say: GOOOOOOOOOD!