Il 17/08/2018 18:04, Giuliano Colla ha scritto:
I modified your code, to add a jump table (as it is in the example you mention)
I came to that program branch; {$ASMMODE intel} label tab,stop,a,b,c; var idx:byte; begin write('Index? '); readln(idx); asm xor eax,eax; mov al,idx; shl ax,2; mov ebx,tab; add ebx,eax; jmp ebx; tab: dd (*offset*) a; dd (*offset*) b; dd (*offset*) c; end['EAX','EBX']; a: writeln('0'); goto stop; b: writeln('1'); goto stop; c: writeln('2'); stop: writeln('stop'); end. but it works only for index 0, and crashes otherwise. Maybe a problem of alignment? Or must be tab declared in data section? _______________________________________________ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal