实验4
之后:

2.
运行截图:


assume cs:code, ds:data
data segment
x dw 91, 792, 8536, 65521, 2021
len equ $ - x
data ends
stack segment
db 16 dup(0)
stack ends
code segment
start:
mov ax, data
mov ds, ax
mov ax, stack
mov ss, ax
mov sp, 16
mov si, offset x
mov cx, 5
s:
mov ax, ds:[si]
call printNumber
call printSpace
add si, 2
loop s
mov ah, 4ch
int 21h
printNumber:
push cx
mov cx, 0
s2:
mov bx, 10
mov dx, 0
div bx
push dx
inc cx
cmp ax, 0
jne s2
s3:
pop bx
or bl, 30h
mov ah, 2
mov dl, bl
int 21h
loop s3
pop cx
ret
printSpace:
mov ah, 2
mov dl, 20h
int 21h
ret
code ends
end start


4.
data segment
str1 db "assembly language, it's not difficult but tedious"
len equ $ - str1
data ends
stack segment
db 16 dup(0)
stack ends
code segment
assume cs:code,ds:data,ss:stack
start:
mov ax,data
mov ds,ax
mov si,offset str1
mov cx,len
call strupr
mov ah,4ch
int 21h
strupr:
s:
mov al,ds:[si]
cmp al,'a'
jb next
cmp al,'z'
ja next
and al,0dfh;1101 1111
mov ds:[si],al
next:
inc si
loop s
ret
code ends
end start

调用之后:




浙公网安备 33010602011771号