-
Notifications
You must be signed in to change notification settings - Fork 0
/
sy1001.asm
74 lines (58 loc) · 974 Bytes
/
sy1001.asm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
assume cs:code,ds:data,ss:stack
data segment
db 'Welcome to masm!',0
data ends
stack segment
db 16 dup (0)
stack ends
code segment
start: mov dh,8
mov dl,3
mov cl,2
mov ax,0b800h
mov es,ax
mov ax,data
mov ds,ax
mov si,0
mov di,0
call show_str
mov ax,4c00h
int 21h
show_str:
;push指令保护子程序用到的寄存器
push bx
push cx
push dx
push si
push di
;指定显存区域
mov ax,0b800h
mov es,ax
;初始化行
mov ax,0a0h
sub dh,1
mul dh
mov bx,ax
mov ax,2
mul dl
mov di,ax
mov ah,cl
s:mov cl,ds:[si]
mov ch,0
jcxz ok
mov al,ds:[si]
mov es:[bx+di],ax
inc si
add di,2
jmp s ;如果CX≠0,继续循环
ok:
;恢复保护的寄存器
pop di
pop si
pop dx
pop cx
pop bx
;返回调用
ret
code ends
end start