6502.org Forum  Projects  Code  Documents  Tools  Forum
It is currently Fri Nov 22, 2024 1:09 pm

All times are UTC




Post new topic Reply to topic  [ 24 posts ]  Go to page 1, 2  Next
Author Message
 Post subject: Using cc65
PostPosted: Sat Oct 25, 2014 1:52 pm 
Offline
User avatar

Joined: Mon Aug 08, 2011 2:48 pm
Posts: 808
Location: Croatia
Hi.
I was quite busy for a while, and I am still are, but I would like to get back into 6502 stuff.
So yesterday I decided to try to get the cc65 compiling for the SBC2, and I copied the cc65 from my old hard drive to my new system, and tried to get the hello world compiling. Of course, it was all broken, since I didn't have any path variables set.
To fix that, I decided to download a fresh copy of cc65, but the cc65 that I got didn't look like the old cc65 that I had. It has no samples, no batch scripts, no installation, just makefiles that are kinda useless on windows.
I looked into the doc, but I still couldn't figure out how to get this working on windows.


Top
 Profile  
Reply with quote  
 Post subject: Re: Using cc65
PostPosted: Sat Oct 25, 2014 2:59 pm 
Offline
User avatar

Joined: Thu Dec 11, 2008 1:28 pm
Posts: 10985
Location: England
For a *nix-like environment on Windows, I've always used cygwin.

https://cygwin.com/install.html


Top
 Profile  
Reply with quote  
 Post subject: Re: Using cc65
PostPosted: Sat Oct 25, 2014 4:25 pm 
Offline
User avatar

Joined: Fri Aug 30, 2002 9:02 pm
Posts: 1748
Location: Sacramento, CA
You could try installing the one I set up for the Kowalski Simulator - linked here:
viewtopic.php?f=2&t=2196&hilit=Beginners+CC65&start=75#p27053

Daryl

_________________
Please visit my website -> https://sbc.rictor.org/


Top
 Profile  
Reply with quote  
 Post subject: Re: Using cc65
PostPosted: Sat Oct 25, 2014 5:16 pm 
Offline
User avatar

Joined: Mon Aug 08, 2011 2:48 pm
Posts: 808
Location: Croatia
Thanks, it works.
Now I gotta get a 6502 contraption in working condition so that I can try that.

One more thing. If I were to edit the console input/output so that it uses a keyboard and screen what exactly do I need to modify. I found cputc.s and cgetc.s with the asm code for that. Do I need just to rewrite those files and execute makesim/copysim, or is there more to it?


Top
 Profile  
Reply with quote  
 Post subject: Re: Using cc65
PostPosted: Sat Oct 25, 2014 8:46 pm 
Offline
User avatar

Joined: Fri Aug 30, 2002 9:02 pm
Posts: 1748
Location: Sacramento, CA
Yes, edit the source files and then use copysim.bat. It copies the files and then executes the makesim.bat file.

Then, re-compile the C source and it should work.

Glad to know my instructions worked... I had a few bumps early on.

Good luck!

Daryl

_________________
Please visit my website -> https://sbc.rictor.org/


Top
 Profile  
Reply with quote  
 Post subject: Re: Using cc65
PostPosted: Sat Oct 25, 2014 9:50 pm 
Offline
User avatar

Joined: Mon Aug 08, 2011 2:48 pm
Posts: 808
Location: Croatia
A while ago ttlworks gave me a sbc2 clone that he made, and I was missing the 65C02.
After a while I got one from ebay, and today I finally decided to get it in working order.
I loaded the sbc2os (SBC25.ROM) in the eeprom, and it worked.
Next, I went to load the hello1 example, and it didn't work.
I tried loading it into the Kowalski simulator, and it did run, but I could get anything on the console (0xF000 settings). I stepped though the code, and it does load the "Hello world!" characters in a loop to the accumulator, but no output. I made it go in a infinite do-while loop, and loaded the thing on the eeprom. I checked with the scope, there is no signal going out of the ACIA, and the cpu seems to be in some sort of a loop, as far as I can see on my scope.

The instructions say to load the program from 0x0200 which doesn't make much sense:
"When prompted, set the starting address to 0x0200 and you can either check the Clear all memory locations box or not."
I typed 0x8000 instead.
Also when I scroll down to 0xFFFF to see the jump vectors I noticed that the hex editor rolled over to 0x0000 and that there is some stuff down there, but then the entire simulator freezes and crashes.


Top
 Profile  
Reply with quote  
 Post subject: Re: Using cc65
PostPosted: Sat Oct 25, 2014 11:05 pm 
Offline
User avatar

Joined: Fri Aug 30, 2002 9:02 pm
Posts: 1748
Location: Sacramento, CA
Dajgoro wrote:
A while ago ttlworks gave me a sbc2 clone that he made, and I was missing the 65C02.
After a while I got one from ebay, and today I finally decided to get it in working order.
I loaded the sbc2os (SBC25.ROM) in the eeprom, and it worked.
Next, I went to load the hello1 example, and it didn't work. I tried loading it into the Kowalski simulator, and it did run, but I could get anything on the console (0xF000 settings). I stepped though the code, and it does load the "Hello world!" characters in a loop to the accumulator, but no output. I made it go in a infinite do-while loop, and loaded the thing on the eeprom. I checked with the scope, there is no signal going out of the ACIA, and the cpu seems to be in some sort of a loop, as far as I can see on my scope.

The instructions say to load the program from 0x0200 which doesn't make much sense:
"When prompted, set the starting address to 0x0200 and you can either check the Clear all memory locations box or not."
I typed 0x8000 instead.
Also when I scroll down to 0xFFFF to see the jump vectors I noticed that the hex editor rolled over to 0x0000 and that there is some stuff down there, but then the entire simulator freezes and crashes.


I made two targets for the Simulator, Sim and Simrom. Sim loads code to RAM, starting at $0200. The code file is variable length, based on the size of the actual code. It does not set the vectors in page $FFxx. It also assumes all memory is RAM. You must load the generated cc65 file at location $0200. This kind of file would be loaded from an OS and executed.

Simrom creates a 32k ROM image file, no matter how big the source file is, and sets the vectors. The code will start at $8000, copy any initialized data to RAM, and continue running the Main program. You must load the generated cc65 file to address $8000. This code would auto-execute when reset is pressed (and released).

If you want to use the SBC2 and generate a program that is stored in ROM, the use the Simrom target and modify the cputc and cgetc routines to use the USART, located at $7F70-$7F73. You can borrow the routines from the SBC2OS source files if you like. The default RAM size is set to $7EFF, which equals the SBC-2's RAM.

Let me know if you need more help.

Daryl

_________________
Please visit my website -> https://sbc.rictor.org/


Top
 Profile  
Reply with quote  
 Post subject: Re: Using cc65
PostPosted: Sun Oct 26, 2014 12:42 am 
Offline
User avatar

Joined: Mon Aug 08, 2011 2:48 pm
Posts: 808
Location: Croatia
It still doesn't work.


Top
 Profile  
Reply with quote  
 Post subject: Re: Using cc65
PostPosted: Sun Oct 26, 2014 3:04 am 
Offline
User avatar

Joined: Fri Aug 30, 2002 9:02 pm
Posts: 1748
Location: Sacramento, CA
Can you zip up the demo folder and the simrom folder with modified files and email it to me? I'll take a look at them and see if I can find anything.

Daryl

_________________
Please visit my website -> https://sbc.rictor.org/


Top
 Profile  
Reply with quote  
 Post subject: Re: Using cc65
PostPosted: Mon Nov 03, 2014 11:59 pm 
Offline
User avatar

Joined: Mon Aug 08, 2011 2:48 pm
Posts: 808
Location: Croatia
Problem solved!
After a week of emailing with 8BIT the cc65 compiler now finally works properly for the SBC2.
Just in case, here is the download link: http://sbc.rictor.org/download/cc65sbc2.zip


Top
 Profile  
Reply with quote  
 Post subject: Re: Using cc65
PostPosted: Tue Nov 04, 2014 4:49 am 
Offline
User avatar

Joined: Fri Aug 30, 2002 9:02 pm
Posts: 1748
Location: Sacramento, CA
Dajgoro wrote:
Problem solved!
After a week of emailing with 8BIT the cc65 compiler now finally works properly for the SBC2.
Just in case, here is the download link: http://sbc.rictor.org/download/cc65sbc2.zip


This package will create a 32k ROM image file for the SBC-2. It provides terminal support through the ACIA.

Feel free to contact me with questions!

Daryl

_________________
Please visit my website -> https://sbc.rictor.org/


Top
 Profile  
Reply with quote  
 Post subject: Re: Using cc65
PostPosted: Wed Nov 05, 2014 7:24 pm 
Offline
User avatar

Joined: Mon Aug 08, 2011 2:48 pm
Posts: 808
Location: Croatia
To make development a bit easier with the cc65 I managed to get Notepad++ to compile files with the cc65.
What you need to to is install Notepad++, then go to plugins, plugin manager, show plugin manager, select NppExec from the list and install it. Once installed go to plugins, NppExec, and click to Exectue.
In the blank area paste:

CD $(CURRENT_DIRECTORY)
C:\cc65\bin\cl65 -t none -C sbc2rom.cfg -o $(CURRENT_DIRECTORY)\$(NAME_PART).65b -m hello.map -l $(FULL_CURRENT_PATH) C:\cc65\lib\sbc2rom.lib

Then click save.
Now you should be able to compile any C file by pressing F6 and get the binary file in the same folder.
I kept the hello.map file in the build path, since then you don't need to have a .map with your C file, but then it uses the demo file. Otherwise you can have your .map file with the C file, in that case use this setting:

CD $(CURRENT_DIRECTORY)
C:\cc65\bin\cl65 -t none -C sbc2rom.cfg -o $(CURRENT_DIRECTORY)\$(NAME_PART).65b -m $(CURRENT_DIRECTORY)\$(NAME_PART).map -l $(FULL_CURRENT_PATH) C:\cc65\lib\sbc2rom.lib


Last edited by Dajgoro on Sat Nov 08, 2014 7:41 pm, edited 1 time in total.

Top
 Profile  
Reply with quote  
 Post subject: Re: Using cc65
PostPosted: Fri Nov 07, 2014 7:09 pm 
Offline
User avatar

Joined: Mon Aug 08, 2011 2:48 pm
Posts: 808
Location: Croatia
I have a ff.h file next to my main.c file which I include, but then I get:
main.c(1): Error: Include file `ff.h' not found

How do I fix this?


Top
 Profile  
Reply with quote  
 Post subject: Re: Using cc65
PostPosted: Fri Nov 07, 2014 7:26 pm 
Offline
User avatar

Joined: Thu Jun 23, 2011 2:12 am
Posts: 229
Location: Rancho Cucamonga, California
Did you try #include "ff.h" instead of #include <ff.h> ?

On most C compilers, double quotes will make the compiler (preprocessor, really) look in the current directory as well as in the include path, whereas it will only look in the include path with <>.

===Jac


Top
 Profile  
Reply with quote  
 Post subject: Re: Using cc65
PostPosted: Sat Nov 08, 2014 3:14 am 
Offline
User avatar

Joined: Mon Aug 08, 2011 2:48 pm
Posts: 808
Location: Croatia
jac_goudsmit wrote:
Did you try #include "ff.h" instead of #include <ff.h> ?

No difference, still won't work.


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 24 posts ]  Go to page 1, 2  Next

All times are UTC


Who is online

Users browsing this forum: No registered users and 16 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to: