Re: What causes this infinite loop?



In article <NIOdneYyOeh3OUTZnZ2dnUVZ_tKdnZ2d@xxxxxxxxxxx>,
spamtrap@xxxxxxxxxx says...

[ ... ]

With most assemblers, "It's not just a good idea, it's the law!"
Usually, an "identifier" must not start with a decimal digit, a number
must start with a decimal digit. If the "hex number" starts with a
decimal digit, you don't have to add a zero. There isn't much point to
"mov ah, 09h" :)

I'm not at all sure that's true of most assemblers at all. Most of the
assemblers I've used on non-Intel platforms have used what I'd consider
more sensible rules. There's virtually nothing sensible about using a
suffix to signal a number's base -- a prefix makes far more sense. It
makes the code easier to read and the assembler easier to write.

In a typical case, a hexadecimal number is signalled by a '$' as a
prefix:

lda #14 ; loads accumulator with 14 decimal
lda #$14 ; loads accumulator with 14 hexadecimal

Simple, straightforward, and no confusion. Oh, in case you wondered,
those same assemblers typically signal an immediate value with '#':

lda #14 ; the value 14
lda 14 ; the value from address 14
lda (14) ; the value pointed to by address 14
; some use '[14]' or '*14' instead.

Since assemblers for Intel platforms generally don't require anything to
signal an immediate value, there's nearly constant confusion in this
area. Specifically, there are three distinct cases, but they provide
only two notations to differentiate between them.

Some assemblers (e.g. NASM) have consistent rules, but from the number
of times questions about this arise here, it's pretty clear that most
people don't quite understand them. Even when you do understand them,
it's annoying to use (IMO, obviously).

MASM goes the opposite direction -- it attempts to be less annoying to
use (mostly successfully, IMO), but its rules about what means what are
so convoluted that I doubt even its authors are sure of them.

--
Later,
Jerry.

The universe is a figment of its own imagination.

.



Relevant Pages

  • Re: What causes this infinite loop?
    ... Usually, an "identifier" must not start with a decimal digit, a number must start with a decimal digit. ... Most of the assemblers I've used on non-Intel platforms have used what I'd consider more sensible rules. ... Since assemblers for Intel platforms generally don't require anything to signal an immediate value, ... Specifically, there are three distinct cases, but they provide only two notations to differentiate between them. ...
    (comp.lang.asm.x86)
  • Re: mov al,0f0h
    ... with a decimal digit. ... (true for all assemblers I'm aware of) ... mov eax, BAH ...
    (alt.lang.asm)
  • Re: MultiWindowed Adventure Game
    ... > It's a bleedin' immediate! ... I don't know that it's intuitive, but it's what other assemblers use ... (MASM, in particular), so I just followed suit. ...
    (alt.lang.asm)
  • Re: Flaws in Drexlers vision
    ... IMO, quite a lot of this site is incorrect, ... going to cost. ... Assemblers today are about here: ... Not exactly a meat machine yet. ...
    (sci.nanotech)