Page 38 of 39

Re: Prog8 language and compiler topic

Posted: Tue Mar 12, 2024 9:53 pm
by hstubbs3
Funkheld

6502 CPU only has few registers... Accumulator (often called A), X and Y.. each is 1 byte - 0 to 255..
Multiple instructions allow indexing into memory using X or Y register ...

Actually, I gave some example of that in the other forum post, where you had asked about prog8 to save/load the current screen..

This bit here - uses X as a counter to track pages, y to index each byte of the page, and ZeroPage_PTR is 2 consecutive bytes in zero page of RAM ( $0000-$00FF ) set to some address like $HH00... the start of a page of memory..

LDX #num_pages
LDY #0
:
: LDA DATA0
STA (ZeroPage_PTR),y
iny
BNE :-
INC ZeroPage_PTR+1 ; this bit right here or you'll only keep overwriting that first page you're trying to write too.
DEX
BNE ;--


random index into array > 256 requires altering the highbyte... one _could_ create an array of arrays to manage the high byte themselves... IE say for 60 lines on screen, make an array sized 120 (60*2 bytes) to hold pointers to arrays with 160 bytes each (80 characters across the screen, char code + color data )

Then ... what line do you want? ... say 31... double it => 64 ... get bytes 64 and 65 into your pointer / memory address ... that would be the array to index for the other data ..

or if the arrays always start at beginning of page, would only need 1 byte for the first array, and access via the setting some ZP to $HH00 to index... but in this example, that would waste 96 bytes per line in memory...

(that bit -might- be more for desertfish to consider supporting a '2d' array of X pages... maybe in a way to span banks??? they are writing a compiler alone... it may be a bit much to ask )


I had provided some code for saving/loading the screen - maybe someone here could fill in the vars and such I wasn't sure on??

viewtopic.php?t=7266

sub screensave() {
ubyte *SAVEDSCREEN $someaddress_in_RAM ; // set the pointer here
for y1 in 0 to 60 {
cx16.vaddr_autoincr(1, VERA_TXTSCREEN + y1*$0100, 0, 2)
for x1 in 0 to 79 {
*SAVEDSCREEN = cx16.VERA_DATA0;
SAVEDSCREEN++;
}
}
}

sub screenload() {
ubyte *SAVEDSCREEN = $someaddress_in_RAM ; // set the pointer here
for y1 in 0 to 60 {
cx16.vaddr_autoincr(1, VERA_TXTSCREEN + y1*$0100, 0, 2)
for x1 in 0 to 79 {
cx16.VERA_DATA0 = *SAVEDSCREEN ;
SAVEDSCREEN++;
}
}
}

Re: Prog8 language and compiler topic

Posted: Tue Mar 12, 2024 10:55 pm
by funkheld
Hello, thank you very much for the quick information.

Now I'm going to go to sleep and I'll work on it tomorrow.

Thank you.
greeting

Prog8 version 10.2 released

Posted: Sun Mar 17, 2024 7:59 pm
by desertfish
:!: Prog8 version 10.2 has been released

https://github.com/irmen/prog8/releases/tag/v10.2

The most important change is that the compiler now treats booleans much stricter than before. No longer 'equivalent' to a byte 0 or 1. You'll need an explicit cast to convert between bytes and booleans now.

If you are using conditionals like "if integervariable {....}" you'll have to make it into a boolean comparison expression like so "if integervariable!=0 {....}" .

For all the gory details read the release notes on the github release page.

Re: Prog8 language and compiler topic

Posted: Mon Mar 18, 2024 12:44 pm
by funkheld
hello, thank you for version 10.2

What a great job you're doing, great.

:D :D :D :D :D

Thanks.
greeting

version 10.2.1

Posted: Thu Mar 21, 2024 7:33 pm
by desertfish
Prog8 version 10.2.1 is released https://github.com/irmen/prog8/releases/tag/v10.2.1

Unfortunately a rather severe error was found after the 10.2 release, in the code generator for logical expressions (and/or). This is now fixed.

PS the error was already present since version 10.0, just not discovered until now...

Re: Prog8 language and compiler topic

Posted: Sun Mar 24, 2024 6:16 pm
by funkheld
hello thanks for info.

greeting

version 10.3 released

Posted: Thu Apr 18, 2024 8:54 pm
by desertfish
:idea: Prog8 version 10.3 has been released: https://github.com/irmen/prog8/releases/tag/v10.3

There's a change in this version that's not backwards compatible with older code, so it may be required to make some simple changes:

It is now possible (and required) to assign all values returned from a romsub/asmsub that returns multiple values.
The void keyword can now also be used in a new way: as a dummy assignment target for any value you are not interested in in such a multi-value assignment.

Please read the documentation in the manual for details about this new feature: https://prog8.readthedocs.io/en/latest/ ... ultiassign

Re: Prog8 language and compiler topic

Posted: Sun Apr 21, 2024 8:24 pm
by funkheld
hello, thank you for the new version.

greeting

Re: Prog8 language and compiler topic

Posted: Tue Apr 23, 2024 1:23 am
by BrokenAnsible
This is such a great project. Thank you!

Version 10.3.1 released

Posted: Fri May 31, 2024 10:05 pm
by desertfish
Prog8 version 10.3.1 has been released

https://github.com/irmen/prog8/releases/tag/v10.3.1

This is a small update release to correct a few problems in 10.3, and a couple of easy changes. It's going to be the last release for a while because I need a summer break :) Other stuff and more complex bug fixes have to wait until after summer!

Library changes:
  • cx16.mouse_pos() now returns the mouse coordinates as unsigned words
  • cx16.mouse_pos() and cx16.mouse_get() now also return the scroll wheel position as extra return value in X
  • cx16: added diskio.f_tell()
  • added cx16.scnsiz (extapi call)
Other stuff:
  • added @nozp tag for variables that should never be placed into zeropage
  • miscellaneous bug fixes and documentation improvements
  • included a "profiler.py" script to process the emulator's new -memorystats dump file to see what parts of your program run the most