[fpc-pascal]Reading the screen

Florian Klaempfl florian at klaempfl.de
Fri Sep 29 10:01:06 CEST 2000


Johann Glaser schrieb:
> 
> Hi!
> 
> Hmm, I saw this way and I wonder why it is necessary to do such
> complicated segment calculations. Is there any reason?
> 
> > begin
> >     segment:=$a7f7+(10*y)+(x div 8);  {address of char}
> >     offset:=$ffee+((x mod 8)*2);
> >     dosmemget(segment,offset,ascii,1);        {read ascii}
> >     inc(offset);
> >     dosmemget(segment,offset,attribut,1);     {read attribut}
> > end;
> 
> It would more clear and far easier when doing it that way:
> 
> Begin
>   Segment := $B800;
>   Offset  := 2*(Y*80 + X);
>   DosMemGet(Segment,Offset,Ascii,1);
>   Inc(Offset);
>   DosMemGet(Segment,Offset,Attribut,1);
> End;
> 

It should working this way.

BTW: You can also use mem[seg:ofs].






More information about the fpc-pascal mailing list