RetroBrew Computers Forum
Discussion forum for the RetroBrew Computers community.

Home » RBC Forums » General Discussion » Porting CP/M-68K to new HW: the oddity of the DRI CBASIC (CB68) compiler and how to solve
Porting CP/M-68K to new HW: the oddity of the DRI CBASIC (CB68) compiler and how to solve [message #8453] Sun, 11 April 2021 05:01 Go to next message
just4fun is currently offline  just4fun
Messages: 273
Registered: May 2017
Location: Dark side of the Moon
Senior Member
I'm currently in the phase of testing the available SW on my SBC.
After I've successfully tested (with the more.c utility) the C compiler inside the CP/M-68K distribution disks, I decided to test the CBASIC (CB68) compiler.

To compile a TEST.BAS program you have to produce the object file with CB68 TEST.BAS and then link the object file with the CBASIC library
to generate the TEST.68K executable with LINK68 TEST.O,CB68.L68.

At first a very simple program like this:

100 FOR I=1 TO 10
200 PRINT I
300 NEXT I
400 END

was successful.

Then I tried the "famous" ASCIIART.BAS and problems started from here.
All the "process" to generate the ASCIIART.68K was without any error, but the execution the ASCIIART.68K caused a strange error:

/forum/index.php?t=getfile&id=2079&private=0

I did some searches and found this thread here of an other person having the same problem on his board.
Even more strange on that thread was the fact that plasmo on his board could run it without any problem.

I've three different versions of my SBC assembled with different RAM sizes: 128KB, 512KB and 1024KB.
The 128KB one can't execute the CB68 compiler because it requires more memory, but both the other two boards gave the same problem...

So I started to do more tests and thinking why on plasmo board ASCIIART.BAS executed normally.
After a while I tried to change the CP/M-68K Memory Region definition on my BIOS (on the 1024KB board) using the same values he used on his board (start address: 0x20000 size: 0xA0000) and this was the result:

/forum/index.php?t=getfile&id=2080&private=0

So it turned out that CB68 was "sensible" on how the CP/M-68K Memory Region is defined inside BIOS...

After more tests I found the that the parameter that makes execute or fail a program made with CB68 was the Memory Region size: if the less significant hex digit of the size is 0x0 the executable runs, if is different from 0x0 it fails...

So changing the Memory Region size inside my BIOS from 0xF45FB to 0xF45F0 made the CB68 compiled program runs with no error.
The same on the other 512KB board (changing the Memory Region size inside my BIOS from 0x785F7 to 0x785F0).
On the 128KB board the equivalent modification made the ASCIIART.68K runs without errors too, but the CB68 compiler couldn't run because it requires more RAM.

So if you want use CB68 without problems in your custom board you have to chose a size of the Memory Region (inside your custom BIOS) as 0xYYYY0, where Y can be any hex value (the starting address of the Memory Region seems to be invariant respect the error, but I haven't done so much tests on that). Cool
  • Attachment: error_1.JPG
    (Size: 71.01KB, Downloaded 683 times)
  • Attachment: ok_1.JPG
    (Size: 224.00KB, Downloaded 606 times)

[Updated on: Sun, 11 April 2021 07:27]

Report message to a moderator

Re: Porting CP/M-68K to new HW: the oddity of the DRI CBASIC (CB68) compiler and how to solve [message #8455 is a reply to message #8453] Sun, 11 April 2021 06:54 Go to previous messageGo to next message
Yves-D. is currently offline  Yves-D.
Messages: 21
Registered: January 2020
Junior Member
Usually a 68000 CPU wants to see word and long reads to be word aligned in the memory space, including instruction fetch.
Perhaps your previous memory organization yields a word read on an odd address - this will result in an exception.
That's exactly what you've shown in your screen shot.

Yves
Re: Porting CP/M-68K to new HW: the oddity of the DRI CBASIC (CB68) compiler and how to solve [message #8457 is a reply to message #8455] Sun, 11 April 2021 14:44 Go to previous messageGo to next message
norwestrzh is currently offline  norwestrzh
Messages: 196
Registered: November 2015
Senior Member
Good catch, just4fun!! I'm the person who was having trouble getting any BASIC program of substance to run after compiling with CB68. A simple loop would compile and run. Plasmo's ASCIIART would compile and link without error, but coughed up that exception upon execution. I checked the definition of memory region in my version of the BIOS, and it was 1DFFFF! When I changed it (a little tricky to do without re-programming the ROMs), the program ran!

1 min and 4 sec on my 18.4 MHz 68000!

[BTW .... a C version of the program, cross-compiled with XGCC (Thanks, Johan), runs in about 13 secs. on the same SBC!]
[same XGCC version on my 68020 SBC (20 MHz) runs in 11 secs.]

Roger

[Updated on: Sun, 11 April 2021 19:27]

Report message to a moderator

Re: Porting CP/M-68K to new HW: the oddity of the DRI CBASIC (CB68) compiler and how to solve [message #8461 is a reply to message #8457] Tue, 13 April 2021 00:41 Go to previous message
just4fun is currently offline  just4fun
Messages: 273
Registered: May 2017
Location: Dark side of the Moon
Senior Member
norwestrzh wrote on Sun, 11 April 2021 23:44

...
[BTW .... a C version of the program, cross-compiled with XGCC (Thanks, Johan), runs in about 13 secs. on the same SBC!]
[same XGCC version on my 68020 SBC (20 MHz) runs in 11 secs.]
...

Hi, I've just learned a new thing.... never tried XGCC...
Previous Topic: old designs: Multibus I
Next Topic: old designs: Linux SBC computer


Current Time: Mon Mar 24 23:27:30 PDT 2025

Total time taken to generate the page: 0.03651 seconds