FPC and assembler 
Author Message
 FPC and assembler

Hallo,

I am converting from TP 7.0 to FPC. Some of my routines use ML. But FPC does
not recognize 16 bit code. I used to program a lot in ML but, to be honest,
never ever programmed for a 386 or higher. My questions:
- Does anyone know a crah course of how to deal with 32 bit codes?
- My main problem: mov AL,ES:[DI] Does anybody know the 32 bit equivalent?
Knowing this one solves 95% of my problem.

Thanks.

Groetjes, Ruud



Sun, 03 Aug 2003 21:37:36 GMT  
 FPC and assembler

Quote:

>I am converting from TP 7.0 to FPC. Some of my routines use ML. But FPC does
>not recognize 16 bit code. I used to program a lot in ML but, to be honest,
>never ever programmed for a 386 or higher. My questions:
>- Does anyone know a crah course of how to deal with 32 bit codes?
>- My main problem: mov AL,ES:[DI] Does anybody know the 32 bit equivalent?

stosb :-)

Quote:
>Knowing this one solves 95% of my problem.

Probably two different problems come together here:

- Use commandline option -Rintel or {$asmmode intel} in *each* source to set
the mode to intel styled assembler.

- Registers get prefixed my 'e' to refer to the 32-bit one.
(eax,ebx,ecx,edx,esi,edi,ebp,esp). Segments are still 16-bit, but a
selector now.

- memory locations are 32-bit. So always index mem with a 'e' register.

- You don't need segments to access variables and data in your own program.

Applying this to above we get: (assuming that EDI is preloaded with the
address):

mov al,[EDI] for intel, or mov (%edi),al



Sun, 03 Aug 2003 22:46:31 GMT  
 FPC and assembler

Quote:

> I am converting from TP 7.0 to FPC. Some of my routines use ML. But FPC does
> not recognize 16 bit code. I used to program a lot in ML but, to be honest,
> never ever programmed for a 386 or higher. My questions:
> - Does anyone know a crah course of how to deal with 32 bit codes?

Unfortunately, no.

Quote:
> - My main problem: mov AL,ES:[DI] Does anybody know the 32 bit equivalent?
> Knowing this one solves 95% of my problem.

The problem happens even earlier: you have to remove all "les di,x" and
"lds si,x" statements and replace them by "mov edi,x" resp. "mov esi,x".
Then the above becomes simply "mov al,[edi]".

General rule of the thumb: everywhere you used a 32 bit addrss using a
segment and an offset, now simply use a 32bit offset.  Where you used only
a 16bit offset, now use a 32bit offset.

Jonas



Sun, 03 Aug 2003 22:54:52 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. FPC:problem with printing from fpc programs

2. FPC: translate execvp from c to FPC

3. Using 386(+) opcodes in the builtin assembler

4. Using data from assembler

5. Using 386+ instructions & and the builtin assembler

6. including assembler-moduls in bp7-programs

7. Assembler

8. Assembler: Problem with using real values

9. TP6 code -> assembler

10. Accessing array from within the built-in assembler

11. Mouse Drivers in Pascal (possibly some assembler) ?

12. Assembler

 

 
Powered by phpBB® Forum Software