一道汇编题目 X+Y-3->R

用汇编语言实现R<-X+Y-3
其中R·X·Y都是字数组,要求X,Y放在D_SEG段,R放在E_SEG段 

D_SEG segment 
    x dw 
200 , 241 , 308 , 102 , 1247  
    y dw 
20 , 25 , 2530 , 888 , 356  
D_SEG ends 
E_SEG segment 
    r dw 
5  dup( ?
E_SEG ends 
datagroup group D_SEG,E_SEG 
code segment 
    assume cs:code,ds:datagroup 
main proc far 
    mov ax,datagroup 
    mov ds,ax 
    call compute 
    mov ax,4c00h     
    
int  21h 
main endp 
compute proc near 
    mov cx,
5  
    mov si,
0  
next: 
    mov ax,x[si] 
    add ax,y[si] 
    sub ax,
3  
    mov r[si],ax 
    add si,
2  
    loop next 
    mov cx,
5  
    add di,
0  
net: 
    mov bx,r[di] 
    push cx 
    call put 
    call crlf 
    add di,
2  
    pop cx 
    loop net 
    ret 
compute endp 
put proc near 
    mov cx,10000d 
    call output 
    mov cx,1000d 
    call output 
    mov cx,100d 
    call output 
    mov cx,10d 
    call output 
    mov cx,1d 
    call output 
    ret 
put endp 
output proc near 
    mov ax,bx 
    mov dx,
0  
    div cx 
    mov bx,dx 
    mov dl,al 
    add dl,30h 
    mov ah,
2  
    
int  21h 
    ret 
output endp 

crlf proc near 
    mov dl,0ah 
    mov ah,
2  
    
int  21h 
    mov dl,0dh 
    mov ah,
2  
    
int  21h 
    ret 
crlf endp 
code ends 
end main
 
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值