1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Norma-Jean [14]
3 years ago
8

write a mips program that runs on SPIM that allows the user to enter the number of hours, minutes and seconds and then prints ou

t the total time in seconds.
Computers and Technology
1 answer:
adell [148]3 years ago
7 0

Answer:

The mips program will be as:

.MODEL SMALL

.STACK 100H

.DATA

  PROMPT_1  DB  \'Enter the time in seconds up to 65535 = $\'

  PROMPT_2  DB  0DH,0AH,\'The time in hh:mm:ss format is = $\'

  SEPARATOR DB  \' : $\'

.CODE

  MAIN PROC

    MOV AX, @DATA                ; initialize DS

    MOV DS, AX

    LEA DX, PROMPT_1             ; load and display the string PROMPT_1

    MOV AH, 9

    INT 21H

    CALL INDEC                   ; call the procedure INDEC

    PUSH AX                      ; puah AX onto the STACK

    LEA DX, PROMPT_2             ; load and display the string PROMPT_2

    MOV AH, 9

    INT 21H

    POP AX                       ; pop a value from STACK into AX

    XOR DX, DX                   ; clear DX

    MOV CX, 3600                 ; set CX=3600

    DIV CX                       ; set AX=DX:AX\\CX , DX=DX:AX%CX

    CMP AX, 10                   ; compare AX with 10

    JGE @HOURS                   ; jump to label @HOURS if AX>=10

    PUSH AX                      ; push AX onto the STACK

    MOV AX, 0                    ; set AX=0

    CALL OUTDEC                  ; call the procedure OUTDEC

    POP AX                       ; pop a value from STACK into AX

    @HOURS:                      ; jump label

    CALL OUTDEC                  ; call the procedure OUTDEC

    MOV AX, DX                   ; set AX=DX

    PUSH AX                      ; push AX onto the STACK

    LEA DX, SEPARATOR            ; load and display the string SEPARATOR

    MOV AH, 9

    INT 21H

    POP AX                       ; pop a value from STACK into AX

    XOR DX, DX                   ; clear DX

    MOV CX, 60                   ; set CX=60

    DIV CX                       ; set AX=DX:AX\\CX , DX=DX:AX%CX

    CMP AX, 10                   ; compare AX with 10

    JGE @MINUTES                 ; jump to label @MINUTES if AX>=10

    PUSH AX                      ; push AX onto the STACK

    MOV AX, 0                    ; set AX=0

    CALL OUTDEC                  ; call the procedure OUTDEC

    POP AX                       ; pop a value from STACK into AX

    @MINUTES:                    ; jump label

    CALL OUTDEC                  ; call the procedure OUTDEC

    MOV BX, DX                   ; set BX=DX

    LEA DX, SEPARATOR            ; load and display the string SEPARATOR

    MOV AH, 9

    INT 21H

    MOV AX, BX                   ; set AX=BX

    CMP AX, 10                   ; compare AX with 10  

    JGE @SECONDS                 ; jump to label @SECONDS if AX>=10

    PUSH AX                      ; push AX onto the STACK  

   MOV AX, 0                    ; set AX=0

    CALL OUTDEC                  ; call the procedure OUTDEC

    POP AX                       ; pop a value from STACK into AX

    @SECONDS:                    ; jump label

    CALL OUTDEC                  ; call the procedure OUTDEC

   MOV AH, 4CH                  ; return control to DOS

    INT 21H

  MAIN ENDP

You might be interested in
What is the meaning of N.W.O​
Likurg_2 [28]

Answer:

The New World Order (NWO) in conspiracy theories is the hypothesis of a secretly emerging totalitarian world government.

8 0
3 years ago
What happens in the development phase of the software development life cycle?
Olin [163]

Answer: Planning the solution, look and feel of the software interface

5 0
2 years ago
Declare and initialize the following variables: int monthOfYear, initialized to the value 11 long companyRevenue, initialized to
lianna [129]

Answer:

Following are the declaration and the initialization of variable

int monthOfYear=11;  // variable declaration of integer

long companyRevenue=5666777; // variable declaration of long

int firstClassTicketPrice=6000;  // variable declaration of int

long totalPopulation=1222333; // variable declaration of long

Explanation:

Following are the description of Statement

  • Declare a variable " monthOfYear "  as integer type and initialized  11 to them .
  • Declare a variable " companyRevenue "  as long type and initialized  5666777 to them .
  • Declare a variable "  firstClassTicketPrice"  as integer type and initialized 6000 to them
  • Declare a variable " totalPopulation "  as Long type and initialized 1222333  to them .
4 0
3 years ago
The which command _________________. a. can only be used to search for executables b. searches for a file in all directories sta
dsp73
Answer: D. Searches for a file only in the directories that are in the path variable
6 0
2 years ago
Which of the following statements is true?
jeka57 [31]

Answer: Constructors can specify parameters but not return types.

Explanation:

public class Student {

 int roll_no;

 public Student(int a) {

   roll_no = a;

 }

public static void main(String[] args) {

   Student abs = new Student(10);

   System.out.println(abc.roll_no);

 }

}

In the above code we have illustrated the working of constructors. We have a class with the name Student. then a constructor is created of the class called as the class constructor. In the main we create an object of the class and with this object we invoke the constructor and also pass a parameter. Here in the code we are passing the roll no of the student.

So we can say that constructor is called during the runtime when the object created invokes the constructor so a constructor can have many arguments but it does not have a return type.

7 0
3 years ago
Other questions:
  • What can be used to describe and document the analysis and design of complex software systems?
    14·1 answer
  • What does Josh Silverman name as the most important aspect of managing finances?
    10·2 answers
  • True or false questions. If a statement is false, you must explain the reason why it is false: a). Suppose that TCP is being run
    12·2 answers
  • Which line in the following program contains the prototype showDub function? 1 #include 2 using namespace std; 3 void showDub(in
    12·1 answer
  • Which two functions can be used with the math module?
    13·1 answer
  • Quick please, URGENT
    12·1 answer
  • Order the steps for accessing the junk email options in Outlook 2016
    9·2 answers
  • What are building blocks? Select three options.
    14·1 answer
  • Which characters are used in hump notion?
    12·1 answer
  • Understanding that protection of sensitive unclassified information is:
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!