komany 发表于 2010-12-20 20:22:12

ASM_16 作业

本帖最后由 komany 于 2010-12-22 10:12 编辑

assume cs:code
data segment
Nisy db 'Hello,Nisy!$'
Komany db 'Hello,komany!$'
China db 'Hello,China!$'
ASM db 'Hello,ASM!$'
data ends
code segment
start:
mov ax,data
mov ds,ax
call fun_1
call fun_2
call fun_3
call fun_4
mov ax,4c00h
int 21h
fun_1: push cx
push si
push dx

mov cx,11
mov si,0

mov bx,offset Nisy
s1: mov al,
cmp al,2ch
jz next1
cmp al,'!'
jz next1
and al,11011111b
mov ,al
next1: inc si
loop s1

mov ax,0900h
mov dx,offset Nisy
int 21h
pop dx
pop si
pop cx
retn
fun_2: push cx
push si
push dx

mov cx,13
mov si,0
mov bx,offset Komany
s2: mov al,
cmp al,2ch
jz next2
cmp al,'!'
jz next2
and al,11011111b
mov ,al
next2:
inc si
loop s2
mov ax,0900h
mov dx,offset Komany
int 21h
pop dx
pop si
pop cx
retn
fun_3: push cx
push si
push dx

mov cx,12
mov si,0
mov bx,offset China
s3: mov al,
cmp al,2ch
jz next3
cmp al,'!'
jz next3
and al,11011111b
mov ,al
next3: inc si
loop s3
mov ax,0900h
mov dx,offset China
int 21h
pop dx
pop si
pop cx
retn
fun_4: push cx
push si
push dx

mov cx,10
mov si,0
mov bx,offset ASM
s4: mov al,
cmp al,2ch
jz next4
cmp al,'!'
jz next4
and al,11011111b
mov ,al
next4: inc si
loop s4
mov ax,0900h
mov dx,offset ASM
int 21h
pop dx
pop si
pop cx
retn
code ends
end start

komany 发表于 2010-12-22 18:59:00

本帖最后由 komany 于 2011-1-1 22:19 编辑



assume cs:code
data segment
Nisy db 'Hello,Nisy! $'
Komany db 'Hello,komany! $'
China db 'Hello,China! $'
ASM db 'Hello,ASM! $'
data ends
code segment
start:
mov ax,data
mov ds,ax

call fun_change_str

mov ax,4c00h
int 21h

fun_change_str: push cx
push si
push bx
mov bx,offset Nisy
mov si,0
mov cx,04h

s: mov al,
cmp al,','
je next
cmp al,'!'
je next
cmp al,' '
je next
cmp al,'$'
je next1
and al,11011111b
mov ,al
next:
inc si
jmp s

next1: xor si,si
mov ax,0900h
mov dx,bx
int 21h
add bx,16
loop s
end1:pop bx
pop si
pop cx
ret

code ends
end start

komany 发表于 2010-12-22 19:00:10

修改版,多谢FBI指教,不仅修改了错误而且使思路更加清晰,不那么罗嗦了

ngm20 发表于 2010-12-24 13:56:00

写的不错。。
页: [1]
查看完整版本: ASM_16 作业