Installing CC65: Difference between revisions

From NESdev Wiki
Jump to navigationJump to search
(Add remark about features/bugfixes possibly being missing in release versions of CC65.)
 
(8 intermediate revisions by 5 users not shown)
Line 1: Line 1:
An '''assembler''' is a program that translates assembly language source code into machine code.
An '''assembler''' is a program that translates assembly language source code into machine code.
A commonly used assembler that produces machine code for 6502 CPUs is '''CA65''', which is distributed as part of the '''CC65''' package.
A commonly used assembler that produces machine code for 6502 CPUs is '''CA65''', which is distributed as part of the '''CC65''' package.
These instructions tell how to install and run CA65 on Windows 2000 or Windows XP.
These instructions tell how to install and run CA65.


== Configuring Windows ==
== Installing CC65 on Windows ==
Windows is shipped with file name extensions hidden in Windows Explorer.
 
=== Configuring Windows ===
Windows is shipped with file name extensions hidden in the File Explorer.
This misfeature was originally intended to make Windows 95 look more like Mac OS 7.5, which did not use file name extensions.
This misfeature was originally intended to make Windows 95 look more like Mac OS 7.5, which did not use file name extensions.
But hiding makes it easier to accidentally create a file name with two extensions.
However, hiding them makes it easier to accidentally create a file name with two extensions.
Worse yet, destructive software such as the ILOVEYOU worm ([[wikipedia:ILOVEYOU|Wikipedia article]]) has shipped with two extensions: one to indicate to the operating system that the file is executable and one to fool the user into thinking that the file is not executable (and thus safe).
Worse yet, destructive software such as the ILOVEYOU worm ([[wikipedia:ILOVEYOU|Wikipedia article]]) are typically shipped with two extensions: one to indicate to the operating system that the file is executable and one to fool the user into thinking that the file is not executable (and thus safe).
The first thing we will do is turn on the display of file name extensions in Windows Explorer:
The first thing we will do is to turn on the display of file name extensions:


#Open Control Panel. (This may be in Start > Control Panel or Start > Settings > Control Panel.)
#Open Control Panel. (This may be in Start > Control Panel or Start > Settings > Control Panel.)
#In Windows XP, if "Pick a category" shows up at top center of the window, click "Switch to Classic View".
#On Windows XP, if "Pick a category" shows up at top center of the window, click "Switch to Classic View".
#Open Folder Options and activate the View pane.
#Open Folder Options (File Explorer Options from Windows 8 and onwards) and activate the View pane.
#In the scrolling list of Advanced Options, turn make sure that "Hide extensions for known file types" is ''not'' checked.
#In the scrolling list of Advanced Options, make sure that "Hide extensions for known file types" is ''not'' checked.
#Press OK to put the change into effect.
#Press OK to put the change into effect.


== Configuring 7-Zip ==
From Windows 8 and onwards, this setting can also be changed from the View tab in the File Explorer's ribbon interface. (Enable/Show File Extensions)


Windows 2000 does not come with software to extract files from PKZIP archives.
=== Configuring 7-Zip ===
Windows XP comes with a bare-bones archiver called Compressed Folders that can only handle PKZIP archives (<code>.zip</code>), not rar or 7z or tar or gz or bz2 files.
 
Windows comes with a bare-bones archiver that can only handle PKZIP archives (<code>.zip</code>), not rar, 7z, tar, gz, or bz2 files.
The [http://www.7-zip.org/ 7-Zip package] can extract files from all of them, as well as add files to PKZIP and 7-Zip archives.
The [http://www.7-zip.org/ 7-Zip package] can extract files from all of them, as well as add files to PKZIP and 7-Zip archives.


== Downloading CC65 ==
=== Downloading CC65 ===


#Read the [http://www.cc65.org/ front page of CC65's web site].
#Read the [http://cc65.github.io/cc65/ front page of CC65's web site].
#Scroll down to "Download". At the bottom of this section is a list of mirrors.
#Scroll down to "Download". At the bottom of this section is a list of mirrors.
#Enter one of the mirrors, and download the <code>cc65-win32-''#####''.zip</code> and <code>cc65-doc-''#####''.zip</code> packages to your computer. (The ''#####'' represents a version number, such as 2.11.0-1, which may change before you read this.) The <code>cc65-win32</code> contains the CC65 package compiled for Windows, and <code>cc65-doc</code> contains the manual.
#Enter one of the mirrors, and download the <code>cc65-win32-''#####''.zip</code> and <code>cc65-doc-''#####''.zip</code> packages to your computer. (The ''#####'' represents a version number, such as 2.11.0-1, which may change before you read this.) The <code>cc65-win32</code> contains the CC65 package compiled for Windows, and <code>cc65-doc</code> contains the manual.
Line 31: Line 34:
#Delete this folder.
#Delete this folder.


Log out and log in to complete installation.
Log out and log in to complete the installation.
 
== Building CC65 on Ubuntu (Linux) ==
 
Absolute easiest method:
 
[http://www.trikaliotis.net/debian Debian Hosting]
 
Set up you repository there as it says on the homepage.
Using software sources and import the gpg key.
or
add:
deb    http://debian.trikaliotis.net/ stable contrib
to your software sources list.
 
Download: [http://www.trikaliotis.net/spiro.pgp KeyFile]
add to authentication sources.
 
Then:
sudo apt-get install cc65
 
Done.! Enjoy.
 
//------------------
 
Note: I'll add a link to the compile.txt in the docs at the cc65 site later.
Note2: I must be really tired, I never even thought of just modifying the makefile.
Note2: Ignore "Method 2". And I'll clean this up in the morning.
Note3: If enough people want it and tell me so on the userpage, I'd be more than willing to upload a package somewhere.


== Installing CC65 on Linux ==


Unzip the source, move that top-level folder somewhere; I just dragged it from the archive onto the Desktop.
=== Installing with Package Managers ===
Open a terminal and get to your Desktop folder (or where ever you put it):
The easiest method is to install CC65 using the package manager of your choice.
Here are some examples from popular distributions:


$ cd cc65-VERSION/make
*Debian-based: apt/apt-get
$ make -f make/gcc.mak
*Arch-based: yay (or any other [https://wiki.archlinux.org/title/AUR_helpers AUR helper])
*RedHat-based: dnf/yum


Now once that finishes, rename gcc.mak to makefile, then open it, and remove the text "make/" from  
=== Building from git ===
line 37. If you don't want a particular executable installed (and also packaged), on line 134, remove
the name of the program. If you're programming for the NES, chances are you don't need the C compiler,
so you'd remove "cc65". Next, you'll need to rename the top-level make folder to the name of its parent folder, as checkinstall will otherwise use "make" as the name of the package. I did this by accident, and it took me
a whole 15 minutes to force the reinstallation of the make utility and make sure the spurious/incorrectly named cc65 package was removed. After you remove the top-level make to the same as the parent, enter that newly renamed folder and run "sudo checkinstall". Give it a nice descriptive name, modify any other items you feel like, and
hit enter. It should do its thing, install the program, and output a .deb package into the folder.


I did not use this method, so attempt it carefully. I used the below method which doesn't modify any files
If CC65 is not available via your package manager, or you wish to use features/bugfixes not yet present in release versions, you can build it from the source code instead.
but it does copy the ENTIRE directory tree into itself, along with some more complex directory/file renaming.
On Debian-based distributions, open a terminal and enter the following commands.
On other distributions, the <code>apt</code> command will need to be changed.
<pre>
sudo apt install build-essential git
mkdir -p ~/develop
cd ~/develop
git clone https://github.com/cc65/cc65.git
cd cc65
nice make -j2
make install PREFIX=~/.local
which cc65
</pre>
If your account has been configured to run applications built from source and installed for one user, the last step should show <code>/home/<username>/.local/bin/cc65</code>.
If it does not, add <code>~/.local/bin</code> to your <code>PATH</code> environment variable:
<pre>
nano ~/.bashrc


METHOD 2
# and add the following at the end of the file
if [ -d "$HOME/.local/bin" ] ; then
    PATH="$HOME/.local/bin:$PATH"
fi
</pre>
Press Ctrl+O Enter to save, then Ctrl+X to quit, and the change to <code>PATH</code> will take effect the next time you log in.


Replace VERSION with the rest of the folder name after "cc65-". It doesn't take long to make the entire suite of programs. After you've built it, you could probably install by just saying "make -f make/gcc.mak install", and perhaps you'll want to (I didn't try this). Others, such as myself, want to make sure it can be removed. For this, we use the checkinstall program. The problem is, the installation runs a script file with a hardcoded path from the main directory to place each executable. While you could play with the makefile, I had success with a somewhat more hackish solution:
== Installing CC65 on Mac OS X ==
Using Homebrew: On computer with Homebrew installed, open Terminal and type the following command: <code>brew install cc65</code>. Everything else should be automatic.


Rename the make directory to the same thing as the top level cc65 directory. Then, enter the directory you just renamed and create a folder called make. Put a copy of install-sh into this new make folder. Now copy all the folders except the recently renamed one INTO the recently renamed one. Then, rename gcc.mak to makefile and run "sudo checkinstall" from the directory that has makefile in it (Desktop/cc65-2.10.1/cc65-2.10.1 for example).
Using Macports: Alternatively macports can be used for easy and fast installation. Open a terminal and enter the following command: <code>sudo port install cc65</code>. This will install cc65, ca65 and ld65 on the computer.

Latest revision as of 02:43, 27 June 2024

An assembler is a program that translates assembly language source code into machine code. A commonly used assembler that produces machine code for 6502 CPUs is CA65, which is distributed as part of the CC65 package. These instructions tell how to install and run CA65.

Installing CC65 on Windows

Configuring Windows

Windows is shipped with file name extensions hidden in the File Explorer. This misfeature was originally intended to make Windows 95 look more like Mac OS 7.5, which did not use file name extensions. However, hiding them makes it easier to accidentally create a file name with two extensions. Worse yet, destructive software such as the ILOVEYOU worm (Wikipedia article) are typically shipped with two extensions: one to indicate to the operating system that the file is executable and one to fool the user into thinking that the file is not executable (and thus safe). The first thing we will do is to turn on the display of file name extensions:

  1. Open Control Panel. (This may be in Start > Control Panel or Start > Settings > Control Panel.)
  2. On Windows XP, if "Pick a category" shows up at top center of the window, click "Switch to Classic View".
  3. Open Folder Options (File Explorer Options from Windows 8 and onwards) and activate the View pane.
  4. In the scrolling list of Advanced Options, make sure that "Hide extensions for known file types" is not checked.
  5. Press OK to put the change into effect.

From Windows 8 and onwards, this setting can also be changed from the View tab in the File Explorer's ribbon interface. (Enable/Show File Extensions)

Configuring 7-Zip

Windows comes with a bare-bones archiver that can only handle PKZIP archives (.zip), not rar, 7z, tar, gz, or bz2 files. The 7-Zip package can extract files from all of them, as well as add files to PKZIP and 7-Zip archives.

Downloading CC65

  1. Read the front page of CC65's web site.
  2. Scroll down to "Download". At the bottom of this section is a list of mirrors.
  3. Enter one of the mirrors, and download the cc65-win32-#####.zip and cc65-doc-#####.zip packages to your computer. (The ##### represents a version number, such as 2.11.0-1, which may change before you read this.) The cc65-win32 contains the CC65 package compiled for Windows, and cc65-doc contains the manual.
  4. Extract cc65-win32-#####.zip to a new folder.
  5. Open this folder and run the install.vbs file as an administrator to copy it to Program Files.
  6. Delete this folder.

Log out and log in to complete the installation.

Installing CC65 on Linux

Installing with Package Managers

The easiest method is to install CC65 using the package manager of your choice. Here are some examples from popular distributions:

  • Debian-based: apt/apt-get
  • Arch-based: yay (or any other AUR helper)
  • RedHat-based: dnf/yum

Building from git

If CC65 is not available via your package manager, or you wish to use features/bugfixes not yet present in release versions, you can build it from the source code instead. On Debian-based distributions, open a terminal and enter the following commands. On other distributions, the apt command will need to be changed.

sudo apt install build-essential git
mkdir -p ~/develop
cd ~/develop
git clone https://github.com/cc65/cc65.git
cd cc65
nice make -j2
make install PREFIX=~/.local
which cc65

If your account has been configured to run applications built from source and installed for one user, the last step should show /home/<username>/.local/bin/cc65. If it does not, add ~/.local/bin to your PATH environment variable:

nano ~/.bashrc

# and add the following at the end of the file
if [ -d "$HOME/.local/bin" ] ; then
    PATH="$HOME/.local/bin:$PATH"
fi

Press Ctrl+O Enter to save, then Ctrl+X to quit, and the change to PATH will take effect the next time you log in.

Installing CC65 on Mac OS X

Using Homebrew: On computer with Homebrew installed, open Terminal and type the following command: brew install cc65. Everything else should be automatic.

Using Macports: Alternatively macports can be used for easy and fast installation. Open a terminal and enter the following command: sudo port install cc65. This will install cc65, ca65 and ld65 on the computer.