Question

In: Computer Science

Write an assembly program that displays the following two options: 1. Display the current date. 2....

Write an assembly program that displays the following two options: 1. Display the current date. 2. Enter a date for a meeting and display remaining days. If the user selects the first option, the program should display the current date in dd/mm/yyyy format. If the user selects the second option, the program asks the user to enter a date for a meeting within year 2020 (in decimal) in dd/mm format. The program then calculates and displays the number of days remaining for the meeting (in decimal).

Solutions

Expert Solution

Program for the given question:

.MODEL SMALL

.STACK 100H

.DATA

PROMPT DB 'Current System Time is : $'

TIME DB '00:00:00$' ; time format hr:min:sec

.CODE

MAIN PROC

MOV AX, @DATA ; initialize DS

MOV DS, AX

LEA BX, TIME ; BX=offset address of string TIME

CALL GET_TIME ; call the procedure GET_TIME

LEA DX, PROMPT ; DX=offset address of string PROMPT

MOV AH, 09H ; print the string PROMPT

INT 21H   

LEA DX, TIME ; DX=offset address of string TIME

MOV AH, 09H ; print the string TIME

INT 21H   

MOV AH, 4CH ; return control to DOS

INT 21H

MAIN ENDP

;----------- Definitions of procedure -----------;

;----------------- GET_TIME ----------------;

GET_TIME PROC

; this procedure will get the current system time

; input : BX=offset address of the string TIME

; output : BX=current time

PUSH AX ; PUSH AX onto the STACK

PUSH CX ; PUSH CX onto the STACK

MOV AH, 2CH ; get the current system time

INT 21H

MOV AL, CH ; set AL=CH , CH=hours

CALL CONVERT ; call the procedure CONVERT

MOV [BX], AX ; set [BX]=hr , [BX] is pointing to hr

; in the string TIME

MOV AL, CL ; set AL=CL , CL=minutes

CALL CONVERT ; call the procedure CONVERT

MOV [BX+3], AX ; set [BX+3]=min , [BX] is pointing to min

; in the string TIME

MOV AL, DH ; set AL=DH , DH=seconds

CALL CONVERT ; call the procedure CONVERT

MOV [BX+6], AX ; set [BX+6]=min , [BX] is pointing to sec

; in the string TIME

  

POP CX ; POP a value from STACK into CX

POP AX ; POP a value from STACK into AX

RET ; return control to the calling procedure

GET_TIME ENDP   

; end of procedure GET_TIME

;******Program to select another date from calender******;

.model tiny

.data

Apr db " April 2017 ",13,10

db "Sun Mon Tue Wed Thu Fri Sat",13,10

db " 1 ",13,10

db " 2 3 4 5 6 7 8 ",13,10

db " 9 10 11 12 13 14 15 ",13,10

db "16 17 18 19 20 21 22 ",13,10

db "23 24 25 26 27 28 29 ",13,10  

db "30 ",13,10,0

May db " May 2017 ",13,10

db "Sun Mon Tue Wed Thu Fri Sat ",13,10

db " 1 2 3 4 5 6 ",13,10

db " 7 8 9 10 11 12 13 ",13,10

db " 14 15 16 17 18 19 20 ",13,10

db " 21 22 23 24 25 26 27 ",13,10

db " 28 29 30 31 "

.code

org 100h

print :

mov ah,9

int 21h

ret

end print

start:

lea dx,Apr  

call print

lea dx,May  

call print

mov ah, 4ch

int 21h

end start

Output of the above program:

Apr 17 '17 at 23:01


Related Solutions

Part 1 Write a program that displays a frame containing two labels that display your name,...
Part 1 Write a program that displays a frame containing two labels that display your name, one for your first name and one for your last. Experiment with the size of the window to see the labels change their orientation to each other. USE FIRST NAME: Aya LAST NAME: KAYED. SEND THE CODE IN THE EXACT FORMAT FOR JAVA ECLIPSE. I WILL COPY AND PASTE THE CODE SO I CAN RUN IT. Part 2 Propose and solve your own digital...
Assignment Description: Write a MIPS assembly language program that adds the following two integers and displays...
Assignment Description: Write a MIPS assembly language program that adds the following two integers and displays the sum and the difference. In the .data section, define two variables num1 and num2 both words. Initialize num1 to 92413 10 and num2 to D4B 16 (use 0xD4B to initialize, Note that D4B is a hexadecimal number). Your main procedure/function should load the values of num1 and num2 into two temporary registers, and display them on the console window. Then add the values...
Using python Write a program that displays all of states in the U.S. and display each...
Using python Write a program that displays all of states in the U.S. and display each state that begins with the letter A.
(Display a Circle and Its Attributes) Write a program that displays a circle of random size...
(Display a Circle and Its Attributes) Write a program that displays a circle of random size and calculates and displays the area, radius, diameter and circumference. Use the following equations: diameter = 2 × radius, area = π × radius2, circumference = 2 × π × radius. Use the constant Math.PI for pi (π). All drawing should be done on a subclass of JPanel, and the results of the calculations should be displayed in a read-only JTextArea.
Write an assembly program that lets the user to input only the word MASM and displays...
Write an assembly program that lets the user to input only the word MASM and displays invalid input for any other user inputs.
ACTIVITY #1: Defining Strings √ Write an assembly program that display your name, your id, and...
ACTIVITY #1: Defining Strings √ Write an assembly program that display your name, your id, and your college name on the screen. √ Remember: the format of the assembly program should be like this. TITLE your title (FileName.asm) .MODEL FLAT .386 .STACK 64 .DATA str1 DB "My name: Essam Alnatsheh",13,10,'$' .CODE main PROC mov ax,@data mov ds,ax mov ah,09h mov dx, offset str1 int 21h ​mov ah,4Ch​​ ; terminate process ​mov al,0​​ ; return code ​int 21h main ENDP END...
Write an 8051-assembly language program for the interfacing of ADC0804 and LM35 to display the room...
Write an 8051-assembly language program for the interfacing of ADC0804 and LM35 to display the room temperature on 16x2 LCD (10marks) please note that the program should be interfacing with ADC0804.
Question 1: Write an AVR program to display text on a 2-line WH2002 LCD display based...
Question 1: Write an AVR program to display text on a 2-line WH2002 LCD display based on the HD44780 controller. Apply the following: The LCD instruction/data bus is connected to PORTD, and control bus is connected to PORTB (RS is connected to PB0, R/W to PB1, E to PB2). Use the #define command to name PORTD as Display_port. Use the #define command to name PORTB as Control_port. The displayed information is stored in the microcontroller Flash ROM (maximum size of...
Write a menu-driven C++ program with two options: 1) Is it odd or even? 2) End...
Write a menu-driven C++ program with two options: 1) Is it odd or even? 2) End Program.The user can only input a positive integer (0 does not count) and if the input is not a positive integer the program must state "Invalid Input." The program must determine whether the input is even or odd. The program must use functions and can only use the iostream and iomanip libraries. Note: The program must loop until the 2nd menu option is chosen.
Write an MSP430 assembly language program that implements the following 2 algorithms: 2) a macro called...
Write an MSP430 assembly language program that implements the following 2 algorithms: 2) a macro called "vdot" that calculates the "dot product" of two vectors "a" and "b", implemented as “arrays” (following the “C” language convention), of 3 elements. the macro should receive 2 pointers to the first element of each vector and return the result in R13.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT