How can the MARIE processor be used to count the number of zeroes in user input?

  • Thread starter Thread starter twoski
  • Start date Start date
  • Tags Tags
    Programming
Click For Summary
The discussion focuses on writing a MARIE program to count the occurrences of '0' in a sequence of decimal digits input by the user, storing the result in a designated memory location. Participants express confusion about how to check for '0' given the limitations of the MARIE processor, which only allows addition and subtraction. The use of the SKIPCOND instruction is suggested as a potential solution to facilitate checking for '0'. The conversation emphasizes the need to handle non-digit inputs to terminate the counting process. Overall, the thread seeks guidance on effectively implementing the counting logic within the constraints of the MARIE architecture.
twoski
Messages
177
Reaction score
2

Homework Statement



Write a MARIE program that repeatedly receives a sequence of decimal digits (one digit at a time) and counts the number of occurrences of ‘0’ and stores it in memory location Count until a non-digit is received. Assemble and run your program using the MARIE simulator

Homework Equations



http://www.edwardbosworth.com/CPSC2105/Lectures/Slides_05/Chapter_04/MARIE_Organization.htm

The Attempt at a Solution



I start with reading user input, but how do i check how many zeroes are in the input if i can only add/subtract values?
 
Physics news on Phys.org
twoski said:
I start with reading user input, but how do i check how many zeroes are in the input if i can only add/subtract values?
The MARIE processor also has a SKIPCOND instruction, how could you make use of that?
 

Similar threads

  • · Replies 2 ·
Replies
2
Views
5K
Replies
3
Views
2K
  • · Replies 22 ·
Replies
22
Views
5K
  • · Replies 7 ·
Replies
7
Views
3K
  • · Replies 7 ·
Replies
7
Views
3K
  • · Replies 6 ·
Replies
6
Views
5K
  • · Replies 15 ·
Replies
15
Views
6K
Replies
11
Views
5K
  • · Replies 8 ·
Replies
8
Views
7K
  • · Replies 2 ·
Replies
2
Views
2K