高手们帮帮忙吧!!

ilrxx 2011-11-15 09:57:01
我有个同事要考试,有几道题大家帮忙解释下含义,我是搞java的,这貌似是汇编,看不懂。。谢谢了。
实验一 循环程序的调试与运行
一.实验目的 掌握循环程序的调试运行方法
二.实验内容
1、程序1
data segment
d1 db 2, -1,-3,5,6,9,18,-29,-72,8,122,-31,95,76,91,-2
rs db ?
data ends
stack1 segment
db 100 dup(?)
stack1 ends
code segment
main proc far
assume cs:code,ds:data,ss:stack1
start: push ds
sub ax,ax
push ax
mov ax,data
mov ds,ax
lea bx,d1
mov cx,16
mov dl,0
lop1: mov al,[bx]
cmp al,0
jge jus
inc dl
jus: inc bx
dec cx
jnz lop1
mov rs,dl
add dl,30h
mov ah,2
int 21h
ret
main endp
code ends
end start
2.程序2
data segment
num dw 6789h
data ends
stack1 segment
db 100 dup(?)
stack1 ends
code segment
main proc far
assume cs:code,ds:data,ss:stack1
start:push ds
sub ax,ax
push ax
mov ax,data
mov ds,ax
mov bx,num
mov ch,4
rota:mov cl,4
rol bx,cl
mov al,bl
and al,0fh
add al,30h
cmp al,3ah
jl print
add al,07h
print:mov dl,al
mov ah,2
int 21h
dec ch
jnz rota
ret
main endp
code ends
end start
实验二 PC串行接口实验
一.实验目的 掌握PC机的基本串行通信
二.实验内容
参考程序
data segment
flag db 0
info db 13,10
db 'please select(s=sending or r=receiving)'
db '$'
sendinfo db 13,10
db 'sending...'
db 13,10
db '$'
receiveinfo db 13,10
db 'receiving...'
db 13,10
db '$'
data ends
stack segment para stack 'stack'
db 256 dup(0)
stack ends
code segment
start proc far
assume cs:code,ds:data
push ds
mov ax,0
push ax
mov ax,data
mov ds,ax
mov al,0h
out 21h,al
mov dx,2fbh
mov al,80h
out dx,al
mov dx,2f8h
mov al,060h
out dx,al
mov dx,2f9h
mov al,0
out dx,al
mov dx,2fbh
mov al,0ah
out dx,al
mov dx,2fch
mov al,0ah
out dx,al
mov dx,2fch
mov al,0bh
out dx,al
mov dx,2f9h
mov al,01h
out dx,al
sti
;
push ds
mov dx,offset irecve
mov ax,seg irecve
mov ds,ax
mov al,0bh
mov ah,25h
int 21h
pop ds
mov dx,offset info
mov ah,9
int 21h
mov ah,1
int 21h
cmp al,'s'
je sending
cmp al,'s'
je sending
cmp al,'s'
jne next
sending:
call send
ret
next: cmp al,'r'
je receiving
cmp al,'r'
jne quit
receiving:
call receive
quit: ret
start endp

receive proc
mov dx,offset receiveinfo
mov ah,9
int 21h
refore:
cmp flag,'!'
jz sequit
jmp refore
requit:ret
receive endp

send proc
mov dx, offset sendinfo
mov ah,9
int 21h
sefore: cmp flag,'!'
jz sequit
mov dx,2fdh
in al,dx
test al,20h
jz sefore
mov ah,0
int 16h
mov flag,al
mov dx,2f8h
out dx,al
mov bx,0
mov ah,14
int 10h
jmp sefore
sequit:ret
send endp

irecve proc
push ax
push bx
push dx
push ds
mov dx,2fdh
in al ,dx
test al,1eh
jnz error
mov dx,2f8h
in al,dx
mov flag,al
and al,7fh
mov bx,0
mov ah,14
int 10h
jmp exit
error:
mov dx,2f8h
in al,dx
mov al,'?'
mov bx,0
mov ah,14
int 10h
exit:
mov al,20h
out 20h,al
pop ds
pop dx
pop bx
pop ax
sti
iret
irecve endp
code ends
end start

给个运行结果和大概意思就行了
...全文
127 回复 打赏 收藏 转发到动态 举报
写回复
用AI写文章
回复
切换为时间正序
请发表友善的回复…
发表回复

21,459

社区成员

发帖
与我相关
我的任务
社区描述
汇编语言(Assembly Language)是任何一种用于电子计算机、微处理器、微控制器或其他可编程器件的低级语言,亦称为符号语言。
社区管理员
  • 汇编语言
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧