Thread overview
Inserting raw data in inline asm
Jan 04, 2007
Leopold Walkling
Jan 04, 2007
Leopold Walkling
Jan 04, 2007
BCS
Jan 05, 2007
Frits van Bommel
Jan 04, 2007
Thomas Kuehne
January 04, 2007
What are those "pseudo-ops" in inline asm like db, dw, dd, dl, df... for?
January 04, 2007
"Leopold Walkling" <leopold_walkling@web.de> wrote in message news:enjsji$kjj$1@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..


January 04, 2007
Jarrett Billingsley schrieb:
> "Leopold Walkling" <leopold_walkling@web.de> wrote in message news:enjsji$kjj$1@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?
January 04, 2007
Leopold Walkling wrote:
> Jarrett Billingsley schrieb:
>> "Leopold Walkling" <leopold_walkling@web.de> wrote in message news:enjsji$kjj$1@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)####, ####, ####, ####];
January 04, 2007
Leopold Walkling schrieb am 2007-01-04:
> What are those "pseudo-ops" in inline asm like db, dw, dd, dl, df... for?

#
# These pseudo ops are for inserting raw data directly into the code. db
# is for bytes, ds is for 16 bit ...
#

sample: asm{inc EAX;} and asm{db 0x40;} result in the same output, because the x86 encoding of "inc EAX" is 0x40.

Thomas

January 05, 2007
BCS wrote:
> Leopold Walkling wrote:
>> Jarrett Billingsley schrieb:
>>> "Leopold Walkling" <leopold_walkling@web.de> wrote in message news:enjsji$kjj$1@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...