about summary refs log tree commit diff stats
path: root/uxntal/fib.tal
blob: 9b5cb99d943cff2498d44f4779ba6d356e222f08 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
( Fibonacci:
	A series of numbers where the next number 
	is made of the two numbers before it )

|0100 ( -> ) @reset

	#0000 INC2k ADD2k
	&loop
		( print ) DUP2 ,print JSR
		( linebreak ) #0a18 DEO
		ADD2k LTH2k ,&loop JCN
	( halt ) #010f DEO

BRK

@print ( short* -- )

	SWP ,&byte JSR
	&byte ( byte -- ) DUP #04 SFT ,&char JSR
	&char ( char -- ) #0f AND DUP #09 GTH #27 MUL ADD #30 ADD #18 DEO

JMP2r