Question: Please use this example for the format of the response: # Code to compute a divided by b IN STO a IN STO b #

Please use this example for the format of the response:

# Code to compute a divided by b

IN

STO a

IN

STO b

# Keep subtracting a from b until you go negative

# Keep a count of how many times you do it

start LDA count

ADD one

STO count

LDA a

SUB b

STO a

BRP start

done LDA count

# Subtract one as we went one too far

SUB one

OUT

HLT

a DAT 000

b DAT 000

count DAT 000

one DAT 001

The following project needs to use this Little Man Computer instruction set:

ADD 1xx Add

SUB 2xx Subtract

STO 3xx Store

LDA 5xx Load

BR 6xx Branch

BRZ 7xx Branch on zero

BRP 8xx Branch on positive

IN 901 Input

OUT 902 Output

HLT 000 Halt or Stop

DAT Data storage location

The program needs 2 values of data entered at the start. First is East/West Green time and North/South green time. The notation of time really means the number of loops the code will do when in a given state. Also, a ~1/3 value of the N/S time needs calculated. These 3 values are stored for later use.

Since this is a real time program, it runs in a continuous loop. Referencing the attached flow chart, enter it when the state is "RRGR". You must set the output before entering this state, which is 251.

As you leave state "RRYR" input is required. The values are shown. Do not try to check them to be correct values. You don't have the code space and since this is hardware driven, they will always be correct.

The loop time for the states that have a yellow is 3 loops.

Please use this example for the format of the response: # Code

to compute a divided by b IN STO a IN STO b

, project 3 Table.pdf. Adobe Acrobat Reader DC File Edit View Window Help e Tools Sign In Hom Project 3 Table.pdfx STATE NORTH LIGHT SOUTH LIGHT EAST/WEST LIGHT LEFT TURN RRGR RED RRYR RED GGRR GREEN YYRRYELLOW RBRG RED RBRYRED BRRG GREEN BRRY GREEN RRRG RED RRRYRED RED RED GREEN YELLO GREEN GREEN RED RED RED RED GREEN YELLOW RED RED RED RED RED RED RED RED RED RED RED RED GREEN YELLOW GREEN YELLOW GREEN YELLOW , project 3 Table.pdf. Adobe Acrobat Reader DC File Edit View Window Help e Tools Sign In Hom Project 3 Table.pdfx STATE NORTH LIGHT SOUTH LIGHT EAST/WEST LIGHT LEFT TURN RRGR RED RRYR RED GGRR GREEN YYRRYELLOW RBRG RED RBRYRED BRRG GREEN BRRY GREEN RRRG RED RRRYRED RED RED GREEN YELLO GREEN GREEN RED RED RED RED GREEN YELLOW RED RED RED RED RED RED RED RED RED RED RED RED GREEN YELLOW GREEN YELLOW GREEN YELLOW

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!