Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!seismo!rutgers!mit-eddie!genrad!decvax!decwrl!labrea!navajo!billw From: billw@navajo.STANFORD.EDU (William E. Westfield) Newsgroups: comp.lang.misc Subject: Re: assembly programming prefereable to HLL programming ? Message-ID: <1192@navajo.STANFORD.EDU> Date: Tue, 9-Dec-86 18:13:32 EST Article-I.D.: navajo.1192 Posted: Tue Dec 9 18:13:32 1986 Date-Received: Wed, 10-Dec-86 04:45:04 EST References: <646@instable.UUCP> <476@atari.UUcp> <8@blipyramid.BLI.COM> <7633@topaz.RUTGERS.EDU> Organization: Stanford University Lines: 27 Summary: anyone know how to implement ELSEIF ? Well, as long as it's under discussion anyway, does anyone have any hints as to how to implement ELSEIF as an assembler macro (specifically for the 8086 MASM v4)? It turns out that IF, ELSE, and ENDIF are pretty simple: IF increments n, and generates a conditional jmp to BEGn. ELSE defines BEGn, adds 1 to n (make in m), and generates a jmp to BEGm. ENDIF just defines BEGn or BEGm. Another counter (x) is used to keep track of N for each level of nesting. the problem is that ELSEIF need to skip over an arbitrary number of N's, which is unknown at the time the JMP is generated. Anybody have any ideas ? ELSEIF should generate an unconditional JMP to the ENDIF, define BEGn, create a new conditional jmp to the next elsif, else, or endif. eg, for an 8086: ELSEIF(Condition,instruction) yields: JMP ENDIF instruction BEGn: JNcondition BEGm Id settle for code where the JMP ENDIF was actually a jmp to the next unconditonil jmp that would eventually end up at ENDIF (hmm, I have an idea Ill have to look at). Anybody else have suggestions ? BillW