1.
data segment
dat1 db 10h,20h,81h,'*'
dat2 db 0
data ends
code segment
assume cs:code,ds:data
start:
mov ax,data
mov ds,ax
xor ax,ax
xor bx,bx
xor dx,dx
lea si,dat1
cycle:
cmp [si],'*'
jz next
add [si],0
js fu
inc ah
add dl,[si]
adc dh,0
fu:
inc si
loop cycle
next:
mov bl,ah
mov ax,dx
idiv bl
mov dat2,al
mov ax, 4c00h
int 21h
ends
end start
2.
data segment
a db 2
b db 3
c db 4
xmu dw 0
data ends
code segment
assume cs:code,ds:data
start:
mov ax,data
mov ds,ax
xor ax,ax
xor bx,bx
mov al,a
mov bl,5
imul bl
mov xmu,ax
mov al,b
mov bl,7
imul bl
adc xmu,ax
mov al,c
mov bl,6
imul bl
sbb xmu,ax
mov ax, 4c00h
int 21h
ends
end start
3.
data segment
x db 1h,2h,3h,1h,2h,3h,1h,2h
x_ dw 0
data ends
code segment
assume cs:code,ds:data
start:
mov ax,data
mov ds,ax
xor ax,ax
xor bx,bx
xor cx,cx
mov si,offset x
mov cx,8
cycle:
mov bl,[si]
add al,bl
adc ah,0
inc si
loop cycle
mov bl,8h
idiv bl
xor ah,ah
add al,0
aaa
mov x_,ax
mov ax, 4c00h
int 21h
ends
end start
4.
data segment
buf1 db 1h
buf2 db 4h
result dw 0
data ends
code segment
assume cs:code,ds:data
start:
mov ax,data
mov ds,ax
xor ax,ax
xor bx,bx
mov al,buf1
mov bl,buf2
cmp al,bl
clc
jl jump
sbb al,bl
jmp to
jump:
clc
sbb bl,al
mov ax,bx
to:
mov result,ax
mov ax, 4c00h
int 21h
ends
end start
5.
data segment
da1 db 1h,2h,1h,30h,6h,8h,11h,20h,70h,10h
da2 db 1h,2h,1h,50h,7h,9h,22h,10h,50h,9h
above db 0
equal db 0
below db 0
data ends
code segment
assume cs:code,ds:data
start:
mov ax,data
mov ds,ax
xor ax,ax
xor bx,bx
xor cx,cx
xor dx,dx
lea si,da1
lea di,da2
mov cx,10
cld
cycle:
mov al,[si]
mov bl,[di]
cmp al,bl
ja ab
je eq
inc below
jmp jump
ab:inc above
jmp jump
eq:inc equal
jmp jump
jump:
inc si
inc di
loop cycle
mov ax, 4c00h
int 21h
ends
end start
6.
data segment
x dw 2h,2h,2h,2h,2h,2h,2h,2h,2h,2h
y dw 2h,2h,2h,2h,2h,2h,2h,2h,2h,2h
z dw 10 dup(0)
ruler dw 0c4c0h
z_ad dw 0
data ends
code segment
assume cs:code,ds:data
start:
mov ax,data
mov ds,ax
xor ax,ax
xor bx,bx
lea si,x
lea di,y
mov dx,ruler
mov cx,10
cycle:
mov ax,[si]
mov bx,[di]
shl dx,1
jnc _
add ax,bx
lea si,z
add si,z_ad
mov [si],ax
jmp jump
_:
sub ax,bx
lea si,z
add si,z_ad
mov [si],ax
jump:
lea si,x
add si,z_ad
add si,2
add di,2
add z_ad,2
loop cycle
mov ax, 4c00h
int 21h
ends
end start