Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
|
|
@ -0,0 +1,18 @@
|
|||
; 8 bit version
|
||||
; IN : a = n (n <= 13, otherwise overflows)
|
||||
; OUT: a = FIB(n)
|
||||
|
||||
fib8: cp 2
|
||||
ret c ; if n < 2 then done
|
||||
|
||||
ld b,a
|
||||
dec b ; b = n - 1
|
||||
ld c,0 ; F0
|
||||
ld a,1 ; F1
|
||||
|
||||
f8_l: ld d,a
|
||||
add a,c
|
||||
ld c,d
|
||||
djnz f8_l
|
||||
|
||||
ret
|
||||
|
|
@ -0,0 +1,34 @@
|
|||
; 32 bit version
|
||||
; IN : a = n (n <= 47, otherwise overflows)
|
||||
; OUT: hlh'l' = FIB(n)
|
||||
|
||||
fib32: ld l,a ; lower bytes in the alt set
|
||||
ld h,0
|
||||
exx ; now in regular set
|
||||
ld hl,0
|
||||
cp 2
|
||||
ret c ; if n < 2 then done
|
||||
|
||||
dec a ; loopcount = n - 1
|
||||
ld bc,0
|
||||
exx ; now in alt set
|
||||
ld bc,0
|
||||
ld hl,1
|
||||
|
||||
f32_l: ld d,h
|
||||
ld e,l
|
||||
add hl,bc
|
||||
ld b,d
|
||||
ld c,e
|
||||
exx ; now in reg set
|
||||
ld d,h
|
||||
ld e,l
|
||||
adc hl,bc
|
||||
ld b,d
|
||||
ld c,e
|
||||
exx ; now in alt set
|
||||
dec a
|
||||
jr nz,f32_l
|
||||
|
||||
exx ; now in reg set
|
||||
ret
|
||||
Loading…
Add table
Add a link
Reference in a new issue