1
0
mirror of https://github.com/cc65/cc65.git synced 2026-04-23 23:17:45 +00:00

New randomize() function for nearly all platforms

git-svn-id: svn://svn.cc65.org/cc65/trunk@1487 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
cuz
2002-11-05 10:48:20 +00:00
parent 444aa7c944
commit 3fae969b5b
19 changed files with 142 additions and 7 deletions
+1
View File
@@ -20,6 +20,7 @@ OBJS = _scrsize.o \
conio.o \
cputc.o \
kbhit.o \
randomize.o \
readjoy.o \
write.o
+21
View File
@@ -0,0 +1,21 @@
;
; Ullrich von Bassewitz, 05.11.2002
;
; void randomize (void);
; /* Initialize the random number generator */
;
.export _randomize
.import _srand
.include "vic20.inc"
_randomize:
lda VIC_LINES ; Get overflow bit
asl a ; Shift bit 7 into carry
lda VIC_HLINE ; Get bit 1-8 of rasterline
rol a ; Use bit 0-7
tax ; Use VIC rasterline as high byte
lda TIME ; Use 60HZ clock as low byte
jmp _srand ; Initialize generator
+8 -5
View File
@@ -8,6 +8,7 @@
ST = $90 ; IEC status byte
TIME = $A0 ; 60HZ clock
FNAM_LEN = $B7 ; Length of filename
SECADR = $B9 ; Secondary address
DEVNUM = $BA ; Device number
@@ -30,10 +31,10 @@ PALFLAG = $2A6 ; $01 = PAL, $00 = NTSC
; Kernal routines
; Direct entries
CLRSCR = $E55F
KBDREAD = $E5CF
CLRSCR = $E55F
KBDREAD = $E5CF
NAMED_OPEN = $F495
NAMED_CLOSE = $F6DA
NAMED_CLOSE = $F6DA
PLOTCHAR = $EAAA ; Char in A, color in X
; ---------------------------------------------------------------------------
@@ -46,8 +47,10 @@ NMIVec = $0318
; ---------------------------------------------------------------------------
; I/O: 6560 VIC
VIC = $9000
VIC_COLOR = $900F
VIC = $9000
VIC_LINES = $9003 ; Screen lines, bit 7 is bit 0 from VIC_HLINE
VIC_HLINE = $9004 ; Rasterline, bits 1-8
VIC_COLOR = $900F ; Border and background color
; ---------------------------------------------------------------------------
; I/O: 6522 VIA1