6502 Assembler

Building your first 6502-based project? We'll help you get started here.
User avatar
cbmeeks
Posts: 1254
Joined: 17 Aug 2005
Location: Soddy-Daisy, TN USA
Contact:

Re: 6502 Assembler

Post by cbmeeks »

I've never used Cross-32 so I can't comment on how good it is. But I have to admit I got a little chuckle when I read this on their site:
Quote:
35,000 lines/min of 68HC05 source code on a 75 MHz Pentium
Funny part is, I'm actually trying to get together a low-end DOS machine (386/486) to play some DOS games.
Cat; the other white meat.
Disgruntled0wll
Posts: 10
Joined: 04 Apr 2016

Re: 6502 Assembler

Post by Disgruntled0wll »

BigEd wrote:
It would certainly be better to use a tool which the NES community use, if your objective is to write NES code.
cool, ill do that thanks man
cbmeeks wrote:
I've never used Cross-32 so I can't comment on how good it is.
iv'e downloaded the demo for it but I'm going to try and find a good free assembler and in the event I cant I'll get that but its looking like the free ones could be just as good from what I've read its just finding one and getting it setup lol
User avatar
cbscpe
Posts: 491
Joined: 13 Oct 2013
Location: Switzerland
Contact:

Re: 6502 Assembler

Post by cbscpe »

I use 64tass and I'm quite happy with it. It's free and the documentation is good.
Disgruntled0wll
Posts: 10
Joined: 04 Apr 2016

Re: 6502 Assembler

Post by Disgruntled0wll »

cbscpe wrote:
I use 64tass and I'm quite happy with it. It's free and the documentation is good.
Is this nes specific? ive managed to get a couple of assemblers open in the command prompt etc. but how do I know if its nes specific or setup properly?
User avatar
BigDumbDinosaur
Posts: 9425
Joined: 28 May 2009
Location: Midwestern USA (JB Pritzker’s dystopia)
Contact:

Re: 6502 Assembler

Post by BigDumbDinosaur »

Disgruntled0wll wrote:
cbscpe wrote:
I use 64tass and I'm quite happy with it. It's free and the documentation is good.
Is this nes specific? ive managed to get a couple of assemblers open in the command prompt etc. but how do I know if its nes specific or setup properly?
What is an "nes (sic) specific" assembler? Traditionally, assemblers are "specific" to the microprocessor for which they assemble code. The machine architecture itself is not a part of the assembly language, as the MPU could be used in widely varying architectures, as was the case with the 65xx family.

The Nintendo Entertainment System is built around the Ricoh RP2A03 or RP2A07 processor, both of which are fundamentally a 6502 without the BCD instructions. Any 6502 assembler is usable with the RP2A03/7, as long as the CLD and SED instructions are not used in the source code. You can add your own source code references to the memory mapped I/O registers and other NES architectural features and Voila! you have an "NES specific" assembler.
x86?  We ain't got no x86.  We don't NEED no stinking x86!
User avatar
BigEd
Posts: 11463
Joined: 11 Dec 2008
Location: England
Contact:

Re: 6502 Assembler

Post by BigEd »

(I believe I read that Nintendo cartridges do use CLD at reset time - perhaps for safety, perhaps to help on some development environment.)

I think the point here is that a console is a platform, not just a micro, so a NES-specific tool will know how to build a correct cartridge image, and might well know things about the video, the audio, the game controllers and so on. It's not that any old assembler won't work, but it would put more burden on the person doing the programming.
Disgruntled0wll
Posts: 10
Joined: 04 Apr 2016

Re: 6502 Assembler

Post by Disgruntled0wll »

okay so Ive decided Im going to stick with ca65 for now, but when I open the cmd prompt and type in ca65 or cc65 it literally just says no input files. Im assuming that means its found it but somethings missing? lost here lol
User avatar
BigEd
Posts: 11463
Joined: 11 Dec 2008
Location: England
Contact:

Re: 6502 Assembler

Post by BigEd »

These are command line programs, not interactive environments. When you invoke the tool, you tell it what you want it to do, and how. I think there's a guide somewhere, but meantime see
viewtopic.php?f=2&t=2455
Disgruntled0wll
Posts: 10
Joined: 04 Apr 2016

Re: 6502 Assembler

Post by Disgruntled0wll »

BigEd wrote:
These are command line programs, not interactive environments.
Okay got that managed to get ASM6 and NESASM open in the command prompt by changing the path directory in the environment variables but not ca65. I dont know what Im doing wrong but apparently it is a bit of a nightmare to set up (so Ive read). you also said in that link you shared you can use any convenient text editor, do you mean like notepad++? if so how do i set that up? and do you code in notepad then copy/assemble in ca65 for example?
thanks
User avatar
BigEd
Posts: 11463
Joined: 11 Dec 2008
Location: England
Contact:

Re: 6502 Assembler

Post by BigEd »

Yes, Notepad++ is a popular choice. You edit a file - let's say hello.a65 - in your editor, save it, then run something like

Code: Select all

ca65 -l hello.a65
cl65 hello.o --target none --start-addr 0x0600 -o hello.bin
and that will write a file called - in this case - hello.bin and you then find a way to load that bin file into your emulator of choice.
Disgruntled0wll
Posts: 10
Joined: 04 Apr 2016

Re: 6502 Assembler

Post by Disgruntled0wll »

Okay I'll try that out, cheers mate
Post Reply