This code is to calculate pi/4 from the infinite series for atan(1): (1-1/3)+(1/5-1/7)+(1/9-1/11)+(1/13-1/15)+... The terms inside () are calculated sequentially; the process continues until () is "small". In fact the series converges quite slowly: 1000 steps yields pi to 4 sigfigs. There are much faster ways of calculating pi on a computer; this is presented as a an example of assembly coding not a useful product. format: (4 enable bits)(hex:r on A bus)(hex:r on B bus)(hex: updated r on D bus) opcode ^^^^=(2x PC update, A bus valid, B bus valid, D bus valid) clr rA 0001xxA clr opcode mov r0 rB 1011x0B mov opcode small float mov r0 rC 1011x0C mov opcode 1.0 mov r0 rD 1011x0D mov opcode 2.0 mov rC r1 0011xC1 mov opcode mov r0 r9 1011x09 mov opcode 2 mov rF rE 0011xFE mov opcode add r9 rE rE 01119EE add opcode #note (rE) is address of following instruction finv rC r2 0011xC2 finv opcode #rC will be 1,3,5,7 fadd rC rD rC 0111CDC fadd opcode finv rC r3 0011xC3 finv opcode fsub r2 r3 r2 0111232 fsub opcode #e.g. 1/5-1/7 fadd r2 rA rA 01112AA fadd opcode fadd rC rD rC 0111CDC fadd opcode fcmp r2 rB 01102Bx 2 fcmp opcode = fsub opcode bpl rE 0011xEF plus condition mov rE rF opcode mov r0 rE 1011x0E mov opcode address to output pi store rA rE 0110CEx store opcode halt remark: this code actually calculates pi/4 to convert pi/4 to pi, I just need to increase the number in the binary exponent by 2 (to multiple by 100 in base 10 just add 2 to exponent in scientific notation. because the exponent starts in bit 53=2^52, I just need to add 2^53 to result: add rA r0 rA 2^53 even though done as an integer add, rA will have pi not pi/4 sum () 2.66666675 0.666666687 2.89523816 5.71428575E-02 2.97604609 2.02020202E-02 3.01707172 1.02564106E-02 3.04183960 6.19195029E-03 on step 1000: 3.14109325 1.24875100E-07