1、用 ccs 编程完成(a+b)*c/2 的运算。实验编程为:.title “xiti.asm“.mmregsSTACK .usect “stack“,10H.bss a,1.bss b,1 .bss c,1.bss y,1.def start.datatable: .word 10,50,4.textstart: STM #0,SWWSRSTM #STACK+10H,SPSTM #a,AR1RPT #2MVPD table,*AR1+CALL SUMBend: B endSUMB: LD #1,DPLD a,AADD b,ASTLM A,TMPY c,ASTL A,-1,yRET.end运行数
2、据段的结果为:反汇编程序为:0000:0080 _text_0000:0080 7728 STM 0h,28h0000:0082 7718 STM 94h,18h0000:0084 7711 STM 80h,11h0000:0086 EC02 RPT #2h0000:0087 7C91 MVPD .data,*AR1+0000:0089 F074 CALL SUMB0000:008B end0000:008B F073 B end0000:008D SUMB0000:008D EA01 LD #1h,DP0000:008E 1000 LD 0h,A0000:008F 0001 ADD 1h,A0000:0090 880E STLM A,0eh0000:0091 2002 MPY 2h,A0000:0092 6F03 STL A,-1,3h0000:0094 FC00 RET 0000:0095 .data0000:0095 000A ADD 0ah,A0000:0096 0032 ADD 32h,A0000:0097 0004 ADD 4h,A0000:0098 edata但步运行的结果为:第一步 LD a,A第二步 ADD b,A第三步 STLM A,T此次编程中发现的问题是,不仅仅是前面所讲的注意 DP 的变化,还得注意在程序中可能出现的各种指令错误!