Page 19 of 39

Prog8 language and compiler topic

Posted: Wed Jan 05, 2022 2:41 am
by ZeroByte


On 12/27/2021 at 11:53 AM, desertfish said:




I have not yet worked with the mouse on the x16, but perhaps there is something similar going on?   If not, all I can say is compare the resulting assembly code from prog8 to your own code and try to discover where the difference occurs.   The easiest way to do this is by making a minimal reproduction program



The mouse in X16 is janky. It only returns screen X Y positions and buttons. (i.e. no dX dY options) and it coopts sprite 0 even if you don't want to have a pointer on the screen. You can specify a blank sprite as sprite0 as the graphic for the pointer, but sprite 0 will be positioned at the X,Y the Kernal wants it to be. Whenever I get zsound to the point where I push it out the door, I might get back on my widget library I was working on, where I planned to counter this by making the engine hide the kernal pointer and move it back to the middle of the screen on each frame so you won't ever run into the edge of the screen and not be able to continue moving the mouse in that direction.


Prog8 language and compiler topic

Posted: Wed Jan 19, 2022 9:09 pm
by desertfish

Version 7.7 has been released!   https://github.com/irmen/prog8/releases/tag/v7.7

Documentation here, as always https://prog8.readthedocs.io/



  • added pipe operator |>


  • added new syntax for string encodings, and added iso: encoding


  • on cx16: added txt.iso() to switch to iso charset


  • added @requirezp flag on variables to force them in Zeropage


  • added pokemon() function


  • fix assembly <-> prog8 label referencing issue (labels in asm no longer start with underscore)


  • less aggressive dead code (variables) removal


  • fixed some type casting issues


  • several small code gen optimizations


  • fix broken code generated for certain equality comparison expressions


  • several other bugfixes.




Prog8 language and compiler topic

Posted: Thu Jan 20, 2022 1:30 am
by Ed Minchau


On 1/19/2022 at 2:09 PM, desertfish said:




added pokemon() function



Gotta catch them all.


Prog8 language and compiler topic

Posted: Thu Jan 20, 2022 3:04 pm
by borgar

It's so nice to see so much regular progress for Prog8.

BTW, I first encountered a language with "piping" syntax during my university days. That was in the BETA programming language (https://en.wikipedia.org/wiki/BETA_(programming_language)). There is looked like this

(* x = 1 *)

1 -> x ;


(* x = f(1)  *)

1 -> f -> x ;


(* res = fibonacci(1,5)  *)

(1,5) -> fibonacci -> res;


Multiple parameters was supported and "safe" so that



(x, y) -> (y, x)



did a "swap".

This syntax is a lot easier read for long functions chains but I have to admit that I never got 100% comfortable with this syntax style. I guess the traditional Algol syntax was already firmly embedded in my skull by the time I encountered BETA.


Prog8 language and compiler topic

Posted: Thu Jan 20, 2022 6:47 pm
by desertfish


pokemon(address, value)



Attempts to write a byte to a ROM at a location in machine language monitor bank. Doesn’t have anything to do with a certain video game.



 



because writing to rom is not possible the function effectively does nothing and is implemented as such



 



 



 




Prog8 language and compiler topic

Posted: Thu Jan 20, 2022 7:04 pm
by desertfish

@borgarthe pipe was or is a bit experimental. It’s inspired by the pipe operator in f#. The implementation can perhaps be used later to serialize nested expressions, thereby avoiding the slow stack based approach. But it lacks some features to do this now


Prog8 language and compiler topic

Posted: Mon Jan 24, 2022 12:19 am
by desertfish

?  Version 7.7.1 has been released that fixes a bunch of compiler crashes.  https://github.com/irmen/prog8/releases/tag/v7.7.1


Prog8 language and compiler topic

Posted: Sat Feb 12, 2022 5:03 pm
by desertfish

?  Version 7.8 has been released   https://github.com/irmen/prog8/releases/tag/v7.8


  • removed old @"screencodes" string encoding syntax (use sc:"hello" instead)


  • library API change: moved cx16.vload() to cx16diskio module


  • API change: added alignment parameter to memory() function


  • library API change: string.find now returns index of character + carry bit status (instead of substring address)


  • completely rewritten variable allocation, resulting in large program size savings


  • diskio.list_files() now has a larger buffer to be able to list larger directories


  • restructured code generator and added -expericodegen command line flag to select alternate experimental code generator (only a stub at the moment)


  • tweak compiler output to be less noisy


  • various bugfixes and optimizations


 


Prog8 language and compiler topic

Posted: Thu Mar 03, 2022 7:59 pm
by desertfish

?  Version 7.9 has been released  https://github.com/irmen/prog8/releases/tag/v7.9



  • added atari compilation target, to create programs for the Atari 800XL. It's very rudimentary still.


  • breaking syntax change of the pipe operator |> : the functions in a pipe now have to be actual function calls (without the first argument specified), rather than just the function names


  • breaking change of the pipe operator |>: you can no longer use a variable at the end to store the value into. Just use an assignment instead.


  • sys.memcopy and sys.memset on the cx16 target no longer depend on kernal routine so now work even when the kernal is not banked in.


  • fix program crash bug caused by non-inlined asmsub not having a proper RTS instruction.


  • fixed compile time calculated constant results of sin() and cos() functions to now be identical to their runtime counterpart


  • better searching for used variable names inside assembly code so unused variable elimination is smarter


  • properly report duplicate label names


  • properly report invalid text encoding selection


  • properly report in check against non-constant range


  • many internal refactorings in the code generator as ongoing attempts to make it easier to change/replace



 


Prog8 language and compiler topic

Posted: Fri Mar 11, 2022 6:25 am
by KennethWilke

Wow, this is very impressive work! I need to put this in my queue of things to tinker with ?

I wrote a 6502 assembler a long while back but never did anything more with it.