[fpc-pascal] Branch table

Marco Borsari borsa77 at libero.it
Tue Aug 14 15:21:23 CEST 2018


Why the code below does exit gracefully without prints anything?
Sure, it is for my poor knowledge of the assembler, but in some details, 
please...

program branch;
{$ASMMODE intel}
label next,stop,a,b,c;
var idx:byte;
begin
write('Index? ');
readln(idx);
asm
mov ax,idx;
shl ax,2;
mov bx,next;
add bx,ax;
jmp (*short*) [ebx+4];
next:
jmp a;
jmp b;
jmp c;
end['EAX','EBX'];
a:
writeln('0');
goto stop;
b:
writeln('1');
goto stop;
c:
writeln('2');
stop:
writeln('stop');
end.

Just another question: why the short modifier is unrecognized?
Thanks for any help in this holydays time,
Marco



More information about the fpc-pascal mailing list