X-Authentication-Warning: delorie.com: mail set sender to djgpp-bounces using -f From: porky_pig_jr AT my-deja DOT com (Porky Pig Jr) Newsgroups: comp.os.msdos.djgpp Subject: question on AT&T assembly question (creating template for local variables offsets) Date: 19 Jan 2004 13:41:37 -0800 Organization: http://groups.google.com Lines: 46 Message-ID: <56cfb0e3.0401191341.7989a029@posting.google.com> NNTP-Posting-Host: 128.197.14.106 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Trace: posting.google.com 1074548498 2990 127.0.0.1 (19 Jan 2004 21:41:38 GMT) X-Complaints-To: groups-abuse AT google DOT com NNTP-Posting-Date: Mon, 19 Jan 2004 21:41:38 +0000 (UTC) To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com Hello, trying to learn AT&T assembly language syntax, and intel ia-32 environment. have a decent IBM/370 Assembly language background. Went through several examples of code. There is one thing I'm missing: create templates for dynamic (or local) variables. In IBM/370 there is a thing called 'dummy section' or dsect. This section does not take any space, its only purpose is to allow you to define the labels of dynamic variables. You declare them just as if they were real static variables. Once you establish you base register for some storage, you can use the labels from dummy section as the offsets of base register. What I saw in examples for AT&T (or GAS) is just the whole bunch of equates, something like this: .equ VAR1 0 /* VAR1 is .long */ .equ VAR2 4 /* VAR2 is .int */ .equ VAR3 6 ... and then you can refer to them as VAR1(%bsp), VAR1(%bsp), etc. That is, we have to keep track of the sizes of the variables. In IBM/370 dsect it's a bit more convenient and the coding is roughly like this (using the pseudo-GAS syntax): DUMMY: .dsect VAR1: .long VAR2: .long VAR3: .int .equ varsize . - DUMMY (follows by another dummy section, or 'control section' which is a mix of .data and .text in IBM/370 lingo). So we don't have to compute anything. We just pretend those are static variables. Assembler does it for us. Much better than '.equ'. Went through GAS manual, but it was not obvious how can I create an equivalent code. Would appreciate some hints/suggestions/examples/... TIA.