home *** CD-ROM | disk | FTP | other *** search
/ The C Users' Group Library 1994 August / wc-cdrom-cusersgrouplibrary-1994-08.iso / listings / v_02_02 / 2n02035a < prev    next >
Text File  |  1990-06-25  |  1KB  |  39 lines

  1.  
  2.     COMMENT     @
  3.  
  4.         fibonacci table:
  5.  
  6.             demonstrates using REPT block to initialize data
  7.  
  8.             unfortunately Masm 5.0 constants are limited to 16 bits
  9.             so the table is shorter than I'd like
  10.             
  11.             C Program considers table an unsigned int array
  12.             
  13.                 extern unsigned fib_table[24]
  14.  
  15.         Version 1.0 Small Memory Model
  16.         
  17.             To assemble with Masm V. 5.0 -- masm /b60 /Ml fibtable;
  18.             June 26, 1990
  19.             Michael Kelly  --  Author
  20.                 May be used freely if authorship is acknowledged
  21.  
  22.         @
  23.  
  24. _DATA   SEGMENT WORD    PUBLIC  'DATA'
  25. PUBLIC  _fib_table                      ;make accessible to C program
  26. prev_fib    =   0
  27. this_fib    =   1
  28. fib         =   1
  29. _fib_table  LABEL   WORD
  30.             REPT    24
  31.             DW  fib
  32. fib         =   this_fib + prev_fib     ;calc fib to 16 bit limit
  33. prev_fib    =   this_fib
  34. this_fib    =   fib 
  35.             ENDM
  36. _DATA       ENDS
  37.  
  38.         END
  39.