Jump to content
IGNORED

My Atari Lynx Programming Journal


OldAtAtari

Recommended Posts

19 minutes ago, Turbo Laser Lynx said:

It is actually potentially quite easy, of course it depends on all kinds of "IT" experience. The folder structure you show there is for collecting all kinds of Lynx development stuff in one place I think, so you would only need to:


Install Karri's cc65 onto your raspberry pi / linux machine, as per these instructions:
http://atariage.com/forums/topic/256753-atari-lynx-programming-tools-and-tutorials-wip/?p=4011786

- When cc65 is installed you can copy over the template somewhere to the linux machine.

 

Use Karri's newest template here:
Or use Karri's newest template with addons from Nop90 here:


- When it's copied over you can navigate into the template folder, the folder structure should look something like this:
Screenshot_080920_022333_AM.jpg.5c38ca9aac109f1d2b8872c6168b2922.jpg
- If everything is installed properly you can just write 'make' and the whole game/cart template compiles. It puts the resulting game.lnx file (that you can run in an emulator) in the cart directory.

Then you can start experimenting changing stuff in the game.c code and in the intro.c code and recompile. In addition to looking at the c code it also makes sense having a little look at the makefiles. When you want to start adding stuff, for example more graphics, you have to list the files/objects in the make files.

- Stuff might start behaving weirdly if you don't do a 'make clean' from time to time.

This should get you started at least. :) :thumbsup:

 

Thank you sir! I checked my install directory that I detailed above, and everything was there under the template/cart folder. And I was able to load the game.lnx file, just like you said! As it booted up, I said "Wow, it's like Jinx for the 7800! Wait, no! It's like Arkanoid!" And then it's not like either of those, but it's still really cool! Might be a simple thing to you guys, but to me, it's amazing that this is some homemade code for the Lynx!

 

So now I see that game.c exists in the /game directory and intro.c exists in the /intro directory, so yes, I can play around with those. That will be fun.

 

As for recompiling, is that a job for lyxass? Silly question I know, but this is the closest I'v been yet to actually compiling some code. Thank you for your patience with me!

Link to comment
Share on other sites

11 minutes ago, OldAtAtari said:

 

Thank you sir! I checked my install directory that I detailed above, and everything was there under the template/cart folder. And I was able to load the game.lnx file, just like you said! As it booted up, I said "Wow, it's like Jinx for the 7800! Wait, no! It's like Arkanoid!" And then it's not like either of those, but it's still really cool! Might be a simple thing to you guys, but to me, it's amazing that this is some homemade code for the Lynx!

 

So now I see that game.c exists in the /game directory and intro.c exists in the /intro directory, so yes, I can play around with those. That will be fun.

 

As for recompiling, is that a job for lyxass? Silly question I know, but this is the closest I'v been yet to actually compiling some code. Thank you for your patience with me!

Ok, not a job for lyxass. That's for assembly, I take it. Trying to run a .c file through it gives me a billion errors. Give or take a billion.

 

Google tells me that I can compile with gcc, as in "gcc game.c"

 

That seems to work, but complains about not finding the lynx.h include. I bet I'm missing some cc65 environment variables. Gonna work on that now.

 

Link to comment
Share on other sites

Argh! I think I get it now.

 

I don't need include environment variables. I don't need gcc.

 

I just need to go back to the /game and /cart directories. In each of those places, I can do a "make clean" and then a "make". It remakes the game.lnx file based on the /game/game.c file, and so it will incorporate my changes. Am I right that I have to do the make in both locations? It seems to be working...

 

But, wow! Thank you, Turbo Laser Lynx!

Hope Lives!

Edited by OldAtAtari
  • Like 1
Link to comment
Share on other sites

Wow, quite a day. I didn't meet my goal of writing and compiling an assembly program that I can run on Handy, but I did figure out how to edit and compile the template game (in C), thanks to Turbo Laser Lynx. And of course thanks to Karri as well for creating it in the first place.

 

And on the side, I start watching the 6502 Programming Tutorial on Youtube. It's good stuff, and so far, all the development tools and test cases work exactly as he explains. Find the first video lesson here:
 

 

And the written form and downloads for that tutorial are here:
https://chibiakumas.com/6502/
 

 

  • Like 1
Link to comment
Share on other sites

As I wrote, for Assembly you just need new_bll and lyxass (not the pachted one).

The just set BLL_ROOT and assemble one of the Minidemos. Then your are done.

You get an .o file which will run directly in handy.

 

Lynxer or lynxdir are not needed in the beginning.

 

Also, lyxass cannot assemble the files from (new)cc65 or v.v. .

  • Like 2
Link to comment
Share on other sites

If you want to code in assembly :

--> your compiler will be LYXASS, and you will get an executable .o file

 

If you want to code in C

--> you will use the (new)cc65 toolset. That means

   1. your code will be compiled from C to assembler by CC65 (*)

   2. the generated assembly code will be compiled by RA65 (*) (another assembler only used in C toolchain)

   3. extra libraries will be linked by LINK65 (*) and you will get an executable .o file

This is what the makefile is doing, so quite transparent for you once setup is done.

 

(*) maybe the names differs in newcc65/cc65 toolchain but the purpose is the same : compile C code / assembly / link

 

.o can be used in emulator or real Lynx via some Flashcard, they just need to have all assets encapsulated in them and must fit in Lynx RAM.

 

Next (optional) step is to generate a cartridge file, with LYNXDIR. This is only mandatory if you need to load assets/data/code from ROM (you won't need this for your 1st attempts) or if you want to create a flashable file for every flashcard or PiHat programmer in order to play on real Lynx.

 

Even if some of us (mostly french people I guess) are still using and enjoying the good old newcc65 (a cc65 version of the 90's modified to target the Lynx), I guess for newcomers, it is more convenient to use karri/nop's template with (quite) up to date cc65. C code is the same syntax, but it does not use BLL Lynx librairies, but generic faunctions and procedures that can target a large variety or target (Lynx, C64, ...), and also has some nice feature natively (load/unload code). And most important a bigger community using it right now (Wookie's tutorial use this toolchain).

 

Edited by Fadest
  • Like 4
Link to comment
Share on other sites

12 hours ago, 42bs said:

As I wrote, for Assembly you just need new_bll and lyxass (not the pachted one).

The just set BLL_ROOT and assemble one of the Minidemos. Then your are done.

You get an .o file which will run directly in handy.

 

Lynxer or lynxdir are not needed in the beginning.

 

Also, lyxass cannot assemble the files from (new)cc65 or v.v. .

Ok, thank you for that, 42bs. So here's my summary of what you said, just to make sure I understand:

1) new_bll --> The template comes with bll. So it sounds like I should download new_bll from your github and install it and use that instead. https://github.com/42Bastian

2) lyxass (not the patched one) --> So I can use the one included in the template

3) BLL_ROOT set to BLL_ROOT base directory --> I've done that! So one point for me.

4) So all I have to do then is a lyxass -v example.asm, which should result in a playable .o file.

5) I don't need to know what lynxer and lynxdir do for now.

6) Lyxass is not the slightest bit related to any version of cc65. cc65 is for C. Bll and lyxass are for assembly.

 

I know you said all that to me before, but somehow it really clicked this time. Thank you so much for your patience. I can't try it just this moment, but I hope later today I'll be able to. Assembly still seems ideal for me. So while I'm enjoying these two parallel learning paths, I would like assembly to be my main method, or at least a tool in my tool belt. Thanks again for your help.

Link to comment
Share on other sites

10 hours ago, Fadest said:

If you want to code in assembly :

--> your compiler will be LYXASS, and you will get an executable .o file

 

If you want to code in C

--> you will use the (new)cc65 toolset. That means

   1. your code will be compiled from C to assembler by CC65 (*)

   2. the generated assembly code will be compiled by RA65 (*) (another assembler only used in C toolchain)

   3. extra libraries will be linked by LINK65 (*) and you will get an executable .o file

This is what the makefile is doing, so quite transparent for you once setup is done.

 

(*) maybe the names differs in newcc65/cc65 toolchain but the purpose is the same : compile C code / assembly / link

 

.o can be used in emulator or real Lynx via some Flashcard, they just need to have all assets encapsulated in them and must fit in Lynx RAM.

 

Next (optional) step is to generate a cartridge file, with LYNXDIR. This is only mandatory if you need to load assets/data/code from ROM (you won't need this for your 1st attempts) or if you want to create a flashable file for every flashcard or PiHat programmer in order to play on real Lynx.

 

Even if some of us (mostly french people I guess) are still using and enjoying the good old newcc65 (a cc65 version of the 90's modified to target the Lynx), I guess for newcomers, it is more convenient to use karri/nop's template with (quite) up to date cc65. C code is the same syntax, but it does not use BLL Lynx librairies, but generic faunctions and procedures that can target a large variety or target (Lynx, C64, ...), and also has some nice feature natively (load/unload code). And most important a bigger community using it right now (Wookie's tutorial use this toolchain).

 

Fadest, this is terrific. Thank you so much. As I did with 42bs' post above, I'll try to restate what you said to make sure I understand:

For Assembly:
1) Lyxass is the assembler. The source file is a *.asm text file. And then lyxass -v example.asm will build the playable .o file. Seems easy enough.

For C (this is where my understanding is sketchy) :

1) CC65 is my assembler. I give it a text file written in C, and it converts my text file to assembly.

2) That assembled source code then gets pushed through RA5, which is a second assembler.

3) During that process, something called LINK65 pulls things from supporting libraries, and the result is a playable .o file.

4) The makefile in Karri's template is taking care of all that for me, reducing multiple steps to one step.

5) Lynxdir is necessary if I want to play this on a real Lynx, and/or if I want to load data into the game from ROM.

6) newcc65 is still usable, but most people these days are using the newer version, which is cc65.

7) C does not use the BLL libraries for anything. BLL is used for assembly, not C.

8 ) Wookie has a tutorial. I need to find that.

So how'd I do? Was that summary anywhere close to correct?

 

 

 


 

 

Edited by OldAtAtari
Correcting one of likely many typoes
Link to comment
Share on other sites

Thanks to everybody for the support. I thought since I'm generally considered a computer geek, and since I've got some assembly and other programming experience, that this whole Lynx thing would be a breeze. But there is a whole world of programs to understand, and I apparently I've finally revealed my ineptitude enough that you folks are spelling it out for me slowly. I know that's a pain for you all, but I really appreciate it. Just over the last 24 hours, I've learned so much. I can't thank you enough. I'm still excited, and I still intend to keep pushing forward until I can write an actual program from scratch in either C or assembly or both. Thanks again.

Link to comment
Share on other sites

18 minutes ago, Fadest said:

In fact, not wookie, but LX.net summarized everything here for cc65:

 

 

 

Yes, of course! That was actually the first tutorial I tried! "Diary of An Atari Lynx Developer". It's an amazing piece of work, but I had so much trouble when it came to the Hello World example, that I just quit. My environment was all messed up. The example was written for Visual Studio 2010 and older versions of the cc65 tools. I made the mistake of thinking newer was better, so I installed Visual Studio 2019 and the newest cc65. So the example was calling joystick functions that have been renamed in the new cc65 includes, and once I debugged that, Visual Studio 2019 wouldn't compile it, saying that the 2010 tools weren't available. It was a long night, and I never got it working. That's when I went off looking for newer tutorials. Truth is that there is probably a ton of useful information in that tutorial, and I should not have given up on it entirely. I should revisit it and learn what I can from it, which is probably a lot.

Link to comment
Share on other sites

Ok, so I just tried new_bll and lyxass to assemble mines2.asm. Segmentation fault (core dumped). I wonder if this version of new_bll and/or lyxass is only for Windows, not Linux. More likely, I did something wrong. Any thoughts would be appreciated. Thanks.

 

lyxass_coredump.jpg

Edited by OldAtAtari
Link to comment
Share on other sites

2 hours ago, OldAtAtari said:

It's an amazing piece of work, but I had so much trouble when it came to the Hello World example, that I just quit. My environment was all messed up. The example was written for Visual Studio 2010 and older versions of the cc65 tools.

That's why I like that Karri's CC65 and newCC65 are locked in time. At least personally I don't have the time or energy to keep up with new updates if I come back to the Lynx say once a year and then old code I need for reference is broken. Also the setup of both of those is much easier. I've noticed that setting up a development environment in different retro-coding scenes (and modern too) seem to be some dark, mystical programmers initiation rite! :grin: That's why I've been so happy that it's been made easier lately for the Lynx with "Karri's cc65".
 

3 hours ago, OldAtAtari said:

6) newcc65 is still usable, but most people these days are using the newer version, which is cc65.

We'd really need a name for "Karri's cc65" or "cc65 Remake" (as I've heard it been called), because technically cc65 is the new official version that's always updated (and doesn't have that much specific Lynx-scene support at this moment). Karri's cc65 is in the middle (age-wise), and over the last years the tools around it has evolved and made developing with it easier and easier. Newcc65 is the oldest one, but still totally fine. It's just some things (like for example loading from cartridge, playing music etc.) that has been made easier in "Karri's cc65".
 

3 hours ago, OldAtAtari said:

4) The makefile in Karri's template is taking care of all that for me, reducing multiple steps to one step.

If you want to understand cc65 more, the docs are really helpful.
https://cc65.github.io/doc/
 

The intro part describes what fadest was saying a bit more in detail:
https://cc65.github.io/doc/intro.html
 

I'm still curious if you're looking to become a master assembly/C Lynx coder or if you just want to make (Lynx) games? I'm just trying to show you the backdoor to rapid/fun Lynx game development, and while you're experimenting you'll learn about all the details meanwhile/later. Of course if you want to learn everything from the ground up instead, I wouldn't want to keep on disrupting you with my "cheaters course". :grin:

 

3 hours ago, OldAtAtari said:

I still intend to keep pushing forward until I can write an actual program from scratch in either C or assembly or both.

I'm thinking this implies you're more into it for learning everything from scratch / to be a good programmer.?:) Otherwise it's perfectly possible to write decent games with the template in quite rudimentary C (taking into account cc65 optimisation hints).
https://cc65.github.io/doc/coding.html

 

Edited by Turbo Laser Lynx
  • Like 1
Link to comment
Share on other sites

1 hour ago, Turbo Laser Lynx said:

That's why I like that Karri's CC65 and newCC65 are locked in time. At least personally I don't have the time or energy to keep up with new updates if I come back to the Lynx say once a year and then old code I need for reference is broken. Also the setup of both of those is much easier. I've noticed that setting up a development environment in different retro-coding scenes (and modern too) seem to be some dark, mystical programmers initiation rite! :grin: That's why I've been so happy that it's been made easier lately for the Lynx with "Karri's cc65".
 

We'd really need a name for "Karri's cc65" or "cc65 Remake" (as I've heard it been called), because technically cc65 is the new official version that's always updated (and doesn't have that much specific Lynx-scene support at this moment). Karri's cc65 is in the middle (age-wise), and over the last years the tools around it has evolved and made developing with it easier and easier. Newcc65 is the oldest one, but still totally fine. It's just some things (like for example loading from cartridge, playing music etc.) that has been made easier in "Karri's cc65".
 

If you want to understand cc65 more, the docs are really helpful.
https://cc65.github.io/doc/
 

The intro part describes what fadest was saying a bit more in detail:
https://cc65.github.io/doc/intro.html
 

I'm still curious if you're looking to become a master assembly/C Lynx coder or if you just want to make (Lynx) games? I'm just trying to show you the backdoor to rapid/fun Lynx game development, and while you're experimenting you'll learn about all the details meanwhile/later. Of course if you want to learn everything from the ground up instead, I wouldn't want to keep on disrupting you with my "cheaters course". :grin:

 

I'm thinking this implies you're more into it for learning everything from scratch / to be a good programmer.?:) Otherwise it's perfectly possible to write decent games with the template in quite rudimentary C (taking into account cc65 optimisation hints).
https://cc65.github.io/doc/coding.html

 

Ha! Funny you should ask. When I need to write a program at work, I never write it from scratch. I always just find an existing Perl script and hack the heck out of it to make do what I want. So why am I so insistent on writing Lynx games from scratch? I don't have an answer for that! I am enjoying learning the languages and procedures, but there's no reason I couldn't try to crank out a quick game from the template. You've done some terrific games that way. So that's exciting, and it may truly be all I ever need.

 

By the way, do you always start from game.c, or is there a different game file you like to start from?

  • Like 1
Link to comment
Share on other sites

8 hours ago, OldAtAtari said:

Ok, so I just tried new_bll and lyxass to assemble mines2.asm. Segmentation fault (core dumped). I wonder if this version of new_bll and/or lyxass is only for Windows, not Linux. More likely, I did something wrong. Any thoughts would be appreciated. Thanks.

 

lyxass_coredump.jpg

Oops :(

Ok, tried it also, same here.
Fixed (at least it assembles now on my ubuntu 20.04). So please pull lyxass again.

 

Edited by 42bs
  • Like 1
Link to comment
Share on other sites

7 hours ago, 42bs said:

Oops :(

Ok, tried it also, same here.
Fixed (at least it assembles now on my ubuntu 20.04). So please pull lyxass again.

 

Thanks for trying it! I'm on 20.04 as well, so I guess it's related to this version of Linux. I was using lyxass from the template. This time I'll grab the version from https://github.com/42Bastian/lyxass.

Thanks again!

Link to comment
Share on other sites

Much better! Thank you 42bs!

7 hours ago, 42bs said:

Oops :(

Ok, tried it also, same here.
Fixed (at least it assembles now on my ubuntu 20.04). So please pull lyxass again.

 

Much better! Thank you again, 42bs.

I have now successfully assembled mines2.asm. And with that, I can say that I have examples of both C programs and assembly programs that I can hack up to my liking, and I have the ability to recompile them.

So I could, in theory, as Laser pointed out, start working on some games! Simple ones for now.

image.thumb.png.42c169cbf753b6d4ebd6dbb0c575e02f.png
 

  • Like 2
Link to comment
Share on other sites

44 minutes ago, OldAtAtari said:

Much better! Thank you 42bs!

Much better! Thank you again, 42bs.

I have now successfully assembled mines2.asm. And with that, I can say that I have examples of both C programs and assembly programs that I can hack up to my liking, and I have the ability to recompile them.

So I could, in theory, as Laser pointed out, start working on some games! Simple ones for now.

image.thumb.png.42c169cbf753b6d4ebd6dbb0c575e02f.png
 

The Atari Lynx Jam on itch.io is closing on Saturday. So there is still a few hours left to squeeze in a game. ;) 

Just kidding. But the Silly Ventures 2020 could be a good target on December 3-6th in Gdansk. Last year I was following the competition remotely through a stream. It was fun. Although I got the last position in the competition with my entry SillySis.

 

Even if you don't submit anything this year just joining in on a Silly Ventures 2020 stream could be fun. Last year there was a lot of developers chatting while the competition was going on. Even R.J. Mical was on-line (the Lynx hw designer in the old times)


sillysis.lnx

 

Perhaps I put together something better this year.

 

 

  • Like 1
Link to comment
Share on other sites

7 minutes ago, karri said:

The Atari Lynx Jam on itch.io is closing on Saturday. So there is still a few hours left to squeeze in a game. ;) 

Just kidding. But the Silly Ventures 2020 could be a good target on December 3-6th in Gdansk. Last year I was following the competition remotely through a stream. It was fun. Although I got the last position in the competition with my entry SillySis.
sillysis.lnx

 

Perhaps I put together something better this year.

 

 

Well that's encouraging!

Funny thing is that I see the Jam theme is "This year's theme is "Future", but that's future with a twist. Think about how the future would have been imagined back in the 1990s when this console was new. Think of the retro movie posters and the games at the time and imagine them 50 years forward. Flying cars, space exploration, living on the moon, visiting other planets, intelligent robots, blasters and mind control, plus many other wonderful things that were yet to come. We're talking about what the 2040s would look like if you were living in the 90s."

 

One of my long-term game ideas was something I was calling "2004: A World of Fortune" which would be what a 1950's science fiction writer would imagine 2004 to be. It would fit right in! But I don't think I'll get it done in time. ?

 

Maybe I'll have something for Silly Ventures in December. That's a bit more realistic.

 

Link to comment
Share on other sites

12 minutes ago, karri said:

Even if you don't submit anything this year just joining in on a Silly Ventures 2020 stream could be fun. Last year there was a lot of developers chatting while the competition was going on. Even R.J. Mical was on-line (the Lynx hw designer in the old times)

 

  • Like 1
Link to comment
Share on other sites

1 hour ago, OldAtAtari said:

Very cool. I'll check out the stream, even if I don't submit a game. Thank you!

Nice!
DSC05710-3.jpeg.35e7ba839b72b5fd7c7b081efaab4bc5.jpeg

 

I hope to attend. After all this COVID19 solitude I would love some party time...

 

Edit: Seeing my current hair colour compared to my avatar some 8 years ago is scary. Am I getting older?

 

  • Like 1
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...