Yaron Nir Posted April 4, 2020 Author Share Posted April 4, 2020 20 hours 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. here to help.... create the following file main.c in any editor (could be notepad, notepad++, sublime text editor, other) Quote include <atari.h> void main(void) { while (1) { }; } this program does an endless loop and basically do nothing. it is just for the sake of this example. the next thing would be to create a build file. which is basically a command line that runs the CC65 compiler and linker to create the Atari executable (*.xex). creare the following build.bat file (on windows): Quote cl65 --debug-info -Wl --dbgfile,mytest.lab -m mytest.map -Ln mytest.lbl -t atari -Oi main.c -o mytest.xex -C atari.cfg there are a lot of parameters in the build command , what is important is the -o followed by the filename.xex - that would be your executable file. another important parameter is the -C followed by the config file name atari.cfg here is a default config file named atari.cfg you can use: Quote FEATURES { STARTADDRESS: default = $2000; } SYMBOLS { __EXEHDR__: type = import; __SYSTEM_CHECK__: type = import; # force inclusion of "system check" load chunk __AUTOSTART__: type = import; # force inclusion of autostart "trailer" __STACKSIZE__: type = weak, value = $0800; # 2k stack __STARTADDRESS__: type = export, value = %S; __RESERVED_MEMORY__: type = weak, value = $0000; } MEMORY { ZP: file = "", define = yes, start = $0082, size = $007E; # file header, just $FFFF HEADER: file = %O, start = $0000, size = $0002; # "system check" load chunk SYSCHKHDR: file = %O, start = $0000, size = $0004; SYSCHKCHNK: file = %O, start = $2E00, size = $0300; SYSCHKTRL: file = %O, start = $0000, size = $0006; # "main program" load chunk MAINHDR: file = %O, start = $0000, size = $0004; MAIN: file = %O, define = yes, start = %S, size = $BC20 - __STACKSIZE__ - __RESERVED_MEMORY__ - %S; TRAILER: file = %O, start = $0000, size = $0006; } SEGMENTS { ZEROPAGE: load = ZP, type = zp; EXTZP: load = ZP, type = zp, optional = yes; EXEHDR: load = HEADER, type = ro; SYSCHKHDR: load = SYSCHKHDR, type = ro, optional = yes; SYSCHK: load = SYSCHKCHNK, type = rw, define = yes, optional = yes; SYSCHKTRL: load = SYSCHKTRL, type = ro, optional = yes; MAINHDR: load = MAINHDR, type = ro; STARTUP: load = MAIN, type = ro, define = yes; LOWBSS: load = MAIN, type = rw, optional = yes; # not zero initialized LOWCODE: load = MAIN, type = ro, define = yes, optional = yes; ONCE: load = MAIN, type = ro, optional = yes; CODE: load = MAIN, type = ro, define = yes; RODATA: load = MAIN, type = ro; DATA: load = MAIN, type = rw; INIT: load = MAIN, type = rw, optional = yes; BSS: load = MAIN, type = bss, define = yes; AUTOSTRT: load = TRAILER, type = ro; } FEATURES { CONDES: type = constructor, label = __CONSTRUCTOR_TABLE__, count = __CONSTRUCTOR_COUNT__, segment = ONCE; CONDES: type = destructor, label = __DESTRUCTOR_TABLE__, count = __DESTRUCTOR_COUNT__, segment = RODATA; CONDES: type = interruptor, label = __INTERRUPTOR_TABLE__, count = __INTERRUPTOR_COUNT__, segment = RODATA, import = __CALLIRQ__; } you can just copy and paste . this is the default publishd with CC65 library. notice i've set my program to start at 2000 memory address location: Quote FEATURES { STARTADDRESS: default = $2000; } you can set it anywhere in the RAM address space. you're ready. build the program by running the build.bat in command line window if all worked fine and no errors, you should see the executable mytest.xex created in your folder. now all you have to do is run it with any emultaor of A8, for example open the file with Altirra emultar. you will see this: now , your ready to write anything you'd like in the main.c file and use this framework to compile and run your programs. good luck! Quote Link to comment Share on other sites More sharing options...
Wrathchild Posted April 4, 2020 Share Posted April 4, 2020 30 minutes ago, Yaron Nir said: you can just copy and paste . this is the default publishd with CC65 library. 33 minutes ago, Yaron Nir said: -C atari.cfg You shouldn't need to do this as the linker should find the config file within the CC65 installation's "cfg" folder. You can override the default by specifying any of the below, e.g. "-C atari-xex.cfg" depending on your requirements. Or, of course, to specify your own rolled config file, e.g. when making a cartridge. But for a newbie I would recommend they don't need to get involved with config's right away and so adding "-C atari.cfg" is not necessary 1 Quote Link to comment Share on other sites More sharing options...
Irgendwer Posted April 4, 2020 Share Posted April 4, 2020 52 minutes ago, Yaron Nir said: cl65 --debug-info -Wl --dbgfile,mytest.lab -m mytest.map -Ln mytest.lbl -t atari -Oi main.c -o mytest.xex -C atari.cfg Really? For a beginner, just checking if the cc65 setup is OK and if he is able to produce an executable, this command line is an easier start: cl65 -t atari -o text.xex main.c 2 Quote Link to comment Share on other sites More sharing options...
TGB1718 Posted April 4, 2020 Share Posted April 4, 2020 many thanks for all the replies, it worked fine from the command line, was wondering what you have to do in Sublime to make it use cl65, I've tried lots of soultions that I "Googled", but none work, it insist on using gcc which obviosly fails. Quote Link to comment Share on other sites More sharing options...
Yaron Nir Posted April 4, 2020 Author Share Posted April 4, 2020 1 minute ago, TGB1718 said: many thanks for all the replies, it worked fine from the command line, was wondering what you have to do in Sublime to make it use cl65, I've tried lots of soultions that I "Googled", but none work, it insist on using gcc which obviosly fails. ok, from sublime, chooes to add new build system: in the template file that is opened, change the command to: Quote { "cmd": ["build.bat"] } save the file, call it cc65.sublime-build. it is mostly located at: Quote ..\AppData\Roaming\Sublime Text 3\Packages\User then you will be a new build system in the menu: now just make sure you open your folder of your problem in sublime, the folder should contain the files i've explained above (main.c, build.bat, atari.cfg) type CTRL+B to build your program (just build from the menu) hope that helped 1 Quote Link to comment Share on other sites More sharing options...
TGB1718 Posted April 4, 2020 Share Posted April 4, 2020 thanks once again, managed to compile one of the samples, very helpful advice Quote Link to comment Share on other sites More sharing options...
Yaron Nir Posted April 7, 2020 Author Share Posted April 7, 2020 lesson #3 - Interrupts, published (no subtitles) Quote Link to comment Share on other sites More sharing options...
TGB1718 Posted April 7, 2020 Share Posted April 7, 2020 @Yaron Nir , have to thank you again, I am writing code, compiling and having it run in Altirra litterally in seconds, I just love this setup although I have noticed a few little "quirks" with the standard routines, but nothing thats not unsurmountable. 1 Quote Link to comment Share on other sites More sharing options...
Wrathchild Posted April 7, 2020 Share Posted April 7, 2020 @Yaron Nir Maybe get a moderator to change the title of the thread for you as you've chosen to include new parts within the thread rather than start new ones for each part? Quote Link to comment Share on other sites More sharing options...
Yaron Nir Posted April 7, 2020 Author Share Posted April 7, 2020 40 minutes ago, TGB1718 said: I have noticed a few little "quirks" with the standard routines, but nothing thats not unsurmountable. which ones? there should be no quirks if working properly...? Quote Link to comment Share on other sites More sharing options...
Yaron Nir Posted April 7, 2020 Author Share Posted April 7, 2020 24 minutes ago, Wrathchild said: @Yaron Nir Maybe get a moderator to change the title of the thread for you as you've chosen to include new parts within the thread rather than start new ones for each part? i thought that if i would be starting each thread for each lesson, i would be trolling... and people would get annoyed, this keeps all the lessons under one thread. i would though change the thread title maybe to specify "lessons" plural rather than state lesson #1..... Quote Link to comment Share on other sites More sharing options...
TGB1718 Posted April 7, 2020 Share Posted April 7, 2020 1 hour ago, Yaron Nir said: which ones? there should be no quirks if working properly...? It's ok, I've just checked on a Linux installation and I get the same behaviour, never noticed this before. int x; char msg[10]; scanf("%d",&x); gets(msg); this code doesn't get msg as the keyboard buffer keeps <CR> in the buffer after scanf so jumps over gets as it receives the <CR> fflush(stdin) doesn't seem to clear it just never noticed this before Quote Link to comment Share on other sites More sharing options...
dmsc Posted April 7, 2020 Share Posted April 7, 2020 Hi! 2 hours ago, TGB1718 said: It's ok, I've just checked on a Linux installation and I get the same behaviour, never noticed this before. int x; char msg[10]; scanf("%d",&x); gets(msg); This should be: int x; char msg[10]; scanf("%d\n",&x); gets(msg); Have Fun! Quote Link to comment Share on other sites More sharing options...
ivop Posted April 8, 2020 Share Posted April 8, 2020 On 4/7/2020 at 3:09 PM, Yaron Nir said: i thought that if i would be starting each thread for each lesson, i would be trolling... and people would get annoyed, this keeps all the lessons under one thread. i would though change the thread title maybe to specify "lessons" plural rather than state lesson #1..... And ask for editing rights on the first post, if you don't already have that, so you can link all lessons from the first post, too. Quote Link to comment Share on other sites More sharing options...
Yaron Nir Posted April 13, 2020 Author Share Posted April 13, 2020 Lesson #4 - Player Missile Graphics (i've wrote to the forum moderator to change the topic of this thread, but no answer ) Quote Link to comment Share on other sites More sharing options...
Yaron Nir Posted April 20, 2020 Author Share Posted April 20, 2020 lesson #5 - Segments, Memory Blocks & Config Files in this lesson i've hacked crownland to show how to work with memory, segments and bin files..... 1 Quote Link to comment Share on other sites More sharing options...
Yaron Nir Posted May 5, 2020 Author Share Posted May 5, 2020 lesson #6 - Antic Mode E , pre-shifted software sprites I also covered @ilmenit cc65 optimization improvements at the second part of the lesson. you can find the reference here: https://github.com/ilmenit/CC65-Advanced-Optimizations Quote Link to comment Share on other sites More sharing options...
Yaron Nir Posted May 14, 2020 Author Share Posted May 14, 2020 lesson #7 - Disable OS - RAM under ROM & Scrolling Theory 2 Quote Link to comment Share on other sites More sharing options...
Yaron Nir Posted May 24, 2020 Author Share Posted May 24, 2020 ok, last lesson #8 - RMT music files and SFX support You can find code sample from all the lessons in the following GIT link: https://github.com/AsafSaar/Atari-8bit-Programming I know this is not in english native language, but you can view the videos and see the explanations. I hope this will help someone. I trully encourage to develope in high language such as C for the atari 8-bit. everything is possible, you just need to understand the language and 8-bit limitations. Cheers, Yaron 1 1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.