Thoughts on Higher Level Language Design for 6502 Systems

Discuss technical or other issues relating to programming the Nintendo Entertainment System, Famicom, or compatible systems.

Moderator: Moderators

User avatar
qbradq
Posts: 952
Joined: Wed Oct 15, 2008 11:50 am

Post by qbradq »

After some thought I realized that I have no experience with the CC65 compiler. The C compiler I use at work is an old HP compiler from 1995 (don't ask) that has only the most rudimentary optimizations. I have spent some quality time with CC65, and I am very impressed at the efficiency of the code it produces.

Much of the optimization I had in mind for this language are already present in CC65 (such as static location evaluation). The only real difference is that my language would try to prevent you from shooting yourself in the foot (with regards to performance), where as CC65 ensures that what you express in C will (eventually) happen on the CPU :D

For now I am putting the breaks on this language idea and seeing how far I can go with CC65.

Thanks for all of the input!
User avatar
thefox
Posts: 3139
Joined: Mon Jan 03, 2005 10:36 am
Location: Tampere, Finland
Contact:

Post by thefox »

qbradq wrote:Much of the optimization I had in mind for this language are already present in CC65 (such as static location evaluation).
What do you mean by "static location evaluation"?
Download STREEMERZ for NES from fauxgame.com! — Some other stuff I've done: fo.aspekt.fi
User avatar
qbradq
Posts: 952
Joined: Wed Oct 15, 2008 11:50 am

Post by qbradq »

Not always using the stack for expression evaluation.
User avatar
thefox
Posts: 3139
Joined: Mon Jan 03, 2005 10:36 am
Location: Tampere, Finland
Contact:

Post by thefox »

qbradq wrote:Not always using the stack for expression evaluation.
Ah OK. I kinda wish it knew how to 1) use global/static memory for local variables and function parameters whenever possible (instead of stack) 2) to re-use the said memory areas for different functions. Currently it's possible to specify local variables as static with a compiler switch, but even then it'll not reuse the same memory areas.
tepples
Posts: 22345
Joined: Sun Sep 19, 2004 11:12 pm
Location: NE Indiana, USA (NTSC)
Contact:

Post by tepples »

I believe it uses the stack under the assumption of the possibility of (non-tail) recursive calls. If there are recursive calls, automatic variables have to be put on the stack. The compiler has to decide whether to use the stack or static allocation for automatic variables at compile time, and it doesn't know whether or not there will be recursive calls until link time (unless all functions that a given function calls are static).
User avatar
thefox
Posts: 3139
Joined: Mon Jan 03, 2005 10:36 am
Location: Tampere, Finland
Contact:

Post by thefox »

tepples wrote:I believe it uses the stack under the assumption of the possibility of (non-tail) recursive calls. If there are recursive calls, automatic variables have to be put on the stack. The compiler has to decide whether to use the stack or static allocation for automatic variables at compile time, and it doesn't know whether or not there will be recursive calls until link time (unless all functions that a given function calls are static).
Yeah I get that, it's completely reasonable from compiler design point of view (given it's the "C way"). It's just unfortunate that vast majority of time recursion isn't used. Of course this problem is solvable (link time code generation) but it probably won't happen in CC65 any time soon.

I'll have to give Atalan a serious try some day.
User avatar
qbradq
Posts: 952
Joined: Wed Oct 15, 2008 11:50 am

Post by qbradq »

I just wish Atalan's syntax was not so esoteric.
tepples
Posts: 22345
Joined: Sun Sep 19, 2004 11:12 pm
Location: NE Indiana, USA (NTSC)
Contact:

Post by tepples »

thefox wrote:
tepples wrote:The compiler [...] doesn't know whether or not there will be recursive calls until link time (unless all functions that a given function calls are static).
Yeah I get that, it's completely reasonable from compiler design point of view (given it's the "C way").
I guess a compiler-specific extension to the C language might be useful for marking a function as not callable in a recursive manner other than tail-recursive. Compare to things such as __attribute__ ((pure)) that GCC implements.
slobu
Posts: 275
Joined: Tue Jul 12, 2011 10:58 am

Post by slobu »

qbradq wrote:I just wish Atalan's syntax was not so esoteric.
Someone is developing a Scratch module for Atalan:
http://work.playpower.org/w/page/350757 ... n-Compiler

Hopefully this is a start of a robust, newbie friendly development platform for the NES. Alas, no downloads yet so it may end up vaporware. Would LOVE to be a tester for it!
User avatar
cpow
NESICIDE developer
Posts: 1097
Joined: Mon Oct 13, 2008 7:55 pm
Location: Minneapolis, MN
Contact:

Post by cpow »

slobu wrote:Someone is developing a Scratch module for Atalan:
http://work.playpower.org/w/page/350757 ... n-Compiler

Hopefully this is a start of a robust, newbie friendly development platform for the NES. Alas, no downloads yet so it may end up vaporware. Would LOVE to be a tester for it!
My experiences with PlayPower end up being vaporware. Several times over the past several years they've expressed interest in helping with specific pieces of NESICIDE so that their developers can use it. [When I say specific I mean "help you add support for the Famicom keyboard" or "support for mapper nnn"] Then there was the GSOC thing that fell through -- not their fault but, whatever.

Your mileage may vary...
mrm78
Posts: 7
Joined: Wed Oct 05, 2011 10:24 am

Post by mrm78 »

Hi, i am marcel from germany.
Rudla and me are working hard on ATALAN & Scratachalan..

Be sure :) it will not be vaporware.

My part is of the project is my Bachelorthesis..
if this is vaporware.. then i am DOOOMED :D

we would be very happy to get people to help us..
We have to stay realistic, its a big programm..
and a the start there will only be simple games possible with it.

Currently i am searching for good Background & Sprite editors... if anybody can give me some tipps... it would be cool.
Tnx ;)
greetings rudla& marcel
tepples
Posts: 22345
Joined: Sun Sep 19, 2004 11:12 pm
Location: NE Indiana, USA (NTSC)
Contact:

Post by tepples »

mrm78 wrote:Currently i am searching for good Background & Sprite editors... if anybody can give me some tipps... it would be cool.
Tnx ;)
For still backgrounds, you could try the Python-based image converter and nametable editor that I've included with all my latest projects (Concentration Room, Thwaite, Zap Ruder).
slobu
Posts: 275
Joined: Tue Jul 12, 2011 10:58 am

Post by slobu »

Hey Marcel!

Have you looked at these places for sprite tools?
http://bobrost.com/nes/resources.php#devtools
http://www.zophar.net/utilities/nesgraph.html
http://www.romhacking.net/?category=10& ... tle=&desc=

It may be better to make your own editor and then use a tile convertor to go from .BMP to .CHR

Can't wait to test out Scratchalan :)
mrm78 wrote:Hi, i am marcel from germany.
Rudla and me are working hard on ATALAN & Scratachalan..

Be sure :) it will not be vaporware.

My part is of the project is my Bachelorthesis..
if this is vaporware.. then i am DOOOMED :D

we would be very happy to get people to help us..
We have to stay realistic, its a big programm..
and a the start there will only be simple games possible with it.

Currently i am searching for good Background & Sprite editors... if anybody can give me some tipps... it would be cool.
Tnx ;)
greetings rudla& marcel
mrm78
Posts: 7
Joined: Wed Oct 05, 2011 10:24 am

Post by mrm78 »

Hi, there is a new beta version from the visual programm system "scratchalan".

still lots of work...
it uses scratch from m.i.t + atalan compiler + a mod of NESST tool

http://playpower.pbworks.com/w/file/fet ... /beta2.rar

Run Scratch.exe then open project "firebreather" in the example folder
then press green flag...

the game is a ripp of an action 52 game... sry i cant pixel :(
its just a test..

would be nice, if i could get some feedback.
tnx
Shiru
Posts: 1161
Joined: Sat Jan 23, 2010 11:41 pm

Post by Shiru »

It wasn't easy to find the flag. Something compiles and runs, but honestly, for me it looks like a Space Shutlle control desk. Have no slightest idea how to use it and why it is easier than conventional programming.
Post Reply