NNTP-Posting-Date: Sat, 27 Oct 2012 14:06:31 -0500 From: Chris Hinsley Newsgroups: comp.lang.forth Date: Sat, 27 Oct 2012 20:06:31 +0100 Message-ID: <2012102720063140720-chrishinsley@gmailcom> References: <2012102715594849117-chrishinsley@gmailcom> <201210271603106615-chrishinsley@gmailcom> <1315f2d4-5da9-42dc-af23-d7d7a9f9018b@l12g2000vbj.googlegroups.com> <2012102717444755036-chrishinsley@gmailcom> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1; format=flowed Content-Transfer-Encoding: 8bit Subject: Re: well formed flag ? User-Agent: Unison/2.1.9 Lines: 47 X-Usenet-Provider: http://www.giganews.com X-Trace: sv3-5xipQQPeb/dCmrOEgzRG2mWXT6epWcMj+VfqNqymcPPei+ft6zv4uH9iG2zwSXR+4OO/sv3NIRtAZMJ!AlCi+q6sAPeO14jWNle5MyEOMxYVbYWMyLgkbbnLulo2xn+OwUwpCcwtiEzRa/9aRbhCpww= X-Complaints-To: abuse@giganews.com X-DMCA-Notifications: http://www.giganews.com/info/dmca.html X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.3.40 X-Original-Bytes: 2910 Path: csiph.com!usenet.pasdenom.info!news.stben.net!border3.nntp.ams.giganews.com!Xl.tags.giganews.com!border1.nntp.ams.giganews.com!nntp.giganews.com!local2.nntp.ams.giganews.com!news.giganews.com.POSTED!not-for-mail Xref: csiph.com comp.lang.forth:16780 On 2012-10-27 18:52:49 +0000, Rod Pemberton said: > "Chris Hinsley" wrote in message > news:2012102717444755036-chrishinsley@gmailcom... > >> One thing I just noticed is that NASM isn't encodeing small constant >> adds as a single byte, it's useing the full 4 byte encodeing ! > > Old style NASM produced the most generic instruction encoding, i.e., large > offsets. With NASM, you need BYTE keyword for imm8 and maybe mem8 > encodings. That's before H.P.A. started messing with NASM's syntax and made > it more MASM like. So, for new versions of NASM w/64-bit support, I'd check > the manual for any syntax changes. > > NASM requires you to specify data sizes when it's indeterminable from the > instruction. This is the opposite of assemblers like MASM where you use > keywords to specify pointer types. GAS (GCC) places sizes on the > instruction name. Unfortunately, that produces naming conflicts with Intel > instructions names for a few instructions. > >> I don't >> recall there being an option to tell NASM to optimise constants, I >> thought there was only -O flags to say optimize branches ? >> > > Maybe, ask on comp.lang.asm.x86 or alt.lang.asm. > > > Rod Pemberton Thanks Rod, I found the relavent section in the NASM manual. You do need to specify 'byte' on constant loads of a 32bit reg from an imm8 ! So I changed my macro to do this: ; adjust data stack %macro ADDDSP 1 %if ((%1 >= -128) && (%1 < 128)) add ebp, byte %1 %else add ebp, %1 %endif %endm This has shorten quite a few words ! :) Chris