Assembly Language Programming
Assembly Language Programming
Assembly Language Programming
Programming
Assembly Programming
• Assembly Language instruction consist of four fields
• Labels
• See rules
• mnemonic, operands
• MOV AX, 6764
• comment
• ; this is a sample program
Model Definition
MODEL directive –selects the size of the memory model
• MODEL MEDIUM
• Data must fit into 64KB
• Code can exceed 64KB
• MODEL COMPACT
• Data can exceed 64KB
• Code cannot exceed 64KB
• MODEL LARGE
• Data can exceed 64KB (but no single set of data should exceed 64KB)
• Code can exceed 64KB
• MODEL HUGE
• Data can exceed 64KB (data items i.e. arrays can exceed 64KB)
• Code can exceed 64KB
• MODEL TINY
• Data must fit into 64KB
• Code must fit into 64KB
• Used with COM files
Segments
Segment definition:
The 80x86 CPU has four segment registers: CS, DS, SS, ES
Segments of a program:
.STACK ; marks the beginning of the stack segment
example:
.STACK 64;reserves 64B of memory for the stack
PAGE [lines],[columns]
• To tell the printer how the list should be printed
• Default mode is 66 lines per page with 80 characters per line
• The range for number of lines is 10 to 255 and for columns
is 60 to 132
TITLE
• Print the title of the program
• The text after the TITLE pseudo-instruction cannot be more
than 60 ASCII characters
Control Transfer Instructions
example1:
number 510(1012) will be 0000 01010
example2:
number 51410(10 0000 00102) will be 0000 0010 0000 0010
Data Types and Data Definition
• Assembler data directives