1. ASM.E question for PETE

Pete:

   Will you please explain to me how you add instructions to the asm.e
file using the sample entry below. I understand the #F6 is the first opcode
I know that #F6D0 would mean NOT al register. I do not understand how
the #D0 part is generated by the #10 + MODRM

    {"NOT",     {#F6, #10 + MODRM}},

The instructions I want to add are the SETcc ( byte set on condition code )
the eaxmples are:

                                            opcode   instruction
SETG AL  -- which should generate #0F9FC0 ( #0F9F     SETG r/8m )
SETL AH  -- which should generate #0F9CC4 ( #0F9C     SETL r/8m )
...... etc

Thanks
Bernie

new topic     » topic index » view message » categorize

2. Re: ASM.E question for PETE

Hi Bernie,

On Fri, 10 Dec 1999 13:17:30 -0500, Bernie Ryan <bwryan at PCOM.NET> wrote:
>Pete:
>
>   Will you please explain to me how you add instructions to the asm.e
>file using the sample entry below. I understand the #F6 is the first opcode
>I know that #F6D0 would mean NOT al register. I do not understand how
>the #D0 part is generated by the #10 + MODRM
>
>    {"NOT",     {#F6, #10 + MODRM}},

The "NOT" is the name of the opcode, followed by one or more sequences of
byte encodings.

The #F6 is a literal byte.
The #10 is part of the MOD/RM field in the instruction.  The MODRM is a
modifier that the asm parser knows to replaces with a Register or Memory
encoding.
The lower 3 bits are for the Register index (AL = 000, in this case)
The upper 2 bits determine whether its a register or memory. (11 for
register)

The remaining 3 bits in the middle can be used to tell between other
instructions that start with #F6.  So the only hex values that we can have
there are #00, #08, #10, #18, #20, #28, #30, #38.

So we have
      bits        hex
      --------    ---
      11___000  = #C0 (from MODRM)
 +    00010000  = #10
                = #D0


... In retrospect, doing it that way was really dumb.  Using modifiers using
bits makes it really hard to understand and add new instructions.



>The instructions I want to add are the SETcc ( byte set on condition code )
>the eaxmples are:
>
>                                            opcode   instruction
>SETG AL  -- which should generate #0F9FC0 ( #0F9F     SETG r/8m )
>SETL AH  -- which should generate #0F9CC4 ( #0F9C     SETL r/8m )
>...... etc
>
>Thanks
>Bernie

Add these to asm.e:
    {"SETG",    {#0F, #9F, #00 + MODRM}},
    {"SETL",    {#0F, #9C, #00 + MODRM}},


---------------------------
-- SETcc.ex test program

include asm.e

asm_output(1, 1)

? get_asm(
"not al "&
"setg al "&
"setl ah ")


--------------
-- output:

constant proc = allocate(8)
poke(proc, {
    #F6,#D0,                --    0: not al
    #0F,#9F,#C0,            --    2: setg al
    #0F,#9C,#C4})           --    5: setl ah
134825648


This appears to do what you want.  I could probably add all the SETcc
instructions to asm.e pretty easily.  I finished my last final a half-hour
ago, so now I have more time to code in Euphoria.  I've started making a
LL(1) parser, so you can throw any grammar at it and have it parse a file or
something.  I made it so that each rule in the grammar will attempt to call
a function of the same name, so that it can do stuff with the parsed data.
It should be suitable for writing a new asm parser, I hope.

--Pete

new topic     » goto parent     » topic index » view message » categorize

3. Re: ASM.E question for PETE

On Fri, 10 Dec 1999 17:27:49 -0500, Pete Eberlein <xseal at HARBORSIDE.COM>
wrote:

>This appears to do what you want.  I could probably add all the SETcc
>instructions to asm.e pretty easily.  I finished my last final a half-hour
>ago, so now I have more time to code in Euphoria.  I've started making a
>LL(1) parser, so you can throw any grammar at it and have it parse a file
or
>something.  I made it so that each rule in the grammar will attempt to call
>a function of the same name, so that it can do stuff with the parsed data.
>It should be suitable for writing a new asm parser, I hope.
>
>--Pete

Thank You Very Much Pete !

Is your LL(1) parser going to be written in Euphoria ?

Maybe you can use it to bootstrap a Euphoria compiler.

Maybe you should think about adding conditionals in asm.e also.

Thanks again

Bernie

new topic     » goto parent     » topic index » view message » categorize

4. Re: ASM.E question for PETE

On Fri, 10 Dec 1999 18:57:54 -0500, Bernie Ryan <bwryan at PCOM.NET> wrote:

>On Fri, 10 Dec 1999 17:27:49 -0500, Pete Eberlein <xseal at HARBORSIDE.COM>
>wrote:
>
>>This appears to do what you want.  I could probably add all the SETcc
>>instructions to asm.e pretty easily.  I finished my last final a half-hour
>>ago, so now I have more time to code in Euphoria.  I've started making a
>>LL(1) parser, so you can throw any grammar at it and have it parse a file
>or
>>something.  I made it so that each rule in the grammar will attempt to
call
>>a function of the same name, so that it can do stuff with the parsed data.
>>It should be suitable for writing a new asm parser, I hope.
>>
>>--Pete
>
>Thank You Very Much Pete !
>
>Is your LL(1) parser going to be written in Euphoria ?

Yes.

>Maybe you can use it to bootstrap a Euphoria compiler.

My thoughts exactly!  smile

>Maybe you should think about adding conditionals in asm.e also.

Sure, let my dig out those handy dandy intel manuals... I'll put the updated
asm.e on my site when it's done.

>Thanks again
>
>Bernie

Pete

new topic     » goto parent     » topic index » view message » categorize

5. Re: ASM.E question for PETE

Pete wrote:

> >Is your LL(1) parser going to be written in Euphoria ?
>
> Yes.

I seem to recall that eBasic has an LL(1) grammar engine in it.

-- David Cuny

new topic     » goto parent     » topic index » view message » categorize

6. Re: ASM.E question for PETE

On Thu, 9 Dec 1999 20:28:15 -0800, David Cuny <dcuny at LANSET.COM> wrote:

>Pete wrote:
>
>> >Is your LL(1) parser going to be written in Euphoria ?
>>
>> Yes.
>
>I seem to recall that eBasic has an LL(1) grammar engine in it.
>
>-- David Cuny

Indeed there is... grammar.e in ebasic.zip.

But that's not going to stop me from making my own.  smile

-- Pete

new topic     » goto parent     » topic index » view message » categorize

7. Re: ASM.E question for PETE

> Pete wrote:
>
> > >Is your LL(1) parser going to be written in Euphoria ?
> >
> > Yes.
>
> I seem to recall that eBasic has an LL(1) grammar engine
> in it.
>
> -- David Cuny

Hi David

eBasic means there is a Basic Interpreter written in
Euphoria?
If available; Can you say where I can download from?, I have
searched the archives, but with no success ( using the
keyword : "Basic" )

Thanx in Advance

Hugo

new topic     » goto parent     » topic index » view message » categorize

8. Re: ASM.E question for PETE

On Sun, 12 Dec 1999 06:07:39 -0500, Hugo Rozas <hrm at PERU.ITETE.COM.PE>
wrote:

>> Pete wrote:
>>
>> > >Is your LL(1) parser going to be written in Euphoria ?
>> >
>> > Yes.
>>
>> I seem to recall that eBasic has an LL(1) grammar engine
>> in it.
>>
>> -- David Cuny
>
>Hi David
>
>eBasic means there is a Basic Interpreter written in
>Euphoria?
>If available; Can you say where I can download from?, I have
>searched the archives, but with no success ( using the
>keyword : "Basic" )
>
>Thanx in Advance
>
>Hugo

eBasic is a Euphoria program that translates QBasic programs into Euphoria.
It handles a very large subset of QBasic and can be downloaded from
http://members.aol.com/EnjoyCruz/ebasic.zip

-- Brian

new topic     » goto parent     » topic index » view message » categorize

9. Re: ASM.E question for PETE

Thanx to Brian and David for the info about eBasic

Hugo

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu