Question

Write a machine language program to input two one-digit numbers ranging from 0 to 4 (using...

Write a machine language program to input two one-digit numbers ranging from 0 to 4 (using the character input instruction), add them, and then output the single digit sum (using the character output instruction). Execute your program in the PEP/8 simulator. Example Input: 43 (this is the numbers 4 and 3. Remember, this is two ASCII characters when inputted into your program) Output: 7 (ASCII character 55dec)

0 0
Add a comment Improve this question Transcribed image text
Answer #1
  1. 0000 4900FE ;Get input from the user and store it @ 00FE
  2. 0003 4900FF ;Get input from the user and store it @ 00FF
  3. 0006 910022 ;Convert second input to decimal
  4. 0009 F100FA ;Store second decimal
  5. 000C D100FE ;Load first input into memory
  6. 000F 910022 ;Convert first input to decimal
  7. 0012 7100FA ;Add two numbers
  8. 0015 A10020 ;convert sum to character
  9. 0018 F1001F ;store the character
  10. 001B 51001F ;output the character
  11. 001E 00 ; stop
  12. 001F 00 ; character to output
  13. 0020 0030 ; convert mask to ASCII from decimal
  14. 0022 000F ; convert mask to decimal from ASCII
  15. Hex Version for the Loader in Pep/8 simulator
  16. 49 00 FE 49 00 FF 91 00 22 F1 00 FA D1 00 FE 91 00 22 71 00 FA A1 00 20 F1 00 1F 51 00 1F 00 00 00 30 00 0F zz
Add a comment
Know the answer?
Add Answer to:
Write a machine language program to input two one-digit numbers ranging from 0 to 4 (using...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Using the MARIE computer assembly language, write a program that computes the following expression: z =...

    Using the MARIE computer assembly language, write a program that computes the following expression: z = a * b * c. The computer will read in the input values a, b, and c from the keyboard and the final result (z) have to be displayed. In addition, every time an input value is read in, it must be displayed on the screen. Remember that the instruction set does not have an instruction to execute multiplication. The program must be tested...

  • MIPS ASSEMBLY PROGRAM: PLEASE Write in MIPS Assembly language. Take strings as input and calculate and...

    MIPS ASSEMBLY PROGRAM: PLEASE Write in MIPS Assembly language. Take strings as input and calculate and print a simple checksum for each string. Make your string long enough to hold 50 characters. Don't forget to leave space for the null byte. Our checksum algorithm will produce a value which you can print with the syscall for printing a character. Stop reading strings when the user enters ".". The syscall to read a string (sycall code 8) adds a newline to...

  • Write a TM (Turing Machine) program that adds two base two numbers. Input is two nonnegative inte...

    Write a TM (Turing Machine) program that adds two base two numbers. Input is two nonnegative integers in base 2 with a plus sign between them. Output is their sum in base 2, with nothing else left on the tape. So first decrement, then increment. Use an online Turing Machine Simulator to see how it works. Use the following language for the program: current state, read symbol, next state, write symbol, direction [directions are (< left, > right, s stay)]...

  • ; original codes provided as following .ORIG x3000        ; begin at x3000 ; input two numbers...

    ; original codes provided as following .ORIG x3000        ; begin at x3000 ; input two numbers IN                               ; input an integer character (ascii) {TRAP 23} LD R3, HEXN30 ; subtract x30 to get integer ADD R0, R0, R3 ADD R1, R0, x0 ; move the first integer to register 1 IN                               ; input another integer {TRAP 23} ADD R0, R0, R3 ; convert it to an integer ; add the numbers ADD R2, R0, R1 ; add the two integers...

  • In basic c develop the code below: (a) You will write a program that will do...

    In basic c develop the code below: (a) You will write a program that will do the following: prompt the user enter characters from the keyboard, you will read the characters until reading the letter ‘X’ You will compute statistics concerning the type of characters entered. In this lab we will use a while loop. We will read characters from stdin until we read the character ‘X’. Example input mJ0*5/]+x1@3qcxX The ‘X’ should not be included when computing the statistics...

  • Using the MARIE computer assembly language, write a program that computes the following expression: z ß...

    Using the MARIE computer assembly language, write a program that computes the following expression: z ß (a * b) * (c * d). The computer will read in the input values a, b, c, and d from the keyboard, and the final result (z) has to be displayed. In addition, every time an input value is read in, it must be displayed on the screen. Each time a multiplication of two numbers is needed, it has to be done using...

  • This is Python The program should accept input from the user as either 7-digit phone number...

    This is Python The program should accept input from the user as either 7-digit phone number or 10-digit. If the user enters 7 characters, the program should automatically add "512" to the beginning of the phone number as the default area code. Dash (hyphen) characters do not count in input character count, but must not be random. If the user enters dashes the total character count must not exceed 12. The program should not crash if the user enters invalid...

  • Write a TM (Turing Machine) program that adds two base two numbers. Input is two nonnegative...

    Write a TM (Turing Machine) program that adds two base two numbers. Input is two nonnegative integers in base 2 with a plus sign between them. Output is their sum in base 2, with nothing else left on the tape. So first decrement, then increment. Use the following language for the program: current state, read symbol, next state, write symbol, direction [directions are (< left, > right, s stay)] Here's an example program: 1,B,2,#,> 2,B,2,B,> 2,X,2,X,> 2,_,3,X,> 3,_,4,X,> 4,_,5,X,< 5,X,5,X,<...

  • MIPS programming question Problem 1: Write a program that asks the user to input a string...

    MIPS programming question Problem 1: Write a program that asks the user to input a string (or no more than 50 characters). Your program should then output the length of the string. The string length should be determined using a separate function strlen that will accept the address of the string and return its length. For the purposes of this exercise, the length of a string will be defined as the number of non-null and non-newline characters until either the...

  • (c.) What is an assembler language and what are the advantages of using one in comparison...

    (c.) What is an assembler language and what are the advantages of using one in comparison to machine code? (6 marks) (d.)The Little Man model of a computer system uses a single-digit op-code and 2-digit memory addressing and has the following instructions defined where the address portion is shown as Op. Code Description 1xx 2xx Add value in memory to accumulator Subtract value in memo Store accumulator value to memo Load value in memory to accumulator Branch to memory location...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT