SHARE
TWEET

Untitled

a guest Dec 9th, 2019 80 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. org 0
  2.  
  3. Main, input choice
  4.     store choice
  5.     load choice
  6.     output
  7.     /check if user wants to add
  8.     load choice
  9.     subt Addition
  10.     skipcond 000
  11.     jns Add
  12.    
  13.     /check if user wants to subtract
  14.     load choice
  15.     subt Subtraction
  16.     skipcond 000
  17.     jns Sub
  18.     /check if user wants to multiply
  19.     load choice
  20.     subt Multiplication
  21.     skipcond 000
  22.     jns Mult
  23.     /check if user wants to exit
  24.     load choice
  25.     add one
  26.     skipcond 400
  27.     jump Main
  28.     halt
  29. TakeInput, hex 000
  30.     input num1
  31.     store num1
  32.     input num2
  33.     store num2
  34.     jumpI TakeInput
  35.  
  36. Add, hex 000
  37.     load choice
  38.     subt Addition
  39.     skipcond 400
  40.     jumpI Add
  41.     jump AddLoop
  42. AddLoop, input num1
  43.     store num1
  44.     load num1
  45.     add one
  46.     skipcond 400
  47.     jump AddTwo
  48.     jns ResetReturn
  49.     jumpI Add
  50.    
  51. AddTwo, load num1
  52.     add return
  53.     store return
  54.     load return
  55.     output
  56.     jump AddLoop
  57.  
  58. Sub, hex 000
  59.     load choice
  60.     subt Subtraction
  61.     skipcond 400
  62.     jumpI Sub
  63.     jump SubLoop
  64. SubLoop, input num1
  65.     store num1
  66.     load num1
  67.     add one
  68.     skipcond 400
  69.     jump SubOne
  70.     jns ResetReturn
  71.     jns unlockSubtraction
  72.     jumpI Sub
  73. SubOne, load lockSub
  74.     subt one
  75.     skipcond 000
  76.     jump SubTwo
  77.    
  78.     load num1
  79.     store return
  80.     load return
  81.     output
  82.     jns lockSubtraction
  83.     jump SubLoop
  84. SubTwo, load return
  85.     subt num1
  86.     store return
  87.     load return
  88.     output
  89.     jump SubLoop
  90.  
  91. Mult, hex 000
  92.     load choice
  93.     subt Multiplication
  94.     skipcond 400
  95.     jumpI Mult
  96.  
  97.     jns TakeInput
  98.     jns ResetReturn /reset the return value
  99.     jump MultLoop
  100. MultLoop, load num1
  101.     add return
  102.     store return
  103.     load num2
  104.     subt one
  105.     store num2
  106.     skipcond 400
  107.     jump MultLoop
  108.     load return
  109.     output
  110.     jumpI Mult
  111.  
  112. /reset the return variable
  113. ResetReturn, hex 000
  114.     load zero
  115.     store return
  116.     jumpI ResetReturn
  117. /unlock subtraction
  118. unlockSubtraction, hex 000
  119.     load zero
  120.     store lockSub
  121.     jumpI unlockSubtraction
  122. /lock subtraction
  123. lockSubtraction, hex 000
  124.     load one
  125.     store lockSub
  126.     jumpI lockSubtraction
  127.  
  128. num1, dec 0
  129. num2, dec 0
  130. return, dec 0
  131. choice, dec 0 /User choice
  132. zero, dec 0
  133. one, dec 1
  134. lockSub, dec 0
  135. Addition, dec 43
  136. Subtraction, dec 45
  137. Multiplication, dec 42
  138. Division, dec 47
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top