Re: What causes this infinite loop?
- From: Jerry Coffin <spamtrap@xxxxxxxxxx>
- Date: Wed, 9 Aug 2006 09:03:06 -0600
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.
.
- Follow-Ups:
- Re: What causes this infinite loop?
- From: Frank Kotler
- Re: What causes this infinite loop?
- References:
- What causes this infinite loop?
- From: Sam
- What causes this infinite loop?
- Prev by Date: Re: Linking ASM Object File to C++ Program
- Next by Date: Re: What language are assemblers written in?
- Previous by thread: Re: What causes this infinite loop?
- Next by thread: Re: What causes this infinite loop?
- Index(es):
Relevant Pages
|