Вы находитесь на странице: 1из 8

1

, . ,
- ,
. . ,
, , .
, -
. ,
8086 Intel, ""
IBM PC .
,
, , ++, . .

,
.
.
,
. ,
.
,
; . ,
, PC (.
). ,
" IBM
DOS", " BIOS" "
XT";

IBM.
,
, ( ) . ( ,
).



, "!". , .
( , ASCII)
HELLO.ASM:

.MODEL
.STACK
.DATA
Message DB
.CODE
mov
mov

SMALL
100h
'!',13,10,'$'
ax,@Data
ds,ax

mov
mov
int
mov

ah,9
dx,OFFSET Message
21h
ah,4ch

int
END

21h

;
;
;
;
;
;
;
;
;

DS
,

DOS
"!"
"!"
DOS

, ,
.

, ++ , , .
, ,
, , ++ . , , , . ,
,
, , .
.


, HELLO.ASM, . , , , .
. 1.1, (, , ),
- .
( )
,
, .
.
HELLO.ASM :
TASM hello

--------------------------------

-----------------------------------------------

HELLO.ASM

L---------------------T------------------------

----------------------------------------------

HELLO.OBJ

L---------------------T-----------------------

----------------------------------------------

HELLO.EXE

L---------------------T-----------------------

-----------------------

L---+ ----L----------------------. 1.1 , ,


.

Enter. ,
HELLO.ASM HELLO.OBJ. (,
. , .ASM.) :
Turbo Assembler Version 3.0 Copyright (C) 1988,1991
(1)
by Borland International Inc.
Assembling file: HELLO.ASM
(2)
Error messages: None
(3)
Warning messages: None
(4)
Passes: 1
(5)
Remaining memory: 266K
(6)
1 - , 3.0;
Borland, 1991 .; 2 - HELLO.ASM; 3 -
: ; 4 - : ; 5 -
: 1; 6 - : 266
HELLO.ASM , ,

. ,
, , . () , ,
,
.


HELLO.ASM
. , ,
.

TLINK,
. :
TLINK HELLO
.
TLINK ,
.OBJ. (
), .EXE ,
( ).
:
Turbo Linker Version 3.0 Copyright (c) 1988, 1991 by Borland
International Inc.
(
). ( ),

, , .


.
DOS hello. :
!
.
!.

?
, HELLO.ASM,
,
.
HELLO.ASM,
HELLO.OBJ. ( ). HELLO.OBJ , , HELLO.ASM, ,

.
HELLO.OBJ TLINK HELLO.EXE, , hello
DOS.
:
dir hello.*
HELLO .
HELLO.ASM, HELLO.OBJ, HELLO.EXE HELLO.MAP.


, -
( " " ,
). :
.MODEL SMALL
.STACK 100h
.DATA
TimePrompt DB ' ? (/) - [Y/N]$'
GoodMorningMessage LABEL BYTE
DB 13,10,' !',13,10,'$'
GoodAfternoonMessage LABEL BYTE
DB 13,10,'!',13.10,'$'
.CODE

mov
mov

ax,@Data
ds,ax

; DS
; ,
;
mov
dx,OFFSET TimePrompt ; -
mov
ah,9
; DOS
int
21h
;
;
cmp
al,'Y'
;
; ( Y)
jz
IsAfternoon
; ,
;
cmp
al,'y'
;
; ( y)
jnz
IsMorning
; ,
;
IsAfternoon:
mov
dx,OFFSET GoodAfternoonMessage ;
; ""
jmp
DisplayGreeting
IsMorning:
mov
dx,OFFSET GoodMorningMessage ;
; " "
DisplayGreeting:
mov
ah,9
; DOS
int
21h
;
;
mov
ah,4ch
; DOS
;
int
21h
;
END

: .
, , ( ) .
Y (
), "!", " !". :
, .
.
, . , hello DOS. :
? (/) - [Y/N]

. Y. :

!
HELLO.ASM
.

, , -
. ,
. :
. -
, , . , ,
. - , ,
.
, , , , . E
.

,
.
,
, , ,
, . .
( ), . ASCII (
),
PRINT,
DOS.


() - .
,
.
:
.MODEL SMALL
.STACK 100h
.DATA
Message DB '!',13,10,'$'
Message_Length EQO $ - Message
.CODE
mov
ax,@Data
mov
ds,ax
;
;
mov
ah,40h
;
;
mov
bx,4
;
mov
cx,Message_Length
;
mov
dx,OFFSET Message
;
int
21h
;
mov
ah,4ch
;
;
int
21h
;
END

DS
,
DOS



"!"
"!"
DOS

DOS
DOS,
, - .
. ,
"!". ( .
HELLO.ASM,
.)
,
,
, :
mov

bx,4

bx,1

:
mov

, .
, , , (
- " ").
,
, ,
-


, ,
- . REVERSE.ASM:
.MODEL SMALL
.STACK 100h
.DATA
MAXIMUM_STRING_LENGTH
StringToReverse
ReverseString
.CODE
mov
ax,@Data
mov
ds,ax

EQU
DB
DB

1000
MAXIMUM_STRING_LENGTH
MAXIMUM_STRING_LENGTH

DUP (?)
DUP (?)

; DS
; ,
mov
ah,3fh
; DOS
mov
bx,0
;
mov
cx,MAXIMUM_STRING_LENGTH ; ;
mov
dx,OFFSET StringToReverse ;
int
21h
;
and
ax,ax
; ?
jz
Done
; ,
mov
cx,ax
;
; ,
; ,
push
cx
;
;
mov
bx,OFFSET StringToReverse
mov
si,OFFSET ReverseString
add
si,cx
dec
si
;
;
ReverseLoop:
mov
al,[bx]
;
mov
[si],al
;
;
inc
bx
;
;
dec
si
;
; buffer
loop
ReverseLoop
;
; ,
pop
cx
;
mov
ax,40h
; DOS
mov
bx,1
;
;
mov
dx,OFFSET ReverceString ;
Done:
mov
ah,4ch
; DOS
;
int
21h
;
END
, . ( REVERSE.ASM).

REVERSE.ASM
REVERSE.ASM
:

TASM reverse
:
TLINK reverse
. , DOS reverse. , ,
,
.
. , , - . :
ABCDEFG
ENTER. :
GFEDCBA
.
, REVERSE.ASM:
.
- , .
.
! ,
, ,
: , .
, ,
, ,

()
(NULL). , :
TASM FILE1,,NUL,
FILE1.ASM FILE1.OBJ, , FILE1.XRF.


Borland , - , . ,
,
:
Ackerman, Charles. Turbo Debugger and Tools: A Self-Teaching
Guide, John Wiley and Sons (New York: 1990).
Swan, Tom. Mastering Turbo Assembler.
Books, 1989.
Swan, Tom. Mastering Turbo Debugger and
Sams and Co. (Carnel, IN: 1990).

Indianapolis: Hayden
Tools.

Howard

Syck, Gary. The


Waite Group's Turbo
Assembler
Howard W. Sams and Co. (Carmel, IN: 1990).

W.

Bible,