Académique Documents
Professionnel Documents
Culture Documents
programs Advantages It is Free It is universally available It is simple to use It requires relatively little memory DEBUG COMMANDS
E (Enter)
-enable you to key in data or machine instruction into memory beginning at a specific location address. E.g -E 0200
D (Display or Dump)
Displays the contents of a portion memory ni hex and ASCII forms starting with the given address E.g. -D 0200
A (Assemble)
Allows you to create a program in mnemonic or symbolic code. E.g. -A 0100
T (Trace)
Runs he program in single-step mode. It also displays the new values of the registers and the next instruction to be executed. E.g -T
G (Go)
Runs the program as a whole in memory an displays the output E.g. -G
U (Unassemble)
Lists all the instructions contained in the program beginning at the given address. You can also specify the last address location. E.g. -U 0100 -U 0100 0109
N (Name)
Gives a name to your program, coded as N <path> <filename> Extention nae is .COM E.g. -N A:SAMPLE.COM
W (Write)
Saves the program onto disk storage E.g. -W BASIC ASSEMBLY INSTRUCTIONS USED IN DEBUG
Copies and transfers data between two registers, or between an immediate data to a register Format: MOV <register>, <register> MOV <register>, <immediate data> Example: MOV AX, BX MOV CX, 5083 MOV CL, DL MOV BL, 33
Reserved Words
Words in which the assembler assigns a special meaning and it cannot be used as identifiers Using reserved words for a wrong purpose causes the assembler to generate an error message Categories of reserved words Instructions Statements that will be translated into machine language and executed by the computer. Examples: MOV ADD SUB MUL DIV INC DEC LOOP CMP
Directives Statements that give information to the assembler Sometimes called pseudo-ops Examples: TITLE DOSSEG .MODEL .STACK .DATA .CODE Rules in Constructing Valid identifier It must use letters (A...Z, az), number (09) and/or special characters like underscore (_), question mark (?) and at sign (@). It must always start with a letter It must not use reserved words It must not exceed to 31 character. Examples of valid identifiers: neym r2d2 num_1 msg8 Examples of invalid identifiers: title num-1 4ever
Statement May begin anywhere on the line Each line can only contain one statement Assembly is not case sensitive Examples: ADD AX, BX ; uses 2 operands DEC CX ; uses RET ; no operand
.CODE Example: .CODE START: Defines the start of program execution Format: START: Examples: START: END It is placed at the last line of the source code Format: END Example: END START STRING Used for descriptive data such as persons name or simply a message. It must end with dollar ($) symbol and defined in double quotation marks ( ). DB is the conventional format for defining string of any length. Example: neym db Louis Vuitton$ Numeric Constant Used to define arithmetic values and memory address. It is defined with a radix specifier such as d for decimal, b for binary and h for hexadecimal. Example: msg db Bon jour, monsieur!, 0Ah, 0Dh, $ msg db Bon jour, monsieur!, 10d, 13d, $ msg db Bon jour, monsieur!, 00001010b, 00001101b, $
Screen Processing
The monitor A typical video screen has 80 columns numbered form 0 to 79 and 25 rows numbered from 0 to 24. Clearing the screen in Assembly Approach Interrupt 10h and function 06h handles the process of clearing the screen and scrolling Clear all or part of display beginning at any screen location and ending at any higher-numbered location. Sample code shows how to clear screen code in assembly MOV AX, 0600h ; AH = 00h (scroll), AL, 00h (Full screen) MOV BH, 07h ; 0 (BLACK BACKGROUND), 7 (WHITE TEXT COLOR)
MOV CX, 0000h ; CH = 00H (ROW), CL, 00H (COLUMN) MOV DX, 184Fh ; DH = 18H (ROW), DL=4FH (COLUMN) INT 10h ; CALL INTERRUPT SERVICE SETTING THE CURSOR FUNCTION
Interrupt 10h is the BIOS operation for screen handling and function 02h tells the operation to set the cursor Its position determines where the next character is to be displayed. MOV AH, 02H ; REQUEST TO SET THE CURSOR POSITION MOV BH, 00H ; PAGE NUMBER 0 MOV DH, 0AH ; ROW - 10 IN DECIMAL MOV DL, 08H ; COLUMN = 8 IN DECIMAL INT 10H