Re: Well, _that_ didn't work.
- From: Steve VanDevender <stevev@xxxxxxxxxxxxxxxxxxxxxxx>
- Date: Thu, 05 Mar 2009 22:33:12 -0800
TimC <tconnors@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx> writes:
On 2009-03-03, Steve VanDevender (aka Bruce)
Honestly, orthogonality isn't just a benefit for humans coding assembly
language; it's also much easier to create good compilers for
architectures that have relatively simple, orthogonal instruction sets.
Admittedly compilers benefit from somewhat different sorts of
orthogonality, like having a large register set with few limitations on
which registers can be combined in operations, rather than having a lot
of memory addressing modes which can all be used in any memory reference
Call me a robot, but I always preferred having 32 registers free for
my disposal than having to always having to dig for the right
instruction for the particular for of data I was looking for.
This view may have been formed when I was doing MIPS in one course and
68HC11 in another. Furrfu. No wonder modern microwave user
interfaces all suck. They must all be using the 68HC11.
Even the 68HC11 is highly orthogonal compared to the last processor I
did any great amount of assembly coding for, the HP Saturn (used in the
HP 28/48 series of calculators, among others).
It has four 64-bit "general-purpose" registers, A, B, C, and D. One can
work with the entire register or with a subfield of nibbles,
corresponding to fields of the floating-point format, the 20-bit address
format (for which there are also short, fast instruction variants), or
using a 4-bit register P, a specified subfield of nibbles from the least
significant nibble through nibble P.
So it takes only two bits to select one of those general registers for a
single-operand instruction. Two-operand instructions, though, also use
two bits to select the two operands, in the pairs (A, B), (B, C),
(C, A), or (D, C), often with an additional variant to reverse the
operand order in each pair. Yup, D can be used only with C.
Only registers A and C can be transferred to/from memory or another set
of internal scratchpad registers R0 through R4.
The memory address for any memory transfer is specified using one of two
20-bit address registers D0 and D1. You can load immediate values into
them or transfer registers A or C into them. The only way to get the
values out of D0 or D1 is to swap them with A or C. Also, a single
four-bit bus is used both to transfer data to/from memory or to load an
address into a memory controller, so memory accesses are
_expensive_ -- by default you can expect the PC to be loaded in the
memory controller, so a memory reference that isn't an instructionn
fetch requires five cycles to shove an address into the memory
controller, one cycle for each nibble read/written (the controller at
least autoincrements the address), and five more cycles to shove the PC
back into the memory controller to set up for the next instruction
Also, HP's internal mnemonics for instructions in their assembler
literally looked like "A=A+B X" or "C=DAT0 W". I swear I am not making
I managed to successfully code the MD5 checksum algorithm as my biggest
project, but only because someone wrote a macro assembler that used a
sane (non-HP) mnemonic set looking more like a traditional assembly
language. I never could wrap my head around the native HP assembler.
Even with that, programs looked a bit weird.
;check for proximity to the HP 48 IR transmitter/receiver pair by pulsing
;the IR transmitter and looking for echo on the receiver. Pushes %0
;(real 0) on the RPL stack if no echo, %1 if an echo was detected.
SAVPTR = #0679B
GETPTR = #067D2
call SAVPTR ;save RPL registers
move.5 #0011a, d0 ;get address of IR receiver in d0
move.5 #0011c, d1 ;get address of IR transmitter in d1
move.1 a, @d0 ;clear receiver status
move.p1 #8, c
move.1 c, @d1 ;turn on transmitter
move.1 @d0, c ;get receiver status
move.1 a, @d1 ;turn off transmitter
brnz.p c, echo ;check receiver status
move.p5 #2a2b4, c ;put pointer to %0 in c
move.p5 #2a2c9, c ;put pointer to %1 in c
move.a c, a ;copy to a
call GETPTR ;restore RPL regs
jump.a @a ;execute RPL object at a, and continue RPL
Steve VanDevender "I ride the big iron" http://hexadecimal.uoregon.edu/
stevev@xxxxxxxxxxxxxxxxxxxxxxx PGP keyprint 4AD7AF61F0B9DE87 522902969C0A7EE8
Little things break, circuitry burns / Time flies while my little world turns
Every day comes, every day goes / 100 years and nobody shows -- Happy Rhodes
- Prev by Date: Re: Sheesh/Furrfu! Two at once!
- Next by Date: Re: "Why is this mail going to that address?
- Previous by thread: Re: Well, _that_ didn't work.
- Next by thread: Re: News from cloud cuckoo land