]> git.sur5r.net Git - cc65/blob - libsrc/vic20/randomize.s
New randomize() function for nearly all platforms
[cc65] / libsrc / vic20 / randomize.s
1 ;
2 ; Ullrich von Bassewitz, 05.11.2002
3 ;
4 ; void randomize (void);
5 ; /* Initialize the random number generator */
6 ;
7
8         .export         _randomize
9         .import         _srand
10
11         .include        "vic20.inc"
12
13 _randomize:
14         lda     VIC_LINES       ; Get overflow bit
15         asl     a               ; Shift bit 7 into carry
16         lda     VIC_HLINE       ; Get bit 1-8 of rasterline 
17         rol     a               ; Use bit 0-7
18         tax                     ; Use VIC rasterline as high byte
19         lda     TIME            ; Use 60HZ clock as low byte
20         jmp     _srand          ; Initialize generator
21