Академический Документы
Профессиональный Документы
Культура Документы
com
www.mspsoft.com
www.mspsoft.com
3..........................................................................................................
10...................................................................................
10...........................................................................................
10................................................................................................
19....................................................................................
19...........................................................................................
20.........................................................................................
21...............................................................................
26................................................................
31.............................................................
www.mspsoft.com
www.mspsoft.com
:
(16 8
(16 8
r) 10
10
10
10
r)
10
10) r
:r 2
(16 8
4
.
3 :8 2
4 :16 2
:2 8
:2 16
.
:r 8
:r 16
:
10
000
0000
001
0001
010
0010
011
0011
www.mspsoft.com
www.mspsoft.com
100
0100
101
0101
110
0110
111
0111
1000
1001
10=A
1010
11=B
1011
12=C
1100
13=D
1101
14=E
1110
1111
15=F
10
(65)2=(101111)
(65)7=(47)102=(101111)
( ) (10) (2)
(2f)16=(65)7
www.mspsoft.com
www.mspsoft.com
(2f)=(00101111)2=(47)10=(47)10=(65)7
(2) (10)
()
(65)7=(2f)16
(65)7=(47)10=(00101111)2=(2f)16
(6*72)+(3*71)+(4*70)=319
10 2
2 10
8 2
2 8
16 2
2 16
(8
10
8 10
(10
10 8
(16 2
10
16 10
(10 2
16
10 16
2
(421,75)10=(110100101,11)2
,75*2=1,5
5
www.mspsoft.com
10
www.mspsoft.com
,5*2=1
(4c,db)16=(114,666)8
2
2
2
))((
2
0+0=0
0+1=1
2
1+0=1
1+1=0
1
2
0-0=0
1110001
1-0=1
- 0011110
1-1=1
1010011
0-1=1
www.mspsoft.com
www.mspsoft.com
0011000100
110001110111: 1
110001111000: 2
www.mspsoft.com
www.mspsoft.com
32 16 8
:
:
dx cx bx ax
.
:ax
AL
AH
:Bx
.
Bx
BH BL
.
:Cx
shift
shift
2
CH CL
:Dx
DH DL
16
:((segment))
.
4
:(cs)
(1
.
www.mspsoft.com
www.mspsoft.com
:(DS)
(2
.
:(SS)
(3
:(ES)
(4
.
:
ofset
:
ss
.
ofset
:((BP))Base pointer(1
offset
:((SP))Stack pointer(2
BP
SS SP
:((SI))Sours Index(3
:((PI))Pestiration Index(4
:((Instation pointer)):IP
offset
.
CS IP
:
.
9
www.mspsoft.com
www.mspsoft.com
15
14
13
12
11
O
10
D
9
I
8
T
7
S
6
Z
4
A
2
P
0
C
:((carvy))C
CF
shift
:((Direction))B
shift
shift
DE
:((parity))P
.
shift
:((Auxiliaxu carry))A
.
:((zero)) Z
:((Sign))S
1
1
((Tyap))T
.
1
:((interrupt))I
.
:((over flow))O
.
10
www.mspsoft.com
www.mspsoft.com
:
(4
(3
(2
(1
(5
(1
(2
.
.
(3
:
(! @ ...)
9 0
B A
]
]
>[
11
www.mspsoft.com
<
][
><
www.mspsoft.com
Segment
Proc fo
End p
End s
End
Segment
End s
Proc
for
.
End p
:
CSassume:
assume
DS:
ES:
DB
SS:
:(DB)
db
my name''dbstr
:
:
5,4,3Dbp
12
www.mspsoft.com
www.mspsoft.com
255Db R
)
dw
dw
:(dw)
:
(
:
6500dwh
:
32
: (dd)
dd
db, dw, dd
:Dup
Dup
.
200
P1 dw 200 Dup(0)
:
10000
70
P2 db 70 dup ("x")
:
P3 db 80 dup ("+-")
: z db 12 dup (7 dup ('*') , 8 dup ('+'))
.
12
8
EQU
:
EQU
: z EQU 12
13
www.mspsoft.com
www.mspsoft.com
T dw 120
Z EQU t
:
:mov
2
:
TEXE EQU
,1
Mov
:
TEXT EQU
Place 1 db ?
Place 2 dw ?
.
eax
ecx
Moveax , ecx
bx
Mov ds , bx
Mov place1 , dh
Mov ax, 40
Movch , place1
Mov cx , ds
14
www.mspsoft.com
www.mspsoft.com
Mov place2 , ds
:1
:2
.
:3
:
dd dw db
.
al
count
:
.
Count dwzoh
Mov al, count error
p2 p1
25 15
2
.
www.mspsoft.com
www.mspsoft.com
Datasg ends
Wdesg segmentpara 'coda'
Main proc for
Assume ds: datasg, cs: wdesg, ss: stksg
Mov ax, datasg
Mov ds, ax
Mov ax, p1
Movbx, p2
Mov p1,bx
Mov p2, ax
Mov ax, 4c00h
Int z1h
Main endP
Wdesg ends
End main
:
LAE <
:LEA
>, <
>
:
www.mspsoft.com
www.mspsoft.com
2
.
.
bx
al
bx
.
table
onebyte
al
:
.
100h
100h
LEA
:
mov
bx
table
.1
:
Mov ax, 50
Mov P,30h
17
www.mspsoft.com
www.mspsoft.com
16
30h
50
ax
.2
:
Mov ax, cx
Mov dx, p
Mov cl, 20h
ax
.3
Mov ax, [si]
:xchg
2
,1
Xchg
P db 25
Mov c1, 10
Mov ah, 20
Xchg c1, ah
Xchg ah, p
.
.
xchg
:1
:2
www.mspsoft.com
www.mspsoft.com
:INC
.
:DEC
:
L1 dw 10
L2 db 15
Mov ax, L1
Inc ax
Dec L2
f2 f1
25 20
:
.
www.mspsoft.com
www.mspsoft.com
Inc f1
Inc f2
Mov ax, 4c00h
Int 21h
Main endP
Codesg ends
End main
40 30 20 10
bl bh
.
al ah
bl al
bh ah
www.mspsoft.com
www.mspsoft.com
www.mspsoft.com
www.mspsoft.com
Codesg ends
End main
:
(0,79)
(0,0)
(17,39)
(24,79)
(24,0)
:
16
(
00H
) 0000
) 0000
07H
) 0000
) 0111
87H
) 1000
) 0111
0fH
) 0000
) 1111
70H
) 0111
) 0000
F0H
) 1111
) 0000
01H
22
www.mspsoft.com
0000
0001
www.mspsoft.com
:
0
10
11
12
13
14
15
:
23
www.mspsoft.com
www.mspsoft.com
16
IRGB
00H
) 0000
71H
) 0111
(
A8H
F4H
(
(
14H
IRGB
(
) 0000
(
) 1010
) 0001
) 1000
) 1111
) 0100
) 0001
) 0100
jp cs
.
.
jp cs
.
2
.1
.2
:
.1
.2
.
.
Bios Dos
24
www.mspsoft.com
www.mspsoft.com
:
.
.
:
Int
10h
6h
6h :
10h :
6h :AH
:AL
:CH
:CL
:DH
:DL
:BH
BH
DL
DH
CL
CH
AL
AH
14h
79
24
25
6h
www.mspsoft.com
www.mspsoft.com
Stksg ends
Datasg segmentpara 'code'
Main proc for
Assume cd: codesg
Mov ah, 6h
Mov al, 25
Movch, 0
Mov cl, 0
Mov dh, 24
Mov dl, 79
Movbh, 0
Int 10 h
Mov ax, 4c00h
Int 21h
Main endP
Codesg ends
End main
.
Stksg segment stack
Db 32 dup ('stack')
26
www.mspsoft.com
www.mspsoft.com
Stksg ends
Datasg segmentpara 'code'
Main proc for
Assume cd: codesg
Mov ah, 6h
Mov al, 12
Movch, 7
Movcl, 10
Movdh, 19
Mov dl, 79
Movbh, 0
Int 10h
Mov ax, 4c00h
Int
21h
Main endP
Codesg ends
End main
10h
2h
2H :AH
27
www.mspsoft.com
www.mspsoft.com
:DH
.
:DL
.
:BH
.
.
21h
9h
.
$
.
$
!
www.mspsoft.com
www.mspsoft.com
Mov ah, 2h
Mov dh, 15
Mov dl, 60
Movbh, 0
Int 10h
Mov dx, offset msg
Mov ah, 9h
Int 21h
Mov ax, 4c00h
Int 21h
Main endP
Codesg end s
End main
:
02h
21h
.
01h
21h
:21h
AL
29
www.mspsoft.com
1h
www.mspsoft.com
2h
DL
8h
AL
.
09h
Dx
.
.
Ds
0Ah
:4ch
:
Stksg segment
stack
Db 32 dup("stack")
Stksg ends
Datasg
segment
para 'data'
Msg1
db 'enter a character;',"$"
Msg2
db 'you typed',"$"
Help
db?
Datasg ends
Codesgsegment para
Main proc
Assume
ds:datasg,cs:codesg
Movax,datasg
Movds,ax
30
www.mspsoft.com
www.mspsoft.com
Mov
ah,2h
Mov
ah,20
Mov
dl,35
Mov
bh,0
Int
10h
Mov
ax,offsetmsg1
Mov
ah,9h
Int
Mov
Int
21h
ah,1h
21h
help
Movhelp,al
Mov
ah,2h
Mov
db,25
Mov
db,35
Mov
bh,0
Int
10h
Mov
dx,offsetmsg2
Mov
ah,9h
31
www.mspsoft.com
www.mspsoft.com
Int
27h
Movdl,help
Mov
Int
Mov
ah,2h
21h
ax,4cooh
Int
21h
Main
end p
Datasg
End
ends
main
:
:
Stack[
Code[
Page[[
]
],[
]]
:
:
60
:title
((
32
www.mspsoft.com
))
www.mspsoft.com
:
ADD<
>,<
>
SUB<
>,<
>
:
Stksg
segment
Db
Stksg
stack
64
dup("stack")
ends
Datasg
segment
Byte1
db
64
Byte2
db
40h
Byte3
db
10h
word1dw
4000h
word2dw
2000h
word3dw
1000h
datasg
ends
codesg
mianproc
segment
para 'data'
para 'code'
for
assumeds:datasg,cs:codesg
mov
al, Byte1
movbl, Byte2
33
www.mspsoft.com
www.mspsoft.com
add
al, Byte3
add
byte1,bl
add
bl,10h
add
byte1,25h
mov
ax, word1
movbx, word2
sub
ax, bx
sub
ax, word3
sub
word1, bx
subbx, 1000h
sub
word1,256h
mov
ax, 4cooh
int
21h
main
end p
codesg
end
ends
main
mul
Imul
:
Mul
Imul
34
www.mspsoft.com
www.mspsoft.com
Ax
(
.
<
Jmp
>
35
www.mspsoft.com
www.mspsoft.com
(1
Je Jz.
(2 jne Jnz.
(3 jne Jnb.
(4 jae Jnba
(5 jb Jnae
(6 jbe Jna .
:
Cf,zF (3
zf (2
Cf (6
zF (1
cf (5
cf (4
:
je (1
Jz.
jne (2 Jzn.
jg (3 Jnle.
jge (4 Jnl.
jl (5
jle(6
Jnge .
Jng.
36
www.mspsoft.com
www.mspsoft.com
:
Zf,sF,oF (3
zf (2
zf (1
zF,sF,oF (6
sF,oF (5
sF,oF (4
:
Jcmz
cn
Jc)
jb( cf
Jnc
cf
Jo
of
Jno
of
jp Jpe
Pf
jnp Jpo
Pf
Js
Sf
Jns
Sf
:
String
Max
37
www.mspsoft.com
www.mspsoft.com
Len
datasg segment paro data
msg1 db enter a string , $
mag2db you enter ed: , $
str list lable byte
max
db.20
lendb ?
buffer db 20 dup ( )
dolardb
datasg
ends
codesg
segment para
code
mainpreo far
assume ds: data sg , es : code sg
mov ax , data sg
mov
ds , an
38
www.mspsoft.com
Buffer :
www.mspsoft.com
mov ah ,6h
mov al , ?5
movch , 0
mov cl , 0
mov ah , 24
mov
dl , 79
movbh , 7
mov dh , 10
mov
dl , 30
movbh , 0
intint , 10 h
lendn , msg 9
mov ah , 9h
int
21 h
39
www.mspsoft.com
www.mspsoft.com
mov
ah , 0 ah
int . 21 h
mov ah , 2h
mov dh , 12
mov dl , 30
lea .bn , buffer
mov .bh , 0
int
10h
mov ah, 0
leadn , msg 2
mov ah , 9h
int . 21h
mov , cl , 0
p1 :mov dl , [bn]
40
www.mspsoft.com
www.mspsoft.com
mov ah , 2h
int . 21h
intbn
int
cl
cmp cl , len
jw z . p1
mov an , 4c00h
int 21h
main
end p
codesg end s
end main
:
Movch , 0
Mov cl , l , en
Sub cl , l
Add bm , cn
41
www.mspsoft.com
www.mspsoft.com
Mov cl , 0
Movdl , (bm]
Mov ah , 2h
Int 21h
Int
cl
Dec bn
Cmp cl , len
Jnz . p1
Movam , 4c00h
Int
21h
Ch2
Ch1
Ch1
42
www.mspsoft.com
www.mspsoft.com
Ch1
Ch2
:
ch1 = z
ch2 = p
lendb ?
buffer db 20 dup ( )
dolerdb $
datasg ends
codesg segment para code
main procfar
assume ds : data sg . csg : code sg
mov an , data sg
43
www.mspsoft.com
Ch2
www.mspsoft.com
mov ds , an
mov ah , 6h
mov al , 25
mov ah , 0
mov cl , 0
mov dh , 74
mov dl , 79
movbh , 7
int
10 h
mov
ah , 2h
mov
dh , 10
mov
dl , 30
movbh , 0
int
10 h
leadn , msg1
mov
ah , 9h
44
www.mspsoft.com
www.mspsoft.com
int
21 h
mov
ah , 0ah
21 h
mov
ah , 2h
mov
dh ,10
: IF
Cmp sum, 65
Jnl
P1
.
.
.
45
www.mspsoft.com
www.mspsoft.com
Jmp
end-if
P1
End if
: chtSwi
Cmp choice, 1
Je L1
Cmp
Je
Cmp
Je
Jmp
choice, 2
L2
choice, 3
L3
L4
L1: choice=1
Jmp L5
91
46
www.mspsoft.com