📄 6.txt
字号:
2、答:
(1) NAME1 NAMELIST < >
(2) MOV AX,DATA ;假设结构变量NAME1定义在数据段DATA中
MOV DS,AX
MOV ES,AX
;
MOV AH,10
LEA DX,NAME1
INT 21H
;
MOV CL,NAME1.ACTLEN
MOV CH,0
LEA SI,NAME1.NAMEIN
LEA DI,DISPFILE
CLD
REP MOVSB
6、答: SKIPLINES PROC NEAR
PUSH CX
PUSH DX
MOV CX,AX
NEXT: MOV AH,2
MOV DL,0AH
INT 21H
MOV AH,2
MOV DL,0DH
INT 21H
LOOP NEXT
POP DX
POP CX
RET
SKIPLINES ENDP
7、答:
dseg segment
num dw 76,69,84,90,73,88,99,63,100,80
n dw 10
s6 dw 0
s7 dw 0
s8 dw 0
s9 dw 0
s10 dw 0
dseg ends
code segment
main proc far
assume cs:code, ds:dseg
start:
push ds
sub ax, ax
push ax
mov ax, dseg
mov ds, ax
call sub1
ret
main endp
sub1 proc near
push ax
push bx
push cx
push si
mov si, 0
mov cx, n
next:
mov ax, num[si]
mov bx, 10
div bl
mov bl, al
cbw
sub bx, 6
sal bx, 1
inc s6[bx]
add si,2
loop next
pop si
pop cx
pop bx
pop ax
ret
sub1 endp
code ends
end start
8、答:
data segment
maxlen db 40
n db ?
table db 40 dup (?)
char db 'a' ; 查找字符’a’
even
addr dw 3 dup (?)
data ends
code segment
assume cs:code, ds:data
main proc far
start:
push ds
mov ax, 0
push ax
mov ax, data
mov ds, ax
lea dx, maxlen
mov ah, 0ah
int 21h ; 从键盘接收字符串
mov addr, offset table
mov addr+2, offset n
mov addr+4, offset char
mov bx, offset addr ; 通过地址表传送变量地址
call count ; 计算CHAR的出现次数
call display ; 显示
ret
main endp
count proc near ; count子程序
push si
push di
push ax
push cx
mov di, [bx]
mov si, [bx+2]
mov cl, byte ptr[si]
mov ch, 0
mov si, [bx+4]
mov al, byte ptr[si]
mov bx, 0
again:
cmp al, byte ptr[di]
jne l1
inc bx
l1: inc di
loop again
pop cx
pop ax
pop di
pop si
ret
count endp
display proc near ; display子程序
call crlf ; 显示回车和换行
mov dl, char
mov ah, 2
int 21h
mov dl, 20h
mov ah, 2
int 21h
mov al, bl
and al, 0fh
add al, 30h
cmp al, 3ah
jl print
add al, 7
print:
mov dl, al
int 21h
call crlf
ret
display endp
crlf proc near ; crlf子程序
mov dl, 0dh
mov ah, 2
int 21h
mov dl, 0ah
mov ah, 2
int 21h
ret
crlf endp
code ends
end start
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -