[fpc-pascal]Porting to Free pascal this little Turbo Pascal code

Jérémie LEFRANCOIS j.lefrancois at altran-tech.net
Fri Jul 30 14:36:17 CEST 2004

Thanks for you reply full of wisdom. Truth is, I *have* *to* make a program 
that emulates multitasking that way.

I adapted the code (after several trials since I have no assembler experience) 
and it seems to work fine now :-)

Here is the tip :
        movl bp_load, %ebp
        movl ss_load, %esp
=> loads the stack segment and base pointer

        movl %ebp, bp_save
        movl %esp, ss_save
=> saves the stack segment and base pointer

I enclosed the revised TASKER.PAS as zip document, in case it could help 
someone else (thanks to Mr Warot).

En réponse à "Nelson M. Sicuro" <nelson at desktopsistemas.com.br>:

> In my humble experience with FreePascal, I know that you cannot mess
> with  
> segment registers as you do in 16 bits mode. This code of yours need to
> be  
> rewrited from scratch to be in 32 bits mode, without using the segment 
> registers and the inline functions (replaced with asm statements).
> Anyway, this code seems unsafe to run in 32 bits anyway.
> Most 32 bits environments are indeed capable of multitask programming, 
> take a look at the DOS 32 bit extenders that FreePascal uses.
> Best regards,
> Nelson
> > Anybody capable of providing me an answer on how to get this working 
> > with Free
> > Pascal (under DOS) ?
> >
> > The trick is that the Base Pointer and Segment Stack are saved and  
> > restored.
> > That is what I am trying to do . Note FreePascal only accepts ASM
> blocks.
> >
> > And also I do not know what instruction $89/$2e $8c/$16 $8b/$2e
> $8e/$16  
> > $90/$90/
> > $90 refer to.
> > Regards.
> >
> >
Jérémie Lefrançois
06 73 27 35 97 
Altran Technologies
-------------- next part --------------
A non-text attachment was scrubbed...
Name: TASKER.zip
Type: application/x-zip-compressed
Size: 1170 bytes
Desc: not available
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20040730/1f5622b8/attachment.bin>

More information about the fpc-pascal mailing list