1. Assembly routines

Here are some questions that may have already been answered:

1.  When using an assembly routine in Euphoria, is it interpreted like the
rest of the program, or does Euphoria actually release control to the
assembly function?

2.  Euphoria uses protected mode (I think).  Is an assembly routine in a
Euphoria program also run in protected mode, or is the computer switched to
real mode before the assembly is run, and switched back to protected mode
when the assembly returns?

3.  Is it possible to pass data back and forth between an assembly function
and the Euphoria program?

4.  Um, I forgot #4.  :)

Any info would be appreciated.
James Powell

new topic     » topic index » view message » categorize

2. Re: Assembly routines

> 1.  When using an assembly routine in Euphoria, is it interpreted like the
> rest of the program, or does Euphoria actually release control to the
> assembly function?

i believe it hands control over to the assembly code

> 2.  Euphoria uses protected mode (I think).  Is an assembly routine in a
> Euphoria program also run in protected mode, or is the computer switched to
> real mode before the assembly is run, and switched back to protected mode
> when the assembly returns?

nope it's in protected mode

> 3.  Is it possible to pass data back and forth between an assembly function
> and the Euphoria program?

the only way i could think of doing that is by doing something like
this:

-- start assembly code
; let's say some function value is stored in register ax
mov dx, 0500h ; just as an example
out dx,ax ; poke ax into #500
ret
-- end assembly code

var = peek(#500)

i think that'd work...  wewp

    .   o   O   Mike Burrell   O   o   .
. o O http://www.geocities.com/SoHo/9036 O o .
   .  o  O burrellm at geocities.com O  o  .

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

3. Assembly routines

James Powell writes:
> 1.  When using an assembly routine in Euphoria, is it interpreted like the
> rest of the program, or does Euphoria actually release control to the
> assembly function?

Euphoria turns over complete control to your machine code. Your machine
code is running on the "bare metal" so to speak.  smile

> 2.  Euphoria uses protected mode (I think).  Is an assembly routine in a
> Euphoria program also run in protected mode, or is the computer switched to
> real mode before the assembly is run, and switched back to protected mode
> when the assembly returns?

Your machine code routine runs in 32-bit protected mode, just like
Euphoria itself. Euphoria does not switch modes before calling your code.

> 3.  Is it possible to pass data back and forth between an assembly function
> and the Euphoria program?

Yes. Your Euphoria program can call allocate() or allocate_low()
to reserve space in memory. It can peek()/poke() data into that
space and your machine code can access that area of memory.
See demo\callmach.ex, demo\hardint.ex, and some
of Jacques Deschenes .e files, for some good examples of this.

Regards,
  Rob Craig
  Rapid Deployment Software

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

Search



Quick Links

User menu

Not signed in.

Misc Menu