From: Chuck Simmons
Organization: You jest.
X-Mailer: Mozilla 4.61 [en] (X11; U; Linux 2.0.33 i586)
Subject: Re: bits question
Date: Sun, 15 Sep 2002 16:06:34 GMT
NNTP-Posting-Date: Sun, 15 Sep 2002 09:06:34 PDT
John Woodgate wrote:
> I read in sci.electronics.design that A.Iakovlev
> wrote (in <3D848CDE.C4FC1647@worldonline.fr>) about 'bits question', on
> Sun, 15 Sep 2002:
> >> Correct but various conventions are used making things interesting at
> >> times. I use an assembler that recognizes "$" and "0x" to mean base 16
> >> so that 0x2b=$2b as far as that assembler is concerned. In the FORTH
> >> language, there typically is no way to indicate the base which is
> >> completely arbitrary - you have to remember what it is set to at the
> >> moment (usually 2, 8, 10 or 16).
> >> Chuck
> >Yes. In the z80 macroassember, for instance, you can give the .radix directive
> >sets the base for what follows..
> Thanks to all who responded. It's astonishing how rather inefficient
> symbols get widely adopted. '0x' is two bytes and certainly needs
> explaining, whereas '&', for example, would seem to be suitable, and
> only a single byte. I know that '&' doesn't appear on all keyboards, but
> it IS an ASCII symbol. Even better, being almost self-explanatory, would
> be 'H'.
Well, 'H' is is not without precedence. I forget where I have seen it
used to mean hex but it has been. Efficiency was never a big concern for
this. Generally, if you have a constant value you will use often in a
program, you define it to be some mnemonic you have half a chance of
remembering after a coffee break so that you don't type the literal
number more than once in a program. Curiously, perhaps from your point
of view, the mnemonic may have many more characters than the literal
number. For example, I might put a directive like
.equ port_a_dir_init = 0x42.
Clearly I don't care how many characters are needed to express the
constant 0x42 since I will always reference it as "port_a_dir_init" in
the program source. Basically, I try to divorce myself as much as
possible from having to remember individual bits in a multitude of
registers. Computers are supposed to do that for me.
... The times have been,
That, when the brains were out,
the man would die. ... Macbeth
Chuck Simmons firstname.lastname@example.org