Escolar Documentos
Profissional Documentos
Cultura Documentos
Comments
● These are statements, or parts of statements, that are ignored by the
assembler.
● Comments are used to write descriptions in English regarding parts of your
program.
● A semicolon (;) is used as the character that denotes a comment, or denotes
a line that is to be ignored by the assembler
● Example: ; This line is a comment.
MOV AX,99 ; Here is another comment
Instructions
● This is a statement that will be translated into machine language.
● Example: ADD AX,BX
MOV SUM, AX
Directives
● This is a statement that gives directions to the assembler.
● Sometimes directives are called pseudo-ops (“pseudo operations”).
● Directives are not translated into machine language; however, they are
necessary for your program to assemble properly.
● Example: SUM DB 1
(Tells assembler to set aside 1 byte of memory and give it to the name SUM)
CSEG SEGMENT
(Tells assembler to start a segment named CSEG)
The Format of Assembly Language Statements
General Guidelines on writing and assembly language program
1. Each line can contain only one statement
2. A statement may begin anywhere on the line
3. Uppercase or lowercase letters may be used. Distinction is only made within
single or double quotes as in “Hello”
Instructions and directives have a more structured format. Each of these type of
statements has up to three parts: a name, an opcode and an operand. These three parts
must always be in this proper order and must be separated by at least one space or tab.
Example:
Name Opcode Operand Comment
Examples:
HELLO $MARKET A12345 LONG_NAME PART_3
For hexadecimal, use digits 0-9 and letters A-F (upper or lower case) making note that
the letter “H” should always be added at the end of the digit.
Example: MOV AX, 855H
For binary, use digits 0 and 1 and make note to add the letter “B” at the end of the digit.
Example: MOV AX,01101001011B
Registers
General Registers (AX,BX,CX,DX)
These registers offer convenient temporary storage for any type of information.
However they all have special purposes.
Using The H and L for the alternate names which stand for “high” and “low”
Directive Purpose
.MODEL Specify the memory model
.STACK Setup the Stack
.DATA Setup a data segment
defines the beginning of the data segment
.CODE Setup a code segment
ends the data segment and starts code segment
.STARTUP Generate start up instructions for the main program
.EXIT Generate exit instructions for the main program
Model Choices:
TINY SMALL MEDIUM COMPACT LARGE HUGE FLAT
Interrupts
Terms:
Interrupt
An interrupt is a signal that an event has occurred which requires immediate attention.
Interrupt Handler
A procedure that does whatever is necessary when an interrupt occurs.
Interrupt Vector
A number that identifies a specific interrupt.
Hardware Interrupt
An interrupt that originates from a hardware service, also called external interrupt.
Software Interrupt
An interrupt that originates from a program that is executing, also called internal
interrupt.
Vector Purpose
05H Copies contents of the screen to printer or print the screen
18H Stops DOS and executes the simple version of BASIC that is stored in
ROM, usually this is called switching to cassette basic
19H Reboots the computer
20H Terminate assembly program and give control back to DOS
This interrupt vector has the same purpose are the opcode RET
which means to Return either to jump to an address/function specified or
simply return to DOS
21H General interrupt, used to request DOS function calls