atarilux Posted May 26, 2022 Share Posted May 26, 2022 Hello, I am planning to write a game at some point. Having learned some basics in well um FastBasic for the 8-bit line, I am considering switching to CC65. I gather this is now also working on the 7800. Excluding 7800 specifics e.g. graphics, what are your experiences of writing games on the 7800 using CC65? I plan to separate the graphics layer, from game logic so that it can be ported to other platforms e.g. C64, Atari 8-bit and ZX Spectrum etc. C seems like an abvious choice as it is available for many platforms. Quote Link to comment Share on other sites More sharing options...
+Karl G Posted May 26, 2022 Share Posted May 26, 2022 Since it is so new, I believe @karri is the only one so far with any significant experience with cc65 and Atari 7800 , being the one who added the support. Quote Link to comment Share on other sites More sharing options...
+karri Posted May 27, 2022 Share Posted May 27, 2022 Feel free to use cc65. A few small notes... I am currently using cc65 for developiomng Wizzy at the same time for Lynx and 7800. This may be a bad choice as the time it takes is much longer than focusing on one platform only. The good thing is that you can share gameplay decisions between the platforms. Sharing code does work only to some extent. The Lynx ROM is up tp 2MB and it has 64k RAM. Compare it to 4k RAM in the 7800. So use lot of const keywords to move the code out of RAM. The sprite packer sp65 does not work for 7800. So you are pretty much on your own for putting together the graphics. I am using Gimp for creating a 256 by 8 bit graphics sheet. Then I populate it with whatever graphics I need for the game and finally flip it vertically so that all data is upside down. Here is an example. I decided to use 2 bits per pixel for this graphics. Once I flip them I can export the data in raw format from Gimp and use some python like blen = 0 def gb(val): b = val[0] << 6 b = b + (val[1] << 4) b = b + (val[2] << 2) b = b + val[3] return '$' + hex(b)[2:4] def printline(f, val): f.write(" .byte " + gb(val[0:4]) + ', ' + gb(val[4:8]) + ', ' + gb(val[8:12]) + ', ' + gb(val[12:16]) + ', ' + gb(val[16:20]) + ', ' + gb(val[20:24]) + ', ' + gb(val[24:28]) + ', ' + gb(val[28:32]) + '\n') fname='font160' with open(fname + '.data', 'rb') as f: data = f.read() fname= fname + '.s' with open(fname, 'w') as f: f.write(" .export _font160\n") f.write(' .rodata\n') f.write(' .align 256\n') f.write("_font160:\n") for i in range(0, int(len(data)/32)): printline(f, data[i * 32:i * 32 + 32]) This turns the data into cc65 asm file that allows me to compile it and link it. For sound effects you can copy the sfx stuff from piratecove. Questions? 3 Quote Link to comment Share on other sites More sharing options...
atarilux Posted May 31, 2022 Author Share Posted May 31, 2022 Thanks for the reply. Please let me know how you get on with it, whether it ended up increasing the time spent or not. So far i am grappling with the basics of CC65 on the XL etc, 7800 next. I think one platform at a time is a good way to go. I will keep all the game logic in C, while the graphics etc, can be handled for each machine separately. I may go down the route of asm where required for critical points. I had previously played around with the 8-bit basic concepts in FastBasic, but it was too slow. In terms of code sharing, did you really save any time doing in CC65? Quote Link to comment Share on other sites More sharing options...
+karri Posted May 31, 2022 Share Posted May 31, 2022 2 hours ago, atarilux said: In terms of code sharing, did you really save any time doing in CC65? The biggest difference is in how you optimize segments. On the Lynx I try to optimize the RAM so that no bytes are just hanging in RAM on a level. On the 7800 I need to optimize the ROM as there is only 4k of RAM. So all data structures need to be const with no changable fields so that the compiler knows to put the data in ROM. Both platforms affect how I write the code. I hope to share all graphics, tunes and game logic. 1 Quote Link to comment Share on other sites More sharing options...
atarilux Posted June 1, 2022 Author Share Posted June 1, 2022 9 hours ago, karri said: The biggest difference is in how you optimize segments. On the Lynx I try to optimize the RAM so that no bytes are just hanging in RAM on a level. On the 7800 I need to optimize the ROM as there is only 4k of RAM. So all data structures need to be const with no changable fields so that the compiler knows to put the data in ROM. Both platforms affect how I write the code. I hope to share all graphics, tunes and game logic. Thanks for the details, I need to get my head around the 7800 architecture which is quite different, in particular how it handles graphics and memory allocation (thanks for drawing my attention to that). I will probably start on the 8-bit line first then port it over to the 7800. Lynx is off for now, unless I buy one. As for graphics, I will start with a platform game so I hope to reuse the basics across both platforms but I may see if I can optimise them for the 7800. Quote Link to comment Share on other sites More sharing options...
+karri Posted June 1, 2022 Share Posted June 1, 2022 4 hours ago, atarilux said: Lynx is off for now, unless I buy one. It is the most amazing of them all... So fun to code for and it has hardware acceleration for sprites. 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.