Jump to content
IGNORED

i love 6502 because...


Wally1

Recommended Posts

Sorry to intercept, but for me there are only two reason why I love the 6502:

 

a) it's very easy to learn

b) it's fast due to it's internal »coding« compared to other 8-bit-processors

 

It does BY FAR not have a symmetrical instruction set ... neither in the instructions nor in the addressing modes. I always stumble over the fact there are no

STA (zero,Y)
STA (zero),X
ASR
DEA
INA
DEC zero,Y
DEC addr,Y
INC zero,Y
INC addr,Y
JMP addr,Y

This all leads to bigger code and sometimes self modifying code just to make things work.

 

I love the processor anyway ... just because it was my first machine language programming experience in my life. :)

Link to comment
Share on other sites

I like the way you can easily count cycles, and (in the vcs' case), it is synchronised to the video (although this is not a feature of the 6502...).

 

 

STA (zero,Y)
STA (zero),X
ASR
DEA
INA
DEC zero,Y
DEC addr,Y
INC zero,Y
INC addr,Y
JMP addr,Y
This all leads to bigger code and sometimes self modifying code just to make things work.

 

I love the processor anyway ... just because it was my first machine language programming experience in my life. :)

 

I agree, mostly the compiler tells me when I made up an instruction :D

also: TYX, TXY. And I don't like that I always have to set/reset the carry when doing additions/substractions. Soon you'll end up with ugly optimizations (not resetting a carry because it's already reset at that specific part of the code)

 

The 65c02, 65816 solves a few though.

Edited by roland p
Link to comment
Share on other sites

Let's not forget that the lack of stack relative addressing makes support of high level languages a bit ugly. But then so does the small stack size.
The 65802/65816 fixes this but good luck finding a 65802 and the 65816 requires a board.

The missing instructions are largely due to the amount of hand layout required for the chip at the time and the desire to make the CPU inexpensive.
I think if the designers had known it would be widely accepted as the basis for personal computers they might have thrown a few more instructions in.

It only takes a handful of instructions to significantly reduce code size even without 16 bit support.
It seems to me the 65C02 allowed me to shrink the code in my music player by around 5% but that it would depend on what you are doing.
Stack relative addressing and a larger stack would shrink C compiler output by a lot more than that.
The sample code change I made for the Applesoft BASIC interpreter saved around 20 clock cycles just for the code that jumps to each token handler.

I can only imagine how many clock cycles stack relative addressing would save with a compiler.
But then compilers were considered to be in the realm of mainframes at that time.

Link to comment
Share on other sites

I assume we're talking about the joys of writing assembly language here, so the fact the chip isn't an optimal high-level compiler platform isn't especially relevant to me. One of the greatest challenges (and greatest pleasures) is finding ways to do things quickly and concisely in 6502, and the instruction set provides a lot of different ways to crack the same nut. I'm constantly surprised by what's possible at 1.79MHz. :)

Link to comment
Share on other sites

It has the only machine language I ever learned (and remembered for 30 years) although I never came close to mastering the Atari.

 

It still amazes me how lots of tiny steps can result in a program much faster than anything I could write in BASIC.

Link to comment
Share on other sites

I guess I love it because it's the processor that was in my Atari computer. If that had been an 8080 I'd probably have grown up with that and "love it" now. :)

 

Personally, I like 6502 assembly because its simple, but when I did some 68000 in school, that was nice. No fooling around with segment offsets to address more memory, and very similar to 6502 so it felt very natural. Unfortunately, the computers I typically used outside school did not contain that particular chip... so it was a fleeting affair.

Edited by Shawn Jefferson
Link to comment
Share on other sites

I'll never forget the moment.

After studying some assembler listing with its basic-loader equivalent in a computer magazine, not quite understanding it -

suddenly grasping what those mnemonics could mean and poking into page 6 those numbers:

 

104,141,24,208,76,0,6

 

after typing x=usr(1536) the world had changed forever... :-)

Link to comment
Share on other sites

I guess I love it because it's the processor that was in my Atari computer. If that had been an 8080 I'd probably have grown up with that and "love it" now. :)

 

Personally, I like 6502 assembly because its simple, but when I did some 68000 in school, that was nice. No fooling around with segment offsets to address more memory, and very similar to 6502 so it felt very natural. Unfortunately, the computers I typically used outside school did not contain that particular chip... so it was a fleeting affair.

I feel the same way, only reason I really programmed for the 6502 is because I got into Atari computers some years back. I think my first experience with assembly was reading a book on the 8080/8085/Z80. I never ended up writing any code that really did anything for any of those, but it gave me an intro to microcomputers and their design. I think I was 11 or 12 at the time, but I don't remember all that well. Anyway, the first actual assembly language programming I did was on this limited thing: 500-in-1 elenco electronics project lab

 

but it taught me the basics of actually doing something. Then I think I found a program called emu8086 on the PC and messed a little with that for a while. I also messed with 386 protected mode a bit, but I never really got far with that. Next was probably the 6502 when I got my atari 400, and lately I've dabbled in some 68000 trying to reverse engineer the motherboard from a piece of lab equipment (has a 68332, an SVGA controller, 4 serial ports, a parallel port, and a bunch of motor driving outputs as well as a floppy drive option that I don't have). I've gotten some progress on that, made the SVGA controller show a picture, got some serial output going, set up the DRAM controller, but I have yet to deal with interupts at all.

 

Anyway, I consider myself a pretty diverse programmer among older obsolete chips. Never touched 65816 or 6800, but I'm sure I'd pick it up fairly fast if I gave it a try. Now that I've had the big 3 older architectures (motorola, 6502, and intel) you start to realize that there aren't all that many differences between the chips other than a few features that have been added. But you still have registers, accumulators, address pointers for indexing modes, interupts, etc. the differences are in how it's arranged and how they're handled.

  • Like 1
Link to comment
Share on other sites

[...] you start to realize that there aren't all that many differences between the chips other than a few features that have been added. But you still have registers, accumulators, address pointers for indexing modes, interupts, etc. the differences are in how it's arranged and how they're handled.

The 6502 is surely an entry system for interested programmers. But other processors - not the ones you mentioned - have drastically different concepts.

 

For example chips like Motorola »DSP56000« or AMD »AM29000« have separate address spaces for program and data (no self modifying code). The »AM29000« and the older »MIPS« processors have a concept, where a flag is set in an universal register based on a comparison and conditional jumps are made based on those flags. The older »MIPS« ones - not sure about the newest generation - has an »out of order« execution where an instruction directly following a jump is also executed (due to pipeline construction of the processor). Chips like the »DEC 21064« has different jump instructions where you as a programmer has to choose if the jump is most probably taken or not ... this can dramatically increase speed because of not needed pipeline refills. And a processor like the Intel »i860« has a pipeline oriented architecture (much like the »Cray-1« supercomputer), where you as a programmer will only get speed if you have thousands or millions of exactly the same operations on different data.

 

This is to let you get a peek into it's not just »how it's arranged«.

 

But I agree: A processor like the 6502 is a perfect tool to get an insight into how a program works.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...