Hi,
I ported the logarithmic floating point numbers from my euro-forth presentation for use with volksForth. However these rely on having efficient bit-shift instructions available.
Here is an implementation of LSHIFT and RSHIFT that appears to be pretty efficient. Is there any reason e.g. WRT memory resource constraints that would prevent us from adding these to vf-cbm-core.fth?
\ 6502 optimized bit-shift dk06aug26
Code lshift ( x1 b8 -- x2)
iny SP )Y lda N sta
SP X) lda 0<> ?[
tax iny
SP )Y lda
[[ N asl .a rol dex 0= ?]
SP )Y sta dey
]? dey
SP 2inc N lda Puta jmp
end-code
Code rshift ( x1 0..15 -- x2)
iny SP )Y lda N sta
SP X) lda 0<> ?[
tax iny
SP )Y lda
[[ .a lsr N ror dex 0= ?]
SP )Y sta dey
]? dey
SP 2inc N lda Puta jmp
end-code
Hi,
I ported the logarithmic floating point numbers from my euro-forth presentation for use with volksForth. However these rely on having efficient bit-shift instructions available.
Here is an implementation of LSHIFT and RSHIFT that appears to be pretty efficient. Is there any reason e.g. WRT memory resource constraints that would prevent us from adding these to vf-cbm-core.fth?