Jump to content
IGNORED

Atari Lynx programming tutorial


LX.NET

Recommended Posts

I've been hunting for sprpck.exe since I came across it in Part 7 of the tutorial. The tutorial seems to assume you have it..

 

I just saw the link posted above for sprpck (http://monlynx.de/lynx/tools.html), but it isn't working :(

 

Any idea where I can download it?

 

 

Edit: Is the version here the same?

 

http://www.mdgames.de/lynx_eng.htm

Edited by pixelperfect
Link to comment
Share on other sites

It is Matthias Domin's website, and I believe I also got it from there.

There is a separate version of sprpck at http://monlynx.de/download/lynx/but that is version 1.97. 1.98 at mdgames is more recent (obviously). Of course, you could also use Karri's contribution of sp65.exe, but I found the lack of bmp support to be to cumbersome for me for now.

 

Like for all other Lynx programmers: feel free to reach out (at the Programming forum or directly via PM) if you have any questions or get stuck somewhere. Always willing to help.

Some more tutorial stuff is going to be released soon. Stay tuned. ;)

Link to comment
Share on other sites

Thanks, really appreciate it! I come from a C# background so I'm sure there's going to be some learning curves for me with C (but it's much less daunting than Assembly at least ;)), but so far so good.

 

One last question for this hopefully.. where do I extract sprpck to?

Edited by pixelperfect
Link to comment
Share on other sites

Humm.. this is kind of painful here. The guide really doesn't take you step by step to make a sprite, it's just snippets here and there, making it very confusing how it is all put together. Also had trouble with SPRCTL0_4_bits_per_pixel not resolving either, then I saw in comments someone custom defined it.

 

I keep comparing from the Tutorial projects back to mine trying to figure out what is different, but the code there is even different than what's on the site >< I don't mean to complain and I really appreciate the guide, but I can see how less stubborn people would just give up here haha..

Link to comment
Share on other sites

It is Matthias Domin's website, and I believe I also got it from there.

There is a separate version of sprpck at http://monlynx.de/download/lynx/but that is version 1.97. 1.98 at mdgames is more recent (obviously). Of course, you could also use Karri's contribution of sp65.exe, but I found the lack of bmp support to be to cumbersome for me for now.

 

Like for all other Lynx programmers: feel free to reach out (at the Programming forum or directly via PM) if you have any questions or get stuck somewhere. Always willing to help.

Some more tutorial stuff is going to be released soon. Stay tuned. ;)

 

The sprpck is also found in https://bitbucket.org/atarilynx/lynx/src and from there tools/newcc65/sprpck.

 

For some reason we never ported it to cc65.org but instead we wrote a new tool sp65 that does the same as sprpck - kind of. You can export the sprites directly as asm, bin or C-code.

 

The new code is modular and it is simple to add support for all kind of graphics formats. You only need to implement one single call

Bitmap* ReadPCXFile (const Collection* A);

The call will read in the entire bitmap and palette and output a Bitmap object for the sprite building engine.

 

I have mainly used pcx format for my editing. Gimp supports it directly. The advantage is that you can use the same format for all kind of images: 2-colours, 4-colours, 8-colours and 16-colours. The new sp65 also supports the "shaped" graphics mode that does not use transparent colours for the sprite but instead clips away the unused data to the right and left of the sprite. This is not the case for sprpck and bmp files. Feel free to look at pcx.h and pcx.c and implement bmp.h and bmp.c

 

Naturally the entry point should be

Bitmap* ReadBMPFile (const Collection* A);

and it should do all the magic needed to fill the Bitmap

struct Bitmap {

    /* Name of the bitmap. This is used for error messages and should be
     * something that allows the user to identify which bitmap the message
     * refers to. For bitmaps loaded from a file, using the file name is
     * a good idea.
     */
    StrBuf      Name;

    /* Size of the bitmap */
    unsigned    Width;
    unsigned    Height;

    /* Palette for indexed bitmap types, otherwise NULL */
    Palette*    Pal;

    /* Pixel data, dynamically allocated */
    Pixel       Data[1];
};
Edited by karri
Link to comment
Share on other sites

Humm.. this is kind of painful here. The guide really doesn't take you step by step to make a sprite, it's just snippets here and there, making it very confusing how it is all put together. Also had trouble with SPRCTL0_4_bits_per_pixel not resolving either, then I saw in comments someone custom defined it.

 

I keep comparing from the Tutorial projects back to mine trying to figure out what is different, but the code there is even different than what's on the site >< I don't mean to complain and I really appreciate the guide, but I can see how less stubborn people would just give up here haha..

 

I will look into this. The comments are from a time when the lynx.h was different and included different defines. So, reading the comments is confusing. I will check the sample code that you can download and see if it has the latest code. Sorry for any confusion.

Link to comment
Share on other sites

 

I will look into this. The comments are from a time when the lynx.h was different and included different defines. So, reading the comments is confusing. I will check the sample code that you can download and see if it has the latest code. Sorry for any confusion.

 

Yea, I finally figured out that was old stuff and had been replaced with new defines in _suzy.h, so I'm using those now as well as their SCB_REHVST_PAL struct. The sample code you download is definitely using the older stuff. I guess my main complaint the other day was that the guide (at least what I've read so far) is in a weird in-between state where it's not really a step-by-step instruction on how to create the sample projects, and it's not straight up theory either. Like you said though, a lot has changed in the meantime and the samples you download don't exactly match what's on the site, so I think a lot of confusion comes from that.

 

Anyway, my personal feeling is that anything is better than nothing. I know how much work it is to make something like this. I just feel like those that don't have a lot of experience will be totally stumped by the things that are left vague and expected for you to figure out. Mostly just simple things too, like exactly which files to put in what folders, what lines to add to what files, etc.

  • Like 1
Link to comment
Share on other sites

One robot enters, no robots leave!


cNMI05C.gif


Picking things up a little faster now. Made some progress with input, collisions, etc today. You're right, definitely a bit less painful after the first part. I still don't fully understand the palettes (I get the idea, just not totally there yet..), and also no clue how to make my own graphics yet, but tomorrow is another day.


Just one note, on part 10 you have "byte depository;" for the sprite with collisions struct, but it took me a minute to realize there's no byte variable type in C :D

Link to comment
Share on other sites

Well, I guess it's an actual game now?

 

JiXOOLK.gif

 

Not too shabby for just a few days effort. Added a simple state machine using enums, title screen, pausing (needs removed now that I see how it can be exploited :D) and scoring. Still trying to figure out how to track elapsed time (made a separate thread about that). Getting a little more comfortable with C, a lot of little things to learn for sure. I think my next focus will be learning how to create new graphics and understanding the palettes, so going back to your guide tomorrow :)

Edited by pixelperfect
Link to comment
Share on other sites

Well, I guess it's an actual game now?

 

JiXOOLK.gif

 

Not too shabby for just a few days effort. Added a simple state machine using enums, title screen, pausing (needs removed now that I see how it can be exploited :D) and scoring. Still trying to figure out how to track elapsed time (made a separate thread about that). Getting a little more comfortable with C, a lot of little things to learn for sure. I think my next focus will be learning how to create new graphics and understanding the palettes, so going back to your guide tomorrow :)

Crikey you're a quick learner. I really struggled with the tutorial and ended up giving in. Maybe you can do a real idiots guide for people like me ?.

 

At this rate you'll be a great asset to the Lynx community, good luck on your next project. (Zarlor Mercenary 2 perhaps)

Rgds

BadPricey

Link to comment
Share on other sites

Haha thanks :) I have some game dev experience outside of this, so I'm familiar with how games work. Once you wrap your head around how the core game loop works then it's only figuring out how to implement for specific platform you're working on. I'm used to more modern stuff though, so I'm still having to learn a lot.

 

A step by step guide to build a small game could definitely be cool if it doesn't exist already. I could throw something together once I'm done if it would help.

 

I will probably do a couple small mobile style games first, but then I would like to do something bigger. I need to figure out if Lynx homebrew is missing any big titles (like say Tetris, Bomberman, etc) that would be nice to have on the platform. I'm not too familiar with it yet since I'm just getting back into it.

Link to comment
Share on other sites

Hithere!
It's been a while due to several reasons. I'm trying to get my development environment up and running again, I forgot how I struggled with it.
Does the CC65 with Microsoft Visual Studio 2010 run in Windows 10?

I'm asking because I keep ketting 'error : Include file `****.h' not found. Checked my environment variables, path etc. a thousand times...any suggestions?

BadPricey: I have GameMaker, including with 2 books :)

Greets,
Tony

Link to comment
Share on other sites

My log file:

 

Build started 24/08/2016 21:51:32.
1>Project "C:\Users\Tony\Documents\Visual Studio 2010\HelloWorld\HelloWorld.vcxproj" on node 2 (build target(s)).
1>Build:
nmake.exe /f tutorial.mak BUILD=Debug all
Microsoft ® Program Maintenance Utility Version 10.00.30319.01
Copyright © Microsoft Corporation. All rights reserved.
copy "C:\CC65"\include\..\tgi\lynx-160-102-16.tgi .
1 file(s) copied.
co65 --code-label _lynxtgi -o lynx-160-102-16.s lynx-160-102-16.tgi
ca65 -t lynx -o lynx-160-102-16.o lynx-160-102-16.s
copy "C:\CC65"\include\..\joy\lynx-stdjoy.joy .
1 file(s) copied.
co65 --code-label _lynxjoy -o lynx-stdjoy.s lynx-stdjoy.joy
ca65 -t lynx -o lynx-stdjoy.o lynx-stdjoy.s
cc65 -o tutorial.s --code-name CODE --rodata-name RODATA --bss-name BSS --data-name DATA -I . -t lynx --add-source -O -Or -Cl -Os tutorial.c
1>tutorial.c(1): error : Include file `6502.h' not found
1>tutorial.c(2): error : Include file `lynx.h' not found
1>tutorial.c(3): error : Include file `tgi.h' not found
1>tutorial.c(9): error : Call to undefined function `tgi_clear'
1>tutorial.c(11): error : Call to undefined function `tgi_setcolor'
1>tutorial.c(11): error : Undefined symbol: `COLOR_WHITE'
1>tutorial.c(12): error : Call to undefined function `tgi_outtextxy'
1>tutorial.c(14): error : Call to undefined function `tgi_updatedisplay'
1>tutorial.c(19): error : Call to undefined function `tgi_install'
1>tutorial.c(20): error : Call to undefined function `tgi_init'
1>tutorial.c(21): error : Call to undefined function `CLI'
tutorial.c(21): Fatal: Too many errors
1>NMAKE : fatal error U1077: 'c:\CC65\bin\cc65.EXE' : return code '0xff'
Stop.
1>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\Microsoft.MakeFile.Targets(38,5): error MSB3073: The command "nmake.exe /f tutorial.mak BUILD=Debug all" exited with code 2.
1>Done Building Project "C:\Users\Tony\Documents\Visual Studio 2010\HelloWorld\HelloWorld.vcxproj" (build target(s)) -- FAILED.
Build FAILED.
Time Elapsed 00:00:00.21

 

 

Link to comment
Share on other sites

OK next likely culprit is your project settings if your environment variables are set correctly. Right click the Project, click Properties, then make sure the VC++ and nmake tabs look like this:

 

A2uGQbi.png

 

3tAetGs.png

 

(the .mak and .lnx should be whatever yours are called)

Edited by pixelperfect
Link to comment
Share on other sites

Tony, i am sure we can fix your problem. Did you set all environment variables?

It works with VS 2010, 2012 and 2015.

Make sure your CC65 path is also included in the lynxcc65.mak. I believe it's the first line. Otherwise your own .ak file that includes the lynx.mak file.

Link to comment
Share on other sites

Does cc65 still use environment variables to locate the lib and include dirs?

 

Yes. It is the latest and greatest version from Ullrich von Bassewitz.

    /* Add paths relative to a main directory defined in an env var */
    AddSubSearchPathFromEnv (LibSearchPath, "CC65_HOME", "lib");
    AddSubSearchPathFromEnv (ObjSearchPath, "CC65_HOME", "obj");
    AddSubSearchPathFromEnv (CfgSearchPath, "CC65_HOME", "cfg");
    /* Add specific paths from the environment */
    AddSearchPathFromEnv (IncSearchPath, "CA65_INC");

    /* Add paths relative to a main directory defined in an env var */
    AddSubSearchPathFromEnv (IncSearchPath, "CC65_HOME", "asminc");

It is still the version 2.13.9 with just very small bug fixes.

Edited by karri
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...