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:
@@ -21,6 +21,7 @@ OBJS = _scrsize.o \
|
|||||||
cputc.o \
|
cputc.o \
|
||||||
kbhit.o \
|
kbhit.o \
|
||||||
mouse.o \
|
mouse.o \
|
||||||
|
randomize.o \
|
||||||
readjoy.o \
|
readjoy.o \
|
||||||
rs232.o \
|
rs232.o \
|
||||||
tgi_mode_table.o\
|
tgi_mode_table.o\
|
||||||
|
|||||||
@@ -8,6 +8,7 @@
|
|||||||
|
|
||||||
ST = $90 ; IEC status byte
|
ST = $90 ; IEC status byte
|
||||||
|
|
||||||
|
TIME = $A0 ; 60HZ clock
|
||||||
FNAM_LEN = $B7 ; Length of filename
|
FNAM_LEN = $B7 ; Length of filename
|
||||||
SECADR = $B9 ; Secondary address
|
SECADR = $B9 ; Secondary address
|
||||||
DEVNUM = $BA ; Device number
|
DEVNUM = $BA ; Device number
|
||||||
|
|||||||
17
libsrc/c128/randomize.s
Normal file
17
libsrc/c128/randomize.s
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
;
|
||||||
|
; Ullrich von Bassewitz, 05.11.2002
|
||||||
|
;
|
||||||
|
; void randomize (void);
|
||||||
|
; /* Initialize the random number generator */
|
||||||
|
;
|
||||||
|
|
||||||
|
.export _randomize
|
||||||
|
.import _srand
|
||||||
|
|
||||||
|
.include "c128.inc"
|
||||||
|
|
||||||
|
_randomize:
|
||||||
|
ldx VIC_HLINE ; Use VIC rasterline as high byte
|
||||||
|
lda TIME ; Use 60HZ clock as low byte
|
||||||
|
jmp _srand ; Initialize generator
|
||||||
|
|
||||||
@@ -24,6 +24,7 @@ OBJS = _scrsize.o \
|
|||||||
cputc.o \
|
cputc.o \
|
||||||
kbhit.o \
|
kbhit.o \
|
||||||
mouse.o \
|
mouse.o \
|
||||||
|
randomize.o \
|
||||||
readjoy.o \
|
readjoy.o \
|
||||||
rs232.o \
|
rs232.o \
|
||||||
tgi_mode_table.o \
|
tgi_mode_table.o \
|
||||||
@@ -43,4 +44,4 @@ all: $(OBJS) $(TGIS)
|
|||||||
|
|
||||||
clean:
|
clean:
|
||||||
@rm -f $(OBJS) $(TGIS:.tgi=.o)
|
@rm -f $(OBJS) $(TGIS:.tgi=.o)
|
||||||
|
|
||||||
|
|||||||
@@ -8,6 +8,7 @@
|
|||||||
|
|
||||||
ST = $90 ; IEC status byte
|
ST = $90 ; IEC status byte
|
||||||
|
|
||||||
|
TIME = $A0 ; 60 HZ clock
|
||||||
FNAM_LEN = $B7 ; Length of filename
|
FNAM_LEN = $B7 ; Length of filename
|
||||||
SECADR = $B9 ; Secondary address
|
SECADR = $B9 ; Secondary address
|
||||||
DEVNUM = $BA ; Device number
|
DEVNUM = $BA ; Device number
|
||||||
|
|||||||
17
libsrc/c64/randomize.s
Normal file
17
libsrc/c64/randomize.s
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
;
|
||||||
|
; Ullrich von Bassewitz, 05.11.2002
|
||||||
|
;
|
||||||
|
; void randomize (void);
|
||||||
|
; /* Initialize the random number generator */
|
||||||
|
;
|
||||||
|
|
||||||
|
.export _randomize
|
||||||
|
.import _srand
|
||||||
|
|
||||||
|
.include "c64.inc"
|
||||||
|
|
||||||
|
_randomize:
|
||||||
|
ldx VIC_HLINE ; Use VIC rasterline as high byte
|
||||||
|
lda TIME ; Use 60HZ clock as low byte
|
||||||
|
jmp _srand ; Initialize generator
|
||||||
|
|
||||||
@@ -28,6 +28,7 @@ OBJS = _scrsize.o \
|
|||||||
mouse.o \
|
mouse.o \
|
||||||
peeksys.o \
|
peeksys.o \
|
||||||
pokesys.o \
|
pokesys.o \
|
||||||
|
randomize.o \
|
||||||
readjoy.o \
|
readjoy.o \
|
||||||
rs232.o \
|
rs232.o \
|
||||||
tgi_mode_table.o
|
tgi_mode_table.o
|
||||||
|
|||||||
16
libsrc/cbm510/randomize.s
Normal file
16
libsrc/cbm510/randomize.s
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
;
|
||||||
|
; Ullrich von Bassewitz, 05.11.2002
|
||||||
|
;
|
||||||
|
; void randomize (void);
|
||||||
|
; /* Initialize the random number generator */
|
||||||
|
;
|
||||||
|
|
||||||
|
.export _randomize
|
||||||
|
.import _srand
|
||||||
|
.importzp time
|
||||||
|
|
||||||
|
_randomize:
|
||||||
|
ldx time ; Use 50/60HZ clock
|
||||||
|
lda time+1
|
||||||
|
jmp _srand ; Initialize generator
|
||||||
|
|
||||||
@@ -27,6 +27,7 @@ OBJS = _scrsize.o \
|
|||||||
kudtim.o \
|
kudtim.o \
|
||||||
peeksys.o \
|
peeksys.o \
|
||||||
pokesys.o \
|
pokesys.o \
|
||||||
|
randomize.o \
|
||||||
rs232.o
|
rs232.o
|
||||||
|
|
||||||
all: $(OBJS)
|
all: $(OBJS)
|
||||||
|
|||||||
16
libsrc/cbm610/randomize.s
Normal file
16
libsrc/cbm610/randomize.s
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
;
|
||||||
|
; Ullrich von Bassewitz, 05.11.2002
|
||||||
|
;
|
||||||
|
; void randomize (void);
|
||||||
|
; /* Initialize the random number generator */
|
||||||
|
;
|
||||||
|
|
||||||
|
.export _randomize
|
||||||
|
.import _srand
|
||||||
|
.importzp time
|
||||||
|
|
||||||
|
_randomize:
|
||||||
|
ldx time ; Use 50/60HZ clock
|
||||||
|
lda time+1
|
||||||
|
jmp _srand ; Initialize generator
|
||||||
|
|
||||||
@@ -19,7 +19,8 @@ OBJS = _scrsize.o \
|
|||||||
conio.o \
|
conio.o \
|
||||||
cputc.o \
|
cputc.o \
|
||||||
crt0.o \
|
crt0.o \
|
||||||
kbhit.o
|
kbhit.o \
|
||||||
|
randomize.o
|
||||||
|
|
||||||
all: $(OBJS)
|
all: $(OBJS)
|
||||||
|
|
||||||
|
|||||||
@@ -6,6 +6,7 @@
|
|||||||
; ---------------------------------------------------------------------------
|
; ---------------------------------------------------------------------------
|
||||||
; Zero page, Commodore stuff
|
; Zero page, Commodore stuff
|
||||||
|
|
||||||
|
TIME = $8D ; 60HZ clock
|
||||||
MEMSIZE = $34 ; Size of memory installed
|
MEMSIZE = $34 ; Size of memory installed
|
||||||
ST = $96 ; IEC status byte
|
ST = $96 ; IEC status byte
|
||||||
SECADR = $D3 ; Secondary address
|
SECADR = $D3 ; Secondary address
|
||||||
|
|||||||
17
libsrc/pet/randomize.s
Normal file
17
libsrc/pet/randomize.s
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
;
|
||||||
|
; Ullrich von Bassewitz, 05.11.2002
|
||||||
|
;
|
||||||
|
; void randomize (void);
|
||||||
|
; /* Initialize the random number generator */
|
||||||
|
;
|
||||||
|
|
||||||
|
.export _randomize
|
||||||
|
.import _srand
|
||||||
|
|
||||||
|
.include "pet.inc"
|
||||||
|
|
||||||
|
_randomize:
|
||||||
|
ldx TIME
|
||||||
|
lda TIME+1 ; Use 60HZ clock
|
||||||
|
jmp _srand ; Initialize generator
|
||||||
|
|
||||||
@@ -20,6 +20,7 @@ OBJS = _scrsize.o \
|
|||||||
cputc.o \
|
cputc.o \
|
||||||
crt0.o \
|
crt0.o \
|
||||||
kbhit.o \
|
kbhit.o \
|
||||||
|
randomize.o \
|
||||||
readjoy.o \
|
readjoy.o \
|
||||||
tgi_mode_table.o
|
tgi_mode_table.o
|
||||||
|
|
||||||
|
|||||||
@@ -8,6 +8,7 @@
|
|||||||
|
|
||||||
ST = $90 ; IEC status byte
|
ST = $90 ; IEC status byte
|
||||||
|
|
||||||
|
TIME = $A3 ; 60HZ clock
|
||||||
FNAM_LEN = $AB ; Length of filename
|
FNAM_LEN = $AB ; Length of filename
|
||||||
SECADR = $AD ; Secondary address
|
SECADR = $AD ; Secondary address
|
||||||
DEVNUM = $AE ; Device number
|
DEVNUM = $AE ; Device number
|
||||||
|
|||||||
17
libsrc/plus4/randomize.s
Normal file
17
libsrc/plus4/randomize.s
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
;
|
||||||
|
; Ullrich von Bassewitz, 05.11.2002
|
||||||
|
;
|
||||||
|
; void randomize (void);
|
||||||
|
; /* Initialize the random number generator */
|
||||||
|
;
|
||||||
|
|
||||||
|
.export _randomize
|
||||||
|
.import _srand
|
||||||
|
|
||||||
|
.include "plus4.inc"
|
||||||
|
|
||||||
|
_randomize:
|
||||||
|
ldx TED_VLINELO ; Use TED rasterline as high byte
|
||||||
|
lda TIME ; Use 60HZ clock as low byte
|
||||||
|
jmp _srand ; Initialize generator
|
||||||
|
|
||||||
@@ -20,6 +20,7 @@ OBJS = _scrsize.o \
|
|||||||
conio.o \
|
conio.o \
|
||||||
cputc.o \
|
cputc.o \
|
||||||
kbhit.o \
|
kbhit.o \
|
||||||
|
randomize.o \
|
||||||
readjoy.o \
|
readjoy.o \
|
||||||
write.o
|
write.o
|
||||||
|
|
||||||
|
|||||||
21
libsrc/vic20/randomize.s
Normal file
21
libsrc/vic20/randomize.s
Normal 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,6 +8,7 @@
|
|||||||
|
|
||||||
ST = $90 ; IEC status byte
|
ST = $90 ; IEC status byte
|
||||||
|
|
||||||
|
TIME = $A0 ; 60HZ clock
|
||||||
FNAM_LEN = $B7 ; Length of filename
|
FNAM_LEN = $B7 ; Length of filename
|
||||||
SECADR = $B9 ; Secondary address
|
SECADR = $B9 ; Secondary address
|
||||||
DEVNUM = $BA ; Device number
|
DEVNUM = $BA ; Device number
|
||||||
@@ -30,10 +31,10 @@ PALFLAG = $2A6 ; $01 = PAL, $00 = NTSC
|
|||||||
; Kernal routines
|
; Kernal routines
|
||||||
|
|
||||||
; Direct entries
|
; Direct entries
|
||||||
CLRSCR = $E55F
|
CLRSCR = $E55F
|
||||||
KBDREAD = $E5CF
|
KBDREAD = $E5CF
|
||||||
NAMED_OPEN = $F495
|
NAMED_OPEN = $F495
|
||||||
NAMED_CLOSE = $F6DA
|
NAMED_CLOSE = $F6DA
|
||||||
PLOTCHAR = $EAAA ; Char in A, color in X
|
PLOTCHAR = $EAAA ; Char in A, color in X
|
||||||
|
|
||||||
; ---------------------------------------------------------------------------
|
; ---------------------------------------------------------------------------
|
||||||
@@ -46,8 +47,10 @@ NMIVec = $0318
|
|||||||
; ---------------------------------------------------------------------------
|
; ---------------------------------------------------------------------------
|
||||||
; I/O: 6560 VIC
|
; I/O: 6560 VIC
|
||||||
|
|
||||||
VIC = $9000
|
VIC = $9000
|
||||||
VIC_COLOR = $900F
|
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
|
; I/O: 6522 VIA1
|
||||||
|
|||||||
Reference in New Issue
Block a user