0% found this document useful (0 votes)
77 views1 page

USING LOOPS in MARIE

This program performs different operations on the variable x depending on conditional tests. It begins by storing an input value in a, then loads and tests x against a. If x is less than a, it outputs a and increments x by 1, repeating the test. Otherwise, it checks if x is 0, and if so increments x by 2. If not, it subtracts 4 from x, checks if it is 0, and if not outputs and increments x by 1 before repeating the test.

Uploaded by

ceferinotan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
77 views1 page

USING LOOPS in MARIE

This program performs different operations on the variable x depending on conditional tests. It begins by storing an input value in a, then loads and tests x against a. If x is less than a, it outputs a and increments x by 1, repeating the test. Otherwise, it checks if x is 0, and if so increments x by 2. If not, it subtracts 4 from x, checks if it is 0, and if not outputs and increments x by 1 before repeating the test.

Uploaded by

ceferinotan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 1

Name: Ceferino Kevin A.

TanCourse: BS Electronics Engineering


EE 180.1 Section: M34
Machine Problem 2
org 010
input
store a
test, load x
subt a
skipcond 000
jump ENDIF
jump process

Start

process,

End

load x
skipcond 400
jump process2
load a
output
load x
add one
store x
jump test

process2,

load x
subt four
skipcond 000
jump process3
load x
add two
store x
jump test

process3,

load x
output
add one
store x
jump test

ENDIF, halt
x,
a,
one,
two,
four,

dec
dec
dec
dec
dec

0
0
1
2
4

Input Value
for a

NO

Test: is x < a?

YES
Output
Value for a

YES

Is x = 0?

NO
Change
x=x+1

Output
Value for x

Is x < 4?

NO
YES
Change
x=x+2

Change
x=x+1

You might also like