From: cuz Date: Thu, 7 Nov 2002 12:16:15 +0000 (+0000) Subject: New _randomize() function, do some cleanup on apple2.inc X-Git-Tag: V2.12.0~2136 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=2f3f1df00fed59665d1303ca594be4eb6ef989d4;p=cc65 New _randomize() function, do some cleanup on apple2.inc git-svn-id: svn://svn.cc65.org/cc65/trunk@1496 b7a2c559-68d2-44c3-8de9-860c34a00d81 --- diff --git a/libsrc/apple2/Makefile b/libsrc/apple2/Makefile index e7f847426..c87d43661 100644 --- a/libsrc/apple2/Makefile +++ b/libsrc/apple2/Makefile @@ -25,6 +25,7 @@ S_OBJS= _scrsize.o \ ctype.o \ cvline.o \ kbhit.o \ + randomize.o \ read.o \ revers.o \ where.o \ diff --git a/libsrc/apple2/apple2.inc b/libsrc/apple2/apple2.inc index 458d78a2e..78f323dd0 100644 --- a/libsrc/apple2/apple2.inc +++ b/libsrc/apple2/apple2.inc @@ -1,22 +1,7 @@ -; Break vector -BRKVec = $03F0 -; Goto Dos -RESTOR = $03D0 +;----------------------------------------------------------------------------- +; Zero page stuff -; Soft switches -; -; write to USEROM to enable apple rom C000-CFFF -USEROM = $C007 -; 80 column card switches -C80ON = $C00C -C80OFF = $C00D -RD80COL = $C01F -PG2OFF = $C054 -PG2ON = $C055 -RDPAGE2 = $C01C - -; Text routines MIN_X = $20 MAX_X = $21 MIN_Y = $22 @@ -25,10 +10,31 @@ CH = $24 CV = $25 BASL = $28 TEXTTYP = $32 +RNDL = $4E ; Random value, low byte +RNDH = $4F ; Random value, high byte MEMSIZE = $73 ; Highest free RAM location -HOME = $FC58 -VTABZ = $FC24 -COUT = $FDED + +;----------------------------------------------------------------------------- +; Vectors + +BRKVec = $03F0 ; Break vector +RESTOR = $03D0 ; Goto Dos + +;----------------------------------------------------------------------------- +; Hardware + +; Soft switches +; +; Write to USEROM to enable apple rom C000-CFFF +USEROM = $C007 + +; 80 column card switches +C80ON = $C00C +C80OFF = $C00D +RD80COL = $C01F +PG2OFF = $C054 +PG2ON = $C055 +RDPAGE2 = $C01C ; Keyboard entries RDKEY = $FD0C @@ -36,52 +42,60 @@ CLEAR_KEY_STROBE = $C010 KEY_STROBE = $C000 ; Game controller -OPEN_APPLE = $C061 -CLOSED_APPLE = $C062 +OPEN_APPLE = $C061 +CLOSED_APPLE = $C062 + +;----------------------------------------------------------------------------- +; ROM routines + +; Text output and helpers +HOME = $FC58 +VTABZ = $FC24 +COUT = $FDED -;Graphics entry points, by cbmnut (applenut??) cbmnut@hushmail.com -WHITE = $01 ;white for $1c, I think... +; Graphics entry points, by cbmnut (applenut??) cbmnut@hushmail.com +WHITE = $01 ; White for $1c, I think... -COLOR = $1C ;Current plot color +COLOR = $1C ; Current plot color -HGR2 = $F3D8 ;Initialize and clear hi-res page 2. +HGR2 = $F3D8 ; Initialize and clear hi-res page 2. -HGR = $F3E2 ;Initialize and clear hi-res page 1. +HGR = $F3E2 ; Initialize and clear hi-res page 1. -HCLR = $F3F2 ;Clear the current hi-res screen to black. +HCLR = $F3F2 ; Clear the current hi-res screen to black. -BKGND = $F3F6 ;Clear the current hi-res screen to the - ;last plotted color (from ($1C). +BKGND = $F3F6 ; Clear the current hi-res screen to the + ; last plotted color (from ($1C). -HPOSN = $F411 ;Positions the hi-res cursor without - ;plotting a point. - ;Enter with (A) = Y-coordinate, and - ;(Y,X) = X-coordinate. +HPOSN = $F411 ; Positions the hi-res cursor without + ; plotting a point. + ; Enter with (A) = Y-coordinate, and + ; (Y,X) = X-coordinate. -HPLOT = $F457 ;Calls HPOSN and tries to plot a dot at - ;the cursor's position. If you are - ;trying to plot a non-white color at - ;a complementary color position, no - ;dot will be plotted. +HPLOT = $F457 ; Calls HPOSN and tries to plot a dot at + ; the cursor's position. If you are + ; trying to plot a non-white color at + ; a complementary color position, no + ; dot will be plotted. -HLIN = $F53A ;Draws a line from the last plotted - ;point or line destination to: - ;(X,A) = X-coordinate, and - ;(Y) = Y-coordinate. +HLIN = $F53A ; Draws a line from the last plotted + ; point or line destination to: + ; (X,A) = X-coordinate, and + ; (Y) = Y-coordinate. -HFIND = $F5CB ;Converts the hi-res coursor's position - ;back to X- and Y-coordinates; stores - ;X-coordinate at $E0,E1 and Y-coordinate - ;at $E2. +HFIND = $F5CB ; Converts the hi-res coursor's position + ; back to X- and Y-coordinates; stores + ; X-coordinate at $E0,E1 and Y-coordinate + ; at $E2. -DRAW = $F601 ;Draws a shape. Enter with (Y,X) = the - ;address of the shape table, and (A) = - ;the rotation factor. Uses the current - ;color. +DRAW = $F601 ; Draws a shape. Enter with (Y,X) = the + ; address of the shape table, and (A) = + ; the rotation factor. Uses the current + ; color. -XDRAW = $F65D ;Draws a shape by inverting the existing - ;color of the dots the shape draws over. - ;Same entry parameters as DRAW. +XDRAW = $F65D ; Draws a shape by inverting the existing + ; color of the dots the shape draws over. + ; Same entry parameters as DRAW. -SETHCOL = $F6EC ;Set the hi-res color to (X), where (X) - ;must be between 0 and 7. +SETHCOL = $F6EC ; Set the hi-res color to (X), where (X) + ; must be between 0 and 7. diff --git a/libsrc/apple2/randomize.s b/libsrc/apple2/randomize.s new file mode 100644 index 000000000..76e8dd60f --- /dev/null +++ b/libsrc/apple2/randomize.s @@ -0,0 +1,17 @@ +; +; Ullrich von Bassewitz, 07.11.2002 +; +; void _randomize (void); +; /* Initialize the random number generator */ +; + + .export __randomize + .import _srand + + .include "apple2.inc" + +__randomize: + ldx RNDH ; Use random value supplied by ROM + lda RNDL + jmp _srand ; Initialize generator +