Xref: utzoo comp.os.msdos.programmer:756 comp.sys.ibm.pc.misc:1387 Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!uunet!zephyr.ens.tek.com!uw-beaver!sumax!amc-gw!jwbirdsa From: jwbirdsa@amc-gw.amc.com (James Birdsall) Newsgroups: comp.os.msdos.programmer,comp.sys.ibm.pc.misc Subject: Re: TASM bug? (no, not at all) Message-ID: <2953@amc-gw.amc.com> Date: 4 Sep 90 20:15:18 GMT References: <4691@bdt.UUCP> <38580@shemp.CS.UCLA.EDU> Reply-To: jwbirdsa@europa.amc.com (James Birdsall) Distribution: na Organization: Applied Microsystems, Redmond, WA Lines: 25 In article <38580@shemp.CS.UCLA.EDU> wales@CS.UCLA.EDU (Rich Wales) writes: >In article <4691@bdt.UUCP> doug@bdt.UUCP (Doug Asherman) reports a prob- >lem when he moves a value from the DL register into a byte in memory[...] > [lots of good explanation deleted] > >Alternatives to CBW (in case "__key__" could be in the range 128-255 and >needed to be treated as unsigned) would be to do XOR AH,AH either before >or after loading AL -- or else to do XOR AX,AX before loading AL. This >would take one more byte of code, and one more processing cycle, than a >CBW; the difference probably isn't important unless the code in question >is in the middle of a tight loop. There's also MOVZX, an obscure instruction that is available on all 80x86. It will extend a byte to a word, zeroing the high byte. I don't know how the execution time compares to an XOR/MOV pair, but I suspect it is faster. Unfortunately, the complementary instruction (MOVSX, move with sign extend) is only available on the 386. -- --- James W. Birdsall jwbirdsa@amc.com 71261.1731@compuserve.com Compu$erve: 71261,1731 GEnie: J.BIRDSALL2 For it is the doom of men that they forget. -- Merlin