Omnimaga

General Discussion => Technology and Development => Other => Topic started by: Hot_Dog on July 06, 2011, 12:41:19 am

Title: Z80 vs 6502
Post by: Hot_Dog on July 06, 2011, 12:41:19 am
I've been starting a port of Commando, a game which uses the Motorola 6502 processor.  (By the way, Ti-83+ ASM is NOTHING compared to programming for the Atari 7800...I'm glad I'm only making a port!!)  Both the Motorola 6502 processor and the Z80 processor came not far from each other, and both were used for video game systems.

Each processor has its advantages and disadvantages.  While I prefer the Z80, there are some things about the Motorola 6502 that I wish the z80 had.

First, here's some things the Z80 has that the 6502 doesn't have, making the Z80 a dang fine processor indeed

The Z80 processor has more registers--many more
The Z80 has instructions that can compare and copy many values at once  (Like LDIR and CPIR)
The Z80's stack is much more flexible than the 6502's stack
You can work with 2-byte values on the z80, but not on the 6502
The 6502 has no register that can hold a direct address to work with  (The Z80 has HL, plus to a certain point DE, BC and SP)
The 6502 requires the carry flag for all math.  On the z80, it's optional.
On the 6502, you can only use conditions with a relative jump.  You can use conditions with calls, returns and longer jumps on the Z80
You can compare any register with register A.  On the 6502, registers cannot be compared with each other

And now, stuff the 6502 does that I wish the Z80 did:

Indexing is much easier and flexible on the 6502.  For instance, you can use a register to store an offset.
You can save one byte and several T-States on the 6502 by storing and retriving values from $0000 to $00FF.  This is not possible on the z80
On the 6520, you can use CP with almost all 1-byte registers
You can use almost all 1-byte registers to store directly to an address, as well as retrieve a value from it
One can increase or decrease the value in a direct address on the 6502

Title: Re: Z80 vs 6502
Post by: z80man on July 06, 2011, 01:01:23 am
Sounds like an interesting but difficult proc. That gives me an idea to compare the RISC vs CISC architecture philosophy. Personally I prefer RISC which the ARM and SuperH use but many also like CISC which is what the z80 along with x86 use.