Skip to content

Instantly share code, notes, and snippets.

@ghostdevv
Created November 17, 2020 15:57
Show Gist options
  • Save ghostdevv/911555b15c349c31a6d0ac473ba2fbf9 to your computer and use it in GitHub Desktop.
Save ghostdevv/911555b15c349c31a6d0ac473ba2fbf9 to your computer and use it in GitHub Desktop.
Multiplication in Assembly Language (Little Man Computer - http://www.peterhigginson.co.uk/LMC/ )
// Get both numbers and store them
INP
STA NUM
INP
STA TIMES
// Multiplication Loop
LOOP LDA TOTAL
ADD NUM
STA TOTAL
LDA TIMES
SUB ONE
BRZ END
STA TIMES
BRA LOOP
// End loop and output number
END LDA TOTAL
OUT
HLT
// Declarations
NUM DAT
TIMES DAT
TOTAL DAT
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment