Вы находитесь на странице: 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

Вам также может понравиться