Slide 2.a: Machine languages
Slide 2.c: An assembly program
Home

Assembly Languages


Machine languages are almost impossible for humans to read and write. Assembly languages have the same structure and set of commands as machine languages, but they enable a programmers to use names instead of numbers. Assembly programs are organized around segments: An instruction is a statement that is executed by the processor at runtime after the program has been loaded into memory and started. An instruction contains four basic parts:
     [label:]   mnemonic   operand(s)   [; comment]
Label (optional)
A label is an identifier that acts as a place marker for either instructions or data. For example,
     L1:    mov   eax, 5000h
Instruction Mnemonic (required)
An instruction mnemonic is a short word that identifies the operation carried out by an instruction. For example,
     mov    edx, OFFSET prompt3
Operand(s) (usually required)
An assembly language instruction can have between zero and three operands, each of which can be a register, memory operand, constant expression, or I/O port.


Comment (optional)
Comments are for the programmers to communicate information about how the program works to a person reading the source code. For example,
     call   WriteString              ; print prompt1