实验3 8259中读取键盘并显示实验.docx

上传人:b****6 文档编号:4458950 上传时间:2022-12-01 格式:DOCX 页数:8 大小:16.10KB
下载 相关 举报
实验3 8259中读取键盘并显示实验.docx_第1页
第1页 / 共8页
实验3 8259中读取键盘并显示实验.docx_第2页
第2页 / 共8页
实验3 8259中读取键盘并显示实验.docx_第3页
第3页 / 共8页
实验3 8259中读取键盘并显示实验.docx_第4页
第4页 / 共8页
实验3 8259中读取键盘并显示实验.docx_第5页
第5页 / 共8页
点击查看更多>>
下载资源
资源描述

实验3 8259中读取键盘并显示实验.docx

《实验3 8259中读取键盘并显示实验.docx》由会员分享,可在线阅读,更多相关《实验3 8259中读取键盘并显示实验.docx(8页珍藏版)》请在冰豆网上搜索。

实验3 8259中读取键盘并显示实验.docx

实验38259中读取键盘并显示实验

实验3中断控制器接口编程

一、实验目的

1.掌握8259、8255编程方法。

2.学习DEBUG调试程序的使用方法。

二、实验准备

1.复习教材《微机接口技术及应用》有关8259编程内容。

2.参考“汇编语言编程设计”有关书籍,预习DEBUG调试程序的使用方法。

三、实验内容

(一)用EDIT进行文件编辑

步骤同实验2,文件名为COMMU.ASM

(二)编译程序

1.程序汇编

C:

\WINDOWS\SHY2〉MASM.EXECOMMU↓

显示objectfilename[COMMU.OBJ]↓

sourcelisting[NUL.LST]COMMU.LST↓

crossreference[NUL.CRF]↓

显示WarringErrors和SevereErrors信息

若无错则可进行链接,若有错用EDIT修改源程序后再汇编直至无错误提示通过汇编为止。

2.程序链接

C:

\WINDOWS\SHY2〉LINKCOMMU↓

显示RunFile[SOUND.EXE]↓

ListFile[NUL.MAP]↓

Libraries[.LIB]↓

查子目录中文件,可见SOUND.OBJ、COMMU.LST、SOUND.EXE文件已存在。

(三)运行程序

1.C:

\WINDOWS\SHY2〉COMMU↓

2.从键盘输入发送内容,以自测方式,接受发送内容并显示在屏幕上。

(四)用DEBUG调试程序

1.进入DEBUG并装入程序COMMU.EXE,操作如下:

C:

\WINDOWS\SHY2〉DEBUGCOMMU.EXE↓

DEBUG以-来回答。

2.用反汇编命令显示程序目标码,操作如下:

-U↓

屏幕显示

12B5:

00001Epushds

12B5:

0001B80000movax,0

12B5:

000450pushax

12B5:

0005BA03FBmovdx,3fbh

12B5:

0008B080moval,80h

12B5:

000AEEoutdx,al

12B5:

000BBA03F8movdx,3f8h

12B5:

000EB060moval,60h

所示信息从左至右依次为:

段地址:

偏移地址,机器语言指令,汇编语言指令

查看程序目标码,并记录需设置断点处的地址。

3.设置断点,用G命令分段运行程序,操作如下:

-G××↓(××为断点处的偏移地址的低字节)

如键入G14,屏幕显示

AX=0060BX=0000CX=0176DX=03F9SP=00FCBP=0000SI=0000DI=0000

DS=1295ES=1295SS=12A5CS=12B5IP=0014NVUPEIPLNZNAPONC

12B5:

0014B000MOVAL,00

程序停在断点处,显示内容为所有寄存器以及各标志位的当前值,最后一行给出下一条将要执行的指令地址、机器语言、及汇编语言。

记录有关内容,填写汇编语言程序注释中要求的内容。

设置下一断点,用G命令继续运行程序。

四、实验报告

1.打印源程序SOUND.ASM清单,填空注释。

五、参考程序

.modelsmall

.stack

.data

old_ip09dw?

old_cs09dw?

old_ip0fdw?

old_cs0fdw?

countdw?

bufferdb20hdup('?

')

buf_pdw?

start_msgdb0ah,0dh,'RUN!

'0ah,0dh,'$'

end_msgdb0ah,0dh,'end!

'0ah,0dh,'$'

full_msgdb'bufferfull!

'0ah,0dh,'$'

 

.code

mainprocfar

start:

movax,@data

movds,ax

leaax,buffer

movbuf_p,ax

movcount,0

;saveoldinterrupt09h

moval,09h

movah,35

int21h

movold_cs09,es

movold_ip09,bx

pushds

;setnewinterrupt

leadx,kdbint

movax,segkdbint

movds,ax

moval,09h

movah,25h

int21h

popds

;setkeyboardinterruptmaskbits

inal,21h

andal,0fdh

out21h,al

 

sti

movdi,20000

delay:

movsi,30000

delay1:

decsi

jnzdelay1

decdi

jnzdelay

movdi,20000

dey:

movsi,30000

dey1:

decsi

jnzdey1

decdi

jnzdey

movdi,20000

de:

movsi,30000

de1:

decsi

jnzde1

decdi

jnzde

movdi,20000

d:

movsi,30000

d1:

decsi

jnzd1

decdi

jnzd

cli

;saveold

pushds

movdx,old_ip09

movax,old_cs09

movds,ax

moval,09h

movah,25h

int21h

popds

;enable

inal,21h

andal,0fdh

out21h,al

sti

movax,4c00h

int21h

mainendp

;...................

kdbintprocnear

pushax

pushbx

cld

inal,60h

pushax

inal,61h

movah,al

oral,80h

out61h,al

xchgah,al

out61h,al

popax

testal,80h

jnzreturn1

movbx,buf_p

mov[bx],al

calldisplay_hex

incbx

inccount

movbuf_p,bx

check:

cmpcount,20h

jbreturn1

return1:

cli

moval,20h

out20h,al

popbx

popax

iret

kdbintendp

display_hexprocnear

pushax

pushcx

pushdx

movch,2

movcl,4

nextb:

rolal,cl

pushax

movdl,al

anddl,0fh

ordl,30h

cmpdl,3ah

jldispit

adddl,7h

dispit:

movah,2

int21h

popax

decch

jnznextb

movah,2

movdl,','

int21h

popdx

popcx

popax

ret

display_hexendp

endstart

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 高中教育 > 英语

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1