Debugging my first SBC

Building your first 6502-based project? We'll help you get started here.
Post Reply
sepseel
Posts: 36
Joined: 05 Mar 2017

Debugging my first SBC

Post by sepseel »

Hi, my name is Seppe. I am 18 years old, and just starting out in the world of 6502.

I have just built my own 6502 based system, so now comes the task of getting some code running on it. This is where I hit a brick wall...
I am trying to get ehBASIC on my system, but for this I would need to assemble it using an assembler. I understood that I can do this with cc65, but I cant seem to figure out how to use it..

So if anyone feels like helping out this noob, i would be very happy to know :D .
Thanks for reading!
Last edited by sepseel on Tue Mar 14, 2017 5:56 pm, edited 1 time in total.
User avatar
barrym95838
Posts: 2056
Joined: 30 Jun 2013
Location: Sacramento, CA, USA

Re: Help using cc65

Post by barrym95838 »

Hi, Seppe, and welcome.

Do you have a monitor program written (or borrowed) and successfully implemented?

How are you transferring the binary from a host to your unit? Serial link? EPROMs?

I'm sure that there are more "ready-to-go" languages freely available, but I would like to mention that ehBASIC is just one possible choice ... others would be Apple 1 BASIC, several free versions of Forth, and my own VTL-02, each of which require minimal resources and standard teletype-style I/O.

Mike B.
Last edited by barrym95838 on Sun Mar 05, 2017 4:55 pm, edited 1 time in total.
sepseel
Posts: 36
Joined: 05 Mar 2017

Re: Help using cc65

Post by sepseel »

So no, I dont have a monitor program written, or borrowed, as i dont know how to do this.

To transfer data to my computer I use EEPROMS and an EEPROMprogrammer.
My 65 system does have a 6551, but i have'nt figured out how to use this.
User avatar
Dr Jefyll
Posts: 3525
Joined: 11 Dec 2009
Location: Ontario, Canada
Contact:

Re: Help using cc65

Post by Dr Jefyll »

Welcome, Seppe!

I am curious to know more details about your 6502 based system. :) For example, does it include other I/O in addition to the 6551? Is it an NMOS CPU you're using? If you begin by providing lots of information then it might save time later.

cheers,
Jeff
In 1988 my 65C02 got six new registers and 44 new full-speed instructions!
https://laughtonelectronics.com/Arcana/ ... mmary.html
User avatar
BigEd
Posts: 11463
Joined: 11 Dec 2008
Location: England
Contact:

Re: Help using cc65

Post by BigEd »

Welcome, Seppe!

Probably I'd start with the basics: some code, any code, which for example prints Hello on some output device. Have you got that far?

To run EhBasic, I think you need to
- have a routine to read a character and one to write a character
- have EhBasic use those routines
- be able to assemble the thing to binary

Perhaps a good starting point is this post
viewtopic.php?f=2&t=2455&p=24630&hilit=ca65#p24630
and the thread around it. Although the package is called cc65, when working with assembly source the command you need is ca65.
sepseel
Posts: 36
Joined: 05 Mar 2017

Re: Help using cc65

Post by sepseel »

Hey jeff, good call!

First off, i included a picture of my system:
(bottom left is where the eeprom sits, the board on top is just an arduino acting as a variable clock, and the board on the bottom is just a bunch of led's connected to the data and adress lines.)

I am using a
R6502P cpu
R6551AP acia
at28c64b eeprom
tc551001cp-70l ram

I used the same memory mapping as described on this website: http://www.loomcom.com/projects/6502/
Attachments
IMG_20170305_183600.jpg
User avatar
BigEd
Posts: 11463
Joined: 11 Dec 2008
Location: England
Contact:

Re: Help using cc65

Post by BigEd »

How far have you got with software? Can you run something which toggles the LEDs, say?

For EhBasic, perhaps have a look at Jeff Tranter's port, the Makefile tells you what you need to build and his mini-mon will provide the features you need to run:
https://github.com/jefftranter/6502/tre ... sm/ehbasic
sepseel
Posts: 36
Joined: 05 Mar 2017

Re: Help using cc65

Post by sepseel »

The furthest i have gotten in terms of software, is filling the eeprom wit EA, wich is hex for the NOP opcode.
This way the led's ont the data lines display the value of EA in binary, and the adress lines start counting up.

As far as Jeff Tranter's port goes, I have no idea how to implement this.
User avatar
BigEd
Posts: 11463
Joined: 11 Dec 2008
Location: England
Contact:

Re: Help using cc65

Post by BigEd »

Ah, good to know you've run and passed a NOP test!

I'm one of those people who do almost all their computing on the command line... so for me the next step would be to get you set up with the tools needed to run ca65 on the command line. Are you OK to try to do that, or looking for a GUI program to work with? (I gather the latest Windows has a bash command line which pretty much does what Linux does.)
sepseel
Posts: 36
Joined: 05 Mar 2017

Re: Help using cc65

Post by sepseel »

I usually go for programs which have a GUI, so i have limited experience using the command line.
But for this project i would like to get more familiar with the command line tools, as they seem more common.
Last edited by sepseel on Sun Mar 05, 2017 6:37 pm, edited 2 times in total.
User avatar
BigEd
Posts: 11463
Joined: 11 Dec 2008
Location: England
Contact:

Re: Help using cc65

Post by BigEd »

Great. First step then is get yourself to a command line and type

Code: Select all

ca65
and have that do the right thing! Are you on Windows?
sepseel
Posts: 36
Joined: 05 Mar 2017

Re: Help using cc65

Post by sepseel »

I am currently using windows 10, but I could switch over to ubuntu if that would make the proces easier ?

Btw in what directory should I use that command ?
User avatar
BigEd
Posts: 11463
Joined: 11 Dec 2008
Location: England
Contact:

Re: Help using cc65

Post by BigEd »

If you can get to bash prompt, in either OS, then we should be in business.

If you choose Ubuntu, use your package manager to install cc65. Likewise in Windows bash - looks like you use apt-get install there too.

Then see if you can invoke ca65. That's the first hurdle. You're hoping to see

Code: Select all

$ ca65
ca65: No input files
(If at any point you want to bale out or just see zip ahead to see where ehbasic takes you, I suggest you install the GUI tool Kowalski's "6502 Macro Assembler, Simulator, and Debugger" and use this version of EhBasic.)
sepseel
Posts: 36
Joined: 05 Mar 2017

Re: Help using cc65

Post by sepseel »

Ok, so I managed to get the bash prompt in windows 10 to work.
Now you say i should install cc65 using the apt-get install command, however when I input: sudo apt-get install cc65,
I get an error saying: unable to locate package cc65.
Should i manually download cc65, and if so, what command get's it installed then ?
User avatar
BigDumbDinosaur
Posts: 9425
Joined: 28 May 2009
Location: Midwestern USA (JB Pritzker’s dystopia)
Contact:

Re: Help using cc65

Post by BigDumbDinosaur »

BigEd wrote:
(If at any point you want to bale out or just see zip ahead to see where ehbasic takes you, I suggest you install the GUI tool Kowalski's "6502 Macro Assembler, Simulator, and Debugger" and use this version of EhBasic.)
The version of the the Kowalski Simulator linked at the above site is out of date. Here is the most recent version.
x86?  We ain't got no x86.  We don't NEED no stinking x86!
Post Reply