[comp.sys.apple2] instruction sets

unknown@ucscb.UCSC.EDU (The Unknown User) (10/28/90)

In art. <9010271753.AA23864@apple.com> MQUINN%UTCVM@PUCC.PRINCETON.EDU writes:
>On Sat, 27 Oct 90 07:24:26 GMT The Unknown User said:
>>	But having more registers takes up more bits of an instruction
>>if you want instructions to be general and use any register.. (I should
>I don't think I follow.  I don't deny this, I just don't understand it and it
>sounds interesting.

	Well, since the 6502 is an 8 bit computer, the smartest (that is,
fastest) thing to do is to make all instructions take up only 8 bits, since
the data bus is 8 bits (it can only send/receive 8 bits at a time).

	So an instruction is    x x x x x x x x  where each x is either
a one or a zero, making up an 8 bit binary number.

	With instructions that only take up 8 bits, if you have more registers,
you will have to use MORE of those 8 bits telling WHICH register you are using.

	Since I don't know the 6502 instruction set, especially not at the
low level I am talking about, I'll make up an instruction...

	The instruction will be to load a register with the value that's 
in the location that another register points to.. I realize that it actually
takes up 2 bytes to make an address, so I'll assume it's a zero page loading
(the high byte of the address to load from is automatically zero)..  I 
hope all of these conditions are not confusing you, I just keep thinking up
these conditions that will make this DEFINITELY be an 8 bit instruction.

	So let's assume if the first 4 bits are 0111, then the instruction
is an indirect load...

	0111 xx yy
        |__| || ||
        |    |  |_register to use as the low byte address to get data from
        |    |_   register where the result will be put
        |_ code that signifies it's an indirect load instruction

	since xx and yy are only two bits apiece, there are four choices
for each of the values...

	Having the capability for more registers means those numbers would
have to be bigger...  

	Some tricks can be used in other ways to add more instructions
total, such as if there was a move register,register  instruction..
since moving register X to register X is kinda pointless, that space
could be taken up for a new instruction.

	gotta run, someone's requesting a talk.

-- 
/Apple II(GS) Forever! unknown@ucscb.ucsc.edu MAIL ME FOR INFO ABOUT CHEAP CDs\
\"If cartoons were meant for adults, they'd be on in prime time."-Lisa Simpson/

gwyn@smoke.brl.mil (Doug Gwyn) (10/29/90)

In article <9010281734.AA18141@apple.com> MQUINN%UTCVM@PUCC.PRINCETON.EDU writes:
>On Sat, 27 Oct 90 21:28:58 GMT Doug Gwyn said:
>>One should note, however, that when fewer alternatives exist in the
>>instructions, in general it will take more instructions to accomplish
>>a given algorithm.  The trade-offs are not simple to evaluate.
>Yeah, that's what I thought, but how can having more bits per instruction
>slow down, increase size, or make a program sloppy?
>I think I can see how it might slow it down (if it does), but I'd think that
>it would still be faster and more efficient than the extra instructions to
>accomplish that task (as with that particular case I was originally talking
>about with having more registers).

As I said, it's not simple to evaluate.  Machines with carefully designed
simplified instruction sets can be implemented such that it takes fewer
cycles of the system clock per instruction than for instruction sets that
require several, synchronized actions to execute an instruction.  This is
the basic concept behind the so-called RISC (Reduced Instruction Set
Computer) architectures that are now found in many fast workstation
products.  Another design possibility enabled by simple basic actions is
the performance of several independent actions at the same time, the
so-called "wide instruction word"; having to coordinate interacting
complicated actions would make implementation of wide instruction words
impractical.  Programming these modern architectures is generally done in
a high-level language, with the compiler taking care of the bookkeeping
needed to schedule the processor's resources.

Complex instruction sets are easier to use for assembly-language
programming, but even for hobbyist computers there isn't much excuse
for an appreciable amount of programming in assembler these days.