[fpc-pascal]asm
adeli at adeli.fr
adeli at adeli.fr
Fri Jan 12 00:06:10 CET 2001
I try to port some bp7 software to freepascal
I have some lib written in asm
when i try to run the example it bugs !
perhaps i to tired to see the error or i miss something in the 32 bit
information...
A chercher = 0:151084
Tableau = 0:151080
An unhandled exception occurred at 0x00021759 :
Access violation
0x00021759 CHERCHE_PLUS_ZONE, line 71 of g:/pp/adeli/test32.pas
0x00021827 main, line 121 of g:/pp/adeli/test32.pas
0x0000206D
I try to check the value in register with both ide in dos and win33 mode
and gdb in win32 mode wiht the same result the value of ds,es,esi,edi are
the same as printed....
{$ASMMODE INTEL}
{ debut poinbte sur le numÚro de l'ÚlÚment...
Var_tableau contient }
function cherche_plus_zone(debut:longint;
var var_a_chercher;
taille:longint;
var var_tableau;
taille_element:longint; { taille de base d'un ÚlÚment du
tableau ou du record}
nombre_element:longint { nombre d'element dans le
tableau}
) :longint;
var sseg:word;
oofs:longint;
sseg_tab:word;
oofs_tab:longint;
pt:p_stock;
a:longint;
begin
writeln('A chercher = ',seg(var_a_chercher),':',ofs(var_a_chercher));
sseg:=seg(var_a_chercher);
oofs:=ofs(var_a_chercher);
pt:=p_stock(var_a_chercher);
writeln('Tableau = ',seg(var_tableau),':',ofs(var_tableau));
sseg_tab:=seg(var_tableau);
oofs_tab:=ofs(var_tableau);
a:=pt^.texte;
asm
push ds
push es
cld
mov eax, debut
mov edi, taille_element
mul edi
xor edi,edi {on calcul l'offset de dÚplacement..}
{ les edi, var_a_chercher}
mov edi, oofs
mov es,sseg
add edi,eax
mov ebx, debut
{ lds esi, var_tableau}
mov ds, sseg_tab
mov esi, oofs_tab
mov edx,esi
@boucle_plus_zone:
mov ecx, taille_element
{line just for test the adresse es:[edi]}
mov eax, dword ptr es:[edi] { here is a bug }
{line just for test the adresse in ds:[esi]}
mov al, byte ptr ds:[esi] { here is the other bug }
repe
cmpsb {HERE is the bug}
je @egal_plus_zone
clc
inc ebx
mov ecx,eax
mov eax,ebx
mov esi,edx
mov edi, taille_element
mul edi
xor edi,edi
mov edi,eax
mov eax,ecx
mov edx,esi
cmp ebx,nombre_element
jb @boucle_plus_zone
mov ebx,0FFFFFFFFH
@egal_plus_zone:
mov eax,ebx
pop es
pop ds
end ['EAX','EBX','ECX','EDX','ESI','EDI'];
end;
Lionel Drevon ldrevon at adeli.fr
Adeli http://www.adeli.fr
618 Av. Gal de Gaulle Tel 04 78 66 11 85
69760 Limonest Fax 04 78 66 04 33
More information about the fpc-pascal
mailing list