Once, I wanted to draw lines on the screen. On a model III.
Man i fought and fought that code. You see, to get good old y=mx+b from a starting point and an end point, you have 2 cases. In one, m is <=1, you can loop with x. If m>1 then you have to loop on y. And I was convinced there was some clever way to do both cases with the same code! Drove me crazy for months!
Then I finally looked it up. Bresenham's Algorithm. Looks at m and then either loops on x or it loops on y. Don't be clever.
Tonight I was reminded of this...
So, there's an old 8080 cross assembler for unix that I use, asm80. There are others around, but asm80 does a better job of being compatible with CP/M's ASM.COM. Its insides were last touched in 2011, when a net.friend and I modernised the source enough for current gcc to be happy.
Then my net.friend ran out of spoons and I found a bad bug in asm80.
I tried to fix this. several times. it defeated me. Since it would work if I said "DB ('X'+80) " I just put up with it.
until tonight!
Every time I tried to fix this code I tried to be clever with it, and it never worked. So tonight I said, forget that! All I had to do, when db() found an opening quote, don't be clever. Just look 2 more characters ahead. If i see a closing quote I can just hand the whole thing off to expr(), otherwise the ascii handler gets it.
all right, as promised!
http://www.sdc.org/~goosey/unix/asm80-2020-05-08.tar.gz
asm80 unix cross assembler. Now handles DB pseudo ops of the style "DB 'X'+80H" correctly!
And it works!
There is some duplicate code. So what!? A 32bit unix box, even a pi1, can afford a hundred or so bytes.
That was my night well spent. Will upload new version tomorrow, ill post the url here.