The RANDOM.I include file resides on the Kyan Pascal 2.x Disk 2. It includes one function:
- function RANDOM
See the Random Numbers page for more details.
Source Code
VAR ISO_Var: Integer;
BEGIN
#A
TXA
PHA
LDA #$0
STA _T
RAN1 INC _T
JSR POLY
CMP #$0
BEQ RAN1
ORA #$10
LDY #5
STA (_SP),Y
;
RAN2 INY
JSR POLY
ROL A
ROL A
ROL A
ROL A
AND #$F0
STA _T+1
JSR POLY
ORA _T+1
STA (_SP),Y
CPY #9
BCC RAN2
LDA _T
INY
STA (_SP),Y
PLA
TAX
#
Random:=ISO_Var
END;(* But not quite! *)
#A
POLY TYA
PHA
LDY #$0
POLY1 INY
CLC
ROL POLYN
ROL POLYN+1
ROL POLYN+2
ROL POLYN+3
ROL POLYN+4
ROL POLYN+5
ROL POLYN+6
ROL POLYN+7
BCC POLY3
;
LDX #$0
POLY2 LDA POLYN,X
EOR GEN,X
STA POLYN,X
INX
CPX #8
BCC POLY2
SEC
;
POLY3 ROL _T+2
CPY #4
BCC POLY1
;
PLA
TAY
LDA _T+2
AND #$0F
CMP #$0A
BCS POLY
RTS
;
;
GEN DW $A1
DB $A2
DB $1A
DB $A2
DB $91
DB $C3
DB $93
DB $C0
;
POLYN DW $63
DB $42
DB $A1
DB $23
DB $55
DB $09
DB $03
DB $87
#
No comments:
Post a Comment