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

:

, , ,
.


:
1.

.MODEL SMALL
.STACK 10h
.DATA
mp1 DW 1111h,2222h,3333h,9999h
mp2 DW 7777h,8888h,0eeeeh,1111h
n EQU ($-mp2)/(TYPE mp2)
.CODE
begin:
mov ax, @DATA
mov ds,ax
clc
lea si,mp1
lea di, mp2
mov cx,n
cicle:
adc [di], ax
add si,2
add di,2
loop cicle
END begin

BCD
. n .
2.

.MODEL SMALL
.STACK 10h
.DATA
bcd1 DB 22h,41h,75h,32h
bcd2 DB 31h,27h,53h,62h
n EQU $-bcd2
.CODE
begin: mov ax,@DATA
mov ds,ax
lea si,bcd1
lea di,bcd2
mov cx,n
clc
mov al,[si]
cicle:adc al, [di]
daa
mov [di],al
inc si
inc di
loop cicle
END begin

;32754122
;62532731

,
ASCII .
3.

.MODEL SMALL
.STACK 10h
.DATA

asc1 DB '7','5','2','1','3' ;31257


asc2 DB '6','1','9','9','5' ;59916
len EQU $-asc2
.CODE
begin: mov ax,@DATA
mov ds,ax
lea si,asc1
lea di,asc2
mov cx,len
clc
cicle:
mov al,[si]
adc al,[di]
aaa
mov [di],al
inc si
inc di
loop cicle
END begin

,
ASCII, ASCII.
BCD .
4.

.MODEL SMALL
.STACK 10h
.DATA
asc1 DB '2','4','7','1','3' ;31742
len EQU $-asc1
dgt DB '4'
asc2 DB 6 DUP(?)
.CODE
begin: mov ax,@DATA
mov ds,ax
lea di,asc2
lea si,asc1
mov cx,len
mov dl,dgt
mov BYTE PTR [di],0
and al ,0fh
cicle: mov al,[si]
inc si
and al ,0fh
mul dl
aam
add al,[di]
aaa
mov [di],al
inc di
mov [di],ah
loop cicle
END begin

, ,
ASCII,
ASCII. .
5.

.MODEL SMALL
.STACK 10h
.DATA
asc1 DB '7','2','1','8','9'; 72189
dgt DB '6'
; 6
asc2 DB 5 DUP(?)

len EQU $-asc2


.CODE
begin: mov ax,@DATA
mov ds,ax
lea si,asc1
lea di,asc2
mov cx,len
mov dl,dgt
and dl, 0Fh
xor ah,ah
cicl: mov al,[si]
inc si
and al, 0Fh
aad
div dl
mov [di],al
inc di
loop cicl
END begin
6. :


: a,
Alfa, g, - Gama, d Delta, , ***.
TITLE example_6
.MODEL SMALL
.STACK 10h
.DATA
cars DB 'a', 'g', 'd'
pos_a DB 'Alfa',13,10,'$'
pos_g DB 'Gama',13,10,'$'
pos_d DB 'Delta',13,10,'$'
pos
DB '***',13,10,'$'
act_tbl
DW act_a, act_g, act_d
.CODE
begin:
mov
ax, @DATA
mov
ds, ax
mov
ah, 01h
int
21h
xor
bx, bx
sled:
cmp
bx, 02h
ja
act
cmp al,cars[bx]
je
find
inc
bx
jmp
SHORT sled
find:
shl
bx, 1
jmp
act_tbl[bx]
act_a:
mov
dx, OFFSET pos_a
mov
ah, 09h
int
21h
jmp
SHORT exit
act_g:
mov
dx, OFFSET pos_g
mov
ah, 09h
int
21h
jmp
SHORT exit
act_d:
mov
dx, OFFSET pos_d

mov
int
jmp
act:
mov
mov
int
21h
exit:
mov
int
END begin

ah, 09h
21h
SHORT exit
dx, OFFSET pos
ah, 09h
ax, 4C00h
21h

, perem
x7, x6, x5, x4, x3, x2, x1, x0. ,

ah.
7.

TITLE example_7
.MODEL SMALL
.STACK 10h
.DATA
perem DB 10010011b
.CODE
start:
mov
ax, @DATA
mov
ds, ax
mov
al, perem
mov
bl, 01011100b
or
bl, al
mov
bh, 11110010b
or
bh, al
mov
cl, 10101101b
or
cl, al
xor
bl, 11011111b
jz
true
xor
bh, 11111110b
jz
true
xor
cl, 11101101b
jz
true
xor
ah, ah
jmp
SHORT continue
true: mov
ah, 1
continue: nop
mov
ax, 4C00h
int
21h
END start

perem
.
8.

TITLE example_8
.MODEL SMALL
.STACK 10h
.DATA
ascii DB '0123456789ABCDEF'
message DB 2 DUP(?)
DB 13,10,'$'
perem DB 98h
.CODE
begin:
mov
ax, @DATA
mov
ds, ax

mov
mov
and
mov
shr
mov
xor
mov
mov
and
mov
xor
mov
mov
mov
mov
int
mov
int
END begin

al, perem
ah, al
al, 0F0h
cl, 4
al, cl
bl, al
bh, bh
al, ascii[bx]
message, al
ah, 0Fh
bl, ah
bh,bh
al, ascii[bx]
message+1, al
dx, OFFSET message
ah, 09h
21h
ax, 4C00h
21h

, 16-
BCD .
9.

TITLE example_9
.MODEL SMALL
.STACK 10h
.DATA
unpck DB 1,2,4,0,7,8,9,0,6,7,9,1,2,5,8,3
pck
DB 8 DUP(?)
.CODE
begin:
mov
ax, @DATA
mov
ds, ax
mov
dx, 8
mov
cl, 4
xor
si,si
mov
di, si
conv:
mov
ax, WORD PTR unpck[si]
shl
al, cl
shr
ax, cl
mov
pck[di], al
add
si, 2
inc
di
dec
dx
jnz
conv
END begin

{ ,
}
16 ,
24 80 ,
.
10.

TITLE example_10
.MODEL SMALL
.STACK 10h
.DATA
buffer
max_length
chars_entered

LABEL BYTE
DB ?
DB ?

string
DB 17 DUP(?)
strings_per_line DW 0
crlf DB 0Dh,0Ah,'$'
.CODE
begin:
mov
ax, @DATA
mov
ds, ax
mov
dx, OFFSET buffer
mov
buffer, 17
mov
ah, 0Ah
int
21h
xor
bx, bx
mov
bl, chars_entered
mov
buffer[bx+2], '$'
mov
al, 80h
cbw
div
chars_entered
xor
ah, ah
mov
strings_per_line, ax
mov
cx, 24
display_screen:
push cx
mov
cx, strings_per_line
display_line:
mov
dx, OFFSET string
mov
ah, 09h
int
21h
loop display_line
mov
dx, OFFSET crlf
mov
ah, 09h
int
21h
pop
cx
loop display_screen
mov
ax, 4C00h
int
21h
END begin



slovo ,
dslovo.
4.1.

.MODEL SMALL
.STACK 10h
.DATA
slovo DB 10011010b
dslovo DW 1001101011110000b
in_byte DB 0
in_byte2 DB 0
left_one DB 0
right_one DB 0
left_one2 DB 0
right_one2 DB 0
.CODE
begin: mov ax,@DATA
mov ds,ax
mov ax,1
mov cx,8
mov bx,-1
cicle: mov dl,slovo
and dx,ax
shl ax,1

inc bx
cmp dx,0
jz fwd
inc in_byte
mov left_one,bl
cmp in_byte,1
jz right
jnz fwd
right: mov right_one,bl
fwd:loop cicle
mov ax,1
mov cx,16
mov bx,-1
cicl: mov dx,dslovo
and dx,ax
shl ax,1
inc bx
cmp dx,0
jz fwd2
inc in_byte2
mov left_one2,bl
cmp in_byte2,1
jz right2
jnz fwd2
right2: mov right_one2,bl
fwd2:loop cicl
Exit: mov ax,4c00h
int 21h
END begin

, 4 12
4 3 .
4.2.

.MODEL SMALL
.STACK 10h
.DATA
not_effective DW 0F51h, 0F51h, 0F51h, 0F51h
effective DW 3 DUP(?)
.CODE
begin: mov ax,@DATA
mov ds,ax
mov ax, [not_effective]
shl ax,4
mov dx, [not_effective]+2
shr dx,8
and dl,00001111b
or al,dl
mov effective, ax
mov
shl
mov
shr
mov
mov

ax, [not_effective]+2
ax,8
dx, [not_effective]+4
dx,4
al,dl
[effective]+2, ax

mov ax, [not_effective]+4


shl ax,12
or ax, [not_effective]+6
mov [effective]+4, ax
Exit: mov ax,4c00h
int 21h
END begin

Оценить