LM3000 Square Root Program

From BenningtonWiki

Jump to: navigation, search
00  MOV  R0, #81			the square number; change this
01  MOV  R1, #1				the start of the sequence of odd numbers
02  MOV  R2, #1				the square root
  
03  MOV  A, R0				the square number - odd number
04  MOV  B, R1
05  SUB  R0
06  BMZ  0D				done if negative or zero
  
07  MOV  A, #2				next odd number in series
08  ADD  R1
09  MOV  A, R2				increment square root
0A  MOV  B, #1
0B  ADD  R2
0C  BRA  03				and keep looking

0D  BRA  0D				done, halt

This is the same algorithm used by ENIAC in 1946. ENIAC ran at 5KHz and could do an add or subtract in one cycle.

Personal tools