6502.org Forum  Projects  Code  Documents  Tools  Forum
It is currently Thu Nov 21, 2024 8:50 pm

All times are UTC




Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 9 posts ] 
Author Message
PostPosted: Fri Dec 17, 1999 7:51 pm 
Does anyone know where to get info on the internet on how mnemonic 6502 instructions are assembled into binary? Reason I'm asking is because me and a couple of my computer nerd friends are thinking about designing an emulator. I've already got plenty of information on the actual instruction set - Unfortunately this is kinda useless without knowing how the instructions assemble. Thanks.


Report this post
Top
  
Reply with quote  
PostPosted: Fri Dec 17, 1999 9:32 pm 
Offline

Joined: Wed Mar 24, 2004 6:32 pm
Posts: 59
Location: Bay Area, CA
Well...

Go to http://www.wdesignc.com/ and check out the spec sheets for the various processors. There is a list of assembley opcodes and the map.

The 6502 processor has a very logical mapping from opcodes to instructions, so a emulator would be quite easy.


Report this post
Top
 Profile  
Reply with quote  
PostPosted: Fri Dec 17, 1999 10:53 pm 
Offline
Site Admin
User avatar

Joined: Fri Aug 30, 2002 1:08 am
Posts: 281
Location: Northern California
I wouldn't recommend the WDC datasheets, for some unknown reason they are in Microsoft Word format. I haven't had a chance to download and convert them yet.

www.6502.org has a special Datasheets section filled with datasheets in PDF and JPEG format which also has this information and much more.

There are also links to emulators in the Cross-Development section.

_________________
- Mike Naberezny (mike@naberezny.com) http://6502.org


Report this post
Top
 Profile  
Reply with quote  
PostPosted: Mon Dec 20, 1999 2:48 pm 
I looked over the data sheets - the opcode matrices seem kind of cryptic. I guess what I'm really looking for is a glossary of instructions, with the graphical bit-boxes showing which parts of the instructions take up which bits (e.g. opcode, src operand, dest. operand, src reg, dest. reg., etc.) as well as information on registers, instruction lengths, memory addressing. I'm really not too familiar with the 6502 at all. Anyone know a good book that's still in print?


Report this post
Top
  
Reply with quote  
PostPosted: Tue Dec 21, 1999 3:39 am 
First thing: You do NOT make an emulator of a system you do not own or know. That's one of "The great truths about emulation", and I should know, as I have written 6502 emulators, and my 6502 knowledge comes from the NES world (our NES developement community has quite a large number of emulator author members, too). Second thing: The *BEST* way to first accustom yourself with the 65xx series is to get a machine which uses it (C-64, Vic-20, Atari 400/800xl are some easy to find). Then you can learn assembly. The best way I've seen yet is through:
1- Reading the "Assembly in one step" tutorial, which will teach you 6502 basics in no time
2- GET THE 6502 instruction set card !!!

The 6502 instruction set card is available at ftp://ftp.comlab.ox.ac.uk/pub/Cards/txt/6502.txt

This will help you greatly in programming your emulator, has it contains cycle information, flag information and mnemonic conversion rules from basic unit to address modes.

The rest of the learning needed can be gotten through programming in 6502 assembly for a good period of time. I've "trained" several people in 6502 assembly using this exact 2-step method, and some of them are really good at it now (though you do need practice, and previous programming experience and knowledge of the most common algorithms is a MUST).

I hope this helps.

Regards,

Tennessee Carmel-Veilleux
(veilleux@ameth.org


Report this post
Top
  
Reply with quote  
PostPosted: Tue Dec 21, 1999 1:01 pm 
I appreciate your information regarding the 6502. I don't know if I share your view, though, that you have to own the actual machine to be able to emulate it, however. As I'm sure you're aware, there are many quality emulators, assemblers, and disassemblers already available for many processors, including the 6502. I personally learned 32-bit SPARC assembly without ever using a SPARC-based machine. It's not even unheard of to create emulations for ficticious architectures for learning purposes. This was actually the first experience I had with emulation - writing an emulator and assembler based on a made-up 32-bit architecture (albeit somewhat scaled down) in GNU C++. Obviously the 6502 is very different, being 8-bit CISC in nature, using variable instruction length , using one operand as opposed to two, and having an accumulator and index registers as opposed to general purpose registers.

But gimme some credit... it's not as if I just fell off the banana boat and decided I'm gonna start programming and make the world's greatest emulator. Granted, I still don't know nearly enough about the 6502, but I'm trying to learn, but I figured it would make a great candidate for emulation. I'm sure any actual code is probably months away...but I still may look into getting an old C64 or Atari computer

Thanks...
Ben L.
blarson@cis.ohio-state.edu


Report this post
Top
  
Reply with quote  
PostPosted: Tue Dec 21, 1999 5:51 pm 
Offline

Joined: Fri Aug 30, 2002 3:06 pm
Posts: 124
Location: Colorado
I've often thought it would be really cool to build a 6502 'emulator' in *hardware* - that is, wire up an ALU, PC, etc. using 74xx-series parts. Use a PROM lookup table as the 'control' block.

The only thing stopping me from trying it is the sheer number of chips and wires that would be required...
I suppose I could do a subset of some sort: only 9 or 10 address lines, and only do the most basic instructions. It would be fun to track down 'vintage' parts for it - that is, no LS parts, just original 74xx parts with old date codes.

With the PROM-based control, it would be possible to micro-program it to do other CPUs, without changing any hardware.

In my collection of vintage computers, I've got a PDP-8/E and a PDP-11/05 that are implemented in TTL. I've also got a first-model PDP-8 that is implemented with *discrete transistors* - not a single IC in the whole unit - it weighs 250 lbs and is 4 feet tall. It has 8 K-words of magnetic core memory (non-volatile!). The standard user I/O device is an ASR-33 teletype...

Pete


Report this post
Top
 Profile  
Reply with quote  
PostPosted: Tue Dec 21, 1999 9:26 pm 
Offline

Joined: Sun Oct 06, 2002 3:46 pm
Posts: 50
How many kilowatts would the 5 Volt supply have to be to run a 74xx implemented 6502 ? :)
Ted


Report this post
Top
 Profile  
Reply with quote  
PostPosted: Mon Dec 27, 1999 10:29 pm 
Well, it is LONG out-of-print but is still usually available in used-computer stores and used-books stores: The Technical Reference Manual for the old Apple II+ computers. Lots of great info on exactly which bits are affected by which operations, how many bytes the opcode requires, how many CPU cycles it takes to execute each one, what the available adressing modes are, opcode maps, yada-yada-yada. It also covers the complete schematic of the Apple II+ computer if you wanted to build hardware to test the emulation against. It doesn't expressly say which bit controls which part of the CPU's hardware, but it does have opcode-to-hexadecimal maps that give you a lot of insight into what is most likely going on.

Anyway, I completely taught myself both assembly language for the 6502 AND digital electronics just by reading through the book and following the hardware descriptions against the schematic, then trying things out on the actual computer. That was before I even knew there were assemblers like MERLIN out there, so my code was written in hex and keyed in byte-by-byte! That's a long way to go on just one book, with no previous background. If a knucklehead like me can do it, anyone can...

Best of luck to you!


Report this post
Top
  
Reply with quote  
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 9 posts ] 

All times are UTC


Who is online

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