Ben said:
DDJ didn't publish that? I now remember (I haven't even though of
this in years!) that I wrote and DDJ published a semicoherent rant
about the C language (I had the bad luck of learning C just before the
ANSI standard came out), and once I saw where my published letter took
most of a page, I wished I'd submitted it as a "guest editorial" or
some such and gotten paid for it!
About your code, there's a routine in the Apple ][ ROM (source
listing in the "Red Book" included with early ]['s) to do the same
thing with a 6502 (its branch and call instructions are almost
identical to the HC11), and the code looks almost identical to yours.
I'm not accusing you of plagiarism or any such, just pointing out that
several people doing the most efficient implementation of a fairly
simple task like this are likely to come up with the same solution.
...
I strongly believe that the only way for most of us to become good
writers is reading the works of good writers. In that sense, written
programs are much like other literature. My assembly code style
developed when I was writing code for 1802 (with no role model) and in
the 6502, where I had the excellent monitor ROMs of the KIM-1 and the
AIM-65 to serve as models of style and repositories of neat ideas. I
read them to learn how to use their functions, but to do that, I needed
to understand what the code did, and the details were enlightening.
I first encountered the "trick" of one function calling another just
after it with no RETURN statement in order to repeat an action in the
AIM-65 monitor. In outline, it looks like this:
DBLSP: CALL CRLF
CRLF: <code to output $0A $0D>
RETURN
When DBLSP (doublespace) is called, CRLF (Carriage-Return/Line-Feed)
executes twice, then returns to the original caller. You don't forget
lines like that any sooner than you forget "Jenny kissed me when we
met"* if you happen to come across it.
I guess that my point is that writing in the same style often creates
similar works. (It's no wonder that some early Mozart sounds rather like
Haydn.) There's no plagiarism, but no coincidence, either.
Jerry
____________________________________________
* Jenny Kissed Me by Leigh Hunt
Jenny kissed me when we met,
Jumping from the chair she sat in.
Time, you thief! who love to get
Sweets into your list, put that in.
Say I'm weary, say I'm sad;
Say that health and wealth have missed me;
Say I'm growing old, but add-
Jenny kissed me!