Close

Fibonacci

A project log for Gigatron TTL microcomputer

Just because! A home computer without microprocessor

Marcel van KervinckMarcel van Kervinck 05/11/2017 at 00:332 Comments

With the ALU verified and the RAM connected, today the breadboard determined that the first 8-bit Fibonacci number is 144.

0000 0000  ld   $00    ; outer loop
0001 c200  st   [$00]  ; a=0
0002 0001  ld   $01    ; b=1
0003 fc0a  bra  $0a
0004 0200  nop         ; (pipelining)
0005 0100  ld   [$00]  ; inner loop
0006 c202  st   [$02]  ; tmp=a
0007 0101  ld   [$01]
0008 c200  st   [$00]  ; a=b
0009 8102  adda [$02]
000a c201  st   [$01]  ; b+=tmp
000b 1a00  ld   ac,out ; emit next Fibonacci number
000c f405  bge  $05    ; repeat if bit7 is still 0
000d 0200  nop         ; (pipelining)
000e fc00  bra  $00    ; start over again
000f 0200  nop         ; (pipelining)

The inner loop runs 12 times (1, 1, 2, 3, 5, .... 89, 144). The entire thing takes 110 cycles. Both are exactly as expected. It can be done faster but I didn't optimise the assembly to maintain my sanity.

I also hooked up a cute little MCP100-475 to the program counter reset line. This gives a controlled reset during power up. The circuit is now 90% wired. Only the high memory address control and some diodes are missing for full functionality.

Discussions

Andrew Starr wrote 05/11/2017 at 10:00 point

Nice work :)

  Are you sure? yes | no

Marcel van Kervinck wrote 05/11/2017 at 11:36 point

Thank you! Last two weeks were an uphill struggle, but it should be a much easier ride from here on.

  Are you sure? yes | no