From owner-freebsd-hackers Thu Feb 29 23:42:40 1996 Return-Path: owner-hackers Received: (from root@localhost) by freefall.freebsd.org (8.7.3/8.7.3) id XAA22960 for hackers-outgoing; Thu, 29 Feb 1996 23:42:40 -0800 (PST) Received: from godzilla.zeta.org.au (godzilla.zeta.org.au [203.2.228.19]) by freefall.freebsd.org (8.7.3/8.7.3) with SMTP id XAA22954 for ; Thu, 29 Feb 1996 23:42:37 -0800 (PST) Received: (from bde@localhost) by godzilla.zeta.org.au (8.6.12/8.6.9) id SAA00619; Fri, 1 Mar 1996 18:36:40 +1100 Date: Fri, 1 Mar 1996 18:36:40 +1100 From: Bruce Evans Message-Id: <199603010736.SAA00619@godzilla.zeta.org.au> To: dahanaya@chaph.usc.edu, koshy@india.hp.com Subject: Re: help - assembly Cc: hackers@freebsd.org Sender: owner-hackers@freebsd.org Precedence: bulk >2. You have to indicate the size of operands as part of the opcode > mnemonic. > For example: > movl %eax, %ebx # moves 32 bits from eax to ebx > movw %ax, %bx # moves 16 bits from ax to bx ... > The suffixes are 'l' for 32 bit operands, 'w' for 16 bit operands, > 'b' for byte operands. The assembler will cross check that the > opcode's implied size and the actual sizes of the operands match. > This catches lots of interesting bugs before they can occur. Actually, it will get this wrong quite often, and introduce lots of interesting bugs if you forget the suffixes or use the wrong register names (%ax instead of %eax...). Example: something like movl %al,%bh ^ oops You have to indicate the size of operands only to avoid these bugs. Bruce