6502.org Forum  Projects  Code  Documents  Tools  Forum
It is currently Sat Nov 23, 2024 12:15 pm

All times are UTC




Post new topic Reply to topic  [ 7 posts ] 
Author Message
 Post subject: which assembler to use.
PostPosted: Mon Sep 07, 2009 1:24 am 
Offline

Joined: Mon Sep 07, 2009 1:14 am
Posts: 3
hello everyone,
hoping someone can help with what kind of assembler i can use to program in 6502 assembly language. i want to be able to program a at29c256 flash chip from atmel. not sure if i should use a avr studio or just import a .bin file that was assembled with a 6502 assembler. which one is the best i can use that will work with this flash chip. what do you all work with???? thanks guys for your help.


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Mon Sep 07, 2009 2:18 am 
Offline
User avatar

Joined: Fri Aug 30, 2002 1:09 am
Posts: 8545
Location: Southern California
I use Universal Cross Assemblers' Cross-32 (C32). I have also used 2500AD's assembler, but it's more expensive and you have to buy another one for each processor, something that's not necessary with C32. C32 even gives you the tools to write the files to be able to assemble for a new processor of your own invention. These two macro assemblers are both excellent, although one has a slight weakness that the other doesn't, and vice-versa. Many on this forum are using free assemblers. Assemblers will usually put out Intel Hex or Motorola S.19 files, which the device programmers universally accept. I'm not sure that's true of .bin files.

For a device programmer, I use Needham's PB-10 which is no longer made. It was only about $100 IIRC. At my last place of work (I left there in 1992), I used a Bytek programmer that had, besides the RS-232 interface, a keypad that even allowed limited stand-alone use.


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Mon Sep 07, 2009 2:30 am 
Offline

Joined: Mon Sep 07, 2009 1:14 am
Posts: 3
im using the willem programmer for the at29c256. when i use the C32 assembler. what is the proper syntax that that can be used for this assembler.

for example: this a basic outline is needed to compile in x816. do i have to recode my program to run in c32.

PROCESSOR 6502

VAR EQU #$FF

ORG $C000
Reset
LDA #$01
STA VAR
.Loop
jmp .Loop

NMI:
pha
txa
pha
tya
pha

pla
tay
pla
tax
pla
rti

IRQ:
rti

ORG $FFFA,0
dc.w NMI
dc.w Reset
dc.w IRQ


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Mon Sep 07, 2009 3:49 am 
Offline

Joined: Sat Jan 04, 2003 10:03 pm
Posts: 1706
I use ca65 myself.

All assemblers will have their own syntaxes. Generally speaking, when changing from one assembler to another, you can bet the farm that you'll need to recode to take advantage of the new assembler's idiosyncrasies.


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Mon Sep 07, 2009 5:13 am 
Offline
User avatar

Joined: Fri Aug 30, 2002 1:09 am
Posts: 8545
Location: Southern California
The syntax for the assembly program material itself will be almost universally the same. What will have small differences will be the assembler directives including how to build macros.

Your NMOS 6502 code, modified slightly for C32, is as follows. (By the way, use the [co de] and [/co de] directives, minus the space in the middle so they'll do their jobs, to get monospacing and preserve the spaces in your code listings in the forum post views.)
Code:
CPU 6502.TBL

VAR EQU #$FF

   ORG   $C000   
Reset
   LDA #$01
   STA VAR
.Loop
   jmp   .Loop

NMI:
   pha
   txa
   pha
   tya
   pha

   pla
   tay
   pla
   tax
   pla
   rti

IRQ:
   rti

   ORG   $FFFA
   DWL   NMI
   DWL   Reset
   DWL   IRQ

Note that you could put your IRQ label on the last line of the NMI section to save a byte, you could put the code a little more to the right so it starts on the same lines with the labels to make it more compact to look at (I spaced it the way you initially wrote it even though the way your post was displayed gobbled up your spaces since you didn't have the code directives), and the CMOS 6502 (65c02) can directly push and pull X and Y without going through A and that the ISR won't always use X and Y so there's often no need to push and pull them anyway, and the JMP can be replaced with BRA (BRanch Always) to save a byte.


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Mon Sep 07, 2009 5:46 am 
Offline

Joined: Mon Sep 07, 2009 1:14 am
Posts: 3
i checked out c32 and it seems pretty cool. im getting really tierd of dos utilities. this program seem to be a snap. its hundred bucks though but well worth it.

actually what i really want to do is finally learn to interface with hardware. as a first project i had this idea of hooking up led's to the D0-D7 and the address lines to switches. in the program it stores numbers into certain addresses (ie. LDA #$07 STA $0301). if my understanding of 6502 interfacing is correct, if i flip the switches to coincide with address $0301, the leds would output 7 in binary to the leds. not sure if i need to use the r/w lines as well. am i on the right track here???


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Mon Sep 07, 2009 6:02 am 
Offline
User avatar

Joined: Fri Aug 30, 2002 1:09 am
Posts: 8545
Location: Southern California
I guess we'll need more details to see if you're thinking of something that will work or not. The 6522 is a very good IC to get I/O from in a 6502 system. It really does live up to its name, "Versatile Interface Adapter," or "VIA." There's a lot more I/O capability there than initially meets the eye, and you can hang far more stuff on a single VIA than beginners ever imagine.

As for the processor, if you're building something yourself as opposed to working with existing hardware like a Commodore 64, just go automatically to the CMOS 6502 (65c02). It has all the bugs of the NMOS 6502 fixed, has more instructions and addressing modes, takes far less power, is available in much faster speeds (although that won't be important to you at first), has an on-board oscillator, and other advantages I can't remember all at once.

My first EPROM programmer was a home-made board with switches to set the address and data, then a pushbutton that started a 50ms timed pulse to program that byte of the EPROM. It worked, but as you can imagine, it was so slow and error-prone so as to be nearly useless. A friend made an EPROM programmer he controlled with his hand-held HP computers, so he helped me get my first home-made computer going. That was in the 1980's, and I had no PC or any other computer of any kind yet to run an assembler on or programmer software. Everything was done by hand.


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 7 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 20 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: