Assembly
Home * Programming * Languages * Assembly
Assembly is a family of low-level languages for programming computers. They implement a symbolic representation of the machine instructions and data needed to program a particular CPU architecture with its particular instruction- and register set. An assembler is used to translate the assembly source code into executable machine instructions in object code. Almost each architecture and its extensions have their own proprietary assembly language with different syntax and mnemonics for operations, data declarations etc..
Contents
Assembler
CDC 6600/Cyber
Mobility in Chess 4.6 based on 47 CXi Xk Population Count, written in COMPASS, the CDC Macro Assembler for the CDC 6600 and CDC Cyber [1]. The square list aka bitboard was loaded into two 60-bit registers, with both populations added and stored.
** COUNTS - COUNT MEMBERS OF A SQUARE LIST COUNTS MACRO Y .STST LOADS Y .CHK2 CX'.S1' X'.S1' CX'.S2' X'.S2' IX'.SS' X'.S2'+X'.S1' .STND COUNTS ENDM ... SETQ MOBIL,(PLUS,(COUNTS,(INDEXS,ATKFR,(LSHIFT,SQLN,1))),MOB
Cray
Cray Assembly Language (CAL) [2], some snippet from Cray Blitz Bitboard code for the Cray-1 or Cray X-MP [3]:
l1020 = * s3 msave3-1,a2 s4 msave4-1,a2 a4 pcount-1,a1 a6 pcount-1,a5 pfirst-1,a1 s1 plast-1,a1 s2 pfirst-1,a5 s3 plast-1,a5 s4 a4 a4-1 a6 a6+1 pcount-1,a1 a4 pcount-1,a5 a6
Intel/AMD
Architectures
CPU | Assemblers |
---|---|
8080 / Z80 | ASM80 |
8086 | MASM, TASM, NASM, GNU Assembler |
x86 | FASM, MASM, NASM, TASM, GNU Assembler |
x86-64 | MASM64, NASM, GNU Assembler |
Syntax
Intel-Syntax: operation target, source
add rax, rdx ; rax += rdx
AT & T Syntax operation<type> source, target
addq %rdx, %rax /* rax += rdx */
PDP-6
HAKMEM 169, to count the ones in a PDP-6/PDP-10 36-bit word, written in MIDAS [4]:
LDB B,[014300,,A] ;or MOVE B,A then LSH B,-1 AND B,[333333,,333333] SUB A,B LSH B,-1 AND B,[333333,,333333] SUBB A,B ;each octal digit is replaced by number of 1's in it LSH B,-3 ADD A,B AND A,[070707,,070707] IDIVI A,77 ;casting out 63.'s
Inline Assembly
Inline assembly is embedded inside various C, C++, D, Pascal and Delphi compiler [5].
See also
Publications
- Lance A. Leventhal (1979). 6502 Assembly Language Programming. Osborne/McGraw-Hill, pdf
- Rodnay Zaks (1979). Programming the Z80. Sybex [6]
- Kathe Spracklen (1979). Z-80 and 8080 assembly language programming. Hayden Books, amazon.com, Internet Archive » 8080, Z80
- Jan Kuipers (1981). Tiny Chess 86 - Een schaakprogramma voor de 8088/8086. Databus 06-81, pdf hosted by Hein Veldhuis » 8086, Tiny Chess 86
- Zaks, Rodnay (1983). Programming the 6502 (Fourth Edition). Sybex
- Ward Douglas Maurer (1984). APPLE assembly language with Lazerware software. Computer Science Press » Apple II
- Ward Douglas Maurer (1985). Commodore 64 assembly language: A course of study based on the DEVELOP-64 assembler/editor/debugger. Computer Science Press » Commodore 64
- Ward Douglas Maurer (1990). Assembly language programming on the Mac with MPW. School of Engineering and Applied Science, George Washington University, GWU-IIST-90-20. » Macintosh [7]
- Michael Abrash (1990). Zen of Assembly Language: Knowledge. Scott Foresman Trade, ISBN-13: 978-0673386021 [8] [9]
- Randall Hyde (2003, 2010). The Art of Assembly Language Programming. No Starch Press, 2nd edition, ISBN-13: 978-1-59327-207-4
Listings
- Chess 4.6 CDC Cyber source code, gift of David Slate, from The Computer History Museum, pdf
- Sargon Z80 assembly listing by Dan and Kathe Spracklen, hosted by Andre Adrian
- Rookie 1.0 68000 assembly source, search.s from Index of /rookie/nostalgia/v1
Manuals
6502
- 6502 Programming Manual, August 1976 (pdf)
68000
- MOTOROLA M68000 FAMILY - Programmer’s Reference Manual (pdf)
- 68000 Assembler - User's Manual (pdf) by Paul McKee
Alpha
ARM
Fairchild F8
- Fairchild F8 Guide To Programming 1977, hosted by the Internet Archive » Fairchild F8
HP Saturn
- Gilbert Fernandes, Eric Rechlin (2005). Introduction to Saturn Assembly Language. Third edition, Part of the HP Calculator Archive » HP Saturn, HP 48 series
PowerPC
SPARC
x86-64
Z80
- Neil J. Colvin (1977). TDL Z80 Relocating/Linking Assembler User's Manual. pdf
Forum Posts
- Assembler handtuning benefit by Jouni Uski, CCC, November 11, 1997
- Assembly language for PC (Off topic) by Josué Forte, Winboard Forum, February 21, 2003
- C vs ASM by Ed Schröder, CCC, March 05, 2013 » C
- [for fun] rewrite of stockfish into asm and question on source by Mohammed Li, FishCooking, January 09, 2015 » asmFish
- Some x64 assembler for the curious by Michael Sherwin, CCC, March 22, 2019 » x86-64
External Links
- Assembly language from Wikipedia
- Comparison of assemblers from Wikipedia
- High-level assembler from Wikipedia
- High Level Assembly
- The Art of Assembly Language Programming and HLA by Randall Hyde
- The Assembly Gems page by John Eckerdal
DEC
IBM
Intel
- Assembly Language Lab by Paul Hsieh
- Assembly language page by Olivier Poudade
- x86 assembly language from Wikipedia
- X86 Assembly/X86 Architecture from Wikibooks
- x86 Assembly Guide
- Introduction to x64 Assembly by Chris Lomont, March 2012
- alt.lang.asm, Google Group
- comp.lang.asm.x86, Google Group
- x86 32-bit Assembly for Atheists
- the dasm macro assembler
- asmx multi-CPU assembler
References
- ↑ Chess 4.6 source code, gift of David Slate, from The Computer History Museum, pdf
- ↑ Cray Assembly Language Reference - iPaper
- ↑ Robert Hyatt's Cray Blitz crayblitz.tar.gz Source Code see folder CAL, unmake.s
- ↑ HAKMEM 169 by Gosper, Mann, Lenard, [Root and Mann], HAKMEM
- ↑ Inline assembly for x86 in Linux by IBM
- ↑ pdf download link by Rodnay Zaks
- ↑ Macintosh Programmer's Workshop from Wikipedia
- ↑ Coding Horror: There Ain't No Such Thing as the Fastest Code by Jeff Atwood, February 19, 2008
- ↑ Re: Developments of the last two years by Don Dailey, CCC, March 03, 2013
- ↑ MIT PDP-10 'Info' file converted to Hypertext 'html' format by Henry Baker