0% found this document useful (0 votes)
78 views

Chap 4 - Assembly Programming - Final

This document contains 18 programming exercises involving assembly language and C programming. The exercises cover topics like: 1. Clearing the screen and setting the cursor position 2. Using INT 10h to perform video functions like setting cursor position 3. Displaying strings and getting keyboard input 4. Adding two numbers and displaying the sum 5. Using unions to set register values 6. Writing C functions to call INT 10h and INT 16h for cursor positioning and keyboard input 7. Continuously displaying the time and date until the user presses "Q"

Uploaded by

Vũ Đức Văn
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
78 views

Chap 4 - Assembly Programming - Final

This document contains 18 programming exercises involving assembly language and C programming. The exercises cover topics like: 1. Clearing the screen and setting the cursor position 2. Using INT 10h to perform video functions like setting cursor position 3. Displaying strings and getting keyboard input 4. Adding two numbers and displaying the sum 5. Using unions to set register values 6. Writing C functions to call INT 10h and INT 16h for cursor positioning and keyboard input 7. Continuously displaying the time and date until the user presses "Q"

Uploaded by

Vũ Đức Văn
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

Chap 4

1. Write the program that:


a. Clears the screen
b. Sets the cursor position at row = 5 and column = 12.
2. What is the function of the following program?
MOV AH, 02
MOV BH, 00
MOV DL, 20
MOV DH, 10
INT 10H
3. The following program is meant to set the cursor at position row = 14 and col =
20. Fix the error and run the program to verify your solution.
MOV AH, 02
MOV BH, 00
MOV DH, 14H
MOV DL, 20H
INT 10H
5. In clearing the screen, does the sequence of the code prior to INT 10H matter?
In setting a cursor position? Verify by rearranging and executing the instructions.
6. You want to clear the screen using the following program, but there are some
errors. Fix the error and run the program to verify it.
MOV AX, 0600H
MOV BH, 07
MOV CX, 0000
MOV DX 184F
INT 10H
7. Write a program that:
a. Clear the screen
b. Sets the cursor at row = 8 and column = 14
c. Displays the string “IBM Personal Computer”
9. Write a program that:
a. Clears the screen
b. Puts the cursor on position row = 15 and column = 20
c. Displays the prompt “What is your name?”
d. Gets a response from the keyboard and displays it at row = 17 and column = 20
10. Write the program that sets the mode to medium resolution, draw a vertical
line in the middle of the screen, then draws a horizontal line across the middle of
the screen.
11. Write a program to input a social security number in the form 123-45-4789
and transfer it to another area with the hyphens removed, as in 123456789. Use
the following data definition
SS_AREA LABEL BYTE
SS_SIZE DB 12
SS_ACTUAL DB ?
SS_DASHED DB 12DUP (?)
SS_NUM DB 9 DUP (?)
12. Write a program (use the simplified segment definition) to input two seven-
digit numbers in response to the prompts “Enter the first number” and “Enter the
second number”. Add them together (using AAA, covered in Chap 3) and display
the sum with the message “The total sum is: ”.
13. Show how to use the union REGS to set AX = 9878H, BH = 90H and CL = F4H.
14. Write a C function to set the cursor using int86. Then use it to set the cursor
to row = 10, col = 20 and display the message “HELLO”.
15. Write a C program with the following objectives.
a. Clear the screen. Use int86.
b. Set the cursor to somewhere around the middle of the screen. Use int86
c. Display the date and time continuously in the following format. Use intdos
Time: hr:min:sec
Date: month/day/year
d. A prompt should ask for “Q” to quit. Use C functions
e. When the user types in Q, it should quit displaying time and date and go back
to DOS. Use C functions.
16. A programmer has declared the REGS union as follows. Would this work?
Union REGS inregs, outregs;
17. Write two versions of a C program that counts upward by increments of 1 and
displays the count with a 1 second delay in between counting. When any key is
pressed, it stops counting and goes back to DOS. The count should start from 0.
a. use the kbhit function
b. use the INT 16 function 01
18. Repeat the b. version of the above program, with the user entering the initial
count instead of starting from zero.

You might also like