4 ms·
I wrote a FORTRAN IV (subset) compiler for the Apple ][ once. It used fixed-point arithmetic and the compiler output was subroutine threaded. E.g. a=b+c would t
by nils-m-holm 8y ago
I wrote a FORTRAN IV (subset) compiler for the Apple ][ once. It used fixed-point arithmetic and the compiler output was subroutine threaded. E.g. a=b+c would translate to
jsr load
address of b
jsr load
address of c
jsr add
jsr store
address of a
Like in the method described by the author, subroutines would fetch their arguments (if any) from the code and adjust the return address. I have no idea how fast it was, but it was certainly faster than doing the same computations in Applesoft BASIC.
- fallat 8y agoI don't want to say I invented a FORTRAN variant, but I also wrote a stack-based arithmetic engine for gbcpu (similar to z80/8080 but NOT THE SAME). It was used like: ld hl, myNBitSizedVar push hl ld hl, myNBitSizedVar2 push hl call addNBitSizedVar Result returned is a pointer to the result in hl. This way I could chain many operations.