Hi, On 10/25/10, Maurice Lombardi <Maurice.Lombardi@ujf-grenoble.fr> wrote:
This means that GPC does an arithmetical right shift (i.e. propagating the 1 (or 0) in the leftmost (highest weight) position), while BP does a logical right shift.
Right, so GPC does it the same as C (no surprise, GCC-based).
It seems more sound to use an arithmetical shift for integer and a logical shift for cardinal.
Right, so shifting a signed number should keep the sign. (Though "cardinal" isn't standard Pascal, comes from Modula-2, and Wirth removed it for Oberon). Tell me if this helps demonstrate anything: --- snip --- CR equ 13 LF equ 10 org 100h mov eax,-2 ; = 0xFFFFFFFE shr eax,1 call hexdword ; EAX = 0x7FFFFFFF call newline mov eax,-2 sar eax,1 call hexdword ; EAX = 0xFFFFFFFF call newline int 20h ; exit hexdword: mov ecx,8 ; 32/4 .begin: rol eax,4 push eax and al,0Fh cmp al,10 sbb al,69h das int 29h ; putchar(AL) pop eax loop .begin ret newline: mov al,CR int 29h mov al,LF int 29h ret