assume cs:code data segment db 'welcome to masm!' db 2,36,113 data ends code segment start: mov ax,data mov ds,ax mov bx,0 mov di,16 mov ax,0b800h mov es,ax mov si,16012+352 mov cx,3 s: mov ah,ds:[di] push cx mov cx,16 s1: mov al,ds:[bx] mov es:[si],ax add si,2 inc bx loop s1 pop cx add si,128 inc di mov bx,0 loop s mov ax,4c00h int 21h code ends end start改成子程序
时间: 2024-02-29 18:53:03 浏览: 142
masm.rar_mov_pop_汇编语言int 10h
5星 · 资源好评率100%
好的,将代码改写成子程序如下:
```
assume cs:code
data segment
db 'welcome to masm!'
db 2,36,113
data ends
code segment
start:
mov ax, data
mov ds, ax
call displayMessage
mov ax, 4c00h
int 21h
displayMessage:
push bx
push di
push si
mov bx, 0
mov di, 16
mov ax, 0b800h
mov es, ax
mov si, 16012+352
mov cx, 3
s:
mov ah, ds:[di]
push cx
mov cx, 16
s1:
mov al, ds:[bx]
mov es:[si], ax
add si, 2
inc bx
loop s1
pop cx
add si, 128
inc di
mov bx, 0
loop s
pop si
pop di
pop bx
ret
code ends
end start
```
阅读全文