[Novalug] Historical Assembly, was: Wii iiiiii !!!!!!!

Ed T. Toton III bones@necrobones.net
Thu Nov 23 08:38:02 EST 2006


Thus spake James Ewing Cottrell 3rd:

> I/O instructions are wrong because they are a separate animal. Memory 
> mapped I/O allows languages like C direct access to I/O.
>
> Special I/O instructions are the way CPUs used to be built. Once DEC 
> showed the world memory Mapped I/O, I am not sure whether any other CPU 
> besides Intel still used special I/O instructions. Even today, Intel 
> devices use memory mapped registers as well as I/O ports.

No argument there. :)


> How many CPUs did you program? I was fortunate to use many, and Intel 
> was by far the worst.

Not many. I was coding for the 286 through 486, but for compatability 
sake, at the time most of my code was limited to 16-bit instructions. I 
worked some 32-bit in where I considered it safe to do so. Outside of the 
Intel line, I coded on VAX for a class, and I can't recall if I did any 
others.


> Besides A, H, and L, which are mnemonic, how are B, C, D, and E any 
> different than R0-Rn?

AX, BX, CX, DX follow this naming scheme:  Accumulator, Base, Counter, 
Data. "Base" was probably fairly meaningless since it was just another 
general purpose data register. CX was automatically used in looping 
instructions, but otherwise was general purpose. The X versions are the 16 
bit mnemonics. L, H are the Low and High bytes of it (such as AL and AH). 
Add an E in the front (like EAX) and you have the 32 bit "enhanced" 
version.

SI and DI are the Source Index and Destination Index automatically used 
and incremented by some of the copy instructions. DS is the Data Segment 
used in such copy instructions. CS is the Code Segment. ES (Extended or 
Extra Segment, I think) was also used in copying and memory pointers.

IP is the instruction pointer. FLAGS is the flags register. SP is the 
Stack Pointer.

I saw no good way to remember which of r0..r15 handled flags, or the 
stack, or whatever.


> None of the segment registers should exist in the first place. That is 
> the job of a memory management unit!

Yeah, but that still leaves a lot of others to remember.


> That is because they were all General Purpose Registers! You could do 
> anything with any register! In fact, that has been pretty much the way 
> with everyone ... except Intel.

Yes, but as I recall some of them had special functions anyway, such as 
handling bit flags. Technically, many of the intel ones can be used for 
purposes other than their intended function too. I've done that. But 
you'll still get your toes stepped on by certain instructions if you code 
it badly. That didn't strike me as any different on the VAX... but then 
again, it's been a long time, I might have misinterpreted what I was 
seeing or remember it incorrectly.


> More like 4. The ones with 5 or 6 are very high level CISC ones that 
> almost no one ever used. And the VAX (and PDP) did a lot of stuff for 
> you. While the Intel machines forced you to do loads and stores to 
> registers before you could operate on them, (add, compare, xor, etc), 
> the DEC processors allowed both the src and dst of operations to be in 
> memory. The VAX also shifted the index registers for you automatically 
> based on the operand size.

Never used? Then why were they so prominent in the class I was taking? 
Never mind, I didn't think the class was structured well... I can chalk it 
up to that.


> Clearly you were meant to have been programming the PDP-11 for a few 
> years before. It would have been a logical extension.

Possibly so.


> And of course, by the time the VAX came out (1978), assembly was already 
> a Dead Language.

True enough. It was still useful in programming games where you needed to 
design some very tight code to handle sprites and sound efficiently, but 
it was a dead art.



------------------------------------------------------------------
  Ed T. Toton III -- http://necrobones.com/ - http://ed.toton.org/
------------------------------------------------------------------
    "I can't believe it! Reading and writing actually paid off!"
                                     -- Homer Simpson




More information about the Novalug mailing list