Login
Back to forumReply to this topicGo to last reply

Posted By

Csabo
on 2014-07-16
13:55:09
 PLUS-Comp Found!

PLUS-CompThis is just a quick note that a long time missing utility, PLUS-Comp has been found. (It was on the B side of Pluvi 32, so, in a way we've already had it on our site all this time...) It's a BASIC to Machine Language compiler, similar to AustroSpeed (or the much lesser used Micro-BASIC-Compiler). In the past there have been some interest about these (as well as some very dedicated reverse engineering efforts), so it's probably worth a quick mention. Check it out if you're interested!

Posted By

SVS
on 2014-07-23
13:55:09
 Re: PLUS-Comp Found!

Very nice find!
I see in the table of the mag that this "new" compiler is more efficient in compiling code than the good Austrospeed (compiled file length).
I would like very much to try it but... it is in Hungarian language, and the article too.
Then, is there a good soul in the +4 scene, knowing the Hungarian, that can translate it? (Pleeeeze)
Many thanx!

Posted By

Csabo
on 2014-07-24
14:09:19
 Re: PLUS-Comp Found!

I added some of the translations to the details page. One thing I noticed just now, running a little test, that it seems this cannot handle BASIC V3.5 commands...

Posted By

MMS
on 2014-07-24
19:49:56
 Re: PLUS-Comp Found!

first part of the article. Sorry for the lot of errors and type mistakes, this was the best I could do now after 12 hours of hard work in office. Please do not be too critical on my bad English, today I dried out happy


The preconditions of the efficient program development are those softwares supports that work to be done. The PLUS-comp is a BASIC compiler that is compatible from "down" with the 3.5 version of BASIC. This program is the youngest version of the B-G-S compiler family.
Compiling of the BASIC programs can be done on Plus4 or C64 machines.
On both machines you can generate a machine code program that runs on a C16 machine. These C16 programs should not contain GRAPHIC command, as the P coded program memory requirement is 7.25KB even if the program contains only 1 BASIC line (this is the compiler code).

You should use the floppy disc, as a tool of compiling. The available 4 compiling modes may fulfill the
requirements of developers and home users too.

The hardware requirements are:
-1 Plus4 of C64 machine
-1 or 2 floppy disc drive (VC-1541 or compatible)
-1 MPS801 printer or compatible, in case there is a need to see the error codes on paper

In case during compiling there is an error, the line number and the error
codes are printed on the scren and on the printer too.

The error messages are in Hungarian language.
-SYNTAX ERROR - the same happy
-TYPE MISMATCH - incorrect character type (?)
-UNDEF'D STATEMENT-number is not defined
-BAD SUBSCRIPT-bad description
-OVERFLOW- data overflow

The compiler uses integer arithmetic. The real numbers are stored as integer, if the conversion is possible. In case other real constants the P code stores the numbers in floating point mode, so the
commands can be done faster.
If the FOR..NEXT uses Integer than the memory requirement of the cycle decreases
only to 9 bytes. As the variables has direct access and the commands are directly operated, the perations goes directly to the command's memory address.

The compiling can be executed on one or two disc drives. If you have only one drive, then only the 1st mode is available. With two drives you may even do automaitic batch compiling and you may use the advantage of the overlay technic (2, 3, 4 modes)

Posted By

SVS
on 2014-07-25
08:12:13
 Re: PLUS-Comp Found!

I want to thank you Csabo for the adds and MMS for the heroic translation (I'm glad your love for Plus4 is greater than the tiredness).

Me too I've the suspect that this compiler acts only with 2.0 Basic. I'll test it to see if a 3.5 command is passed to standard (non-compiled) execution or if it causes an error.

I've found a warning regarding the GETKEY command that never has to be used in the source files.

Plus-Comp produces a so called P-code file (not pure ML) but the table on the mag shows that it is much shorter than an equivalent one by Austrospeed.

And at end there is the option "Menu" mode that is missing in Austrospeed.

*** Awaiting for your discoveries! happy

Posted By

Csabo
on 2014-07-25
11:05:50
 Re: PLUS-Comp Found!

Just a quick note: the benchmarks are based on the short BASIC program on the left side of the page on page 5. You could type that in and compile it yourself with both AustroSpeed and PLUS-Comp, then see the outcome for yourself.

Posted By

MMS
on 2014-07-25
12:45:13
 Re: PLUS-Comp Found!

will continue today. As i saw there is a way to use v3.5 commands. Maybe Graphic command limitation is just for c16

Posted By

JamesC
on 2014-07-25
16:23:13
 Re: PLUS-Comp Found!

@MMS: I'm curious whether it can handle BASIC 3.5 or not. The way I interpret the article (admittedly with no knowledge of the language), the ability to compile on a Plus/4 or C64 would limit this compiler to BASIC 2.0 commands.

Looking forward to your translation. happy

Posted By

MMS
on 2014-07-27
12:09:53
 Re: PLUS-Comp Found!

Second part:

The compiler offers 4 different modes
1) Compile one program on Drive 8
2) Compile a pack of programs from Drive 8 to Drive 9 in the order of Drive 8 directory
3) Automatic compiling of a program pack. It is the same as the Mode2 with the difference, that
only the first program gets the machine code runtime routine pack, the rest of the programs
will be loaded over this first one
4) Automatic compiling with overlay technic. It is the same as Mode3 with the difference that
the first program contains the variables of all programs, so the programs will take from each
other the values in variables and dims

The BASIC programs compiles in three steps: A, B, C.
The A step executed only when the overlay technic used.
In step B the program prepares the work files that are linked together in step C.

There is a special case when GRAPHIC command used. The GRAPHIC command moves the BASIC
programs from position $1000 to $4000. Such programs need to be compiled with GRAFIKUS compiling mode. In such cases the the compiled machine code program need to be loaded directly to $4000.
The Compiler "downwards" compatible with the BASIC 3.5, as the compilation method was worked
out based on BASIC2.0. Because of this, there are some commands where we should tell the
Compiler program, that a BASIC3.5 command will come. In most of the cases the detection of
V3.5 commands is automatic, but few commands need to be extended with a compilation
directive.
We can choose from three different directives. (The difference is between the limits of the directives: how long the the special handling mode to be used).
:: = one command
<- = command line (back arrow)

#be = beginning of a program module
#ki = end of a program module

The Compiler can accept the own developped BASIC expensions too, these commands should be handled in the same way as the BASIC3.5 commands.

From 1986 onwards you can buy at Novotrade shops the B-G-S Comp(P) compiler family for
Commodore64. The meaning of the B-G-S:
B = BASIC
G = Supergraphic 64
S = Simons BASIC
It can compile the above BASIC versions on systems with one or two floppy drives. With two
floppy drives (P) can execute all 4 compiling mode even on a Commodore 64 machine too. The
above three compiling directives can be used here too, that may help reducing memory
requirement and improving program speed.

The S-Comp(P) knows more functions than the better known SIMONS-COMP versions.
The P code programs generated with SIMONs-COMP cannot switch back from the graphic mode to normal character screen, it gives an error code "?NEXT WITHOUT FOR ERROR", and stops.
The same failure does not happen with the programs compiled with S-COMP. S-COMP let it using the sprite and DESIGN command too, this is impossible at SIMONS-COMP.

There was a benchmark to compare the normal BASIC with the compiled programs and to find
the fastest compiled P code with a program built up from 9 blocks.

The best average was realized by the PLUS-COMP (+COMP), the end result was way faster than any
C64 compiler.
(see attachement PLUS-COMP result.JPG)



MMS side comments:
-There was no example given how the special directives should be used, so some tests needed here

-It is the proper way use integer variable in FOR-NEXT cycle to speed it up drastically (12x faster than original Plus4 V3.5):

FOR I%=1 to 10000
NEXT

It did not work in Austrospeed compiler when I tested it, but maybe the NEXT command without variable is the key to success?

-In normal mode C64 seems faster than Plus/4, when arithmetics, DIMs, FOR/NEXT used. DIMs seems make situation much worse, the average 10% difference grows to 20%. So compiler really needed to compensate bad lines and ROM/RAM switching happy

Posted By

SVS
on 2014-07-27
08:39:11
 Re: PLUS-Comp Found!

@MMS: great work.
Just a confirmation, is it correct the "::" before a Basic 3.5 command? Because inside the code I've found this string:

"BASIC 3.5 = (rvs)";:SYS5761:

Posted By

MMS
on 2014-07-27
12:25:56
 Re: PLUS-Comp Found!

I dunno happy
the scan quality is not perfect, could be :: or ;:
checking again i noticed for complete line compilation you need a <- (back arrow) and not a -.
Just corrected

Posted By

SVS
on 2014-07-29
08:35:35
 Re: PLUS-Comp Found!

>>FOR I%=1 to 10000
>>NEXT

>>It did not work in Austrospeed compiler when I tested it, but maybe the NEXT command without variable is the key to success?

No. Austrospeed can surely use either integer or FP variable. Of course integer is faster. I don't know why you failed with it. Anyway the use of NEXT without variable is allowed.
I've even observed that NEXT: NEXT works faster than NEXT x: NEXT y.

@Csabo: the referring to Micro-compiler is not correct :), because it is the lone (known) compiler to true ML. On the contrary Austro* and +4 Comp compile to P-code.

Posted By

MMS
on 2014-07-29
11:06:32
 Re: PLUS-Comp Found!

OFF (side comment):
would be great, if the compliler would able to change/swap the original slow V3.5 drawing and paint routines with newer, blazing fast ML ones, not to mention an optimized SSHAPE and GSHAPE for a potential sprite simulation within BASIC happy (the holy grail. it is almost there, but slow, probably beacsue of the too many arguments and possible options set in the original routine, not to mention the blinking due to uncontrolled timed writing to gfx memory)

Less complex commands with less parameters (kind of limitation) could be more sufficient for BASIC development than the currently slow ones (just passing the compilation).
I remember there were some fast gfx routines in a C=64 HW hacking magazine, not to forget the suprisingly fast drawing routine of LITWR (HN2010YC)...

Posted By

MMS
on 2015-08-18
19:58:55
 Re: PLUS-Comp Found!

Update:
I added the full English translation to the PLUS-Comp page directly.


I dunno if anyone tested this compiler with something more complex? some real life experience?
As it seems to able to better handle the special +4 commands than the Austro, I will try this with my "project", as I need some speed for the sprite emulation in BASIC, will be done with GSHAPE commands. No big expectations on fluent movement, just something "basic", ehehehe. I want to build it in for future RS232 mouse support, if that project will ever finish, too. happy
(I think once I uploaded a BASIC program demonstrated did this, but cannot find any more (I had two PC craches since then) )

still, I have questionmarks, how the A$ can be filled up with data, if I may preload the string with data without using SSHAPE command and drawing on the screen. I will test it...

Posted By

SVS
on 2015-12-15
07:43:52
 Re: PLUS-Comp Found!

@MMS
Sorry for the late answer.

>>I have questionmarks, how the A$ can be filled up with data, if I may preload the string with data without using SSHAPE command and drawing on the screen.

There is a bug (or lack of info) in the SSGAPE command. I've experienced when you save to file a variable used by it. When you read the variable from file and set it to GSHAPE the result is a wrong horizontal size of the box.



Back to topReply to this topic


Copyright © Plus/4 World Team, 2001-2024