home *** CD-ROM | disk | FTP | other *** search
/ Transactor / Transactor_17_1987_Transactor_Publishing.d64 / rndgen2 < prev    next >
Text File  |  2023-02-26  |  1KB  |  49 lines

  1. base=$232b
  2. cell21=$2340
  3. cell2=$232d
  4. cell1=$232c
  5. tmp=$232a
  6. flag=$2329
  7. hicnt=$2328
  8. ;-----partial seed-----
  9. *=$2331
  10. .dbyte $0305,$0904,$0701,$0406,$0302,$0005,$0704,$0908
  11. *=$2341
  12. ;
  13. ;
  14. ;
  15. init  lda #0 ;entry point to reinitialize
  16.        sta hicnt       ;zero counter most sig byte
  17.        sta flag ;clear flag
  18.        tay             ;zero counter least sig byte
  19. shift  clc             ;entry after reinitialization
  20.        lda cell21
  21.        adc cell2
  22.        cmp #10
  23.        bcc temp        ;acc <10: already mod 10
  24.        sbc #10         ;if not,make result mod 10
  25. temp   sta tmp  ;store until shift is done
  26.        ldx #20  ;# of times to shift
  27. loop   lda base,x      ;shift from here...
  28.        sta base+1,x ;to here
  29.        dex       ;next lower cell
  30.        cpx #0    ;done yet?
  31.        bne loop  ;no, then loop
  32.        lda tmp         ;get mod 10 addition result...
  33.        sta cell1 ;and put in the first cell
  34.        lda flag   ;get flag
  35.        cmp #$ff ;initial runnup done?
  36.        bne loop2 ;no, then continue
  37.        rts    ;yes, back to main prgm
  38. loop2  iny             ;increment least sig byte
  39.        cpy #0
  40.        bne shift       ;not 0: continue
  41.        inc hicnt       ;0: increment most sig byte
  42.        lda hicnt
  43.        cmp #10         ;runnup done yet?
  44.        bne shift       ;no, continue
  45.        lda #$ff
  46.        sta flag ;yes, set flag
  47.        jmp shift       ;done runnup, shift normal now
  48. .end
  49.