I’m trying to make some graphics in Processing that look just like what I’d get on an Apple //e. I think the info I seek is in the ROM disassembly but I can’t find anything by googling. I'm also interested in the algorithms behind other Applesoft Basic commands.
You can find the hi-res drawing code in an Applesoft disassembly. HPLOT starts at $F6FE.
The ROM code is optimized for size, and parts are tricky to sort out. If you want something a bit more straightforward, you can find Applesoft-ish line drawing in fdraw. Some commentary on how Applesoft's line drawing code sets bits on the hi-res screen can be found in the documentation.
One difference between Applesoft's routines and a typical Bresenham implementation is called out in the fdraw docs:
The Applesoft routine isn't quite the same as the standard Bresenham algorithm, because it doesn't move diagonally. Consider a line from (0,0) to (50,10) -- gently sloping down and to the right. The standard algorithm would plot exactly 51 pixels, one in each horizontal position. The "pen" always moves one pixel right, but sometimes also moves down.
In Applesoft, the "pen" can move either right or down, but can't do both at once. This results in lines that feel thin when near horizontal or vertical, but become thicker as they approach 45 degrees. This reduces performance, because Applesoft draws twice as many pixels for a diagonal line as the basic algorithm. It can also be visually jarring when animated, because lines get very thick when near diagonal.
The routines are documented in the Programmers Aid #1 manual
https://archive.org/details/programmers-aid-1/page/n81
These are basically the same as the ones in the Applesoft ROM. They might use different zero page locations and won't handle floating point numbers but they are the same algorithms.
HCOLOR=3: HPLOT 0,0 to 279,191
. – fadden Aug 13 '19 at 22:28