[fpc-pascal]Intel ASM syntax problem
AITOR.SM
AITOR.SM at teleline.es
Mon Jun 25 23:11:00 CEST 2001
Ooops!!
You are entirely right! 32-bit world!
Let me explain something else about this program. This is a piece of
snippet taken from SWAG, as it is a quite detailed drive identification
code, so I didn't write it myself. I simply tried to compile under FPK,
just forgetting that I am doing these seg:ofs calls and the like.
Well, I don't believe this will compile even if I change bx by ebx. My
solutions could be:
(a) any of you has a piece of code to detect fd/cd/hd/ram/net disks
under GO32V2
(b) as this is a *very* small program, I will compile it under TP
(which is a pitty, I expected to release my program entirely compilable
under FreePascal)
Well, thanks!
Aitor
----- Mensaje Original -----
De: Jonas Maebe <jonas at zeus.rug.ac.be>
Fecha: Lunes, Junio 25, 2001 5:37 pm
Asunto: Re: [fpc-pascal]Intel ASM syntax problem
>
> On maandag, juni 25, 2001, at 05:17 , Aitor Santamaria Merino wrote:
>
> > am trying to compile this (which compiles under TP): (using asm and
> > {$ASMMODE Intel}):
> >
> > (66) mov word ptr ds:ControlBlk25[bx].StartSector,ax
> > (67) mov word ptr ds:ControlBlk25[bx].StartSector[2],ax
> >
> >
> > where
> > ControlBlk25 = record { control block for INT 25 extended
> call }
> > StartSector : LongInt; { start sector to read }
> > Count : Word; { number of sectors to read }
> > BufferOffs : Word; { data buffer offset }
> > BufferSeg : Word; { data buffer segment }
> > end;
> >
> >
> > The problem appears when it reaches the [bx]:
> > drvscan.pp(66,18) Fatal: Syntax error, [ expected but identifier
> found>
> > Any alternative/correction?
>
> First of all: you will most likely have to rewrite almost all your
> assembler routines, because you now work in a 32bit memory model.
> This
> means that anything that uses segments (including lds/les) or
> memory
> address expressions containing registers (such as the above) will
> have
> to change. The reason is that there are no segments anymore, only
> selectors (which you normally can ignore, you can assume all of
> your
> data is in the DS selector, except if you need to access video
> memory or
> so) and all offsets are 32bits (so you'd need at least ebx instead
> of bx
> in the above example).
>
> Second, you won't be able to pass a data structure from you
> program to a
> Dos interrupt call the way you are trying it, because Dos can only
> work
> with the first megabyte of memory and in segment:offset format,
> while
> FPC programs work with all memory in your computer and that data
> structure most likely lies way above the first megabyte. You will
> need
> the dosmemput/dosmemget/global_dos_alloc/global_dos_free routines
> from
> the go32 unit. I suggest you throughly read the docs of that unit
> before
> attempting things like this
>
> Third: there may indeed be bugs in the assembler reader. It should
> compile if you change it to
>
> mov word ptr ControlBlk25[ebx].StartSector,ax
>
> but I'm not sure (you definitely need a 32bit register as offset,
> I
> don't think we support the generation db 67h prefixes to allow
> 16bit
> registers in memory expressions).
>
>
> Jonas
>
> _______________________________________________
> fpc-pascal maillist - fpc-pascal at lists.freepascal.org
> http://lists.freepascal.org/mailman/listinfo/fpc-pascal
>
___________________________________________________________________
Consigue tu e-mail gratuito TERRA.ES
Haz clic en http://www.terra.es/correo/
More information about the fpc-pascal
mailing list