Re: I've seen the future...and it works! (was: my view on this assembler is blah)

From: luvr (spam-loving-criminal_at_spam-sink.net)
Date: 08/31/04


Date: Mon, 30 Aug 2004 23:34:33 +0100


"Betov" <betov@free.fr> wrote in message
news:XnF955293A679829betovfreefr@212.27.42.73...

> Now, about commenting XXXXX registers given in the form of
> r0... rn, this is nothing but the demonstration of what i
> was discussing in the thead where this post has been extract
> from, that is: This kind of regs naming _removes_ the original
> meaning of the traditional namings. In other words such a
> _flat_ naming _decreases_, a lot, the readability.

Hmmm... The IBM mainframe has 16 general-purpose registers, identified by
number - so, they just go 0, 1, 2, ... 15.
Right - Just using these numbers does, indeed, hinder readability.

So - what does one do, then?
Simple: One uses EQUates to assign meaningful names to the registers.

Plus, to stress the fact that a given EQUate identifies a register number,
the common convention is, to begin register number equates with 'R' (for
"Register"). So, e.g.,

RBASECOD EQU 12 ; Base register for the code.
RBASEDAT EQU 11 ; Base register for the data.
RBASEINR EQU 10 ; Base register for input record.
<...>

(Not the best, or most inspired, example, really, but just something I could
quickly come up with.)

How's that for readability?

--Luc.



Relevant Pages

  • Re: Calculating checksums...
    ... MOV BYTE PTR, ... byte-sized register and converting it to a word sized register by ... I use labels with meaning since they help to locate code sections ...
    (alt.lang.asm)
  • Re: Magic Jack
    ... No monthly fees, contracts, surcharge fees, or minimums. ... Call anyone at any number out of your region and it's .10/min but it caps ... at 1.99 meaning the most expensive call for ANY length of time, ... When you register it's registered to your home phone. ...
    (alt.home.repair)
  • Re: i386/x86_64 segment register issuses (Re: PATCH: Fix x86 segment register access)
    ... > HAS MEANING, even if the meaning is only about performance, not about ... > and gas will pick the 32-bit version based on the register name, yes, you ... > of the instruction when you do not specify a size does NOT MEAN that it's ... Segment registers are really 32 bits in length. ...
    (Linux-Kernel)
  • Re: Why not contract?
    ... HVS wrote: ... That's what style and register are all about. ... meaning much if a historian were to write "I'm fucked if I ... My pleasure, Harvey. ...
    (alt.usage.english)
  • Re: PIC EQU section.
    ... EEADR EQU 9;EEPROM address register ... WR EQU 1;Write bit in EECON1 ...
    (sci.electronics.basics)