
 1000  *---------------------------------
 1010  *      RANDOM FUNCTION
 1020  *      ---------------
 1030  *      CALLS SUBROUTINE IN INTEGER BASIC ROM TO GET
 1040  *      A RANDOM NUMBER BETWEEN 0 ANT X-1
 1050  *
 1060  *      CALL:  VALUE X IN Y- AND A-REGISTERS
 1070  *             JSR RANDOM
 1080  *    RETURN:  RANDOM NUMBER IN Y- AND A-REGISTERS
 1090  *             LO-BYTE IN Y, HI-BYTE IN A
 1100  *---------------------------------
 1110  IB.ARG     .EQ $CE,CF
 1120  IB.LOSTACK .EQ $50 THRU $6F
 1130  IB.HISTACK .EQ $A0 THRU $BF
 1140  *---------------------------------
 1150  IB.RANDOM  .EQ $EF51
 1160  MON.PRBYTE .EQ $FDDA
 1170  MON.COUT   .EQ $FDED
 1180  *---------------------------------
 1190  RANDOM LDX #$20     I/B NOUN-STACK POINTER
 1200         STA IB.ARG+1
 1210         STY IB.ARG
 1220         LDY #0       FLAG VALUE ON STACK
 1230         JSR IB.RANDOM
 1240         LDA IB.HISTACK,X
 1250         LDY IB.LOSTACK,X
 1260         RTS
 1270  *---------------------------------
 1280  TEST.RANDOM
 1290         LDA #160
 1300         STA COUNT
 1310  .1     LDY #1000
 1320         LDA /1000
 1330         JSR RANDOM   RND(1000)
 1340         JSR MON.PRBYTE
 1350         TYA
 1360         JSR MON.PRBYTE
 1370         LDA #$A0     PRINT BLANK
 1380         JSR MON.COUT
 1390         DEC COUNT
 1400         BNE .1
 1410         RTS
 1420  COUNT  .BS 1

