Re: maybe a bit OT: EEPROMs and PCs



Herbert Kleebauer wrote:
Indead. This is the most important innovation introduced
by NASM, and all of the actual Assemblers conform to this
new and clean definition of the syntax basics.

If the above examples are correct, then MASM/TASM does it the correct way and the NASM/FASM form is completely illogical. We have a register set (let's use the names r0, r1, r2 ...) and a set of memory locations (m0, m1, m2, ..)

Now, a "mov r0,r1" moves the content of register 1
into register 0 (if we use the illogical "dest,src" form).
If it should be logical, then a "mov r0,m4" has to move the content of memory location 4 into register 0.

Oh, would you people stop arguing for once! =))

There is only one logical way to have things and it is the way they are done in binaries or as close as possible, because the things making it all work are called logic circuts and they just can't work when the input is illogically organized.

And then there is the diffirence between universal logic and human common sense (which isn't even global for one).

Now Intel don't uses r0,r1, ..  but AL, DL, ... and the
memory locations are numbers only without an "m" prefix, so we
get:

 mov al,dl   ; move content of dl into al
 mov al,4    ; move content of memory location 4 into al

If you want to move the number 4 into al, you have to
explicitly say so:

  mov al,#4

But to use the word "offset" instead of a simple symbol
like # is also illogical. If I want to load the constant
number 4 into al, what has this to do with an "offset"?

There are only a few specifics in ASM that don't corespond to the underlying instructions directly. That's what makes ASM such a great thing to program in and that is why I need to use it to fill a BIOS chip.


Once you realize that in reality, there is no computer's number "4", there is only one long stream of 1s and 0s that is organized meaningfully by offsets, ranges and terminators, it becomes preety clear that "mov al,4" means absolutely nothing, unless you want your assembler to either guess or read your mind. In the end you'll have to allocate your memory space where you will put that 4 in a way that it can be recgotnized as "numerical value of four" (db I guess) and then provide that thing into your register, in effect using the offset and viola.

Go figure.

--
Model: INFJ
Primary function: Coprocessor
Secondary function: Cluster commander

Yes I'm a therian:
http://www.wikitherian.org

Creationism & Darwin:
"The bible says humans were
supposed to use animals to
do work for them and I like
to work so I must be an animal!"
.



Relevant Pages

  • Re: maybe a bit OT: EEPROMs and PCs
    ... mov eax, offset 4 ... to load the content of memory location 4 into eax. ... not the content of memory location 4 and the content of memory location 4 is specified by, then you also have to specify the content of register al by: ...
    (alt.lang.asm)
  • Re: Kind of new: function implementation questions, MASM
    ... yet ds is a 16 bit register and I want to make sure ... >another register that is the offset for the selector in the segment ... The assembler also includes a table telling the linker ... because the point of using the data segment was that the data ...
    (comp.lang.asm.x86)
  • Re: Code density and performance?
    ... >> You also need load/store with SP as a base and a large offset. ... > are plain register indirect with no offset. ... >> FP instructions is surprisingly small. ... but to get that the old 16 bit inst had ...
    (comp.arch)
  • Re: 0x8024D007, automatic update service starting, REGSVR32 wuauen
    ... Yes, when I try to register wuaueng.dll, I get the same error (Invalid ... access to memory location) as when I try to start the BITS service. ... When I try to register wuaueng.dll by using the command REGSVR32 ... That would hopefully expose the source of the failure. ...
    (microsoft.public.windowsupdate)
  • Re: Code density and performance?
    ... The problem is that 3-4 bits is pretty useless as an offset value, ... are plain register indirect with no offset. ... > FP instructions is surprisingly small. ... but to get that the old 16 bit inst had ...
    (comp.arch)