home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Transactor
/
Transactor_17_1987_Transactor_Publishing.d64
/
rndgen2
< prev
next >
Wrap
Text File
|
2023-02-26
|
1KB
|
49 lines
base=$232b
cell21=$2340
cell2=$232d
cell1=$232c
tmp=$232a
flag=$2329
hicnt=$2328
;-----partial seed-----
*=$2331
.dbyte $0305,$0904,$0701,$0406,$0302,$0005,$0704,$0908
*=$2341
;
;
;
init lda #0 ;entry point to reinitialize
sta hicnt ;zero counter most sig byte
sta flag ;clear flag
tay ;zero counter least sig byte
shift clc ;entry after reinitialization
lda cell21
adc cell2
cmp #10
bcc temp ;acc <10: already mod 10
sbc #10 ;if not,make result mod 10
temp sta tmp ;store until shift is done
ldx #20 ;# of times to shift
loop lda base,x ;shift from here...
sta base+1,x ;to here
dex ;next lower cell
cpx #0 ;done yet?
bne loop ;no, then loop
lda tmp ;get mod 10 addition result...
sta cell1 ;and put in the first cell
lda flag ;get flag
cmp #$ff ;initial runnup done?
bne loop2 ;no, then continue
rts ;yes, back to main prgm
loop2 iny ;increment least sig byte
cpy #0
bne shift ;not 0: continue
inc hicnt ;0: increment most sig byte
lda hicnt
cmp #10 ;runnup done yet?
bne shift ;no, continue
lda #$ff
sta flag ;yes, set flag
jmp shift ;done runnup, shift normal now
.end