Page 8 of 39

Prog8 language and compiler topic

Posted: Sun Mar 21, 2021 7:46 pm
by desertfish

Hm, In the meantime, I've discovered a few bugs in the comparison operators (such as <, >, <= etc).

This means I will probably add one more release soon with optimized and fixed code for this.   Also with a few other nice things such as a vload() routine that does the same as the VLOAD basic command.


Prog8 language and compiler topic

Posted: Thu Mar 25, 2021 9:39 pm
by desertfish

Prog8 6.4 was just released.

As always the documentation is here and the git repository is here.

It contains fixes for the bugs mentioned above, further optimizations, and the code generator is now finally fully completed.  There's also a cx16.vload() function now that is similar to basic's VLOAD. Have a look at the release notes on Github if you want all the details


Prog8 language and compiler topic

Posted: Wed Mar 31, 2021 9:21 am
by borgar


On 3/25/2021 at 10:39 PM, desertfish said:




Prog8 6.4 was just released.

As always the documentation is here and the git repository is here.



It contains fixes for the bugs mentioned above, further optimizations, and the code generator is now finally fully completed.  There's also a cx16.vload() function now that is similar to basic's VLOAD. Have a look at the release notes on Github if you want all the details



Hi, I have been tracking the X16 project for a while but never really been completely "hooked". I didn't want to edit basic in the X16 (or Vice) emulator and didn't feel like going back to 6810 assembly (though I did write some simple demos back in the 80's). Prog8 however, seemed like a nice intermediate step, not requiring writing commodore basic but without having to go to assembly. And it's been fun messing around with this a bit.

I've begun writing a small character based game inspired by Galaga since I wanted to see if I can get the interesting "double character resolution" movement using the PETSCII chars that that game uses.

Some of my code now fail to compile after update to 6.4 with 

  ERROR it's not possible to use more than one complex array indexing expression in a single statement; break it up via a temporary variable for instance

which worked fine with 6.3. I can of course use temp variable in the code to avoid "complex index expressions" but wondered if this was an intentional change.

Here is a sample of the affected code (I'm using a single array to hold multiple bullet objects and indexing using const ubyute's like fp_x and fp_y)



  sub clear(ubyte bull_num) {

    offset = bull_num * 4


    txt.setcc(bulletData[offset + fp_x], bulletData[offset + fp_y], main.CLR, 2)

  }



Prog8 language and compiler topic

Posted: Wed Mar 31, 2021 12:17 pm
by desertfish

yeah it was intentional (unfortunately)

I'm struggling with the code generator for complex array index expressions. The reason you now see this error is because I reduced the number of automatically generated internal temporary variables to hold expression results.

Suggestion for now: add 2 variables yourself for the x and y arguments to setcc().   I think the resulting assembly code will be more optimized that way as well.

Maybe this limitation will be lifted again in a future version of the compiler.


Prog8 language and compiler topic

Posted: Thu Apr 01, 2021 12:23 pm
by borgar

No worries, this is just a few trivial fixes in the code.

I'm just thinking how much fun it would have been to have something like Prog8 back in the day. But of course that would have had to be compiled directly on the c64 and that might not have been very feasible (at least the compile cycle wouldn't likely have been very fast). At that time I coded using a hex monitor which wasn't very flexible (or forgiving) ?


Prog8 language and compiler topic

Posted: Thu Apr 01, 2021 12:31 pm
by desertfish

Yeah I think it’s pretty much impossible to have the same full featured prog8 compiler optimizer and code generator natively. Then again there is a (limited) native C compiler that I also thought not being possible at all. 

I was using a macro assembler on the Commodore 64 back in the days


Prog8 language and compiler topic

Posted: Thu Apr 01, 2021 2:18 pm
by Greg King

If you want to see the native stuff that we had back in the good old days, then look at https://www.lyonlabs.org/commodore/onrequest/collections.html

and https://telarity.com/~dan/cbm/languages.html


Prog8 language and compiler topic

Posted: Thu Apr 01, 2021 2:37 pm
by desertfish

Wow that is amazing @Greg King

now i remember more, I used Simons basic and Logo as well. But both weren’t compilers.  


Prog8 language and compiler topic

Posted: Fri Apr 02, 2021 7:30 pm
by desertfish

@borgar i'm curious about your experiences with Prog8 so far. I'm not really aware of anyone else beside myself using it, so I wonder what you think of it and if you have any comments maybe?


Prog8 language and compiler topic

Posted: Sat Apr 03, 2021 9:37 am
by borgar

I quite like Prog8. It's almost exactly what I though it would be, I.e a low level language that produces fairly efficient code (at least compared with Basic) while abstracting away the most tedious parts of assembly.

I'm exactly the right age (50) for feeling nostalgic for the simplicity for the 80's computers (I used to own a C64 and later an Amiga 500).  On the other hand I work as a developer (well more as a dev manager now) and have no desire of writing anything in Commodore Basic again.

I don't have any serious feedback for the language so far. I've had experience with quite a lot of languages over the years so the syntax is comfortable. I actually like that the syntax is simple and limited. It matches well with the concept for X16. I.e. working within a simple and constrained platform where you have to get the most out of limited resources/capabilities

The only thing that I have missed so was a bit of doc for libraries (e.g. for txtio). Just a list of functions with signatures and simple description. But I just got these in the source so no worries. With a userbase of 1 I can see why this hasn't been a huge priority ?