home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #31 / NN_1992_31.iso / spool / comp / os / vms / 20142 < prev    next >
Encoding:
Internet Message Format  |  1992-12-31  |  3.2 KB

  1. Path: sparky!uunet!paladin.american.edu!gatech!usenet.ins.cwru.edu!agate!ucbvax!tchden.org!lbmoore
  2. From: lbmoore@tchden.org ("Louis B. Moore")
  3. Newsgroups: comp.os.vms
  4. Subject: RE: comp.os.vms.flame, never ending story...
  5. Message-ID: <00965DB1.3FA57140.6066@tchden.org>
  6. Date: 30 Dec 92 16:57:16 GMT
  7. Sender: daemon@ucbvax.BERKELEY.EDU
  8. Distribution: world
  9. Organization: The Internet
  10. Lines: 116
  11.  
  12.  
  13. >with MOVE, indeed: Carl. He took the time to send me a kind question, just
  14.  
  15. Nobody pointed out that Carl had politely responded to requests for help
  16. from Egypt before, again politely, suggesting an interpreter.  Carl's flames
  17. have been much flamed, but Carl's patience has been ignored.
  18.  
  19. I ignore most posts on INFO-VAX, but usually read those of Arne, Carl, 
  20. and Ehud.
  21.  
  22. >Oscar.
  23.  
  24.  
  25.  Louis B. Moore                      Internet: lbmoore@tchden.org
  26.  Systems Programmer                  Phone:    +1 303 837 2513
  27.  The Children's Hospital of Denver   Denver, Colorado USA 80218
  28.  
  29. With thanks to Ehud for the concept, what follows is some actual
  30. technical content:
  31.  
  32. ------------------------------------------------------------------
  33.  
  34.            .Title        RANDOM_INT
  35.     .Subtitle    RANDOM_INT - Program Header
  36.     .Ident        'V1.0-001'
  37.     .Library    'Sys$library:LIB.MLB'
  38. ;
  39.     .Subtitle    RANDOM_INT - Declarations and Equates
  40.     .Page
  41.  
  42.     .Macro    SDESC    LEN, ADDR              ;Fixed
  43.     .WORD        LEN
  44.     .BYTE        DSC$K_DTYPE_T
  45.     .BYTE        DSC$K_CLASS_S
  46.     .ADDRESS    ADDR
  47.     .Endm    SDESC
  48.  
  49.  
  50.     .Subtitle    RANDOM_INT - Read/Write Data
  51.     .Page
  52.     .Psect        RANDOM_INT$RW_DATA    Pic,Page,Noexe,Rd,Wrt
  53.  
  54.  
  55. SEED:        .BLKQ    1
  56. MAXINT:        .BLKL    1
  57.  
  58. RANDOM:        .BLKL    1
  59.  
  60.  
  61. RANDOM_DSC:    SDESC    MAXINT_SIZ,RANDOM_TXT
  62. RANDOM_TXT:    .BLKB    8
  63. MAXINT_SIZ    = . - RANDOM_TXT
  64.  
  65.  
  66. MAXINT_DSC:    SDESC    MAXINT_SIZ,MAXINT_TXT
  67. MAXINT_TXT:    .BLKB    MAXINT_SIZ
  68.  
  69. MAXINT_FIXED:    .ASCID    "99999999"
  70.  
  71. SYMBOL:        .ASCID    "RAND_INT"
  72. LOCAL_SYM:    .LONG    1
  73.  
  74. RND_D_PROMPT:    .ASCID    "Maximum integer to generate for: "
  75.  
  76.  
  77.  
  78.     .Subtitle    RANDOM_INT - Program Code
  79.     .Page
  80.     .Psect        RANDOM_INT$code    Pic,long,exe,rd,nowrt
  81.  
  82. ;
  83.  
  84.     .ENTRY    RANDOM_INT, ^M<>
  85.  
  86. INIT:    PUSHL        #0            ;flag (no prompting)
  87.     PUSHAL        (SP)            ;Address of flags
  88.     PUSHAW        MAXINT_DSC        ;resultant length
  89.     PUSHAQ        RND_D_PROMPT        ;prompt string
  90.     PUSHAQ        MAXINT_DSC        ;result string
  91.     CALLS        #4,G^LIB$GET_FOREIGN    ;get data
  92.     ADDL2        #4,SP            ;fix SP
  93.     BLBS        R0,10$            ;Ok? Yes, branch
  94.     MOVQ        MAXINT_FIXED,MAXINT_DSC    ;    No,  put in our own value
  95. 10$:    PUSHL        #4            ;Size of output
  96.     PUSHAL        MAXINT            ; Location of output
  97.     PUSHAQ        MAXINT_DSC        ;  source text
  98.     CALLS        #3,G^OTS$CVT_TU_L    ;   convert
  99. 20$:    BLBC        R0,30$            ;    error
  100.     $GETTIM_S    TIMADR=SEED        ;Get Time to use as seed
  101.     BLBS        R0,40$            ;Branch if OK.
  102. 30$:    PUSHL        R0            ;Error
  103.     CALLS        #1,G^LIB$STOP        ;If not
  104. 40$:    PUSHAL        SEED            ;Address of Seed
  105.     CALLS        #1,G^MTH$RANDOM        ;get a random number F_Float
  106.     CVTLF        MAXINT,R1        ;Convert Max Integer to F_Float
  107.     MULF2        R1,R0            ;Multiply Max int time random
  108.     CVTFL        R0,RANDOM        ;Convert back to integer
  109.  
  110.     PUSHL        #MAXINT_SIZ        ;MAXINT_SIZ digits
  111.     PUSHAQ        RANDOM_DSC        ;For text version of RANDOM
  112.     PUSHAL        RANDOM            ;Binary version
  113.     CALLS        #3,G^OTS$CVT_L_TU    ;Convert
  114. 50$:    BLBC        R0,30$            ;Yuck!
  115.     PUSHAL        LOCAL_SYM        ;Local Symbol Table
  116.     PUSHAQ        RANDOM_DSC        ;Value
  117.     PUSHAQ        SYMBOL            ;Symbol
  118.     CALLS        #3,G^LIB$SET_SYMBOL    ;Do it
  119.     BLBC        R0,50$            ;mumble
  120.  
  121. EXIT:    MOVL    #SS$_NORMAL,R0
  122.     $EXIT_S    R0
  123.  
  124.     .END    RANDOM_INT
  125.  
  126.  
  127.  
  128.