[comp.sys.m6809] OS-9 Assembler BUG

dml@loral.UUCP (11/23/86)

  \\\   (chomp)
-<XXX-0<t must be the dreaded LINE EATER BUG!
  ///   (munch)

  There's a bug in the OS-9 assembler that prevents it from accepting
symbol names that contain the underscore (_) character. The faulty code
is located at offset 0379 in the Version 2.00.00 asm module, and should
be near there in any other versions. The buggy code is:

 0379  A6 80    LDA   ,X+       Get the next character
 037B  8D 23    BSR   03A0      Test for alpha, set carry if not
 037D  24 14    BCC   0393      Good char if alpha
<037F  81 39    CMPA  #'9       Test digit range
<0381  22 17    BHI   039A        throw out if too high
<0383  81 30    CMPA  #'0
<0385  24 0C    BCC   0393        OK if 0-9
<0387  81 2E    CMPA  #'.       Good char if `.'
<0389  27 08    BEQ   0393
<038B  81 24    CMPA  #'$       Good char if `$'
<038D  27 04    BEQ   0393
<038F  81 5F    CMPA  #'_       Good char if `_'
<0391  26 07    BNE   039A      Not good otherwise
 0393  A7 C0    STA   ,U+       Store the character
 0395  5A       DECB            Count it
 0396  26 E1    BNE   0379      Get next if not zero
 0398  20 02    BRA   039C      8 chars done, exit
 039A  30 1F    LEAX  -1,X      Bad char, point back to it
 039C  6F C0    CLR   ,U+       Mark end with null
 039E  35 E0    PULS  Y,U,PC    Pull and return

  You can see the problem -- '_ is 5F, so it gets thrown out at 0381; the
test at 038F never does any good. To fix, rearrange the routine so the
exceptions (. $ and _) get tested first:

 0379  A6 80    LDA   ,X+       Get the next character
 037B  8D 23    BSR   03A0      Test for alpha, set carry if not
 037D  24 14    BCC   0393      Good char if alpha
>037F  81 2E    CMPA  #'.
>0381  27 10    BEQ   0393      Good char if `.'
>0383  81 24    CMPA  #'$
>0385  27 0C    BEQ   0393      Good char if `$'
>0387  81 5F    CMPA  #'_
>0389  27 08    BEQ   0393      Good char if `_'
>038B  81 39    CMPA  #'9       Test digit range
>038D  22 0B    BHI   039A        throw out if too high
>038F  81 30    CMPA  #'0
>0391  25 07    BCS   039A        throw out if too low
 0393  A7 C0    STA   ,U+       Store the character
 0395  5A       DECB            Count it
 0396  26 E1    BNE   0379      Get next if not zero
 0398  20 02    BRA   039C      8 chars done, exit
 039A  30 1F    LEAX  -1,X      Bad char, point back to it
 039C  6F C0    CLR   ,U+       Mark end with null
 039E  35 E0    PULS  Y,U,PC    Pull and return

  This is the same length as the original, so you can use Debug to make
the changes. Fixing this will be of limited usefulness, though -- if you
start using underscores in your symbol names, your source won't work with
an unpatched assembler. WAAAAH!
  Microware, are you listening? Can you send out a bug report to your
customers and get this fixed? (has it been found before?)

-------------------------------
          Dave Lewis    Loral Instrumentation   San Diego

  hp-sdd --\     ihnp4 --\
  sdcrdcf --\      bang --\   kontron -\
  csndvax ---\   calmasd -->-->!crash --\
  celerity --->------->!sdcsvax!sdcc3 --->--->!loral!dml  (uucp)
  dcdwest ---/                 gould9 --/

 "Hot diggity damn, I'm in the nut hatch and the head looney has
  come to talk to me"

-------------------------------