Vous êtes sur la page 1sur 23

Introduction to MASM

Assembly language unlocks the secrets of computer hardware and software. Assembler will
converts source code to machine own language. Microsoft Macro Assembler (MASM), a product
of Microsoft Corporation includes several features which makes programming efficient and
productive. This lab sheet gives an overview of how to use MASM for assembling the 8086
programs.
MASM is a command line assembler. User has to first create a file and write assembly program using
DOS editor before using the assembler. It does not have provisions to create, edit, save and debug
programs. All the commands accepted by the assembler are entered at the DOS prompt.

Execution of 8086 Software programs

Run command prompt and go to Masm directory

i.e. C:\masm\

Type the program by opening an editor using Edit command

i.e. C:\masm\edit filename.asm

After typing the program assemble the program using masm command.

i.e. C:\masm\masm filename.asm;

After assembling, link the file using link command

i.e. C:\masm\link filename.obj;

Finally use debug or afdebug command to execute the program.

C:\masm\debug filename .exe

-t ; for single step execution

-g ; for at a time execution

-I ; for restarting the program execution

-d ; to see the data segment

-q ; to quit the execution

C:\masm\afdebug filename .exe

F1 ; for single step execution

g ; for at a time execution

L filename .exe ; to reload the program

Quit ; to come out of the execute screen


Creating a program file:

Create a file with .asm extension by typing the following command at the DOS command prompt.

C:\masm611\bin>EDIT sourcefilename.asm

The following blue screen will appear

Write 8086 program code in this editor and save.

Loading and Linking:

Run the assembler to create the .com or .exe file by typing the following command at the command
prompt:

C:\masm611\bin>MASM sourcefilename.asm.

MASM Debugger: CodeView


Code View (CV) is the debugger that comes along with MASM. To launch code view type cv
somefile.com at the DOS prompts. The startup screen consists of windows, each of which has its own
name and purpose. The main screen of the CodeView debugger is divided into windows. A good place to
start for debugging assembly language programs is with the following windows since they are the ones
most commonly used:

* The source text window

* The registers' window

* The command window

The Source window contains the text of your program in assembly language and the line numbers. When
CodeView executes one command in your executable module (.COM), it highlights the corresponding
line in your source code in the Source window. To execute one command, press the F8 or F10 key.

The Register window reflects the current state of the registers and flags. The registers are represented by
name (AX, BX and so on) and their hexadecimal values. Flag values however have symbolic denotation
(NZ, OV and so on). The Register window is situated on the right side of the screen. This window appears
when you press the F2 key and disappears if you press it again.

The Command window is intended for controlling the debugging process. The cursor is usually located in
this window, indicating that you can type in commands.

Command q is to quit the code view. This command finishes the debugging process, and returns control to
MS-DOS. The next most useful command is the h command, which means Help. Use this command to
get online information about CodeView commands, parameters and features. These two commands are
practically all you need to start working with CodeView.

SYNTAX OF 8086/8088 ASSEMBLY LANGUAGE

The language is not case sensitive.


There may be only one statement per line. A statement may start in any column.
A statement is either an instruction, which the assembler translates into machine code, or an
assembler directive (pseudo-op), which instructs the assembler to perform some specific task.
Syntax of a statement:

{name} mnemonic {operand(s)} {; comment}

(a) The curly brackets indicate those items that are not present or are optional in some statements.
(b) The name field is used for instruction labels, procedure names, segment names, macro names,
names of variables, and names of constants.
(c) MASM 6.1 accepts identifier names up to 247 characters long. All characters are significant,
whereas under MASM 5.1, names are significant to 31 characters only. Names may consist of
letters, digits, and the following 6 special characters: ? . @ _ $ % .If a period is used; it must
be the first character. Names may not begin with a digit.
(d) Instruction mnemonics, directive mnemonics, register names, operator names and other words
are reserved.
Syntax of an instruction:
{label:} mnemonic {operand { , operand} } {; comment}

The curly brackets indicate those items that are not present or are optional in some instructions. Thus
an instruction may have zero, one, or two operands.

Operators:
The 8086/8088 Assembly language has a number of operators. An operator acts on an operand or
operands to produce a value at assembly time. Examples are: + , - , *, / , DUP, and OFFSET

Comments:
A semicolon starts a comment. A comment may follow a statement or it may be on a separate line.
Multiple-line comments can be written by using the COMMENT directive. The syntax is:
COMMENT delimiter {comment}
comment

...

delimiter { comment }

where delimiter is any non-blank character not appearing in comment. The curly brackets indicate an
item that is optional.

e.g.,

COMMENT *

This program finds

the maximum element in a byte array

Numbers:
(a) A binary number is suffixed by b or B.

e.g., 11010111B

(b) A decimal number is suffixed by an optional d or D.

e.g., 42d -22D 3578

(c) A hexadecimal number must begin with a decimal digit and it is suffixed by h or H

e.g., 20H 0bF2Ah

Characters:
A character is enclosed in a pair of single quotes or in a pair of double quotes.

e.g., x B

Strings:
A string is enclosed in a pair of single quotes or in a pair of double quotes.

e.g., ENTER YOUR NAME:

THE MAXIMUM VALUE IS

For a string delimited by single quotes, a pair of consecutive single quotes stands for a single quote.

e.g., Omar s books

Data definition
Each variable has a data type and is assigned a memory address by the program. The data-defining
directives are:
Directive Description of Initializers

BYTE, DB (byte) Allocates unsigned numbers from 0 to 255.

SBYTE (signed byte) Allocates signed numbers from 128 to +127.

WORD, DW (word = 2 bytes) Allocates unsigned numbers from


0 to 65,535 (64K).

SWORD (signed word) Allocates signed numbers from


32,768 to +32,767.

DWORD, DD (doubleword = 4 bytes), Allocates unsigned numbers from


0 to 4,294,967,295 (4 megabytes).

SDWORD (signed doubleword) Allocates signed numbers from


2,147,483,648 to +2,147,483,647.

e.g., ALPHA DB 4

VAR1 DB ?

ARRAY1 DB 40H, 35H, 60H, 30H

VAR2 DW 3AB4h

ARRAY2 DW 500, 456, 700, 400, 600

PROMPT DB ENTER YOUR NAME $

POINTER1 DD 6BA7000AH

A ? in place of an initializer indicates you do not require the assembler to initialize the variable. The
assembler allocates the space but does not write in it. Use ? for buffer areas or variables your program
will initialize at run time.Example: Type the following program using EDIT and save it with .asm
extension.

.model tiny

.code

.startup

mov ax,50h

mov bx,20h

mov dx,80h

mov cx,05h
loop1: dec cx

jnz loop1

.exit

end

The DUP operator can be used to generate multiple bytes or words with known as well as un-
initialized values.

e.g., table dw 100 DUP(0)

stars db 50 dup(*)

ARRAY3 DB 30 DUP(?)

ARRAY4 DB 10 DUP(50), 45, 22, 20 DUP(60)

STRINGS DB 20H DUP(Dhahran)

Note: If a variable name is missing in a data definition statement, memory is allocated; but no name
is associated with that memory. For example:

DB 50 DUP(?)

allocates 50 un-initialized bytes; but no name is associated with those 50 bytes.

In MASM 6.1 and above, a comma at the end of a data definition line (except in the comment field)
implies that the line continues. For example, the following code is legal in MASM 6.1:
longstring BYTE "This string ",
"continues over two lines."
bitmasks BYTE 80h, 40h, 20h, 10h,
08h, 04h, 02h, 01h

Named constants:
The EQU (equate) directive, whose syntax is:

name EQU constant_expression

assigns a name to a constant expression. Example:

MAX EQU 32767

MIN EQU MAX - 10

LF EQU 0AH

PROMPT EQU TYPE YOUR NAME: $

Note: (i) No memory is allocated for EQU names


(ii) A name defined by EQU may not be redefined later in a program.

The LABEL directive, whose syntax is:


name LABEL type

where type (for MASM Version 5.1 and lower versions) is BYTE, WORD, DWORD, QWORD,
TBYTE, NEAR, or FAR provides a way to define or redefine the type associated with a variable or a
label.

Example1:

ARRAY1 LABEL WORD

ARRAY2 DB 100 DUP(0)

Here ARRAY1 defines a 50-word array, and ARRAY2 defines a 100-byte array. The same memory
locations are assigned to both arrays. Thus the array can be accessed as either the byte array
ARRAY1 or the word array ARRAY2.

Example2:

VAR3 LABEL DWORD

WORD1 LABEL WORD

BYTE1 DB ?

BYTE2 DB ?

WORD2 LABEL WORD

BYTE3 DB 50H

BYTE4 DB 66H

in this example, each of the words, and each of the bytes of the double word variable VAR3 can be
accessed individually.

SEGMENT DEFINITION
An 8086/8088 assembly language program file must have the extension .asm

There are two types of 8086/8088 assembly language programs: exe-format and com-format.

An exe-format program generates executable files with extension .exe. A com-format program
generates executable files with extension .com .

An exe-format program must contain a code segment and a stack segment. It may contain a data
segment or an extra segment.
Note: In a program, the data, code, and stack segments may appear in any order. However, to avoid
forward references it is better to put the data segment before the code segment.

SIMPLIFIED SEGMENT DIRECTIVES


MASM version 5.0 and above, and TASM provide a simplified set of directives for declaring
segments called simplified segment directives. To use these directives, you must initialize a memory
model, using the .MODEL directive, before declaring any segment. The format of the .MODEL
directive is:
.MODEL memory-model

The memory-model may be TINY, SMALL, MEDIUM, COMPACT, LARGE, HUGE or FLAT :

memory- description
model

TINY One segment. Thus code and data together may not be greater than 64K

SMALL One code-segment. One data-segment. Thus neither code nor data may be greater
than 64K

MEDIUM More than one code-segment. One data-segment. Thus code may be greater than
64K

COMPACT One code-segment. More than one data-segment. Thus data may be greater than
64K

LARGE More than one code-segment. More than one data-segment. No array larger than
64K. Thus both code and data may be greater than 64K

HUGE More than one code-segment. More than one data-segment. Arrays may be larger
than 64K. Thus both code and data may be greater than 64K

FLAT One segment up to 4GB. All data and code (including system resources) are in a
single 32-bit segment.

All of the program models except TINY result in the creation of exe-format programs. The TINY
model creates com-format programs.

The simplified segment directives are: .CODE , .DATA , .STACK .

The .CODE directive may be followed by the name of the code segment.

The .STACK directive may be followed by the size of the stack segment, by default the size is 1K i.e.,
1,024 bytes.
The definition of a segment extends from a simplified segment directive up to another simplified
segment directive or up to the END directive if the defined segment is the last one.

THE GENERAL STRUCTURE OF AN EXE-FORMAT PROGRAM


The memory map of a typical exe-format program, with segments defined in the order code, data, and
stack is:

SP

Stack segment

SS

Data segment

Code segment

CS , IP

PSP (100H bytes)

DS , ES

The CS and IP registers are automatically initialized to point to the beginning of the code segment.

The SS register is initialized to point to the beginning of the stack segment.

The SP register is initialized to point one byte beyond the stack segment.

The DS and ES registers are initialized to point to the beginning of the PSP (Program Segment Prefix)
segment.

This is a 100H (i.e., 256) byte segment that DOS automatically prefaces to a program when that
program is loaded in memory.

The PSP contains important information about the program.

Thus if a program contains a data segment, the DS register must be initialized by the programmer to
point to the beginning of that data segment.

Similarly if a program contains an extra segment, the ES register must be initialized by the
programmer to point to the beginning of that extra segment.

Initialization of DS
Note: The instructions which initialize the DS register for an exe-format program with simplified
segment directives are:

MOV AX , @DATA

MOV DS , AX

where AX may be replaced by any other 16-bit general purpose register.

At load time, @DATA is replaced with the 16-bit base address of the data segment.

Thus @DATA evaluates to a constant value; such an operand is usually called an immediate operand.

Since MOV instructions of the form:

MOV SegmentRegister , ImmediateOperand

are invalid, an initialization of the form:

MOV DS , @DATA

is invalid. Such an initialization is done indirectly using any 16-bit general-purpose register. Example:

MOV AX , @DATA

MOV DS , AX

Note: Every 8086 assembly language program must end with the END directive. This directive may
be followed by an entry label, which informs the assembler the point where program execution is to
begin. The entry label can have any valid name.

Follow the steps given below to debug the program and view the results.

1. Assemble the program using ML filename.asm at the prompt.


2. Open code view debugger using cv filename.com
3. Observe the above said windows in the startup screen of code view. Can you identify them??
4. In the command window type h to view the list of commands supported by cv.
5. Press <F2> to pop up a window of register values
6. For line by line execution of the program press <F8> key and watch the change in the content of
the registers in the register window.
7. Type q in the command window to finish debugging process and return control to MS-DOS.

Instruction Set:
Instructions Operands Description
Copy operand2 to operand1.
REG, memory
MOV memory, REG The MOV instruction cannot:
REG, REG Set the value of the CS and IP registers.
memory, immediate Copy value of one segment register to another segment
REG, immediate register (should copy to general register first).
SREG, memory Copy immediate value to segment register (should copy to
memory, SREG general register first).
REG, SREG
SREG, REG
Algorithm: operand1 = operand2

Ex:
Mov AX,BX ;Copy contents of BX to AX
Mov si,00h ;load Si with 00h
Unsigned multiply.
MUL REG Multiply the contents of REG/Memory with contents of AL register.
Memory Algorithm:

When operand is a byte:


AX = AL * operand.

When operand is a word:


(DX: AX) = AX * operand.
Compare.
REG, memory
CMP memory, REG Algorithm: operand1 - operand2
REG, REG
memory, immediate Result is not stored anywhere, flags are set (OF, SF, ZF, AF, PF, CF)
REG, immediate according to result.

Unconditional Jump.

JMP Label Transfers control to another part of the program. 4-byte address
may be entered in this form: 1234h: 5678h, first value is a segment
second value is an offset.

Algorithm: always jump


Jump If Above.

JA Label Short Jump if first operand is Above second operand (as set by CMP
instruction). Unsigned.

Algorithm: if (CF = 0) and (ZF = 0) then jump

Jump If Above Or Equal

JAE Label Short Jump if first operand is Above or Equal to second operand (as
set by CMP instruction). Unsigned.
Algorithm: if CF = 0 then jump

Jump If Below.
JB Label Short Jump if first operand is Below second operand (as set by CMP
instruction). Unsigned.

Algorithm:

if CF = 1 then jump

Jump If Below Or Equal

JBE Label Short Jump if first operand is Below second operand (as set by CMP
instruction). Unsigned.

Algorithm:

if CF = 1 then jump

Jump If Carry

JC Label Short Jump if Carry flag is set to 1.

Algorithm:

if CF = 1 then jump
Jump If Equal.

JE Label Short Jump if first operand is Equal to second operand (as set by
CMP instruction). Signed/Unsigned.

Algorithm:

if ZF = 1 then jump
Jump If Greater

JG Label Short Jump if first operand is Greater then second operand (as set
by CMP instruction). Signed.

Algorithm:

if (ZF = 0) and (SF = OF) then jump


Jump If Greater Or Equal.

JGE Label Short Jump if first operand is Greater or Equal to second operand
(as set by CMP instruction). Signed.

Algorithm:

if SF = OF then jump
Jump If Less than.

JL Label Short Jump if first operand is Less then second operand (as set by
CMP instruction). Signed.

Algorithm:

if SF <> OF then jump


Jump If Less Or Equal.

JLE Label Short Jump if first operand is Less or Equal to second operand (as
set by CMP instruction). Signed.

Algorithm:

if SF <> OF or ZF = 1 then jump


Jump If Non Zero.

JNZ Label Short Jump if Not Zero (not equal). Set by CMP, SUB, ADD, TEST,
AND, OR, XOR instructions.

Algorithm:

if ZF = 0 then jump
Jump If Zero.

JZ Label Short Jump if Zero (equal). Set by CMP, SUB, ADD, TEST, AND,
OR, XOR instructions.

Algorithm:

if ZF = 1 then jump
Load Effective Address.

LEA REG, memory Algorithm:

REG = address of memory (offset)

Decrease CX, jump to label if CX not zero.

Algorithm:
LOOP Label
CX = CX - 1
if CX <> 0 then

o jump

else

o no jump, continue
Add.
REG, memory
ADD memory, REG Algorithm:
REG, REG
memory, immediate operand1 = operand1 + operand2
REG, immediate

Logical AND between all bits of two operands. Result is stored in


REG, memory operand1.
AND memory, REG
REG, REG These rules apply:
memory, immediate
REG, immediate 1 AND 1 = 1; 1 AND 0 = 0
0 AND 1 = 0; 0 AND 0 = 0

Logical OR between all bits of two operands. Result is stored in first


operand.
OR REG, memory
memory, REG These rules apply:
REG, REG
memory, immediate 1 OR 1 = 1; 1 OR 0 = 1
REG, immediate 0 OR 1 = 1; 0 OR 0 = 0

Subtract.
REG, memory
memory, REG Algorithm:
SUB REG, REG
memory, immediate operand1 = operand1 - operand2
REG, immediate

Decimal adjust After Addition.


Corrects the result of addition of two packed BCD values.

DAA No Operands Algorithm:


if low nibble of AL > 9 or AF = 1 then:
AL = AL + 6
AF = 1

if AL > 9Fh or CF = 1 then:


AL = AL + 60h

CF = 1
Decimal adjust After Subtraction.
Corrects the result of subtraction of two packed BCD values.

DAS No Operands Algorithm:


if low nibble of AL > 9 or AF = 1 then:
AL = AL - 6
AF = 1

if AL > 9Fh or CF = 1 then: AL = AL - 60h ,CF = 1


Increment.

INC REG Algorithm: operand = operand + 1


memory
Decrement.

DEC REG Algorithm: operand = operand 1


Memory
Unsigned divide.

REG Algorithm:
DIV Memory
when operand is a byte:
AL = AX / operand
AH = remainder (modulus)
when operand is a word:
AX = (DX AX) / operand
DX = remainder (modulus)

Shift Left.
memory, immediate
SHL REG, immediate Shift operand1 Left. The number of shifts is set by operand2.

memory, CL Algorithm:
REG, CL
Shift all bits left, the bit that goes off is set to CF.

Zero bit is inserted to the right-most position.


Shift Right.
memory, immediate
SHR REG, immediate Shift operand1 Right. The number of shifts is set by operand2.

memory, CL Algorithm:
REG, CL
Shift all bits right, the bit that goes off is set to CF.

Zero bit is inserted to the left-most position.


Rotate Left.
memory, immediate
REG, immediate Rotate operand1 left. The number of rotates is set by operand2.
ROL
memory, CL Algorithm:
REG, CL
Shift all bits left, the bit that goes off is set to CF and the
same bit is inserted to the right-most position.
Rotate Right.
memory, immediate
REG, immediate Rotate operand1 right. The number of rotates is set by operand2.
ROR
memory, CL Algorithm:
REG, CL
Shift all bits right, the bit that goes off is set to CF and the
same bit is inserted to the left-most position.
memory, immediate Rotate operand1 left through Carry Flag. The number of rotates is
REG, immediate set by operand2.
RCL
memory, CL Algorithm:
REG, CL
Shift all bits left, the bit that goes off is set to CF and
previous value of CF is inserted to the right-most position.

Example:
STC ; set carry (CF=1).
MOV AL, 1Ch ; AL = 00011100b
RCL AL, 1 ; AL = 00111001b, CF=0.
RET
C O

r r

OF=0 if first operand keeps original sign.

procedure name Transfers control to procedure, return address is (IP) pushed to


CALL label stack.

Return from near procedure.

RET No operands Algorithm:


Or even immediate
date Pop from stack:
o IP

if immediate operand is present: SP = SP + operand


Input from port into AL or AX.
AL, im.byte Second operand is a port number. If required to access port number
IN AL, DX over 255 - DX register should be used.
AX, im.byte
AX, DX
AL, im.byte Output from AL or AX to port.
AL, DX First operand is a port number. If required to access port number
OUT AX, DX over 255 - DX register should be used.
Get 16 bit value from the stack.
REG
POP SREG Algorithm: Operand = SS : [SP](top of stack)
memory
SP = Sp + 2.

Store 16 bit value in the stack.

REG Algorithm:
PUSH SREG
memory SP = SP - 2

SS:[SP] (top of the stack) = operand


Logical XOR (Exclusive OR) between all bits of two operands.
REG, memory Result is stored in first operand.
memory, REG
XOR REG, REG These rules apply:
memory, immediate
REG, immediate 1 XOR 1 = 0; 1 XOR 0 = 1
0 XOR 1 = 1; 0 XOR 0 = 0

Exchange values of two operands.


REG, memory
XCHG memory, REG Algorithm: operand1 < - > operand2
REG, REG

Translate byte from table.


Copy value of memory byte at DS:[BX + unsigned AL] to AL
XLAT No Operands register.

Algorithm: AL = DS:[BX + unsigned AL]

ASCII Adjust after Addition.


Corrects result in AH and AL after addition when working with BCD
AAA No Operands values.

Algorithm:

if low nibble of AL > 9 or AF = 1 then:


AL = AL + 6
AH = AH + 1

AF = 1

CF = 1

else
AF = 0
CF = 0

in both cases:
clear the high nibble of AL.

Example:
MOV AX, 15 ; AH = 00, AL = 0Fh
AAA ; AH = 01, AL = 05

ASCII Adjust after Subtraction.


Corrects result in AH and AL after subtraction when working with
BCD values.

Algorithm:

if low nibble of AL > 9 or AF = 1 then:


AL = AL - 6
AH = AH - 1
AAS No Operands
AF = 1

CF = 1

else
AF = 0
CF = 0

in both cases:
clear the high nibble of AL.

Example:
MOV AX, 02FFh ; AH = 02, AL = 0FFh
AAS ; AH = 01, AL = 09

ASCII Adjust after Multiplication.


Corrects the result of multiplication of two BCD values.

Algorithm:

AH = AL / 10
AAM No Operands AL = remainder

Example:
MOV AL, 15 ; AL = 0Fh
AAM ; AH = 01, AL = 05
Interrupt INT 21h:

INT 21h calls DOS functions.

Function 01h - Read character from standard input, result is stored in AL. If there is no character in the keyboard
buffer, the function waits until any key is pressed.

Invoked by: AH = 01h

Returns: AL = character entered.

Example:

Mov AH, 01h

INT 21h

Function 02h - Write a character to standard output.

Invoked by: DL = character to write.

AH =02h

After execution AL = DL.

Example:

Mov AH, 02h

Mov DL, a ; Character to be displayed on screen must be stored in DL reg.

INT 21h

Function 06h Direct console for input/output. If DL = 0FFH on entry, then this function reads the console. If DL
= ASCII character, then this function displays the ASCII character on the console video screen.

Invoked by: Parameters for O/P: DL = 0255

Parameters for I/P: DL = 255.


Returns: for O/P: AL = DL.

For I/P: ZF set if no character available & AL = 0

ZF clear if character available & AL = character.

Example:

Mov AH, 06h

Mov DL, 0ffh

INT 21h

Function 09h - Write a string to standard output at DS: DX.

String must be terminated by '$'. The string can be of any length and may contain control characters such as
carriage return (0DH) and line feed (0AH).

Invoked by: DS = string to write.

AH = 09h

Example:

Mov AH, 09h

Mov DX,offset str ;Address of the string to be displayed

INT 21h

Function 2Ch - Get system time.

Invoked by: AH =2Ch


Return: CH = hour. CL = minute. DH = second. DL = 1/100 seconds.

Example:

Mov AH, 2ch

INT 21h

Function 3Ch - Create or truncate file.

Invoked by: CX = file attributes:


mov cx, 0 ; normal - no attributes.

mov cx, 1 ; read-only.

mov cx, 2 ; hidden.

mov cx, 4 ; system

mov cx, 7 ; hidden, system and read-only!

mov cx, 16 ; archive

mov cx, 0BH ; Volume label

mov cx, 10H ; Subdirectory

DS: DX -> filename. ; AH =3Ch

Returns:

CF clear if successful, AX = file handle.


CF set on error AX = error code.

Example:

Mov AH, 3ch

Mov CX, 01

Mov DX, offset Filename

INT 21h

Function 41h - Delete file (unlink).

Invoked by: DS: DX -> ASCIZ filename (no wildcards, but see notes).

AH=41h
Return:

CF clear if successful, AX destroyed.

CF set on error AX = error code.

Example:

Mov AH, 41h

Mov DX, offset Filename


INT 21h

Function 4Ch Terminate a process.

Invoked by: AH = 4ch

Return: returns control to the operating system.

Example:

Mov AH, 4Ch

INT 21h

Interrupt INT 10h:

INT 10h calls the BIOS functions. This interrupt often called the video services interrupt as it directly
controls the video display in a system.

Function 02h - Set cursor position.

Invoked by: DH = row; DL = column; BH = page number (0...7); AH=02h.

Example:

MOV AH, 02h

MOV BH, 00

MOV DH, 06

MOV DL, 10

INT 10h

Function 03h Get cursor position.

Invoked by: BH = page number. (In general 0)

AH = 03h

Return: DH = row number; DL = column number; CH = cursor start line;


CL = cursor bottom line.

Example:

Mov BH, 0

Mov AH, 03h

INT 10h

Function 06h Scroll up window

Invoked by: AL = number of lines by which to scroll. (00h = clear the entire screen.)

BH = attribute used to write blank lines at bottom of window.


CH, CL = row, column of window's upper left corner.
DH, DL = row, column of window's lower right corner.

Vous aimerez peut-être aussi