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