A compilation Question X + Y-3-> R

Source: Internet
Author: User

R <-X + Y-3 using assembly language
Where R · X · Y is a word group, which requires that X and Y be placed in the D_SEG segment, and R be placed in the E_SEG segment.

D_SEG segment
X dw 200,241,308,102,124 7
Y dw 20, 25, 2530,888,356
D_SEG ends
E_SEG segment
R dw 5 dup (?)
E_SEG ends
Groups roup group D_SEG, E_SEG
Code segment
Assume cs: code, ds: Role roup
Main proc far
Mov ax, role roup
Mov ds, ax
Call compute
Mov ax, 4c00h
Int 21 h
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, Objective D
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, 30 h
Mov ah, 2
Int 21 h
Ret
Output endp

Crlf proc near
Mov dl, 0ah
Mov ah, 2
Int 21 h
Mov dl, 0dh
Mov ah, 2
Int 21 h
Ret
Crlf endp
Code ends
End main

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.