Inserting raw data in inline asm
Frits van Bommel
fvbommel at REMwOVExCAPSs.nl
Thu Jan 4 17:45:39 PST 2007
BCS wrote:
> Leopold Walkling wrote:
>> Jarrett Billingsley schrieb:
>>> "Leopold Walkling" <leopold_walkling at web.de> wrote in message
>>> news:enjsji$kjj$1 at digitaldaemon.com...
>>>> What are those "pseudo-ops" in inline asm like db, dw, dd, dl, df...
>>>> for?
>>>
>>> Doesn't your topic answer your question?
>>>
>>> I guess they're for inserting static data without using D syntax..
>>>
>> I found out what it does, but for what reason should I insert a raw
>> float into the machine code?
>
> for doing something like this in ASM;
>
> float a, b;
>
> a = b * 7.35235532;
>
> or maybe
>
> float[] arr;
>
> arr[] = [cast(flost)####, ####, ####, ####];
I think you'll find you'd put the floats into instructions that move
them to the coprocessor (or whatever, never used floats from asm). But
I'm pretty sure you wouldn't want to just paste the raw binary
representation of a float into a spot where the cpu will expect a new
instruction to start. That sounds like a recipe for disaster...
I guess those pseudo-ops are not very useful in an inline assembler.
Though I suppose you could jump over them and use them as values in
memory from other instructions[1].
Or you could use them to generate opcodes for (new) instructions that
the compiler doesn't (yet) know about :)...
[1]: which is probably as good as useless, since you typically can't
modify the code section, which is where they'd be stored...
More information about the Digitalmars-d-learn
mailing list