Article View: comp.lang.pascal.borland
Article #243Re: BASM - Type to binary
From: Raimo Suonio
Date: Sat, 24 Jul 1999 00:00
Date: Sat, 24 Jul 1999 00:00
33 lines
1866 bytes
1866 bytes
Robert AH Prins kirjoitti viestiss๏ฟฝ <7naolk$5j$1@nnrp1.deja.com>... >To avoid having to load pointers over and over again, the program uses a >GETMEM'ed array, I use BASM, and this works without a glitch, until... >I had to change the size of the elements from 8 to 16 and didn't realize >that I also needed to change a "shl cx, 3" into "shl cx, 4". I spend >ages trying to find out what was wrong - the equivalent code in Pascal >continued to work, be it rather more slowly. > >Does anyone know, short of what I've done now, adding a constant with >the required shift value, if there is a way to get the base-2 log of >sizes of datastructures in BASM. (Obviously restricted to sizes that are >powers of 2...) I don't understand perfectly your question, I figure that you haven't written the assembler code for yourself. Anyhow, it seems that the instruction is part of the code that calculates the memory address offset out of the array index. It simply multiplied the index by 8 and now by 16. If the element size had not been a power of two, the code would have been a little more complex. -- Raimo Suonio raimo.suonio@qdlc.fi (remove spam preventing q)
Technical Details
Message-ID:
<7nb22t$p4o$1@tron.sci.fi>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailReferences:
<7naolk$5j$1@nnrp1.deja.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII X-Google-Thread: 111659,1574494622d1a1c7 X-Google-Attributes: gid111659,public X-Google-Thread: 108ebd,1574494622d1a1c7 X-Google-Attributes: gid108ebd,public From: "Raimo Suonio" <raimo.suonio@qdlc.fi> Subject: Re: BASM - Type to binary Date: 1999/07/24 Message-ID: <7nb22t$p4o$1@tron.sci.fi> X-Deja-AN: 504594967 Content-Transfer-Encoding: 8bit References: <7naolk$5j$1@nnrp1.deja.com> Content-Type: text/plain; charset="iso-8859-1" X-MimeOLE: Produced By Microsoft MimeOLE V4.72.3110.3 Organization: SAUNALAHDEN SERVERIN asiakas Mime-Version: 1.0 Newsgroups: comp.lang.pascal.borland,borland.public.turbopascal