Re: [cc65] Randomizer problem with library

From: Joseph Rose <rose.joseph121yahoo.com>
Date: 2012-05-18 19:15:43
Oops...I found the problem.  The jiffy clock is apparently big-endian, while I was assuming it to be little-endian.  I changed the code to read "lda    TIME+2" and it works now.



________________________________
From: Joseph Rose <rose.joseph12@yahoo.com>
To: cc65 mailing list <cc65@musoftware.de> 
Sent: Tuesday, May 15, 2012 11:46 AM
Subject: [cc65] Randomizer problem with library


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 Fri May 18 19:15:52 2012

This archive was generated by hypermail 2.1.8 : 2012-05-18 19:15:56 CEST