[cc65] Randomizer problem with library

From: Joseph Rose <rose.joseph121yahoo.com>
Date: 2012-05-15 17:46:12
Hi.  I am working on a memory extension for the C128 under cc65 and am having a problem with random numbers.  Every time I use the _randomize() function, the seed seems to start off at the same number.  I can tell this because the output of a function is the same after it calls the _randomize() function.  When I remove the call, the calling routine seems to work fine.  But I need random numbers.  I did alot of debugging and narrowed the problem to the particular function.  The _randomize() function is intended to be called from Bank 0 and access Bank 15 before returning to Bank 0.  Can anybody help me out?  The code for the function follows:
----------------------
.segment "LOWCODE"
__randomize:
 lda #$00
 sta $FF00
        ldx     VIC_HLINE       ; Use VIC rasterline as high byte
        lda     TIME            ; Use 60HZ clock as low byte
 sta $FF01
        jmp     _srand          ; Initialize generator
------------------------
Joseph Rose, a.k.a. Harry Potter
Working magic in the computer community
----------------------------------------------------------------------
To unsubscribe from the list send mail to majordomo@musoftware.de with
the string "unsubscribe cc65" in the body(!) of the mail.
Received on Tue May 15 17:46:26 2012

This archive was generated by hypermail 2.1.8 : 2012-05-15 17:46:30 CEST