Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Assembly language
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
===Support for structured programming=== <!-- With rare exceptions, macros are not part of the assembler but reside in the source code or in macro libraries. --> Packages of macros have been written providing [[structured programming]] elements to encode execution flow. The earliest example of this approach was in the [[Concept-14 macro set]],<ref name="Kessler_1970"/> originally proposed by [[Harlan Mills]] (March 1970), and implemented by Marvin Kessler at IBM's Federal Systems Division, which provided IF/ELSE/ENDIF and similar control flow blocks for OS/360 assembler programs. This was a way to reduce or eliminate the use of [[GOTO]] operations in assembly code, one of the main factors causing [[spaghetti code]] in assembly language. This approach was widely accepted in the early 1980s (the latter days of large-scale assembly language use). IBM's High Level Assembler Toolkit<ref>{{cite web | title = High Level Assembler Toolkit Feature Increases Programmer Productivity | id = A95-1432 | date = December 12, 1995 | url = https://www.ibm.com/common/ssi/ShowDoc.wss?docURL=/common/ssi/rep_ca/2/649/ENUSA95-1432/index.html&request_locale=en | work = Announcement Letters | publisher = [[IBM]] | archive-url = https://web.archive.org/web/20230307045942/https://www.ibm.com/common/ssi/ShowDoc.wss?docURL=/common/ssi/rep_ca/2/649/ENUSA95-1432/index.html&request_locale=en | archive-date = March 7, 2023 | url-status = dead }} </ref> includes such a macro package. Another design was [[A-Natural]],<ref>{{Cite book |last=Whitesmiths Ltd |url=http://archive.org/details/a-natural-manual |title=A-Natural Language Reference Manual |date=1980-07-15}}</ref> a "stream-oriented" assembler for 8080/[[Zilog Z80|Z80]] processors from [[Whitesmiths|Whitesmiths Ltd.]] (developers of the [[Unix]]-like [[Idris (operating system)|Idris]] operating system, and what was reported to be the first commercial [[C (programming language)|C]] [[compiler]]). The language was classified as an assembler because it worked with raw machine elements such as [[opcode]]s, [[processor register|registers]], and memory references; but it incorporated an expression syntax to indicate execution order. Parentheses and other special symbols, along with block-oriented structured programming constructs, controlled the sequence of the generated instructions. A-natural was built as the object language of a C compiler, rather than for hand-coding, but its logical syntax won some fans. There has been little apparent demand for more sophisticated assemblers since the decline of large-scale assembly language development.<ref name="assembly-language?cat=technology"/> In spite of that, they are still being developed and applied in cases where resource constraints or peculiarities in the target system's architecture prevent the effective use of higher-level languages.<ref name="Provinciano_2005"/> Assemblers with a strong macro engine allow structured programming via macros, such as the switch macro provided with the Masm32 package (this code is a complete program): <syntaxhighlight lang="nasm"> include \masm32\include\masm32rt.inc ; use the Masm32 library .code demomain: REPEAT 20 switch rv(nrandom, 9) ; generate a number between 0 and 8 mov ecx, 7 case 0 print "case 0" case ecx ; in contrast to most other programming languages, print "case 7" ; the Masm32 switch allows "variable cases" case 1 .. 3 .if eax==1 print "case 1" .elseif eax==2 print "case 2" .else print "cases 1 to 3: other" .endif case 4, 6, 8 print "cases 4, 6 or 8" default mov ebx, 19 ; print 20 stars .Repeat print "*" dec ebx .Until Sign? ; loop until the sign flag is set endsw print chr$(13, 10) ENDM exit end demomain </syntaxhighlight>
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)