+karri Posted April 22, 2013 Author Share Posted April 22, 2013 I already found out that having many tunes in the same build causes some clashes in the namespace. The format of Chipper is nice. It would be very nice to have a set of cool sound effects that could be used in real time. Perhaps we could maintain a Chipper sound library in Bitbucket with cool sound effects? You could save the sounds in BLL, newcc65 and "cc65 remake" formats. To use it you may need to give the musicptr some sensible name like _boingsound in order to use it from C-code. ;;; source file for CC65 "remake" compiler .include "soundbs.mac" .global _boingsound .rodata _boingsound: .word CHANNEL_0, CHANNEL_1, CHANNEL_2, CHANNEL_3 PATTERN_LENGTH .set 2560 CHANNEL_0: PATTERN ENVIROS PATTERN PATTERN_01 PATTERN PATTERN_04 CHAN_STOP CHANNEL_1: PATTERN ENVIROS PATTERN PATTERN_02 PATTERN PATTERN_02 CHAN_STOP CHANNEL_2: PATTERN ENVIROS PATTERN PATTERN_03 PATTERN PATTERN_03 CHAN_STOP CHANNEL_3: PATTERN ENVIROS PATTERN PATTERN_DELAY PATTERN PATTERN_DELAY CHAN_STOP ... 1 Quote Link to comment Share on other sites More sharing options...
GadgetUK Posted May 4, 2013 Share Posted May 4, 2013 Thanks btw, I forgot to reply to this =) I got sound working fine and learnt a few things on the way. Very little to finish off with Alien now, just got to motivate myself Quote Link to comment Share on other sites More sharing options...
GadgetUK Posted May 4, 2013 Share Posted May 4, 2013 I've been manually editing these .asm files btw, and wondered about the relevance of 'PATTERN_LENGTH .set 2560 '. Since i've been removing patterns etc, does anyone foresee a problem? I guess I would need to understand how that value is calculated in order to change it manually. Quote Link to comment Share on other sites More sharing options...
GadgetUK Posted May 7, 2013 Share Posted May 7, 2013 This was a 'DOH' moment... Stupidest question I could have asked... I can see its a define used by the delay macro now. Quote Link to comment Share on other sites More sharing options...
Turbo Laser Lynx Posted March 28, 2015 Share Posted March 28, 2015 Hi! I've been tampering with installing cc65 remake and finally maybe got it (I think/hope) I'm now trying to compile the pong with segments example but I ran into problems. It seems sh.exe keeps crashing when running make and unfortunatley I'm not exactly knowing what I'm doing. I wonder if I would need some cygwin stuff to make everything run properly on windows or if the cc65 snapshots downloaded from LX.NET's tutorial thread are newer and incompatible with the pong example. Any help appreciated. RIN# makeC:/CC65/usr/local/wbin/make.EXE -C cartmake.EXE[1]: Entering directory `C:/Lynx/pong2/cart'C:/CC65/usr/local/wbin/make.EXE -C ../intromake.EXE[2]: Entering directory `C:/Lynx/pong2/intro'make.EXE[2]: Nothing to be done for `all'.make.EXE[2]: Leaving directory `C:/Lynx/pong2/intro'C:/CC65/usr/local/wbin/make.EXE -C ../musicmake.EXE[2]: Entering directory `C:/Lynx/pong2/music'rm -f objlistfor obj in track2.o; do echo ../music/$obj >> objlist; donemake.EXE[2]: Leaving directory `C:/Lynx/pong2/music'C:/CC65/usr/local/wbin/make.EXE -C ../playmake.EXE[2]: Entering directory `C:/Lynx/pong2/play'cc65 -t lynx --code-name PONG_CODE --rodata-name PONG_RODATA --data-name PONG_DATA --bss-name PONG_BSS -o pong.s pong.cca65 -t lynx -o pong.o pong.srm -f pong.srm -f objlistfor obj in pong.o; do echo ../play/$obj >> objlist; donemake.EXE[2]: Leaving directory `C:/Lynx/pong2/play'C:/CC65/usr/local/wbin/make.EXE -C ../mainmake.EXE[2]: Entering directory `C:/Lynx/pong2/main'cc65 -t lynx -o main.s main.cmain.c(30): Error: Call to undefined function `lynx_snd_init'main.c(36): Error: Call to undefined function `lynx_snd_pause'main.c(38): Error: Call to undefined function `lynx_snd_play'main.c(42): Error: Call to undefined function `lynx_snd_continue'make.EXE[2]: *** [main.o] Error 255make.EXE[2]: Leaving directory `C:/Lynx/pong2/main'make.EXE[1]: *** [all] Error 2make.EXE[1]: Leaving directory `C:/Lynx/pong2/cart'C:\CC65\usr\local\wbin\make.EXE: *** [all] Error 2RIN# Also when I try to compile an old MegaPak template with Catacomb Raider on it it says: "C:/CC65/usr/local/wbin/make.EXE" -C resident;abnormal program terminationC:\Users\Sampo\AppData\Local\Temp\make30002.sh: fork failed: no error [1]"C:/CC65/usr/local/wbin/make.EXE" -C intro;C:\CC65\usr\local\wbin\make.EXE[1]: Entering directory `C:/Lynx/MegaPak/intro'cc65 -I . -t lynx --add-source -O -Or -Cl -Os --code-name INTRO_CODE --rodata-name INTRO_RODATA --bss-name INTRO_BSS --data-name INTRO_DATA -o intro.s intro.cintro.c(11): Error: Macro redefinition is not identicalintro.c(12): Error: Macro redefinition is not identicalintro.c(13): Error: Macro redefinition is not identicalintro.c(653): Warning: Converting integer to pointer without a castintro.c(658): Warning: Converting integer to pointer without a castintro.c(664): Warning: Converting integer to pointer without a castintro.c(669): Warning: Converting integer to pointer without a castintro.c(689): Warning: Converting integer to pointer without a castintro.c(694): Warning: Converting integer to pointer without a castintro.c(700): Warning: Converting integer to pointer without a castintro.c(705): Warning: Converting integer to pointer without a castintro.c(1152): Warning: Converting integer to pointer without a castintro.c(1191): Warning: Converting integer to pointer without a castC:\CC65\usr\local\wbin\make.EXE[1]: *** [intro.o] Error 255C:\CC65\usr\local\wbin\make.EXE[1]: Leaving directory `C:/Lynx/MegaPak/intro'C:\CC65\usr\local\wbin\make.EXE: *** [all] Error 2 The lines it's complaining about are: #include <lynx.h> #include <tgi.h> #include <joystick.h> #include <stdlib.h> #include <conio.h> #include <6502.h> #include <string.h> #include "../resident/resident.h" #include "../abcmusic/abcmusic.h" #define tgi_sprite(spr) tgi_ioctl(0, (unsigned)(spr)) #define tgi_flip() tgi_ioctl(1, 0) #define tgi_setbgcolor(col) tgi_ioctl(2, (unsigned)(col)) Quote Link to comment Share on other sites More sharing options...
+karri Posted March 28, 2015 Author Share Posted March 28, 2015 (edited) You are still missing the latest cc65. The missing chipper support complains about not having lynx_snd. The reason for tgi_sprite etc is that these definitions are now part of cc65 and you should delete these lines from your own code. We put up a repository for the cc65 version that is stable. I could try to make a Windows version of all the latest stuff and put it in a download section. https://bitbucket.org/atarilynx/lynx PS. A quick check showed me that the binaries by LX.NET are the latest in the pinned Tutorial section. So I am not going to change anything here. -- Karri Edited March 28, 2015 by karri Quote Link to comment Share on other sites More sharing options...
+karri Posted March 28, 2015 Author Share Posted March 28, 2015 (edited) Sorry about the previous misleading post. The chipper is not part of the c65. Perhaps it should be. I really have to check the status of this detail. In order for chipper to work you need to add a file to your project. You also need to add a few defines to use it: void lynx_snd_init ();void lynx_snd_pause ();void lynx_snd_continue ();void __fastcall__ lynx_snd_play (unsigned char channel, unsigned char *music);void lynx_snd_stop (); My original idea was to include this into cc65. But for some reason (which I don't remember) I have not done this. Just rename this to lynx-snd.s and add it to your compiled sources. ca65 -t lynx -I $(CC65_ASMINC) -o lynx-snd.o $(AFLAGS) lynx-snd.s -- Karri lynx-snd.txt Edited March 28, 2015 by karri Quote Link to comment Share on other sites More sharing options...
Turbo Laser Lynx Posted March 28, 2015 Share Posted March 28, 2015 I could try to make a Windows version of all the latest stuff and put it in a download section. That would be amazingly awesome obviously I'll play around more with this today and see if I can get anything to work. Chipper got me really excited too, it should be so much easier to create better lynx-music with it. Quote Link to comment Share on other sites More sharing options...
+karri Posted March 28, 2015 Author Share Posted March 28, 2015 That would be amazingly awesome obviously I'll play around more with this today and see if I can get anything to work. Chipper got me really excited too, it should be so much easier to create better lynx-music with it. I already compiled it but the result is identical to the files at LX.NET. Your installed compiler is already ok. Quote Link to comment Share on other sites More sharing options...
Turbo Laser Lynx Posted March 28, 2015 Share Posted March 28, 2015 (edited) Allright cool, I'll continue my tinkering and tampering then, thanks a lot for the help! Edited March 28, 2015 by Turbo Laser Lynx Quote Link to comment Share on other sites More sharing options...
Turbo Laser Lynx Posted March 28, 2015 Share Posted March 28, 2015 (edited) I got pong to compile both with and without music, wohoo! But I still have some weird problems. When running "make" or "ls" only 1 in 5 times seems to work, otherwise it throws "abnormal program termination", i also get that in the middle of the compiling but it seems to work anyway. Also although there's rules for creating .o files from .s files in Common.mk I have to ca65 the .s files manually, maybe there's som path(s) wrong. I managed to add lynx-snd as an object to the cart make file so now it doesn't complain about the missing externals any more but it warns something about the segments instead. With the pong example at least I got forward by experimenting (and guessing) but I don't understand at all what goes wrong when trying to compile the old MegaPak (further down). Again any help mega-appreciated, sry for being such an old noob :/ make.EXE[2]: Entering directory `C:/Lynx/pong2/cart'cl65 -t lynx -C lynx-coll.cfg -o pong.lnx -m pong.map exehdr.o directory.o @../intro/objlist @../music/objlist @../play/objlist @../main/objlist lynx.libld65.exe: Warning: lynx-coll.cfg(67): Segment `PONG_RODATA' does not existld65.exe: Warning: lynx-coll.cfg(67): Segment `PONG_BSS' does not existld65.exe: Warning: lynx-coll.cfg(67): Segment `INTRO_DATA' does not existld65.exe: Warning: lynx-coll.cfg(67): Segment `INTRO_BSS' does not existmake.EXE[2]: Leaving directory `C:/Lynx/pong2/cart'make.EXE[1]: Leaving directory `C:/Lynx/pong2/cart'RIN# With the pong example at least I got forward by experimenting (and guessing) but I don't understand at all what goes wrong when trying to compile the old MegaPak: RIN# cd MegaPak/RIN# make"C:/CC65/usr/local/wbin/make.EXE" -C resident;C:\CC65\usr\local\wbin\make.EXE[1]: Entering directory `C:/Lynx/MegaPak/resident'ca65 -t lynx -I "C:\CC65\include/../asminc" -o fadeout.o fadeout.sabnormal program terminationC:\Users\Sampo\AppData\Local\Temp\make50482.sh: fork failed: no error [1]ca65 -t lynx -I "C:\CC65\include/../asminc" -o fileexec.o fileexec.sca65 -t lynx -I "C:\CC65\include/../asminc" -o vbl.o vbl.stouch objlistrm objlistfor obj in aaresident.o lynxeeprom.o eeprom.o fadein.o fadeout.o filedir.o fileexec.o filehelp.o fileload.o irq.o lynx-stdjoy.o lynx-160-102-16.o uploader.o vbl.o kbhit.o cgetc.o; do echo ../resident/$obj >> objlist; doneC:\CC65\usr\local\wbin\make.EXE[1]: Leaving directory `C:/Lynx/MegaPak/resident'"C:/CC65/usr/local/wbin/make.EXE" -C intro;C:\CC65\usr\local\wbin\make.EXE[1]: Entering directory `C:/Lynx/MegaPak/intro'touch objlistrm objlistfor obj in intro.o bricks_megapak.o radioon.o radiooff.o checkon.o checkoff.o MegaPak.o game.o image.o music.o toolbox.o; do echo ../intro/$obj >> objlist; doneC:\CC65\usr\local\wbin\make.EXE[1]: Leaving directory `C:/Lynx/MegaPak/intro'"C:/CC65/usr/local/wbin/make.EXE" -C abcmusic;abnormal program terminationC:\Users\Sampo\AppData\Local\Temp\make16804.sh: fork failed: no error [1]"C:/CC65/usr/local/wbin/make.EXE" -C mygame;abnormal program terminationC:\Users\Sampo\AppData\Local\Temp\make16805.sh: fork failed: no error [1]"C:/CC65/usr/local/wbin/make.EXE" -C music;abnormal program terminationC:\Users\Sampo\AppData\Local\Temp\make16806.sh: fork failed: no error [1]"C:/CC65/usr/local/wbin/make.EXE" -C miniloader;C:\CC65\usr\local\wbin\make.EXE[1]: Entering directory `C:/Lynx/MegaPak/miniloader'touch objlistrm objlistfor obj in aaminiexec.o minidir.o minihelp.o miniload.o; do echo ../miniloader/$obj >> objlist; doneC:\CC65\usr\local\wbin\make.EXE[1]: Leaving directory `C:/Lynx/MegaPak/miniloader'"C:/CC65/usr/local/wbin/make.EXE" -C cart clean;C:\CC65\usr\local\wbin\make.EXE[1]: Entering directory `C:/Lynx/MegaPak/cart'touch lnxhdr.o encrypt1024.o directory.o title.orm lnxhdr.o encrypt1024.o directory.o title.otouch cart.lnxrm cart.lnxtouch lynxcart.maprm lynxcart.mapC:\CC65\usr\local\wbin\make.EXE[1]: Leaving directory `C:/Lynx/MegaPak/cart'"C:/CC65/usr/local/wbin/make.EXE" -C cart;abnormal program terminationC:\Users\Sampo\AppData\Local\Temp\make16809.sh: fork failed: no error [1]cp cart/cart.lnx .cp: cart/cart.lnx: No such file or directoryC:\CC65\usr\local\wbin\make.EXE: *** [all] Error 1RIN# Edited March 28, 2015 by Turbo Laser Lynx Quote Link to comment Share on other sites More sharing options...
+karri Posted March 28, 2015 Author Share Posted March 28, 2015 many things are simplified a lot since the MegaPak template. You don't need to compile tgi or joy libs anymore. The fadeout/fadein does not work well currently. I have not looked into it. A typical hello.c looks like this: #include <lynx.h> #include <tgi.h> #include <6502.h> void main(void) { tgi_install(&lynx_160_102_16); tgi_init(); CLI(); while (tgi_busy()) ; tgi_clear(); tgi_setcolor(COLOR_GREEN); tgi_outtextxy(0, 0, "Hello World"); tgi_updatedisplay(); while (1) ; } Quote Link to comment Share on other sites More sharing options...
Turbo Laser Lynx Posted March 28, 2015 Share Posted March 28, 2015 Ok, I'll try and fiddle around some more, thanks Karri! Quote Link to comment Share on other sites More sharing options...
+karri Posted March 28, 2015 Author Share Posted March 28, 2015 (edited) You could look at "Shaken, not stirred" for an example. https://bitbucket.org/karri/shaken You should look at the sources and especially the cart/lynx.cfg cart/directory.s to see what kind of new defines are required in lynx.cfg. There is also no explicit bootloader anymore. And in the bitmaps directory all bitmaps are compiled to sprites using sp65. Only *.pcx format is supported. You can easily convert your graphics to pcx in Gimp. static void initlynx() { tgi_install(&tgi_static_stddrv); tgi_init(); joy_install(&joy_static_stddrv); lynx_snd_init(); CLI(); lynx_snd_pause(); lynx_snd_play(0, musicptr.music0); lynx_snd_play(1, musicptr.music1); lynx_snd_play(2, musicptr.music2); lynx_snd_play(3, musicptr.music3); lynx_snd_continue(); }; Edited March 28, 2015 by karri Quote Link to comment Share on other sites More sharing options...
Turbo Laser Lynx Posted March 28, 2015 Share Posted March 28, 2015 Ok cool, thanks! I will have a close look at the shaken code and try to learn as much as possible from it. Quote Link to comment Share on other sites More sharing options...
Turbo Laser Lynx Posted March 28, 2015 Share Posted March 28, 2015 Yay! I managed to compile shaken now, but there's a lot of stuff going on that I don't understand, if anyone has any ideas help would be super-appreciated. - It complained that there's no rule for creating an objectlist, although I think I see stuff for that in the makefiles. Anyways, I created object lists manually into the cart and intro folders. - it seems that it still can't create some .o files, but just a while ago created a bunch of .o files in the bitmaps directory, but in the cart directory i had to ca65 them manually. I wonder if there's something wrong with my cc65 installation or could it be windows 8.1? (or probably just the user ) Quote Link to comment Share on other sites More sharing options...
LX.NET Posted March 28, 2015 Share Posted March 28, 2015 I will have a look at it tomorrow. Quote Link to comment Share on other sites More sharing options...
Turbo Laser Lynx Posted March 29, 2015 Share Posted March 29, 2015 Thanks LX.net, that would be very nice of you. Actually I'm thinking about setting everything up with visual studio in case that would help, but then again that wouldn't be helpful at all if the underlying cc65 installation is somehow screwed up. Quote Link to comment Share on other sites More sharing options...
LX.NET Posted March 30, 2015 Share Posted March 30, 2015 Thanks LX.net, that would be very nice of you. Actually I'm thinking about setting everything up with visual studio in case that would help, but then again that wouldn't be helpful at all if the underlying cc65 installation is somehow screwed up. There are two new articles on my blog that guide you through the steps of setting up your machine and do a clean compile of both the CC65 tools and the Shaken project. I will expand the examples in the latest post to also include the Pong with Segments game. Here are the two articles: https://atarilynxdeveloper.wordpress.com/2015/03/29/compiling-cc65-suite-and-lynx-libraries/ https://atarilynxdeveloper.wordpress.com/2015/03/30/compiling-lynx-homebrew-projects/ Please let me know if you find these useful and if you are missing something here or run into trouble otherwise. Good luck. I will ping this thread if I expand the post with Pong or otherwise. Quote Link to comment Share on other sites More sharing options...
Turbo Laser Lynx Posted March 31, 2015 Share Posted March 31, 2015 (edited) @LX.net That's so great! I already read both and look forward to getting it to work. A big thanks also for the whole programming tutorial on your blog, it's really amazing and an important contribution to the Lynx community! I must have read it 3-4 times already the last years. @Karri I've read about the segments in LX.net's tutorial many times and I feel I understand the theory fine, however understanding it on a practical level (the shaken code) is a bit tougher. When I look at lynx.cfg and directory.s it seems to me that all five parts begin at the same place in memory $0200 so those can replace each other in ram, but I can't see where the resident file is placed in the memory (the main one that can't be replaced/removed), is that the RAM part $BE38 minus $1c00? Edited March 31, 2015 by Turbo Laser Lynx Quote Link to comment Share on other sites More sharing options...
+karri Posted April 1, 2015 Author Share Posted April 1, 2015 (edited) Yes. All the default segments like Lynx libraries, CODE, DATA, RODATA are in the RAM segment. I just decided to chip away $1C00 bytes from the beginning of memory for the background sprites (Casino, Warehouse, Garage, Spa, Alley, Penny). This was a very basic segmentation. All code is in the RAM segment in Shaken. ZP: file = "", define = yes, start = $0000, size = $0100;not defined machine stack start at $0100, size $0100SPA: file = %O, define = yes, start = $0200, size = $1c00;RAM: file = %O, define = yes, start = $1e00, size = $BE38 - $1c00 - __STACKSIZE__;SCREEN buffers start at $BE38 Start of RAM = $1e00 I even noticed a typo. The RAM size should be "all the rest of memory" This means $BE38 - $1E00. Then we also need to reserve space for the BSS and subroutine calls. These go into __STACKSIZE__. This is defined as __STACKSIZE__: type = weak, value = $0800; # 2k stack This means that the correct RAM size should have been size = $BE38 - $1e00 - __STACKSIZE__; or simply size = $9838; Edited April 1, 2015 by karri Quote Link to comment Share on other sites More sharing options...
Turbo Laser Lynx Posted April 1, 2015 Share Posted April 1, 2015 Ok cool, then I understood it correctly, thanks Karri! Gonna have a try at this asap Quote Link to comment Share on other sites More sharing options...
8bit-Dude Posted September 29, 2019 Share Posted September 29, 2019 Hey guyz! I would like to ask for a little help on getting Chipper working with CC65. I am using the attached files (which come from another thread), which I can compile and link. Inside my code, I have implemented: extern unsigned char *music; void PlayMusic() { lynx_snd_pause(); lynx_snd_play(0, music); lynx_snd_continue(); } void StopMusic() { lynx_snd_stop(); } But the game freezes when I get to lynx_snd_play. Maybe I am not declaring the music data correctly...? I am using a recent version of cc65, and everything else (sprites, joystick, etc...) is working as it should. Thanks in advance for any help! Tony music.asm soundbs.mac Quote Link to comment Share on other sites More sharing options...
Turbo Laser Lynx Posted September 29, 2019 Share Posted September 29, 2019 (edited) Hi Tony! I compared the soundbs.mac file with the one in the newest version of Karri's template with Nop90's add ons, and they're identical: So I think the issue probably is that you're using a newer version of CC65 then, because it was froze in time for this specific version of Lynx CC65. Here's a link to where you can find the correct version of everything: https://atariage.com/forums/topic/287147-is-10-fps-a-too-low-framerate-for-a-lynx-tile-based-game/page/2/?tab=comments#comment-4202302 Edited September 29, 2019 by Turbo Laser Lynx Quote Link to comment Share on other sites More sharing options...
Nop90 Posted September 29, 2019 Share Posted September 29, 2019 @8bit-Dude if you share the sources of a simple project that uses the code you posted I can try to compile it with my CC65 (Karri's version) and test it. 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.