1. Compile the computing program
Data Segment
X dB 29
Y dB 8
Z dB 25
F DW?
Data ends
Code segment
Assume DS: data, CS: Code
Main proc far
Start: PUSH DS
Sub ax, ax
PUSH AX
MoV ax, data; data segment register DS Initialization
MoV ds, ax
MoV Al, X; MoV Al x
Mul y; Mul completes the x * Y operation and stores the result in ax.
MoV BH, 0
MoV BL, Z
Add ax, BX; complete x * Y + z
Sub ax, 500
MoV F, ax; sub final ax is sent to F
RET
Main endp
Code ends
End start
2. Implement logic circuit Functions
Stacka segment Stack
DB 100 DUP (?)
Stacka ends
Data Segment
In1 dB 201711b
In2 dB 10101010b
In3 dB 111111b
In4 dB 11111011b
F DB?
Data ends
Code segment
Assume DS: data, CS: Code
Main proc far
Start: PUSH DS
Sub ax, ax
PUSH AX
MoV ax, data; data segment register DS Initialization
MoV ds, ax
MoV Al, in1
Not al
MoV ah, in2
Or Al, ah
MoV BL, in3
And BL, in4
XOR Al, BL
MoV F, Al
RET
Main endp
Code ends
End start
3. Compile a 32-bit unsigned number division program
Stacka segment Stack
DB 100 DUP (?)
Stacka ends
Data Segment
Num1 dd 2a8b7654h
Num2 DW 5 abch
Num3 DW?
Num4 DW?
Data ends
Code segment
Assume DS: data, CS: Code
Manum proc far
Start: PUSH DS
Sub ax, ax
PUSH AX
MoV ax, data; data segment register DS Initialization
MoV ds, ax
MoV ax, word PTR num1
MoV dx, word PTR num1 + 2
Div num2
MoV num3, ax
MoV num4, DX
RET
Manum endp
Code ends
End start
4. Compile a "word splitting" program
Stacka segment Stack
DB 100 DUP (?)
Stacka ends
Data Segment
Ary dB 12 h
Data ends
Code segment
Assume DS: data, CS: Code
Manum proc far
Start: PUSH DS
Sub ax, ax
PUSH AX
MoV ax, data; data segment register DS Initialization
MoV ds, ax
MoV Si, offset ary
MoV ah, 0
MoV Al, [Si]
MoV BL, 10 h
Div BL
MoV [Si + 1], Al
MoV Al, [Si]
And Al, 0fh
MoV [Si + 2], Al
RET
Manum endp
Code ends
End start