|
|
|
|
|
by lebuffon
1890 days ago
|
|
This is interesting from the standpoint of the different mentality of Forth coders. If they really needed a fast removal of 4 stack items they would first code what you did. Then after things were working they might replace droooop with something like this: ( Forth assembler psuedo-code follows) code droooop sp 4 cells addi, next, endcode
One instruction to move the CPU stack pointer.
Unthinkable to touch the stack pointer in most other environments but Toto we're not in Kansas. :)*Next, is the traditional name of the "return to Forth function" in threaded Forth. A return instruction would be used in a native code Forth. Carnal knowledge of the internals is required and used by Forth coders. |
|
Here's some Breshenham line code I first wrote in FORTH (Mitch Bradley's SunForth on a 68k Sun-2 with cg2 graphics board), then translated to 68k code (using the rpn FORTH assembler) -- the FORTH code is commented out before the corresponding assembly code:
https://donhopkins.com/home/archive/forth/cg/line.f
The cg2 board wasn't directly memory mapped -- it had a really weird way of selecting and accessing one row and one column at a time, which was kinda convenient for drawing lines and curves, and ropping blocks around, but nowhere as convenient as direct memory mapped access would have been.
https://donhopkins.com/home/archive/forth/cg/cg.f
I had to reverse engineer it from the map of the registers in this helpful include file:
https://donhopkins.com/home/archive/forth/cg/cg2reg.h