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.
If you said " DB 'hello world'" it was fine. If you said "DB 'H'" it was fine. If you said "DB 67" it was fine. If you said "DB 60+7" it was fine
but if you said "DB 'X'+80" it threw an error.
Hunting through the code was easy. The "db" handler looks at each element. If source started with a qoute, db() called the handler for ascii blocks, which reads and emits the bytes until it finds a closing quote, and then db() would freak when it found an operator instead of a comma or eol.
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.
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!
asm80 unix cross assembler. Now handles DB pseudo ops of the style "DB 'X'+80H" correctly!
"I appreciate SDF but it's a general-purpose server and the name doesn't make it obvious that it's about art." - Eugen Rochko