Index
SL Name Page
1 Write and execute a machine language program in MTS86 trainer board and show basic 2
characteristics of DAC by simple input output operation.
2 Establish communication between two computers using parallel ports. 2
3 Write and execute a machine language program in MTS86 trainer board and show hexadecimal 3
values (0,1,2,3, ... F) on the LED.
4 Write and execute a machine language program in MTS86 trainer board to show hexadecimal 3
values (0,1,2,3, ... F) on the Seven Segment Display.
5 Write and execute a machine language program in MTS86 trainer board to show hexadecimal 4
value 9.
1
1. Write and execute a machine language program in MTS86 trainer board and show basic characteristics of DAC
by simple input output operation.
Ans:
Program: This program outputs a simple ramp signal (incrementing values) to a Digital-to-Analog Converter (DAC)
via an output port and demonstrates its basic characteristic: converting digital values to analog voltages.
Assumptions: 1. MTS86 uses a DAC (e.g., DAC0800) interfaced via port address 0x300.
2. The DAC accepts 8-bit input (0–255).
Machine Language:
B0 00 ; MOV AL, 00 - Start with value 0 in AL
BA 00 03 ; MOV DX, 0300 - DAC port address in DX
E6 00 ; OUT DX, AL - Output AL to DAC
04 01 ; ADD AL, 01 - Increment AL by 1
EB FA ; JMP $-6 - Loop back to OUT instruction
Explanation: B0 00: Loads 0 into AL (accumulator). BA 00 03: Sets DX to port address 0x300 (little-endian: 00 03).
E6 00: Outputs AL to the port specified in DX. 04 01: Adds 1 to AL, incrementing the digital value. EB FA: Jumps back
6 bytes (to E6 00), creating an infinite loop.
Result: The DAC outputs a linearly increasing voltage (a ramp), showing its digital-to-analog conversion
characteristic.
2. Establish communication between two computers using parallel ports.
Ans:
Assumptions: 1. Both computers have MTS86 trainers or PCs with parallel ports (DB-25 connectors).
2. Port address for LPT1 is 0x378 (data port).
Steps:
1. Hardware Setup: Connect the parallel ports of two MTS86 boards (or PCs) using a crossover cable: Data pins (2–
9) of one port to data pins (2–9) of the other. Ground pins (18–25) connected together.
No handshaking is implemented for simplicity.
2. Sender Program (Computer 1):
B0 41 ; MOV AL, 41 - ASCII 'A'
BA 78 03 ; MOV DX, 0378 - LPT1 data port
E6 00 ; OUT DX, AL - Send 'A' to parallel port
EB FE ; JMP $-2 - Infinite loop
2
3. Receiver Program (Computer 2):
BA 78 03 ; MOV DX, 0378 - LPT1 data port
E4 00 ; IN AL, DX - Read from parallel port
EB FC ; JMP $-4 - Infinite loop
Execution: Load and run the sender program on Computer 1. Load and run the receiver program on Computer 2.
On Computer 2, halt execution and check AL (e.g., via MTS86 monitor); it should show 41h (ASCII 'A').
Explanation: The sender outputs a fixed value ('A') to the parallel port. The receiver reads the data from its parallel
port. The crossover cable ensures data lines match (e.g., pin 2 to pin 2).
3. Write and execute a machine language program in MTS86 trainer board and show hexadecimal values (0,1,2,3,
... F) on the LED.
Ans:
B0 00 ; MOV AL, 00 - Start with 0
BA 00 03 ; MOV DX, 0300 - LED port address
E6 00 ; OUT DX, AL - Output to LED
04 01 ; ADD AL, 01 - Increment AL
3C 10 ; CMP AL, 10 - Compare with 16 (F+1)
75 F8 ; JNZ $-8 - If not 16, loop back
EB F4 ; JMP $-12 - Restart from 0
Explanation: B0 00: Initializes AL to 0. BA 00 03: Sets DX to port 0x300. E6 00: Outputs AL to the LED. 04 01:
Increments AL. 3C 10: Checks if AL reached 16 (10h). 75 F8: Loops back if AL < 16. EB F4: Restarts from 0 after F.
Execution on MTS86: Enter the hex code at 0000:0100. Run the program and observe the LED cycling through
binary patterns (0000 to 1111).
4. Write and execute a machine language program in MTS86 trainer board to show hexadecimal values (0,1,2,3,
... F) on the Seven Segment Display.
Ans: Program: This program displays 0–F on a seven-segment display by outputting segment patterns via a port.
Assumptions: Seven-segment display is common cathode, interfaced via port 0x300. Segment patterns (a–g) for 0–
F are stored in a lookup table.
Lookup Table (at 0000:0200): DB 3F 06 5B 4F 66 6D 7D 07 7F 6F 77 7C 39 5E 79 71
Machine Language:
B0 00 ; MOV AL, 00 - Counter (0–F)
BE 00 02 ; MOV SI, 0200 - Lookup table address
BA 00 03 ; MOV DX, 0300 - Display port
8A 04 ; MOV AL, [SI] - Load pattern from table
E6 00 ; OUT DX, AL - Output to display
3
46 ; INC SI - Next pattern
3C 10 ; CMP AL, 10 - Compare counter with 16
75 F6 ; JNZ $-10 - If not 16, loop back
EB F2 ; JMP $-14 - Restart from 0
Explanation: B0 00: Initializes AL as a counter. BE 00 02: Points SI to the lookup table. BA 00 03: Sets DX to port
0x300. 8A 04: Loads the segment pattern into AL. E6 00: Outputs the pattern to the display. 46: Moves to the next
pattern. 3C 10 and 75 F6: Loops until all 16 values are shown. EB F2: Restarts the cycle.
Execution on MTS86: Load the lookup table at 0000:0200. Enter the program at 0000:0100. Run it and watch the
seven-segment display cycle from 0 to F.
5. Write and execute a machine language program in MTS86 trainer board to show hexadecimal value 9.
Ans:
B0 6F ; MOV AL, 6F - Pattern for 9
BA 00 03 ; MOV DX, 0300 - Display port
E6 00 ; OUT DX, AL - Output to display
EB FE ; JMP $-2 - Infinite loop
Explanation: B0 6F: Loads the pattern for 9 into AL. BA 00 03: Sets DX to port 0x300. E6 00: Outputs the pattern to
the display. EB FE: Loops to keep 9 displayed.
Execution on MTS86: Enter the hex code at 0000:0100. Run it; the display shows 9 continuously.