- 1
- 0
- 约1.49万字
- 约 66页
- 2017-12-13 发布于江苏
- 举报
微型计算机系统与接口:CH
3.子程序结构 ● 键盘 I/O ● 显示器 I/O (a) 利用寄存器传送参数 (b) 利用存储器传送参数 (c) 通过地址表传送参数地址 (d) 利用堆栈传送参数或参数地址 (4) 子程序的参数传送 例1:累加数组中的元素(通过地址表传送参数地址) data segment ary dw 10,20,30,40,50,60,70,80,90,100 count dw 10 sum dw ? table dw 3 dup (?) ; 地址表 data ends code segment main proc far assume cs:code, ds:data push ds sub ax, ax push ax mov ax, data mov ds, ax mov table, offset ary mov table+2, offset count mov table+4, offset sum mov bx, offset table call proadd ret main endp proadd proc near push ax push cx push si push di mov si, [bx] mov di, [bx+2] mov cx, [di] mov di, [bx+4] xor ax, ax next: add ax, [si] add si, 2 loop next mov [di],ax pop di pop si pop cx pop ax ret proadd endp code ends end main 30d 40d 50d 60d 70d 80d 90d 100d 10d ary? 20d 10d count? sum? table? 0000 0014 0016 0018 0000 0014 0016 ?(bx) (si) (di) 550d 例2:累加数组中的元素(通过堆栈传送参数地址) data segment ary dw 10,20,30,40,50,60,70,80,90,100 count dw 10 sum dw ? data ends stack segment dw 100 dup (?) tos label word stack ends code1 segment main proc far assume cs:code1, ds:data, ss:stack start: mov ax, stack mov ss, ax mov sp, offset tos mov ax, data mov ds, ax mov bx, offset ary push bx mov bx, offset count push bx mov bx, offset sum push bx call far ptr proadd mov ax, 4c00h int 21h main endp code1 ends code2 segment assume cs:code2 proadd proc far push bp mov bp, sp push ax push cx push si push di mov si,[bp+0ah] mov
您可能关注的文档
最近下载
- 新版冀教版科学四年级上册期末试卷(5套).pdf VIP
- 人行悬索桥专项施工方案(论证).pdf VIP
- 你是在高三如何最大幅度提分?——from知乎:铁匠qwer(提分150+).pdf VIP
- 标准图集-17J008 挡土墙(重力式、衡重式、悬臂式) -抗震烈度7.pdf VIP
- 浙江省宁波市余姚市2024-2025学年三年级上学期期末语文试卷.docx VIP
- 电土施表13.3-12 地漏及地面清扫口排水试验记录.doc VIP
- 工商业储能商业模式探索_储能PPT - 副本.pptx VIP
- 数据库原理及应用教程(MySQL版)全套教学课件.pptx VIP
- 医学课件-会厌囊肿护理查房.pptx VIP
- CATL安全作业试题及答案.doc
原创力文档

文档评论(0)