Prog8 language and compiler topic

All aspects of programming on the Commander X16.
User avatar
desertfish
Posts: 1096
Joined: Tue Aug 25, 2020 8:27 pm
Location: Netherlands

Prog8 language and compiler topic

Post by desertfish »


@KennethWilke prog8 was created for the Commodore-64 but then I was introduced to the X16 which massively spiked my motivation to work on it ?

User avatar
desertfish
Posts: 1096
Joined: Tue Aug 25, 2020 8:27 pm
Location: Netherlands

Prog8 language and compiler topic

Post by desertfish »


?  Version 8.0 has been released   https://github.com/irmen/prog8/releases/tag/v8.0

Documentation here: https://prog8.readthedocs.io/



A new major version release to commemorate the long awaited official "r39" release of the Commander X16 emulator and kernal roms.

Some fundamental changes were made there that had to be reflected in Prog8's cx16 target and libraries.



For current cx16 development, prog8 8.0 is required. Older versions won't work properly anymore.



Changes:




  • support for the official r39 commander x16 release (new Vera memory layout, changes to rom routines, etc.)


  • updated cx16 examples to new routines


  • breaking syntax change: ** operator has been removed. Use floats.pow() instead.


  • make '&&' a parser error instead of treating it as bitwise and followed by address-of


  • library API change: moved pattern_match() from prog8_lib to string module


  • fixed string encoding for escaped characters


  • fixed bug in codegen for containment check in bytearrays and strings


  • fixed error for certain typecasted expressions inside comparisons


  • fixed return type error for asmsubs with >1 result values


  • [internal] new simplified Ast meant to build better code generators on in the future


  • [experiment] new 'virtual' target and built-in VM to compile prog8 programs for


  • [experiment] new syscall builtin function to interface with the VM




 

User avatar
desertfish
Posts: 1096
Joined: Tue Aug 25, 2020 8:27 pm
Location: Netherlands

Prog8 language and compiler topic

Post by desertfish »


I've decided to remove the plethora of integer trig builtin functions (sin8u, cos8u, ...) in the next prog8 version.

My expectation is that if you need to use trig functions, that a tailor made implementation for your program is better than the general functions that prog8 used to provide.

I think I'll move the old builtin functions into a regular library module instead, if you really want to use them.

rje
Posts: 1263
Joined: Mon Apr 27, 2020 10:00 pm
Location: Dallas Area

Prog8 language and compiler topic

Post by rje »


A library module would be nice, since my custom trig things are neither particularly usable nor documented, so...

Looking over the stuff prog8 has, plus my using C for the past year for the X16, has finally started to pique my interest.

 

User avatar
desertfish
Posts: 1096
Joined: Tue Aug 25, 2020 8:27 pm
Location: Netherlands

Prog8 language and compiler topic

Post by desertfish »


They will get a place in the (existing) math module, as regular subroutines this time.

So the only thing that older code has to change, is prefixing them with "math." and then it will continue to work.

borgar
Posts: 52
Joined: Wed Mar 31, 2021 9:30 am
Location: Oslo

Prog8 language and compiler topic

Post by borgar »


I've had my old C64, 1741 floppydrive and an old Samsung "portable" TV in the attick so to speak for, well something like 30 to 35 years. During the the Corona period I dragged this out and tested and unfortunately my C64 didn't work anymore. Got the Light Blue/Blue screen without any text so I guess it could one of the ROMs that are bad. However, I did get hold of another C64 a few years ago that I hadn't tested yet. I found out the old power supplies where untrustworthy so I didn't want to risk anything and it took me a while to get around to order a new.

Well, now I have new powerbrick (ordered from here : https://www.c64psu.com/c64psu/43-1488-commodore-64-c64-psu-power-supply.html) and the other C64 works without any trouble so far. Even the 1741 workes fine. At least 4 of the 5 old floppies (with hrm, "backups") works. I still didn't have any way to get the game over to the C64 but after looking a bit only I ended up with a TapeCartSD solution (cheap, easy to use for non-disk images like prg files).

So today I tested Petaxian on real hardware for the first time.

I may have to make the game a bit harder since I beat this on first try even with the terrible joystic (none of the decent joystic I bought back then lasted very long as far as I remember).

The screen quality of the TV wasn't great when it was new, and has probably not gotten any better in the last 35 years and the antenna output is pretty bad as well. I actually tested with a monitor I have that takes just about anything as input (including from antenna) and the picture quality was actually worse than the one in the CRT. I'll just have to order C64 to SCART plug. Those are pretty cheap.

petaxian_on_a_c64.thumb.jpg.16df0dabb98bd71fd34b03396a061e3e.jpg

User avatar
desertfish
Posts: 1096
Joined: Tue Aug 25, 2020 8:27 pm
Location: Netherlands

Prog8 language and compiler topic

Post by desertfish »


Wow amazing!! I have yet to beat the game, but I play mostly with keyboard on the emulator, which isn't ideal for this.

 

Also, is that a D&D character sheet on the table?

borgar
Posts: 52
Joined: Wed Mar 31, 2021 9:30 am
Location: Oslo

Prog8 language and compiler topic

Post by borgar »



On 5/19/2022 at 1:58 AM, desertfish said:




Wow amazing!! I have yet to beat the game, but I play mostly with keyboard on the emulator, which isn't ideal for this.



 



Also, is that a D&D character sheet on the table?



Keyboard isn't as good as a controller that is true. And I may have played the game a few times more than you for some reason ?.

And well spotted, it's a D&D sheet. Though this was printed for my son and not myself. I haven't been able to inspire my son to take up computers and programming, but I did manage get him into D&D.

User avatar
desertfish
Posts: 1096
Joined: Tue Aug 25, 2020 8:27 pm
Location: Netherlands

Prog8 language and compiler topic

Post by desertfish »


?  Version 8.1has been released!  https://github.com/irmen/prog8/releases/tag/v8.1

Documentation here: https://prog8.readthedocs.io/

- API change: moved all integer trig builtin functions (sin8u, cos8u etc) to regular subroutines in the math module

- API change: moved all floating piont builtin functions to regular subroutines in the floats module

- API change: sum() builtin function was removed altogether

- API change: max() min() and abs() now always return uword type.

- API change: abs() supports only integer arguments now, use floats.fabs() for floating point.

- compiler now correctly accepts string multiplication "xxxx" * expr   where expr is not just a number literal (but still must be constant)

- compiler now automatically converts multi compare expression (if x==1 or x==2 or x==3..) into a more efficient containment check (used to only give a warning)

- compiler now gives a warning in many cases about shadowing symbols (re-definitions)

- compiler now automatically inlines some more trivial non-assembly subroutines

- added %option merge  to merge module content with existing

- improve checks for invalid pipe expressions

- improve error message for invalid args to min() and max()

- fixed superfluous printing of WARN and ERROR

- optimized cx16.setcc() and setcc2() library routines

- finished the 'virtual' compiler target codegen and the 'emulator'

- several other minor bugfixes and improvements

 

User avatar
desertfish
Posts: 1096
Joined: Tue Aug 25, 2020 8:27 pm
Location: Netherlands

Prog8 language and compiler topic

Post by desertfish »


?  Version 8.2 has been released!   https://github.com/irmen/prog8/releases/tag/v8.2

Documentation here https://prog8.readthedocs.io/

- Syntax change: The pipe expression "|>" has been removed from the language.

- Syntax change: now allows casting of negative numbers to unsigned (will result in the proper 2's complement)

- API change:  swap() builtin function has been removed.

- API change: boolean() builtin function has been added, to get the 'thruthy' value of a number.

- diskio.f_read_all() now returns correct size.

- cx16: fixed macptr() signature and it is now used in cx16diskio.f_read(),  vastly improving load times.

- fix for regression: again gives proper name redefinition errors in same scope

- Improved (not) mentioning of the GPL software license in the shared library files.

- greatly improved  code gen for logical expressions and array / pointer indexing.

- zsound examples added for cx16.

- improved compatibility with running the compiler on windows (some file/path errors solved)

- bugfixes.

 

Post Reply