1. Euphoria-DOS32-Assembly32
- Posted by Beaumont Furniss <bfurniss at IHUG.CO.NZ> May 12, 2000
- 478 views
I'm wondering if anyone knows how to pass a sequence ; perhaps with type checking , for say integer values , or single precision, to an assembly language program. A further requirement being that the values are compatible with the IEEE format , for words and double words , quad words ; etc. The only way that occurs to me, presently , is to convert each element of the sequence into the floating point equivalent ; using , for instance , atom_to_float32(). To date this has been a valid , though SLOW approach to sending sequences of atoms to assembly language routines. For the software I've written to date ; this is the greatest limitation in terms of through - put of data. The steps involved are: 1. sequence , of atoms. 2. Allocate memory for sequence. 3. select an element ( atom ) of the sequence. 4. convert element ( atom ) to IEEE equivalent , using atom_to_float32(); atom_to_float64() might, alternately , be used. 5. poke resulting bytes into appropriate , pre-allocated , memory location. 6. Use values from allocated memory , that are now in IEEE format , in assembly language routine[s]. 7. peek at pre-allocated memory locations. 8. Use float32_to_atom() or float64_to_atom() , if appropriate, to convert back to the value of an atom. 9. place this atom back into the sequence at the appropriate location. 10. de-allocate memory , set aside for sequence. Even if one is generating values [atoms] without putting these into a sequence , an atom_to_float32() , then eventually , float32_to_atom() is necessary. atom_to_float64() , then eventually , float64_to_atom() ; if one is using double precision. These routines are SLOW , does anyone know of an alternate approach to this way , of dos32 to assembly32, data translation ? More Ideally 1. Allocate memory for sequence. 2. copy sequence to allocated memory ; or poke into allocated memory. 3. Use values in Assembly Routines. 4. copy values in pre-allocated memory to sequence ; or peek from mem. 5. De-allocate memory. If the atom_to_float32() , float32_to_atom() was applicable to a Whole sequence , in an effecient way then this restriction on data flow might be alleviated. Is an IEEE formatted atom valid within Euphoria or must one always convert this to the usual format for an atom ? Maybe I need to investigate some of these issues ; for instance by doing this. 1. allocate memory for sequence , of atoms. 2. poke elements ( atoms ) into pre-allocated memory. 3. Use fld dw [ebx] , fstp dw [ebx]. 4. peek elements ( IEEE type things ). 5. see if the resulting objects ( atoms ?) are in IEEE format. 6. 7. de-allocate memory. Somehow I don't think this will work. Perhaps write the equivalent of float32_to_atom() , atom_to_float32() in assembly32 code ; have this as a standard option. In the meantime I'd like to hear back from anyone who has experience/ knowledge in these matters. P.S. This might seem like blasphemy to some ; is there anyway to find the starting and/or ending address of a sequence and then overwrite the values from within assembly32 routines ? Obviously this might save on the amount of memory required for manipulating most any sequence. One possibility is to allocate memory , for one atom , immediately after a sequence has been declared or assigned values ; this might then be close to the end address of the sequence. Net-Tamer V 1.11 - Test Drive
2. Re: Euphoria-DOS32-Assembly32
- Posted by Bernie Ryan <xotron at BUFFNET.NET> May 12, 2000
- 511 views
Have you look at pete's ASM.E which can be used to generate 32 bit assembler code including floating point. You are saying that you want to use floating point and are concerned about speed; unless you are concern about precision you should use fix-point for speed. Maybe you should explain to the list why you need to use a sequence of floating point to perform your task. Someone may have have a better way of accomplishing the same thing.
3. Re: Euphoria-DOS32-Assembly32
- Posted by Beaumont Furniss <bfurniss at IHUG.CO.NZ> May 13, 2000
- 451 views
On 2000-05-12 EUPHORIA at LISTSERV.MUOHIO.EDU said: EU>EUPHORIA at LISTSERV.MUOHIO.EDU; Fri, 12 May 2000 11:02:59 -0400 EU>Have you looked at pete's ASM.E which can be used to generate 32 bit EU>assembler code including floating point. You are saying that you EU>want to use floating point and are concerned about speed; unless EU>you are concerned about precision you should use fix-point for speed. EU>Maybe you should explain to the list why you need to use a sequence EU>of floating point to perform your task. Someone may have have a EU>better way of accomplishing the same thing. I have yet to scrutinize asm.e , which may have some bugs , to date asm86 is what I used for prototyping my assembly code ; then I corrected for the 32-bit form of the instruction. Initially tedious , until you build up a set of instructions that you can use from within an editor. Thereafter you can copy and paste and construct what you desire , and fairly easily run from Euphoria ; after you have built the appropriate software interface between the two. There are some applications where I want speed and a fair amount of accuracy , for instance when doing statistics on a large database. Suffice it to say , that I require both , Assembly32 permits this. Euphoria allows one to access a lot of data , however , the rate of through put is limited ; assembly language , if written correctly is faster than C or C++. This is mostly for my own use , however because my machine is an IBM compatible , numerous others will be able to run this software. ---------------------------------------- The crux seems to be the representation of data by Euphoria , in particular ; that of an atom , this doesn't appear to be the same as the IEEE format. Yet the conversion to the appropriate format shouldn't be that difficult ; C does this with type casting , I think. The difficulty is Euphoria sequence to IEEE sequence and IEEE sequence to Euphoria sequence. The Euphoria sequences are then usable in graphics instructions , like , display_image . ------------------------------------------ P.S. Sorry if I'm boring you. Net-Tamer V 1.11 - Test Drive
4. Re: Euphoria-DOS32-Assembly32
- Posted by Mark Brown <mabrown at SENET.COM.AU> May 13, 2000
- 486 views
Beaumont wrote..... > The crux seems to be the representation of data by Euphoria , in > particular ; that of an atom , this doesn't appear to be the same as the > IEEE format. Yet the conversion to the appropriate format shouldn't be > that difficult ; C does this with type casting , I think. Forgive me if I've got what you need wrong, but can't you use the euphoria atom_to_float, float_to_atom functions to get the ieee format you require? eg atom your_double_value atom a_double_value a_double_value = allocate(8) -- allocate 8 bytes to hold your floating point your_double_value = 1.23564 -- now poke 8 consecutive memory locations with the ieee representation -- of the value in your atom poke(a_double_value, atom_to_float64(your_double_value) (hope the above is correct!!) I would think that once you have your floating point atom poked into memory you should be able to use your assembly code to get at it. All the best Mark
5. Re: Euphoria-DOS32-Assembly32
- Posted by Bernie Ryan <xotron at BUFFNET.NET> May 13, 2000
- 480 views
On Sat, 13 May 2000 02:31:38 -0600, Beaumont Furniss <bfurniss at IHUG.CO.NZ> wrote: > I have yet to scrutinize asm.e , which may have some bugs , to date > ASM.E dosn't have any known bugs in it. ASM.E supports the full 32 bit instruction set, MMX instruction set, floating point instruction set, etc.