Professional Documents
Culture Documents
TASK1:
org 0x0100
jmp start
Str1 db '127&j~3#^&*#*#45^', 0
StrLen equ $ - Str1
start:
mov ax, 0
mov cx, StrLen
mov si, 0
search:
cmp byte [Str1 + si], '#'
je found
inc ax
inc si
loop search
mov ax, -1
jmp exit
found:
jmp exit
exit: mov ah,
0x4C
int 0x21
TASK2:
jmp start
Str1 db 'Hello', 0
Str2 db 'World', 0
start:
push Str2
push Str1 call
IsCompare
mov ah, 0x4C
int 0x21
IsCompare:
push bp
mov bp, sp
mov si, [bp + 4]
mov di, [bp + 6]
compare:
mov al, [si]
cmp al, [di]
jne strNE
inc si inc di
cmp byte [si], 0
jne compare
mov ax, 1
jmp end
strNE:
xor ax, ax
end:
pop bp
ret
TASK3:
org 0x100
jmp start
pop di
pop cx
pop ax
pop es
ret
reverse:
push bp
mov bp, sp
push es
push ax
push cx
push si
push di
reverse_loop:
std
lodsb
cld
stosw loop
reverse_loop
pop di
pop si
pop cx
pop ax
pop es
pop bp
ret 4
start: call
clrscr
mov ax, msg
push ax push
word [len] call
reverse print:
lodsb
test al, al
jz end int
0x10 jmp
print
end: mov
ax,0x4c00 int
0x21
TASK 4: org
0x0100 jmp
start arr: dw
1,3,5,2 size:
db 4 start:
mov di,arr
mov cx,7 xor
ax,ax
l1: mov ax,
[di] imul
ax,3
inc di
dec cx
cmp cx,0
je end
xor ax,ax
jmp l1
end: mov
ax,0x4c0
0
int 0x21