home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD1.mdf / forth / compiler / fpc / source / largest.seq < prev    next >
Text File  |  1990-05-25  |  609b  |  16 lines

  1. \ LARGEST.SEQ   Return the largest element of an array of words
  2.  
  3. code largest    ( a1 n1 --- a2 n2 )
  4.                 pop cx          \ count of array to search
  5.                 pop bx          \ starting address of array
  6.                 mov ax, # 0     \ starting highest value = 0
  7.                 mov dx, bx      \ highest value addr = start address
  8.           here  cmp 0 [bx], ax
  9.              u> if      mov dx, bx
  10.                         mov ax, 0 [bx]
  11.                 then
  12.                 add bx, # 2     \ bump to next element
  13.                 loop
  14.                 2push           end-code
  15.  
  16.