This web site exists to document my adventures in writing software emulators for old computer hardware. So far, I have completed (sort of) a Commodore PET emulation and am working on a Sinclair Spectrum emulation.
In which I continue my war against associated values In my previous post, I ended by trying to eliminate the CompiledWord cases that use associated values. These are: I’ve got rid of the last of these, but it was a difficult struggle. I did it by introducing a new word .jsr similar to .pushNext. So, … Continue reading My Fifth Rethink on Execution Tokens
In which we refactor compiled words again It’s probably come to your attention that I now have a file called MyForth+Primitives.swift that contains two enormous switch statements. Frankly, I think these need to go away. The easiest way – well, the easiest I’ve thought of – would be make CompiledWord map to Int with a … Continue reading My Forth Rethink on Execution Tokens
In which I simplify the execution cycle Every word now has an execution token and most words are interpreted using the function execute(token:,wordStream:,index:, output:). There are still a couple of words that have to be executed outside of this due to their CompiledWord having an associated value. Thus we have this ugly bit of code: … Continue reading Forth: Cleaning up the execute loop
In which I refactor word lists and primitives I’ve made a lot of progress with the core test suite, but unfortunately, I have come to the test case for ‘ and EXECUTE. These tests assume you can put an execution token on the data stack. An execution token is a number which refers to a … Continue reading Go Forth and Execute