;This is a possible answer to the "quiz" question
;Find the minimum value in an array of signed words, and count how many
;times that minimum occured.
wordlen equ     1000
        jmp     beginit
small   dw   ?
count   dw   1
results  dw  -3,-3,-1000,8000,0,77,-1000,-1000,99, wordlen dup (0)  
;                  note: extra words at end!
beginit: mov    si, 0              ;point at first SIGNED word
        mov     ax, results [si]   ; first word is the min
        mov     si, 2
loopit: cmp   ax,  results [si]    ;if ax is below, then it is still the min
        je      moremin
        jng     nextword           ;note SIGNED comparison
; a new minimum has been found!
        mov     ax, results [si]    ;record new minimum
        mov     count, 1            ;reset count back to 1
        jmp     nextword
moremin: inc    count               ;another occurence of the minimum found
nextword: add   si, 2               ;In any case, go to next word
        cmp     si, wordlen*2       ;up to the length * 2 (because it's words)
        jb      loopit
        mov     small, ax           ;done - record min value - count already set
        int     20h
        end