Prog8 language and compiler topic

All aspects of programming on the Commander X16.
yock1960
Posts: 136
Joined: Tue Nov 16, 2021 8:42 pm

Prog8 language and compiler topic

Post by yock1960 »



On 12/13/2021 at 5:20 PM, desertfish said:




Don't "hunt" it down, it's dangerous to download random dlls from the internet. Instead install the Microsoft supplied runtime libraries https://docs.microsoft.com/en-US/cpp/windows/latest-supported-vc-redist?view=msvc-170



It's a bit weird that you don't have these yet I thought they came via windows updates automatically, but hey.



Well, what I meant was to figure out what it was...which I did, downloaded the redistributable on the desktop and was rewarded with the clean white screen. Intel graphics incompatibility I guess, but it's working on one machine anyway!

yock1960
Posts: 136
Joined: Tue Nov 16, 2021 8:42 pm

Prog8 language and compiler topic

Post by yock1960 »


By the way....this emulator looks way cool.....even if I don't know how to use all the extra goodies yet!

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

Prog8 language and compiler topic

Post by desertfish »


I am glad you eventually got it all to work, so I'll repeat myself : happy programming!

yock1960
Posts: 136
Joined: Tue Nov 16, 2021 8:42 pm

Prog8 language and compiler topic

Post by yock1960 »


I know that an IDE for Prog8 is being worked on, but for the time being, if anyone is interested, Relaunch64 works, except that you need to name your source files .asm and add the -out /dir command option to the 'run' script, to send the output files to another directory to prevent your source from being overwritten. I had hoped there was a way to open any text file, but it's limited to .asm only. One could modify the source to allow this, but that's beyond me currently. A really talented and determined individual could even create additional Quick Reference tabs specific to the CX16, to add to the nice ones that already exist for the C64!

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

Prog8 language and compiler topic

Post by desertfish »


That's great news that you can coax other editors that you like into using prog8 as well, but it really does sound unfortunate (and a bit silly, in my opinion) that relaunch64 only accepts .asm files.

What other tools are people using to code in prog8?

Personally, I'm using IntelliJ IDEA. Here's me working on my image viewer program:

image.thumb.png.7c54e5951657e20b34f21b9792d53927.png

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

Prog8 language and compiler topic

Post by borgar »


I started out using Emacs in plain text mode which worked well enough for me. Though I have mainly switched to Visual Studio Code with Adam Kubiczek's syntax highlighting (https://github.com/akubiczek/Prog8-TmLanguage-VsCode) now.

Generally, I prefer fairly basic editors over IDE's and it turns out VSC does the lightweight IDE well.
prog8_work.png
yock1960
Posts: 136
Joined: Tue Nov 16, 2021 8:42 pm

Prog8 language and compiler topic

Post by yock1960 »


So, just dipping my toes into the water, writing the ubiquitous Hello World program, but outputting to 640x480x4 hires mode. I can see that I'm going to need to print out Borgar's code to get more example code to peruse, this in addition to the Prog8 manual and various library sources. After a few errors, I got the program working, but I have a warning that, while it doesn't hurt anything, I have no clue how to properly code:

keyp = c64.GETIN()

to avoid the warning. 

Also, I'd like to use, I guess cx16.enter_basic() to gracefully exit the program, but don't know how to pass...and what to pass...@Pc!

Oh and in the GFX2 source for the text() sub, you may want to note that the screen code 'string' requires a terminating null....seems obvious....but to an even ranker novice than I...

   

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

Prog8 language and compiler topic

Post by desertfish »


@yock1960 there are many examples included in prog8 that you can study https://github.com/irmen/prog8/tree/master/examples

all strings in prog8 should be 0 terminated which is hopefully documented in the manual , if not or unclear please let me know. Note that strings declared in prog8 are automatically 0 terminated .

returning to basic is just exiting from the start() routine.  You’ll have to set zeropage use to basic safe though. Read the manual I about the %zeropage directive, or study some examples to see how it’s done! Good luck 

yock1960
Posts: 136
Joined: Tue Nov 16, 2021 8:42 pm

Prog8 language and compiler topic

Post by yock1960 »


Is there anything different going on 'under the hood' as far as the mouse is concerned? As part of learning to code in Prog8, I've been working on porting my fractal explorer from assembly, but I just can't seem to be able to read the mouse buttons. I've got the assembly version working under R39 & Box16, so I know the code works...but even inlining it refuses to work from Prog8. I'm out of ideas!

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

Prog8 language and compiler topic

Post by desertfish »


No, prog8 itself has no idea about the mouse. It just compiles to assembly code that is run....

I do know that there was a weird thing going on when reading the *joystick* though. See https://github.com/commanderx16/x16-rom/issues/203

Basically the default IRQ handler can mess up the results  from the joystick_get() kernal routine.

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

Post Reply