Jump to content
IGNORED

cc65 for Windows


karri

Recommended Posts

Hi guys.

 

Today I again got questions of how to set up stuff for Windows. As I found an old laptop I decided to give it a try.

 

1) Run http://www.cygwin.com/setup-x86_64.exe

 

This is because the Windows was a 64 bit version. For a 32 bit version you have to install setup-x86.exe instead.

 

During installation I just clicked "Next" to everything except to the screen "Select packages".

Here I added the first versions of

 

gcc core

git

make

 

2) Open a Cygwin shell by clicking on the Cygwin icon on the desktop.

 

Type:

git clone https://bitbucket.org/atarilynx/lynx.git

This will fetch the C-compiler cc65 sources from the net.

 

Then we need to compile and install everything. Type:

cd lynx/tools/cc65
make -f make/gcc.mak
make -f make/gcc.mak install

Now we are ready to develop the first Lynx program.

 

 

Create a file called main.c and save it to C:/cygwin86/home/user/

 

#include <lynx.h>
#include <tgi.h>
#include <joystick.h>
#include <6502.h>


int main()
{
  joy_install(&lynx_stdjoy);
  tgi_install(&lynx_160_102_16);
  tgi_init();
  CLI();
  while (tgi_busy())
    ;
  tgi_setcolor(COLOR_GREEN);
  tgi_outtextxy(10, 10, "Hello World!");
  tgi_updatedisplay();
  while (1)
    ;
  return 1;
}

Compile it by typing this:

cl65 -t lynx -o main.lnx main.c

You should now have a game called main.lnx in C:/cygwin86/home/user/

 

 

Edited by karri
  • Like 3
Link to comment
Share on other sites

If you're on Windows 10, you could also do this with Bash on Windows -> https://msdn.microsoft.com/en-us/commandline/wsl/install_guide

 

That said, I've been using the "real" cc65 located on github, built for Windows myself, and I'm having zero problems with Lynx dev...why is there a separate repo/branch that you're maintaining? I'm sure there's some history I'm missing. :)

Link to comment
Share on other sites

If you're on Windows 10, you could also do this with Bash on Windows -> https://msdn.microsoft.com/en-us/commandline/wsl/install_guide

 

That said, I've been using the "real" cc65 located on github, built for Windows myself, and I'm having zero problems with Lynx dev...why is there a separate repo/branch that you're maintaining? I'm sure there's some history I'm missing. :)

 

My repo is just a few years old, frozen in time. The reason why it exists is that I never got the segments to work correctly on the new version of the cc65. Once it works ok I could update.

Link to comment
Share on other sites

 

My repo is just a few years old, frozen in time. The reason why it exists is that I never got the segments to work correctly on the new version of the cc65. Once it works ok I could update.

Interesting. I'm just using the default segment config, but perhaps if I were to do something more complex I'll run into it. Good to know, thanks for the info! :)

Link to comment
Share on other sites

Interesting. I'm just using the default segment config, but perhaps if I were to do something more complex I'll run into it. Good to know, thanks for the info! :)

 

I had problems with the 7DRL competition. "Shaken, not stirred" had mysterious crashes with the latest cc65. When I rolled back to older compilers the newest working one is the one I have been using since.

 

The old compiler also created tighter code than the new one. Some of my old games did not fit in the rom with the newer compiler anymore.

Link to comment
Share on other sites

There is another detail in my version too. In most development chains you need sprpck.exe to turn a bitmap to a sprite.

 

In my version there is a native tool for the cc65 chain called sp65. It will turn a bitmap into a sprite as a C-file.

bd000001.o : bd.pcx
        $(SP) -r $< --slice 10,0,10,10 -c lynx-sprite,mode=packed,ax=4,ay=0 -w $*.c,ident=$*
        $(CC) -o $*.s $*.c
        $(AS) -o $*.o $*.s
        $(RM) $*.c
        $(RM) $*.s

 

It also supports the modes literal, packed and shaped. The shaped mode can use all 16 colours while still having a form. No transparent pixels required. This is not supported by sprpck.exe.

 

It also supports an anchor point

ax=0,ay=0

and you can slice a bit of the bitmap for the sprite

--slice x,y,w,h

The reason for not using sprpck.exe is that it requires a lot of extra libraries and the license is not flexible enough to have it as a cc65 tool. So after some discussions with the cc65 core developers we decided to create sp65. It works on other machine architectures also like Apple.

Link to comment
Share on other sites

Tried following this Karri, but got stuck at the line

make -f make/gcc.mak install

 

which gave me the following error:

 

If you are denied permission to install or uninstall this package,
then you will need to do "make/gcc.mak install" or "make/gcc.mak uninstall"
as either the root user or an administrator.
for f in ar65 ca65 cc65 cl65 co65 da65 ld65 od65 grc65 sp65; \
do make/install-sh -c -m 755 -s src/$f/$f.exe /usr/local/bin || exit $?; \
done
install: cannot stat 'src/ar65/ar65.exe': No such file or directory
make: *** [make/gcc.mak:151: install-bins] Error 1

Any advice here?

Link to comment
Share on other sites

Tried following this Karri, but got stuck at the line

make -f make/gcc.mak install

 

which gave me the following error:

 

If you are denied permission to install or uninstall this package,
then you will need to do "make/gcc.mak install" or "make/gcc.mak uninstall"
as either the root user or an administrator.
for f in ar65 ca65 cc65 cl65 co65 da65 ld65 od65 grc65 sp65; \
do make/install-sh -c -m 755 -s src/$f/$f.exe /usr/local/bin || exit $?; \
done
install: cannot stat 'src/ar65/ar65.exe': No such file or directory
make: *** [make/gcc.mak:151: install-bins] Error 1

Any advice here?

 

What I did was to 1st run this as a user

 

make -f make/gcc.mak

 

and after it has compiled

 

sudo make -f make/gcc.mak install

 

I did not need to do anything to line breaks. It just worked on Window 8.1.

Edited by karri
Link to comment
Share on other sites

sudo does not seem to be recognized from the setup above

 

Sorry my error.

I do not have sudo on my setup either. Forget about the sudo.

 

But I did run the make and make install separately.

 

I also ran the stuff as a user - not as admin.

 

But perhaps my user has more rights than a guest?

 

I feel so stupid when I have not run Windows for years...

Link to comment
Share on other sites

Hmm, I wasn't able to get it to work tonight. I guess the command not found might just be some path issue or missing dependency. If someone sees something really apparent, please point me in the correct direction:

Sampo@Rintanen ~/lynx/tools/cc65
$ make -f make/gcc.mak
make[1]: Entering directory '/home/Sampo/lynx/tools/cc65/src'
make -C common -f make/gcc.mak
make[2]: Entering directory '/home/Sampo/lynx/tools/cc65/src/common'
Creating dependency information
gcc -g -O2 -Wall -W -std=c89 -MM abend.c addrsize.c alignment.c assertion.c bito                 ps.c chartype.c check.c cmdline.c coll.c cpu.c debugflag.c exprdefs.c fileid.c f                 ilepos.c filestat.c filetime.c filetype.c fname.c fp.c gentype.c hashfunc.c hash                 tab.c intstack.c matchpat.c mmodel.c print.c searchpath.c segnames.c shift.c str                 buf.c strpool.c strstack.c strutil.c target.c tgttrans.c version.c xmalloc.c xsp                 rintf.c > .depend
/bin/sh: gcc: command not found
make[2]: *** [make/gcc.mak:86: depend] Error 127
make[2]: Leaving directory '/home/Sampo/lynx/tools/cc65/src/common'
make[1]: *** [make/gcc.mak:26: common] Error 2
make[1]: Leaving directory '/home/Sampo/lynx/tools/cc65/src'
make: *** [make/gcc.mak:65: bins] Error 2

Sampo@Rintanen ~/lynx/tools/cc65
$ make -f make/gcc.mak install

If you are denied permission to install or uninstall this package,
then you will need to do "make/gcc.mak install" or "make/gcc.mak uninstall"
as either the root user or an administrator.

mkdir -m 755 -p /usr/local/share || mkdir -m 755 /usr/local/share
mkdir -m 755 -p /usr/local/share/doc || mkdir -m 755 /usr/local/share/doc
mkdir -m 755 -p /usr/local/share/doc/cc65 || mkdir -m 755 /usr/local/share/doc/cc65
mkdir -m 755 -p /usr/local/lib/cc65 || mkdir -m 755 /usr/local/lib/cc65
mkdir -m 755 -p /usr/local/lib/cc65/asminc || mkdir -m 755 /usr/local/lib/cc65/asminc
mkdir -m 755 -p /usr/local/lib/cc65/include || mkdir -m 755 /usr/local/lib/cc65/include
mkdir -m 755 /usr/local/lib/cc65/include/em
mkdir -m 755 /usr/local/lib/cc65/include/geos
mkdir -m 755 /usr/local/lib/cc65/include/joystick
mkdir -m 755 /usr/local/lib/cc65/include/mouse
mkdir -m 755 /usr/local/lib/cc65/include/sys
mkdir -m 755 /usr/local/lib/cc65/include/tgi
mkdir -m 755 -p /usr/local/lib/cc65/cfg || mkdir -m 755 /usr/local/lib/cc65/cfg
mkdir -m 755 -p /usr/local/lib/cc65/lib || mkdir -m 755 /usr/local/lib/cc65/lib
mkdir -m 755 -p /usr/local/lib/cc65/obj || mkdir -m 755 /usr/local/lib/cc65/obj
mkdir -m 755 /usr/local/lib/cc65/emd
mkdir -m 755 /usr/local/lib/cc65/joy
mkdir -m 755 /usr/local/lib/cc65/mou
mkdir -m 755 /usr/local/lib/cc65/ser
for f in ar65 ca65 cc65 cl65 co65 da65 ld65 od65 grc65 sp65; \
  do make/install-sh -c -m 755 -s src/$f/$f.exe /usr/local/bin || exit $?; \
  done
install: cannot stat 'src/ar65/ar65.exe': No such file or directory
make: *** [make/gcc.mak:151: install-bins] Error 1

Sampo@Rintanen ~/lynx/tools/cc65

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

the cygwin installer/setup says I have 'djgpp-gcc-core: GCC for DJGPP toolchain ( C )' installed, but there's four other gcc cores here on the list with bigger file-size. The one I installed was just furthest up the list when I searched for pakages, maybe I should just try with some other one.

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

I installed another gcc core but it still complains about gcc: Command not found. I googled it and it seems to be some path problems since gcc is installed and I see all the gcc exe files. http://askubuntu.com/questions/428220/cant-run-make-gcc-command-not-found

I have to look at it later.

Sampo@Rintanen ~/lynx/tools/cc65
$ make -f make/gcc.mak
make[1]: Entering directory '/home/Sampo/lynx/tools/cc65/src'
make -C common -f make/gcc.mak
make[2]: Entering directory '/home/Sampo/lynx/tools/cc65/src/common'
gcc -g -O2 -Wall -W -std=c89   -c -o abend.o abend.c
make[2]: gcc: Command not found
make[2]: *** [<builtin>: abend.o] Error 127
make[2]: Leaving directory '/home/Sampo/lynx/tools/cc65/src/common'
make[1]: *** [make/gcc.mak:26: common] Error 2
make[1]: Leaving directory '/home/Sampo/lynx/tools/cc65/src'
make: *** [make/gcc.mak:65: bins] Error 2

Sampo@Rintanen ~/lynx/tools/cc65
$

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

Sry I'm still a linux noob so I have to google almost every step. The paths are wrong and I've been trying to change them in etc/profile and etc/defaults/etc/profiles like I found somewhere when I googled, but that didn't help. I also tried adding some windows environment variables but that didn't help either. I only had limited time to put on this on the weekend but was not able to solve it :/

 

gcc --version doesn't work but ls /usr/bin | grep gcc shows a list of all the different gcc exe files

Link to comment
Share on other sites

I was just going to try this cygwin thing as it seemed so easy and it might have made my workflow a bit less silly, but I'm really happy with my raspberry pi setup since at least it's working! :) I don't want to waste my precious spare time fighting tools when I have one working setup. I have so many important Lynx and non-Lynx projects, and I'm spread so thin time-wise at the moment. Thanks so much for offering help though, that's very kind! By the way, I've read all of your tutorials many times and they're really great! I never got around trying your Visual Studio setup since I was not sure if it's 100% compatible with Karri's stuff (which I would need it to be).

Edited by Turbo Laser Lynx
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...