A slow jonesforth port
Posted: Sat Sep 30, 2023 5:19 pm
Someone trapped me in the forth rabbit hole via this article (reader beware: https://ratfactor.com/forth/the_program ... tself.html )
This ended up with me writing a 16-bit 6502-based port of jonesforth. It's super slow (I recently discovered TaliForth is about 3x faster) but has been a great learning experience, and led to some interesting profiling visualization. Work in progress is at https://github.com/patricksurry/forth-6502
One of the main sources of slowness comes from too much overhead in 16-bit pointer manipulation.
For example I think I went too general in using 16-bit data and return stack pointers where a single page each would
likely be enough. What do people typically use for stack size in 16bit forth?
A question that's been bugging me: since the 65(C)02 only has indirect addressing indexed by y, is there any reasonably efficient way to copy between two offsets of the same indirect address? i.e. something which would be similar to followed by but obviously that's not legal. all of I can think of is copying the indirect address value into some self modifying code that uses direct indexing but that seems pretty icky.
This ended up with me writing a 16-bit 6502-based port of jonesforth. It's super slow (I recently discovered TaliForth is about 3x faster) but has been a great learning experience, and led to some interesting profiling visualization. Work in progress is at https://github.com/patricksurry/forth-6502
One of the main sources of slowness comes from too much overhead in 16-bit pointer manipulation.
For example I think I went too general in using 16-bit data and return stack pointers where a single page each would
likely be enough. What do people typically use for stack size in 16bit forth?
A question that's been bugging me: since the 65(C)02 only has indirect addressing indexed by y, is there any reasonably efficient way to copy between two offsets of the same indirect address? i.e. something which would be similar to
Code: Select all
lda (SP),yCode: Select all
sta (SP), x