[Coco] bug in Basic09

Robert Gault robert.gault at worldnet.att.net
Sat Aug 12 08:25:33 EDT 2006


Bob Devries wrote:

> People, I've come across a bug in Basic09 that is related to our Y2K 
> problem.
> 
> It is the DATE$ function.
> If I issue the command:
> 
> PRINT DATE$
> 
> in my Basic09 programme, it returns:
> 
> :6/08/12 20:50:00
> 
> It *should* either return:
> 
> 106/08/12 20:50:00
> or
> 06/08/12 20:50:00
> or
> 2006/08/12 20:50:00
> 
> Has anyone looked at patching Basic09 (and RunB) to deal with this issue?
> 
> -- 
> Regards, Bob Devries, Dalby, Queensland, Australia
> 
> Isaiah 50:4 The sovereign Lord has given me
> the capacity to be his spokesman,
> so that I know how to help the weary.
> 
> website: http://www.home.gil.com.au/~bdevasl
> my blog: http://bdevries.invigorated.org/
> 
> 

This ought to be simple although I have not yet tried to modify the 
code. The code in question is

          os9   F$Time     Get time packet
          bcs   L4FEC      Error, exit
          bsr   L5021      Start converting
          lda   #'/        Append /
          bsr   L501F
          lda   #'/
          bsr   L501F
          lda   #$20
          bsr   L501F
          lda   #':
          bsr   L501F
          lda   #':
          bsr   L501F
          bra   L4FEC

L501F    sta   ,u+
L5021    lda   ,x+        Get byte from time packet
          ldb   #'/
L5025    incb
          suba  #10
          bcc   L5025
          stb   ,u+
          ldb   #':
L502E    decb
          inca
          bne   L502E
          stb   ,u+
          rts

Since the same routine is used for all the number conversions, at first 
glance I don't see why there is only the year is messed up.



More information about the Coco mailing list