Article View: comp.lang.pascal.borland
Article #244Re: BASM - Type to binary
From: Pedt Scragg
Date: Sat, 24 Jul 1999 00:00
Date: Sat, 24 Jul 1999 00:00
32 lines
2131 bytes
2131 bytes
Robert AH Prins <mailto:prinsra@williscorroon.com> said: >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 can only think of two easy ways to do it as you cannot use SizeOf in BASM : 1. In your startup program code get the SizeOf the data element into a global variable and, if being used for shifts, convert to the relevant power of two. You can just load this into CL for your shifts - as SHL <register>, CL 2. Declare two dummy global variables the same size as one data element immediately after each other and use BASM to get load the memory offset of each into variables then use SUB to get the memory size. You'll still need to SHL <register>, CL HTH -- Pedt Veni; Vidi; Visa ... I came, I saw, I did a little shopping
Technical Details
Message-ID:
<12nBGCAEnUm3YwId@pedt.demon.co.uk>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-7-bit X-Google-Thread: 111659,1574494622d1a1c7 X-Google-Attributes: gid111659,public X-Google-Thread: 108ebd,1574494622d1a1c7 X-Google-Attributes: gid108ebd,public From: Pedt Scragg <newsmaster@pedt.demon.co.uk> Subject: Re: BASM - Type to binary Date: 1999/07/24 Message-ID: <12nBGCAEnUm3YwId@pedt.demon.co.uk> X-Deja-AN: 504653385 X-NNTP-Posting-Host: pedt.demon.co.uk:194.222.191.220 References: <7naolk$5j$1@nnrp1.deja.com> X-Complaints-To: abuse@demon.net X-Trace: news.demon.co.uk 932793131 nnrp-13:27272 NO-IDENT pedt.demon.co.uk:194.222.191.220 Organization: Signpost Design MIME-Version: 1.0 Reply-To: Pedt Scragg <signpost@pedt.demon.co.uk> Newsgroups: comp.lang.pascal.borland,borland.public.turbopascal