1. ASM.E question for PETE
- Posted by Bernie Ryan <bwryan at PCOM.NET> Dec 10, 1999
- 519 views
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
2. Re: ASM.E question for PETE
- Posted by Pete Eberlein <xseal at HARBORSIDE.COM> Dec 10, 1999
- 555 views
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
3. Re: ASM.E question for PETE
- Posted by Bernie Ryan <bwryan at PCOM.NET> Dec 10, 1999
- 506 views
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
4. Re: ASM.E question for PETE
- Posted by Pete Eberlein <xseal at HARBORSIDE.COM> Dec 10, 1999
- 497 views
- Last edited Dec 11, 1999
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!>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
5. Re: ASM.E question for PETE
- Posted by David Cuny <dcuny at LANSET.COM> Dec 09, 1999
- 484 views
- Last edited Dec 10, 1999
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
6. Re: ASM.E question for PETE
- Posted by Pete Eberlein <xseal at HARBORSIDE.COM> Dec 10, 1999
- 493 views
- Last edited Dec 11, 1999
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.-- Pete
7. Re: ASM.E question for PETE
- Posted by Hugo Rozas <hrm at PERU.ITETE.COM.PE> Dec 12, 1999
- 499 views
> 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
8. Re: ASM.E question for PETE
- Posted by Brian Broker <bkb at CNW.COM> Dec 12, 1999
- 520 views
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
9. Re: ASM.E question for PETE
- Posted by Hugo Rozas <hrm at PERU.ITETE.COM.PE> Dec 14, 1999
- 497 views
Thanx to Brian and David for the info about eBasic Hugo