Program (Assembly Code)
INP STA NUM1 INP STA NUM2 LOOP LDA TOTAL ADD NUM1 STA TOTAL LDA NUM2 SUB ONE STA NUM2 BRP LOOP LDA TOTAL SUB NUM1 STA TOTAL OUT HLT NUM1 DAT NUM2 DAT ONE DAT 1 TOTAL DAT 0
Adding 2 inputs
Max of 2 inputs
Count down timer
Multiplying 2 inputs
Triangular Numbers
Factorial of...
Load
Translate »
Denary
Binary
Punched Tape
INP STA num1 INP ADD num1 OUT HLT num1 DAT
INP STA num1 INP STA num2 SUB num1 BRP pos LDA num1 OUT BRA exit pos LDA num2 OUT exit HLT num1 DAT num2 DAT
INP loop OUT STA count SUB one STA count BRP loop HLT one DAT 1 count DAT
INP STA NUM1 INP STA NUM2 LOOP LDA TOTAL ADD NUM1 STA TOTAL LDA NUM2 SUB ONE STA NUM2 BRP LOOP LDA TOTAL SUB NUM1 STA TOTAL OUT HLT NUM1 DAT NUM2 DAT ONE DAT 1 TOTAL DAT 0
loop LDA number ADD counter OUT STA number LDA counter ADD one STA counter LDA ten SUB counter BRP loop HLT counter DAT 1 number DAT 0 one DAT 1 ten DAT 10
INP STA final BRZ oneval SUB one STA iteration STA counter LDA final STA num mult LDA iteration BRZ end SUB one BRZ end LDA final ADD num STA final LDA counter SUB one STA counter SUB one BRZ next BRA mult next LDA final STA num LDA iteration SUB one STA iteration STA counter SUB one BRZ end BRA mult end LDA final OUT HLT oneval LDA one OUT HLT final DAT 0 counter DAT 0 one DAT 1 iteration DAT 0 num DAT 0