# Enter assembler code here # # To add comments begin lines with # # Code lines have 3 entries separated by tabs # > First an optional label, # > second an instruction mnemonic, and # > third an address label if required. # # Valid mnemonics are: # HLT, ADD, SUB, STO, LDA, # BR, BRZ, BRP, IN, OUT, DAT 1 IN 2 STO a 3 IN 4 STO b start LDA b 6 BRZ end ###branch to end if value is zero 7 SUB one ###subtract one from b 8 STO b 9 LDA count 10 ADD a 11 STO count 12 BR start end LDA count 13 OUT 14 HLT a DAT 000 ###first number b DAT 000 ###number of interactions count DAT 000 one DAT 001