Jump to content
IGNORED

CC65 - online course - lesson #1


Recommended Posts

Hey guys,

corona days, staying at home , thought it would be nice to do an online course for CC65 developing for the Atari 8Bit.

 

it is in my native language so I don’t expect you understand what I am saying but you can see the course on going and understand the basics . 
the first lesson was an introduction to CC65, env. , compiler and linker , building first app hello world , debugging altirra and more.

 

any questions , comments . Would be most welcome 

enjoy

 

 

  • Like 11
  • Thanks 1
Link to comment
Share on other sites

Hi, many thanks for your tutorial, I've looked at CC65 in the past, but couldn't get it going.

 

Now I've installed it in Windows and compiled a version on a Raspberry Pi.

 

I have one question, I only speak english, so may be missing some information, what is the IDE you are using ?

 

I can't find any executable relating to what you show

 

thanks

 

Tim

 

Link to comment
Share on other sites

2 hours ago, TGB1718 said:

Hi, many thanks for your tutorial, I've looked at CC65 in the past, but couldn't get it going.

 

Now I've installed it in Windows and compiled a version on a Raspberry Pi.

 

I have one question, I only speak english, so may be missing some information, what is the IDE you are using ?

 

I can't find any executable relating to what you show

 

thanks

 

Tim

 

Hi Tim,

 

the editor i am using is sublime text editor https://www.sublimetext.com/3

and in the early hour of the course i am explaning how to use CTRL+B command line and build the CC65 code within sublime text.

 

let me know if you need anything other help

 

next lesson would be on display list and graphics modes.... i will post it when ready

 

Link to comment
Share on other sites

Many thanks, I look forward to your next video.

 

I'm fine with C, used it for many years on UNIX  and the ST and today on Raspberry Pi

I currently use MAC65 and wanted to try CC65 to see if it's a better environment to develop with.

Edited by TGB1718
Link to comment
Share on other sites

1 hour ago, Yaron Nir said:

Lesson number 2 is published,

main focus graphics screens and display list

Two small comments:

- you may use joystick.h

- display list definition is one of the things I'd propose to make in dedicated segment in linker configuration file to avoid copying

Link to comment
Share on other sites

2 minutes ago, ilmenit said:

Two small comments:

- you may use joystick.h

- display list definition is one of the things I'd propose to make in dedicated segment in linker configuration file to avoid copying

 

Hi @ilmenit, your comments are correct

 

i was focusing the lesson (as it is just the second lesson) in display list and graphic modes,

linker (as part of the config) is later lesson.

joystick.h will be used next lesson as we will do so more graphics tricks using DLIs

 

Link to comment
Share on other sites

On 3/30/2020 at 3:29 PM, Yaron Nir said:

Lesson number 2 is published,

Hints:

* Current cc65 version supports binary literals:

Quote

Binary literals, a C++14 feature and a GCC C extension, are accepted. They can be disabled with the --standard option.


        unsigned char foo = 0b101; // sets it to 5
        

This way, e.g. charset and PMG data is better visible and easy to edit in the source code:

...
0b00011000,
0b00011000,
0b00001000,
0b10011000,
0b00111100,
0b00011010,
0b00110100,
0b01100110
...

* cc65 addition of void-arrays help a lot with the DL definition, containing char instruction and (LMS) words in a mixture:

Quote

cc65 allows the initialization of void variables. This may be used to create arbitrary structures that are more compatible with interfaces written for assembler languages. Here is an example:


        void GCmd = { (char)3, (unsigned)0x2000, (unsigned)0x3000 };
        

That will be translated as follows:


        _GCmd:
                .byte   3
                .word   $2000
                .word   $3000
        

Nevertheless, I'm quite happy that I lot of what I added to cc65 is actually used!

(Currently working on better sound support.)

  • Like 4
Link to comment
Share on other sites

10 minutes ago, Irgendwer said:

Nevertheless, I'm quite happy that I lot of what I added to cc65 is actually used!

(Currently working on better sound support.)

these are your contributions? Nice! I'm planning to look at first optimizer, then the general code generation code, because cc65 in some cases generates quite terrible code by itself and you need to use additional code to better produce code (especially with accesses to arrays that fit in one page).

Link to comment
Share on other sites

18 minutes ago, Irgendwer said:

Nevertheless, I'm quite happy that I lot of what I added to cc65 is actually used!

(Currently working on better sound support.)

your contribution to the CC65 is well noticed! well done!

 

19 minutes ago, Irgendwer said:

(Currently working on better sound support.)

is that rmt? 

one of my next lessons would be on RMT support......

 

Link to comment
Share on other sites

8 minutes ago, ilmenit said:

these are your contributions?

Not the enhancements I mentioned in my post - but e.g. the definition of the Antic-"Instruction Set" as well as the OS-structure.

 

Yes, the optimizer could be better and also has some issues - if you browse through the list of code generation bugs.

I also thought about a better separate, external optimizer, as writing one in C isn't IMHO that much fun.

This tool could also parse library function and create a "DB" of e.g. register usages, taking this information into account when optimizing surrounding calling code.

 

An additional improvement (which would a little bit easier to provide and also speed-up code and save memory) would be a change of the library format/linker to support "sub-code-blocks".

There are many cases where library code is separated in several files, to prevent inclusion of big code chunks, while only parts of them are needed. (Linking is on file level.)

But this leads to missing optimization opportunities, where e.g. one function just can run into another to complete a task - currently solved by jumping to the separate, imported function.

Link to comment
Share on other sites

Hi!

15 hours ago, Yaron Nir said:

your contribution to the CC65 is well noticed! well done!

 

is that rmt? 

one of my next lessons would be on RMT support......

 

I have working samples of including the RMT player with relocatable tunes, this means that you don't need to store the tune at a fixed location, as the tune is converted by a little C program that I wrote into a standard assembly file, for use with CA65.

 

See the attached, there are examples for C and FastBasic, this is a minimal C program with game sounds:

int main(void)
{
    // Init RMT player
    rmt_init( rmt_song_data, 2);
    // STar playing
    rmt_start();
    // Play SFX over channel 3, note 10, max volume
    rmt_sfx_channel = 3;
    rmt_sfx_note = 10;
    rmt_sfx_volume = 0xF0;
  
    cputs("Press 1 to 8 for SFX, any key to end\r\n");
    while(1) {
        unsigned char c = cgetc() - '0';
        if( c < 9 )
            rmt_sfx_play(c);
        else
            break;
    }
    // Stop playing and end
    rmt_stop();
    return 0;
}

 

Have Fun!

 

rmt-cc65-20200403.zip

  • Like 2
Link to comment
Share on other sites

Would love to try CC65, but can't seem to get anything to work, don't get the environment shown in the video's, there doesn't

seem to be a way to create a project to get started and it appears without that there is no way to confugure a build environment.

Link to comment
Share on other sites

CC65 is an excellent development environment. One of its best features is also one of its worst, however - it is very flexible and powerful, especially because of its fantastic config file system to control code generation and linking. The config file is fairly complex and abstract in order to provide this flexibility, though, so you really have to dig into it and there's a learning curve there. If all you want to do is just make small C programs like utilities and things, you can just use the provided config file. When you want to work with large game development, though, you will have to modify the config file to match. Still, it is well worth it.

Link to comment
Share on other sites

31 minutes ago, TGB1718 said:

Would love to try CC65, but can't seem to get anything to work, don't get the environment shown in the video's, there doesn't

seem to be a way to create a project to get started and it appears without that there is no way to confugure a build environment.

let us know what errors you get and we will help ?

Link to comment
Share on other sites

It is. Most of the extra size comes from the included libraries. Refraining from using stdio.h and similar c-lib stuff will help quite a bit. When I was using it, simply including printf added about 8k. There are smaller libraries provided, such as conio.h as a replacement for stdio.h. Plus, for really speed critical you can drop into assembler quite easily, either in-line or using teh CA65 assembler in teh same project.

 

Of course, no matter what you do, it will be larger that a hand-curated assembly program. It is very usable though. There's been some high powered games written in it, and I even wrote a mouse driver in it for the ST mouse on a 130xe. The ease of coding and higher level constructs make wrangling a large program somewhat easier.

Edited by danwinslow
Link to comment
Share on other sites

4 minutes ago, danwinslow said:

It is. Most of the extra size comes from the included libraries. Refraining from using stdio.h and similar c-lib stuff will help quite a bit. When I was using it, simply including printf added about 8k. There are smaller libraries provided, such as conio.h as a replacement for stdio.h. Plus, for really speed critical you can drop into assembler quite easily, either in-line or using teh CA65 assembler in teh same project.

 

Of course, no matter what you do, it will be larger that a hand-curated assembly program. It is very usable though. There's been some high powered games written in it, and I even wrote a mouse driver in it for the ST mouse on a 130xe. The ease of coding and higher level constructs make wrangling a large program somewhat easier.

Good to know,  yeah I include stdio.h and use printf's out of habit.  haha

Link to comment
Share on other sites

47 minutes ago, zzip said:

Good to know,  yeah I include stdio.h and use printf's out of habit.  haha

If you don't need any formatting, I always use puts(). Still pulls in some of stdio, but not several kilobytes for printf.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...