home *** CD-ROM | disk | FTP | other *** search
/ The Equalizer BBS / equalizer-bbs-collection_2004.zip / equalizer-bbs-collection / DEMOSCENE-STUFF / BLACDEMO.ZIP / FDEMO.INC < prev    next >
Text File  |  1995-12-30  |  19KB  |  528 lines

  1. ;*** Fire part of Black Ice demo
  2.  
  3.  
  4.  
  5. .data
  6. EVEN
  7. FireBuf db      72*160 dup (0)
  8.  
  9. RandPos         dw      (0)
  10. RandOff         dw      (0)
  11. DatName         db      "FIREWORD.DAT", 0
  12.  
  13. EVEN
  14. RandTab LABEL BYTE
  15.     db      0, 0, 0, 255, 0, 0, 255, 0, 0, 255, 0, 0
  16.     db      255, 0, 255, 255, 0, 255, 0, 255, 0, 255, 0, 0
  17.     db      255, 0, 255, 255, 0, 0, 255, 0, 0, 0, 255, 255
  18.     db      0, 255, 0, 255, 255, 255, 0, 255, 255, 0, 0, 255
  19.     db      255, 0, 0, 255, 0, 0, 0, 255, 0, 0, 0, 255
  20.     db      0, 0, 255, 0, 0, 0, 0, 255, 0, 0, 255, 255
  21.     db      255, 0, 0, 255, 0, 255, 255, 0, 0, 255, 255, 0
  22.     db      255, 255, 0, 0, 255, 0, 255, 0, 255, 0, 255, 255
  23.     db      0, 255, 0, 0, 0, 0, 255, 255, 0, 255, 0, 0
  24.     db      255, 255, 0, 255, 0, 0, 255, 255, 255, 0, 0, 0
  25.     db      255, 0, 255, 255, 255, 0, 255, 0, 0, 255, 0, 0
  26.     db      255, 255, 255, 0, 255, 255, 255, 0, 255, 0, 255, 255
  27.     db      0, 255, 255, 0, 0, 255, 255, 255, 0, 0, 255, 0
  28.     db      0, 255, 0, 0, 255, 0, 255, 0, 255, 0, 255, 255
  29.     db      255, 0, 0, 0, 255, 255, 255, 255, 0, 255, 0, 255
  30.     db      0, 255, 255, 255, 0, 255, 0, 0, 0, 255, 255, 255
  31.     db      0, 255, 0, 255, 0, 0, 255, 0, 0, 0, 255, 255
  32.     db      255, 255, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255
  33.     db      0, 255, 255, 0, 0, 0, 0, 0, 255, 0, 255, 255
  34.     db      0, 0, 255, 0, 0, 255, 0, 255, 0, 0, 0, 0
  35.     db      255, 0, 255, 255, 0, 0, 255, 0, 0, 0, 0, 255
  36.     db      255, 255, 0, 255, 0, 255, 255, 255, 255, 255, 255, 0
  37.     db      0, 255, 255, 255, 0, 0, 0, 0, 255, 0, 0, 255
  38.     db      0, 0, 255, 0, 255, 0, 0, 0, 255, 255, 255, 0
  39.     db      255, 255, 255, 0, 0, 255, 0, 255, 255, 0, 255, 255
  40.     db      255, 255, 255, 255, 255, 0, 0, 255, 0, 0, 255, 255
  41.     db      0, 255, 0, 255, 0, 255, 255, 0, 0, 0, 255, 255
  42.     db      255, 255, 0, 255, 255, 0, 255, 0, 255, 255, 0, 255
  43.     db      0, 255, 255, 255, 0, 0, 0, 255, 255, 0, 0, 0
  44.     db      255, 0, 0, 255, 0, 0, 255, 0, 255, 255, 255, 255
  45.     db      0, 255, 0, 0, 255, 255, 255, 0, 0, 0, 255, 0
  46.     db      255, 255, 0, 0, 0, 255, 0, 0, 0, 0, 0, 255
  47.     db      255, 255, 255, 255, 255, 0, 0, 0, 0, 0, 255, 255
  48.     db      255, 255, 255, 0, 255, 255, 255, 0, 0, 0, 0, 255
  49.     db      0, 255, 0, 255, 0, 0, 0, 255, 0, 0, 0, 0
  50.     db      255, 255, 0, 255, 255, 0, 0, 0, 0, 0, 0, 255
  51.     db      255, 0, 0, 0, 255, 0, 255, 255, 255, 255, 0, 255
  52.     db      0, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 0
  53.     db      0, 0, 255, 0, 0, 0, 255, 255, 255, 0, 0, 255
  54.     db      255, 0, 0, 0, 255, 255, 0, 0, 255, 255, 0, 255
  55.     db      255, 255, 0, 0, 255, 0, 0, 255, 0, 255, 0, 0
  56.     db      0, 0, 255, 0, 0, 0, 255, 0, 0, 255, 255, 255
  57.     db      0, 0, 255, 0, 0, 0, 255, 255, 255, 0, 0, 255
  58.     db      0, 0, 0, 0, 255, 255, 255, 255, 255, 0, 255, 0
  59.     db      0, 0, 0, 0, 255, 0, 255, 0, 0, 0, 255, 0
  60.     db      0, 255, 0, 255, 255, 255, 255, 0, 0, 0, 255, 255
  61.     db      0, 0, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0
  62.     db      255, 0, 255, 255, 0, 0, 255, 255, 0, 255, 0, 0
  63.     db      255, 0, 255, 255, 0, 255, 0, 0, 0, 255, 255, 255
  64.     db      0, 255, 0, 0, 0, 255, 0, 0, 0, 255, 0, 255
  65.     db      255, 0, 0, 0, 255, 255, 255, 0, 255, 255, 0, 255
  66.     db      255, 255, 0, 255, 0, 255, 0, 255, 0, 0, 0, 0
  67.     db      255, 255, 255, 0, 0, 0, 255, 0, 255, 0, 0, 255
  68.     db      255, 0, 0, 0, 255, 0, 255, 0, 0, 255, 0, 0
  69.     db      0, 255, 0, 0, 255, 255, 255, 0, 255, 0, 0, 0
  70.     db      255, 0, 0, 0, 255, 255, 0, 255, 255, 0, 0, 0
  71.     db      0, 255, 255, 0, 0, 0, 0, 0, 0, 0, 255, 255
  72.     db      255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255
  73.     db      255, 0, 255, 0, 0, 255, 255, 0, 255, 0, 255, 0
  74.     db      0, 0, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255
  75.     db      0, 255, 0, 255, 0, 0, 0, 0, 255, 255, 255, 255
  76.     db      255, 0, 255, 255, 255, 255, 0, 0, 0, 255, 255, 255
  77.     db      0, 255, 255, 0, 0, 255, 0, 255, 255, 0, 255, 0
  78.     db      255, 255, 255, 255, 255, 0, 255, 0, 0, 0, 0, 0
  79.     db      255, 0, 0, 0, 0, 0, 255, 255, 0, 255, 0, 0
  80.     db      0, 255, 255, 255, 0, 255, 255, 0, 255, 255, 0, 255
  81.     db      0, 0, 255, 0, 0, 0, 0, 0, 255, 255, 0, 255
  82.     db      0, 0, 0, 255, 0, 0, 255, 255, 255, 255, 0, 255
  83.     db      0, 0, 255, 0, 0, 255, 0, 255, 0, 255, 255, 255
  84.     db      0, 0, 0, 255, 0, 0, 0, 255, 255, 0, 255, 0
  85.     db      0, 0, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0
  86.     db      0, 255, 0, 0, 255, 255, 0, 255, 255, 255, 255, 0
  87.     db      0, 0, 255, 255, 0, 0, 255, 255, 0, 255, 255, 0
  88.     db      0, 255, 0, 255, 255, 0, 0, 0, 0, 255, 0, 255
  89.     db      255, 255, 255, 0, 0, 255, 255, 0, 255, 0, 255, 0
  90.     db      255, 0, 0, 0, 255, 255, 255, 255, 0, 255, 255, 0
  91.     db      0, 0, 0, 0, 255, 0, 0, 255, 0, 0, 0, 0
  92.     db      255, 0, 0, 255, 0, 0, 255, 255, 255, 0, 255, 0
  93.     db      255, 255, 255, 0, 0, 0, 255, 0, 0, 255, 255, 255
  94.     db      0, 255, 0, 0, 255, 0, 0
  95.  
  96. EVEN
  97. palette LABEL BYTE
  98.     db      0, 0, 0, 0, 0, 6, 0, 0, 6, 0, 0, 7
  99.     db      0, 0, 8, 0, 0, 8, 0, 0, 9, 0, 0, 10
  100.     db      2, 0, 10, 4, 0, 9, 6, 0, 9, 8, 0, 8
  101.     db      10, 0, 7, 12, 0, 7, 14, 0, 6, 16, 0, 5
  102.     db      18, 0, 5, 20, 0, 4, 22, 0, 4, 24, 0, 3
  103.     db      26, 0, 2, 28, 0, 2, 30, 0, 1, 32, 0, 0
  104.     db      32, 0, 0, 33, 0, 0, 34, 0, 0, 35, 0, 0
  105.     db      36, 0, 0, 36, 0, 0, 37, 0, 0, 38, 0, 0
  106.     db      39, 0, 0, 40, 0, 0, 40, 0, 0, 41, 0, 0
  107.     db      42, 0, 0, 43, 0, 0, 44, 0, 0, 45, 0, 0
  108.     db      46, 1, 0, 47, 1, 0, 48, 2, 0, 49, 2, 0
  109.     db      50, 3, 0, 51, 3, 0, 52, 4, 0, 53, 4, 0
  110.     db      54, 5, 0, 55, 5, 0, 56, 6, 0, 57, 6, 0
  111.     db      58, 7, 0, 59, 7, 0, 60, 8, 0, 61, 8, 0
  112.     db      63, 9, 0, 63, 9, 0, 63, 10, 0, 63, 10, 0
  113.     db      63, 11, 0, 63, 11, 0, 63, 12, 0, 63, 12, 0
  114.     db      63, 13, 0, 63, 13, 0, 63, 14, 0, 63, 14, 0
  115.     db      63, 15, 0, 63, 15, 0, 63, 16, 0, 63, 16, 0
  116.     db      63, 17, 0, 63, 17, 0, 63, 18, 0, 63, 18, 0
  117.     db      63, 19, 0, 63, 19, 0, 63, 20, 0, 63, 20, 0
  118.     db      63, 21, 0, 63, 21, 0, 63, 22, 0, 63, 22, 0
  119.     db      63, 23, 0, 63, 24, 0, 63, 24, 0, 63, 25, 0
  120.     db      63, 25, 0, 63, 26, 0, 63, 26, 0, 63, 27, 0
  121.     db      63, 27, 0, 63, 28, 0, 63, 28, 0, 63, 29, 0
  122.     db      63, 29, 0, 63, 30, 0, 63, 30, 0, 63, 31, 0
  123.     db      63, 31, 0, 63, 32, 0, 63, 32, 0, 63, 33, 0
  124.     db      63, 33, 0, 63, 34, 0, 63, 34, 0, 63, 35, 0
  125.     db      63, 35, 0, 63, 36, 0, 63, 36, 0, 63, 37, 0
  126.     db      63, 38, 0, 63, 38, 0, 63, 39, 0, 63, 39, 0
  127.     db      63, 40, 0, 63, 40, 0, 63, 41, 0, 63, 41, 0
  128.     db      63, 42, 0, 63, 42, 0, 63, 43, 0, 63, 43, 0
  129.     db      63, 44, 0, 63, 44, 0, 63, 45, 0, 63, 45, 0
  130.     db      63, 46, 0, 63, 46, 0, 63, 47, 0, 63, 47, 0
  131.     db      63, 48, 0, 63, 48, 0, 63, 49, 0, 63, 49, 0
  132.     db      63, 50, 0, 63, 50, 0, 63, 51, 0, 63, 52, 0
  133.     db      63, 52, 0, 63, 52, 0, 63, 52, 0, 63, 52, 0
  134.     db      63, 53, 0, 63, 53, 0, 63, 53, 0, 63, 53, 0
  135.     db      63, 54, 0, 63, 54, 0, 63, 54, 0, 63, 54, 0
  136.     db      63, 54, 0, 63, 55, 0, 63, 55, 0, 63, 55, 0
  137.     db      63, 55, 0, 63, 56, 0, 63, 56, 0, 63, 56, 0
  138.     db      63, 56, 0, 63, 57, 0, 63, 57, 0, 63, 57, 0
  139.     db      63, 57, 0, 63, 57, 0, 63, 58, 0, 63, 58, 0
  140.     db      63, 58, 0, 63, 58, 0, 63, 59, 0, 63, 59, 0
  141.     db      63, 59, 0, 63, 59, 0, 63, 60, 0, 63, 60, 0
  142.     db      63, 60, 0, 63, 60, 0, 63, 60, 0, 63, 61, 0
  143.     db      63, 61, 0, 63, 61, 0, 63, 61, 0, 63, 62, 0
  144.     db      63, 62, 0, 63, 62, 0, 63, 62, 0, 63, 63, 0
  145.     db      63, 63, 1, 63, 63, 2, 63, 63, 3, 63, 63, 4
  146.     db      63, 63, 5, 63, 63, 6, 63, 63, 7, 63, 63, 8
  147.     db      63, 63, 9, 63, 63, 10, 63, 63, 10, 63, 63, 11
  148.     db      63, 63, 12, 63, 63, 13, 63, 63, 14, 63, 63, 15
  149.     db      63, 63, 16, 63, 63, 17, 63, 63, 18, 63, 63, 19
  150.     db      63, 63, 20, 63, 63, 21, 63, 63, 21, 63, 63, 22
  151.     db      63, 63, 23, 63, 63, 24, 63, 63, 25, 63, 63, 26
  152.     db      63, 63, 27, 63, 63, 28, 63, 63, 29, 63, 63, 30
  153.     db      63, 63, 31, 63, 63, 31, 63, 63, 32, 63, 63, 33
  154.     db      63, 63, 34, 63, 63, 35, 63, 63, 36, 63, 63, 37
  155.     db      63, 63, 38, 63, 63, 39, 63, 63, 40, 63, 63, 41
  156.     db      63, 63, 42, 63, 63, 42, 63, 63, 43, 63, 63, 44
  157.     db      63, 63, 45, 63, 63, 46, 63, 63, 47, 63, 63, 48
  158.     db      63, 63, 49, 63, 63, 50, 63, 63, 51, 63, 63, 52
  159.     db      63, 63, 52, 63, 63, 53, 63, 63, 54, 63, 63, 55
  160.     db      63, 63, 56, 63, 63, 57, 63, 63, 58, 63, 63, 59
  161.     db      63, 63, 60, 63, 63, 61, 63, 63, 62, 0, 0, 0
  162.  
  163. .code
  164.  
  165. mainbit         PROC NEAR
  166.     
  167.     call    WaitRetrace
  168.  
  169.  
  170.     mov     dx, 3c4h                        ;Sequencer Register
  171.     mov     al, 2                           ;Index 2
  172.     mov     ah, 0011b                       ;Enable planes 1 and 2
  173.     out     dx, ax
  174.  
  175.     mov     ax, 0a000h                      ;ES -> VGA
  176.     mov     es, ax
  177.     mov     si, offset FireBuf              ;DS:SI -> Fire buffer
  178.     
  179.     mov     di, (320/4) * 15               ;ES:DI -> 25 lines down VGA
  180.     
  181.     
  182.     mov     cx, ((68*160) / 2) / 4         ; 1/2 of the buffer, in DWORDS
  183.     rep     movsd
  184.     
  185.     mov     dx, 3c4h                        ;Sequencer Register
  186.     mov     al, 2                           ;Index 2
  187.     mov     ah, 1100b                       ;Enable planes 3 and 4
  188.     out     dx, ax
  189.  
  190.     ;mov     si, offset FireBuf              ;DS:SI -> Fire Buffer +1
  191.     ;inc     si
  192.     add     si, 80 * 4                      ;skip 2 seed lines - TEST!!!
  193.     
  194.     mov     di, (320/4) * 15               ;ES:DI -> 25 lines down VGA 
  195.         
  196.     mov     cx, ((68*160) / 2) / 4         ; 1/2 of the buffer in DWORDS
  197.     rep     movsd
  198.  
  199.  
  200.     mov     ax, ds
  201.     mov     es, ax                          ;ES = DS
  202.     mov     si, offset RandTab              ;pointer to Random numbers
  203.     add     si, [RandPos]                   ;offset the position
  204.     mov     di, offset FireBuf              ;pointer to Fire Buffer
  205.     add     di, 70*80                       ;put DI at the last 2 lines
  206.  
  207.     mov     cx, 80                          ;80 pixels across buffer
  208.                         ;(for planes 1&2)                                               
  209.     seedloop:
  210.     movsb                                   ;mov SI -> DI
  211.     inc     [RandPos]                       ;Store RandPos (add 3)
  212.     inc     [RandPos]
  213.     inc     [RandPos]
  214.     inc     si                              ;Inc source (only 2 req'd)
  215.     inc     si
  216.     cmp     [RandPos], 700                  ;Have we read 400 randoms?
  217.     jb      noreset
  218.  
  219.     mov     [RandPos], 0                    ;Reset RandPos
  220.     mov     ax, [RandOff]
  221.     add     [RandPos], ax                   ;Random no. offset adjust
  222.     mov     si, offset RandTab              ;pointer to Random numbers
  223.     add     si, ax                          ;add the offset adjust
  224.  
  225.     inc     [RandOff]                       ;increase the offset
  226.     and     [RandOff], 255                  ;limit offset 0-255
  227.     ;sub     si, 700                         ;And SI
  228.     noreset:
  229.     loop    seedloop
  230.  
  231.     mov     si, offset FireBuf              ;Source in Fire Buffer
  232.     add     si, 70*80                       ;SI = 2 lines from bottom
  233.     mov     di, si                          ;Dest also there
  234.     add     di, 80                          ;but one line down
  235.  
  236.     mov     cx, 80 / 4                      ;copy one 80 pixel seed line
  237.     rep     movsd                           ;down to the next
  238.                 ;(Important to have 2 seed lines to get the
  239.                 ; proper fire effect)
  240.  
  241.     ;Now do the same with planes 3&4
  242.     
  243.     mov     si, offset RandTab              ;pointer to Random numbers
  244.     add     si, [RandPos]                   ;offset the position
  245.  
  246.     mov     di, offset FireBuf              ;pointer to Fire Buffer
  247.     add     di, 142*80                      ;put DI at the last 2 lines
  248.  
  249.     mov     cx, 80                          ;80 pixels across buffer
  250.                         ;(for planes 1&2)                                               
  251.     seedloop1:
  252.     movsb                                   ;mov SI -> DI
  253.     inc     [RandPos]                       ;Store RandPos (add 3)
  254.     inc     [RandPos]
  255.     inc     [RandPos]
  256.     inc     si                              ;Inc source (only 2 req'd)
  257.     inc     si
  258.     cmp     [RandPos], 700                  ;Have we read 400 randoms?
  259.     jb      noreset1
  260.  
  261.     mov     [RandPos], 0                    ;Reset RandPos
  262.     mov     ax, [RandOff]
  263.  
  264.     add     [RandPos], ax                   ;Random no. offset adjust
  265.     mov     si, offset RandTab              ;pointer to Random numbers
  266.     add     si, ax                          ;add the offset adjust
  267.  
  268.     inc     [RandOff]                       ;increase the offset
  269.     and     [RandOff], 255                  ;limit offset 0-255
  270.     ;sub     si, 700                         ;And SI
  271.     noreset1:
  272.     loop    seedloop1
  273.  
  274.     mov     si, offset FireBuf              ;Source in Fire Buffer
  275.     add     si, 142*80                      ;SI = 2 lines from bottom
  276.     mov     di, si                          ;Dest also there
  277.     add     di, 80                          ;but one line down
  278.  
  279.     mov     cx, 80 / 4                      ;copy one 160 pixel seed line
  280.     rep     movsd                           ;down to the next
  281.                 ;(Important to have 2 seed lines to get the
  282.                 ; proper fire effect)
  283.  
  284.     ; *** NOW AVERAGE THE PIXELS TO GIVE A FIRE EFFECT ! ***
  285.  
  286.  
  287.     mov     cx, 70*80                       ;average 50 lines * 80 pixels
  288.     
  289.     mov     di, offset FireBuf
  290.     
  291.     xor     ax, ax                          ;ONE individual one (the first
  292.     xor     dx, dx                          ;element)
  293.                         ;otherwise it includes one
  294.                         ;of the seed line elements!
  295.                         ;(because its the first, and
  296.                         ;therefore no element to its
  297.                         ;left.                                          
  298.     mov     dl, [di+5760]                   ;<- see that? No LEFT pixel!
  299.     add     ax, dx                          ;source 1 line below so fire
  300.     mov     dl, [di+80]                     ;'scrolls' up
  301.     add     ax, dx
  302.     mov     dl, [di+5760]                   
  303.     add     ax, dx                          
  304.     mov     dl, [di+160]                    
  305.     add     ax, dx
  306.     shr     ax, 2                           ;divide by 4 to get average
  307.     jz      nodec                           ;skip decrement if already 0
  308.     dec     ax
  309.     jz      nodec
  310.     dec     ax
  311.     ;jz      onenodec
  312.     ;dec     ax
  313.     
  314.     onenodec:
  315.     mov     [di], ax                        ;put averaged pixel in di
  316.     inc     di                              ;next one
  317.     dec     cx
  318.  
  319.     avloop:
  320.     xor     ax, ax
  321.     xor     dx, dx
  322.     mov     dl, [di+5759]                   ;add 4 surrounding pixels
  323.     add     ax, dx                          ;source 1 line below so fire
  324.     mov     dl, [di+80]                     ;'scrolls' up
  325.     add     ax, dx
  326.     mov     dl, [di+5760]
  327.     add     ax, dx
  328.     mov     dl, [di+160]
  329.     add     ax, dx
  330.     shr     ax, 2                           ;divide by 4 to get average
  331.     jz      nodec                           ;skip decrement if already 0
  332.     dec     ax
  333.     ;jz      nodec
  334.     ;dec     ax
  335.     ;jz      nodec
  336.     ;dec     ax
  337.     
  338.     nodec:
  339.     mov     [di], ax                        ;put averaged pixel in di
  340.     inc     di                              ;next one
  341.     loop    avloop                          ;loop to top, decrement cx
  342.  
  343.     mov     cx, 70*80                      ;average 50 lines * 80 pixels
  344.     ;mov     di, offset FireBuf            ;leave DI as it is
  345.     
  346.     add     di, 80*2                        ;skip 2 seed lines
  347.     avloop1:
  348.     xor     ax, ax
  349.     xor     dx, dx
  350.     mov     dl, [di-5760]                   ;add 4 surrounding pixels
  351.     add     ax, dx                          ;source 1 line below so fire
  352.     mov     dl, [di+80]                     ;'scrolls' up
  353.     add     ax, dx
  354.     mov     dl, [di-5759]
  355.     add     ax, dx
  356.     mov     dl, [di+160]
  357.     add     ax, dx
  358.     shr     ax, 2                           ;divide by 4 to get average
  359.     jz      nodec1                          ;skip decrement if already 0
  360.     dec     ax
  361.     ;jz      nodec1
  362.     ;dec     ax
  363.     ;jz      nodec1
  364.     ;dec     ax
  365.     
  366.     nodec1:
  367.     mov     [di], ax                        ;put averaged pixel in di
  368.     inc     di                              ;next one
  369.     loop    avloop1                         ;loop to top, decrement cx
  370.  
  371.     PollSB                    ;poll the music
  372.  
  373.  
  374.     
  375.     ret
  376. mainbit         ENDP
  377.  
  378. LoadPic         PROC NEAR
  379.  
  380.     push    ds
  381.     mov     ax, 3d00h                       ;Open file, read only
  382.     mov     dx, offset DatName
  383.     int     21h
  384.     mov     bx, ax                          ;store the handle in BX
  385.     
  386.     mov     ax, [WordSeg]            ;allocated segment
  387.     mov     ds, ax
  388.     xor     dx, dx
  389.     
  390.     mov     cx, 32000                       ;size of data file
  391.         
  392.     mov     ah, 3Fh                         ;read file
  393.     int     21h
  394.     
  395.     mov     ah, 3Eh                         ;close file (BX already set)
  396.     int     21h
  397.  
  398.     pop     ds
  399.     ret
  400. LoadPic         ENDP
  401.  
  402. WriteBuffer     PROC NEAR
  403.     ;CX = offset into Pic Buffer (ie the text line)
  404.     push    ds
  405.     mov     ax, ds
  406.     mov     es, ax
  407.  
  408.     mov     ax, [WordSeg]
  409.     mov     ds, ax
  410.     
  411.     xor     si, si 
  412.     add     si, cx                          ;line offset
  413.     mov     di, offset FireBuf
  414.     add     di, (55 * 80) + 5               ;offset into fire (plane 1)
  415.     
  416.     mov     cx, (160 * 10) / 2              ;half of one sentence
  417.      xorloop:   
  418.     mov     al, [si]                        ;get byte from Picture Buffer               
  419.     or      es:[di], al                     ;OR it with FireBuffer
  420.     inc     si
  421.     inc     di
  422.     loop    xorloop
  423.  
  424.     mov     di, offset FireBuf
  425.     add     di, (72 * 80) + (55 * 80) + 5   ;offset into fire (plane 2)
  426.     mov     cx, (160 * 10) / 2
  427.      xorloop1:   
  428.     mov     al, [si]                        ;get byte from Picture Buffer               
  429.     or      es:[di], al                     ;OR it with FireBuffer
  430.     inc     si
  431.     inc     di
  432.     loop    xorloop1
  433.  
  434.  
  435.     pop     ds
  436.     ret
  437. WriteBuffer     ENDP
  438.  
  439. FillBack        PROC NEAR
  440.     
  441.     mov     ax, 0a000h                      ;Set up VGA pointer
  442.     mov     es, ax
  443.     xor     di,di
  444.     mov     dx, 3c4h                        ;Seq Address
  445.     mov     ah, 1111b                       ;ALL planes
  446.     mov     al, 2                           ;Map Mask
  447.     out     dx, ax
  448.     
  449.     mov     ah, 8                           ;Fill with blue
  450.     mov     al, 8
  451.     mov     cx, (25*80) / 2                 ;Fill 25 lines, word at a time
  452.                         ;(80*4 = 320 | Unchained)
  453.     rep     stosw                           ;Fill it
  454.     add     di, (48 * 80)                   ;skip over the fire part
  455.     mov     cx, (25 * 80)                   ;Another 25 lines
  456.     rep     stosw
  457.     ret
  458. FillBack        ENDP
  459.  
  460. FireDemo    PROC NEAR
  461.  
  462.     call    Set13h
  463.     mov    cx, 40            ;320 wide
  464.     call    SetModeX
  465.     mov    cx, 3
  466.     call    SetDScan        ;set doublescan
  467.     
  468.     call    ClearModeX
  469.     mov     si, offset palette
  470.     call    setpal
  471.  
  472.     call    FillBack
  473.     mov    ecx, 2000000h
  474.     waitkey2:
  475.     call    mainbit
  476.     
  477.     sub    ecx, 10000h 
  478.     jnz     waitkey2
  479.  
  480.  
  481.     call    WriteBuffer
  482.      
  483.     mov     cx, 150
  484.      funkloop:
  485.     push    cx
  486.     call    mainbit
  487.     xor     cx, cx                          ;Line 1 of text
  488.     call    WriteBuffer
  489.     pop     cx
  490.     loop    funkloop
  491.  
  492.     mov     cx, 30
  493.      funkloop2:
  494.     push    cx
  495.     call    mainbit
  496.     pop     cx
  497.     loop    funkloop2
  498.     
  499.     mov     cx, 150
  500.      funkloop3:
  501.     push    cx
  502.     call    mainbit
  503.     mov     cx, (1 * (160*10) )             ;1 line down
  504.     call    WriteBuffer
  505.     pop     cx
  506.     loop    funkloop3
  507.     
  508.     mov     cx, 200
  509.      funkloop4:
  510.     push    cx
  511.     call    mainbit
  512.     pop     cx
  513.     loop    funkloop4
  514.     
  515.     mov    ecx, 400000h        ;64 decrements    
  516.   fadeloop:
  517.     mov    si, offset Palette 
  518.     mov    bx, 1
  519.     call    DecPalette
  520.     call     mainbit
  521.     sub    ecx, 10000h
  522.     jnz    fadeloop
  523.  
  524.  
  525.     ret
  526. FireDemo    ENDP
  527.  
  528.