Answer to Question #323319 in Assembler for Ahmed

Question #323319

a) Write an assembly program using MARIE's assembly Instruction set that prompts the user to enter a non-negative integer that is less than 10. The program should include a subroutine that keeps prompting until a valid value is obtained. When a valid number is entered, it will be displayed. (Hint: Use JNS & JUMPI instructions to implement the subroutine) N.B: You should include the MARIE code in your Answer, with an explanation of each instruction in your code beside it (not a screenshot!). Example: Subt One /Subtract 1 from AC Your included code should be ready to be tested by your instructor. b) Add a screenshot of the simulation, showing the result (A screenshot of the MARIE Simulator window after running the program). Instructions: - Use “ORG” instruction to start your program at address equivalent to 25610. - Use your last university ID number to input the value of X. For example, if your ID is1915161678234, then you will use the number 4 as the value of x. -


1
Expert's answer
2022-04-04T16:11:58-0400
    ORG    256        
start,     JnS     Print       / call Print
 
     INPUT            / get value N
    STORE        N    / save N
    SUBT        N10        / compare with 10
    SKIPCOND    00        / if N < 10 then OK
    JUMP        start        / else go to back and try again

    LOAD        N        / restore N
    ADD  N0                / N to ASCII
    OUTPUT                / display N

    HALT

Print,   hex     256      
         load        MsgN    
         output
         load        Msg     
         output
 
     JumpI   Print      / return from Print

MsgN,   dec         78        / 'N'
Msg,    dec         58       / ':'

N,       dec  0
N10,     dec  10
N0,      dec  48 




Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS