Thread overview | ||||||||
---|---|---|---|---|---|---|---|---|
|
January 04, 2007 Inserting raw data in inline asm | ||||
---|---|---|---|---|
| ||||
What are those "pseudo-ops" in inline asm like db, dw, dd, dl, df... for? |
January 04, 2007 Re: Inserting raw data in inline asm | ||||
---|---|---|---|---|
| ||||
Posted in reply to Leopold Walkling | "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 Re: Inserting raw data in inline asm | ||||
---|---|---|---|---|
| ||||
Posted in reply to Jarrett Billingsley | 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 Re: Inserting raw data in inline asm | ||||
---|---|---|---|---|
| ||||
Posted in reply to Leopold Walkling | 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 Re: Inserting raw data in inline asm | ||||
---|---|---|---|---|
| ||||
Posted in reply to Leopold Walkling Attachments: | 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 Re: Inserting raw data in inline asm | ||||
---|---|---|---|---|
| ||||
Posted in reply to BCS | 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...
|
Copyright © 1999-2021 by the D Language Foundation