home *** CD-ROM | disk | FTP | other *** search
/ Stars of Shareware: Animation & Sound / SOS-ANIM_SOUND.ISO / programm / ldplasm / plasma.asm < prev    next >
Assembly Source File  |  1993-07-20  |  50KB  |  981 lines

  1. ;|----------------------------------------------------------------------------|
  2. ;|      written 1993 by Alexander Lenhardt (Centauri of Legend Design)        |
  3. ;|      All rights reserved                                                   |
  4. ;|      Inspired by VTIRIS from VangeliSTeam                                  |
  5. ;|      USE (c) is a Trademark of AWL - Trade and Development                 |
  6. ;|                                                                            |
  7. ;|----------------------------------------------------------------------------|
  8. ;******************************************************************************
  9. ;ASSEMBLER COMMANDS
  10. ;******************************************************************************
  11. ;------------------------------------------------------------------------------
  12.                 MODEL SMALL
  13.                 .STACK 300H
  14.                 .386
  15. ;------------------------------------------------------------------------------
  16. ;******************************************************************************
  17. ;STRUCTURES
  18. ;******************************************************************************
  19. ;------------------------------------------------------------------------------
  20. ;------------------------------------------------------------------------------
  21. ;******************************************************************************
  22. ;EQUALS
  23. ;******************************************************************************
  24. ;------------------------------------------------------------------------------
  25.  IMAGE_DELAY    EQU 200           ;cyclces until face appears or disappears
  26.  LIFT_DELAY     EQU 3             ;delay cycles between every "face lift"
  27.  LOGO_X         EQU 0             ;start x position for legend logo plasma
  28.  LOGO_Y         EQU 65            ;start y position for legend logo plasma
  29.  LOGO_LENGTH    EQU 80            ;logo length in pixel
  30.  LOGO_HEIGTH    EQU 15            ;logo height in pixel
  31.  P_WIDTH        EQU 60            ;plasma width after pop up
  32.  P_HEIGTH       EQU 50            ;plasma height after pop up
  33. ;------------------------------------------------------------------------------
  34. ;==============================================================================
  35.  .DATA
  36. ;==============================================================================
  37. ;******************************************************************************
  38. ;PREDEFINED LOCAL VARIABLES AND AREAS
  39. ;******************************************************************************
  40. ;------------------------------------------------------------------------------
  41.  COSTABLE       DB 64,64,64,64,64,64,64,64,63,63,63,63
  42.                 DB 63,62,62,62,62,61,61,61,60,60,59,59
  43.                 DB 59,58,58,57,57,56,56,55,55,54,53,53
  44.                 DB 52,52,51,50,50,49,48,48,47,46,46,45
  45.                 DB 44,44,43,42,41,41,40,39,38,37,37,36
  46.                 DB 35,34,34,33,32,31,30,30,29,28,27,27
  47.                 DB 26,25,24,23,23,22,21,20,20,19,18,18
  48.                 DB 17,16,16,15,14,14,13,12,12,11,11,10
  49.                 DB  9, 9, 8, 8, 7, 7, 6, 6, 5, 5, 5, 4
  50.                 DB  4, 3, 3, 3, 2, 2, 2, 2, 1, 1, 1, 1
  51.                 DB  1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
  52.                 DB  0, 0, 0, 0, 1, 1, 1, 1, 1, 2, 2, 2
  53.                 DB  2, 3, 3, 3, 4, 4, 5, 5, 5, 6, 6, 7
  54.                 DB  7, 8, 8, 9, 9,10,11,11,12,12,13,14
  55.                 DB 14,15,16,16,17,18,18,19,20,20,21,22
  56.                 DB 23,23,24,25,26,27,27,28,29,30,30,31
  57.                 DB 32,33,34,34,35,36,37,37,38,39,40,41
  58.                 DB 41,42,43,44,44,45,46,46,47,48,48,49
  59.                 DB 50,50,51,52,52,53,53,54,55,55,56,56
  60.                 DB 57,57,58,58,59,59,59,60,60,61,61,61
  61.                 DB 62,62,62,62,63,63,63,63,63,64,64,64
  62.                 DB 64,64,64,64
  63.                                   ;cosinus table for creating plasma
  64.                                   ;movings
  65. ;------------------------------------------------------------------------------
  66.  COSTABLE_COLOR DB 03FH,03FH,03FH,03FH,03FH,03FH,03FH,03FH
  67.                 DB 03EH,03EH,03EH,03EH,03EH,03DH,03DH,03DH
  68.                 DB 03DH,03CH,03CH,03CH,03BH,03BH,03BH,03AH
  69.                 DB 03AH,039H,039H,038H,038H,037H,037H,036H
  70.                 DB 036H,035H,035H,034H,033H,033H,032H,032H
  71.                 DB 031H,030H,030H,02FH,02EH,02EH,02DH,02CH
  72.                 DB 02CH,02BH,02AH,029H,029H,028H,027H,026H
  73.                 DB 026H,025H,024H,023H,023H,022H,021H,020H
  74.                 DB 020H,01FH,01EH,01DH,01CH,01CH,01BH,01AH
  75.                 DB 019H,019H,018H,017H,016H,016H,015H,014H
  76.                 DB 013H,013H,012H,011H,011H,010H,00FH,00FH
  77.                 DB 00EH,00DH,00DH,00CH,00CH,00BH,00AH,00AH
  78.                 DB 009H,009H,008H,008H,007H,007H,006H,006H
  79.                 DB 005H,005H,004H,004H,004H,003H,003H,003H
  80.                 DB 002H,002H,002H,002H,001H,001H,001H,001H
  81.                 DB 001H,000H,000H,000H,000H,000H,000H,000H
  82.                 DB 000H,000H,000H,000H,000H,000H,000H,000H
  83.                 DB 001H,001H,001H,001H,001H,002H,002H,002H
  84.                 DB 002H,003H,003H,003H,004H,004H,004H,005H
  85.                 DB 005H,006H,006H,007H,007H,008H,008H,009H
  86.                 DB 009H,00AH,00AH,00BH,00CH,00CH,00DH,00DH
  87.                 DB 00EH,00FH,00FH,010H,011H,011H,012H,013H
  88.                 DB 013H,014H,015H,016H,016H,017H,018H,019H
  89.                 DB 019H,01AH,01BH,01CH,01CH,01DH,01EH,01FH
  90.                 DB 020H,020H,021H,022H,023H,023H,024H,025H
  91.                 DB 026H,026H,027H,028H,029H,029H,02AH,02BH
  92.                 DB 02CH,02CH,02DH,02EH,02EH,02FH,030H,030H
  93.                 DB 031H,032H,032H,033H,033H,034H,035H,035H
  94.                 DB 036H,036H,037H,037H,038H,038H,039H,039H
  95.                 DB 03AH,03AH,03BH,03BH,03BH,03CH,03CH,03CH
  96.                 DB 03DH,03DH,03DH,03DH,03EH,03EH,03EH,03EH
  97.                 DB 03EH,03FH,03FH,03FH,03FH,03FH,03FH,03FH
  98.                                   ;cosinus table for creating plasma
  99.                                   ;color cyclings
  100. ;------------------------------------------------------------------------------
  101.  PALETTE        DB 0,0,0          ;first color black
  102.                 I=0               ;create
  103.                 REPT 64           ;a black faded
  104.                 DB I/2,I/2,I/2    ;white
  105.                 I=I+1             ;palette
  106.                 ENDM              ;using asm macros
  107.                 DB 26,32,32       ;middle color a little bit cyan
  108.                 I=1               ;than create a palette part
  109.                 REPT 63           ;white faded
  110.                 DB 32-I/2,32-I/2,32-I/2
  111.                                   ;to black
  112.                 I=I+1             ;using
  113.                 ENDM              ;asm macros too
  114. ;------------------------------------------------------------------------------
  115.  PLASMA_POS     DW 68+57*80       ;the plasma position at the beginning
  116.  PLASMA_WIDTH   DB 1              ;the start plasma width
  117.  PLASMA_HEIGTH  DB 1              ;the start plasma height
  118.  COSPOSC1       DB ?              ;phase offset for red cosinus wave
  119.  COSPOSC2       DB ?              ;phase offset for green cosinus wave
  120.  COSPOSC3       DB ?              ;phase offset for blue cosinus wave
  121.  COSPOSX1       DB ?              ;phase offset for first horizontal wave
  122.  COSPOSX2       DB ?              ;phase offset for second horizontal wave
  123.  COSPOSY1       DB ?              ;phase offset for first vertical wave
  124.  COSPOSY2       DB ?              ;phase offset for second vertical wave
  125.  RUN_X1_POS     DW ?              ;current position in 1. hor. cos. wave
  126.  RUN_X2_POS     DW ?              ;current position in 2. hor. cos. wave
  127.  RUN_Y1_POS     DW ?              ;current position in 1. vert. cos. wave
  128.  RUN_Y2_POS     DW ?              ;current position in 2. vert. cos. wave
  129.  IMAGE_LIFT     DB 0              ;current image value multiplier
  130.  COUNTER        DW LIFT_DELAY     ;counter for delay between two lifts
  131.  COUNTER2       DW IMAGE_DELAY    ;counter for delay between up and down lifts
  132.  LINE_DOUBLE    DB 4              ;adding value for maximum raster line reg.
  133.  PLASMA_PICTURE DW OFFSET PLASMA_IMAGE
  134.                                   ;offset for the plasma face
  135.  HORIZ_ADD_1    DW 300H           ;speed to go thru 1. hor. cos. wave (real)
  136.  HORIZ_ADD_2    DW 200H           ;speed to go thru 2. hor. cos. wave (real)
  137.  VERTI_ADD_1    DW 300H           ;speed to go thru 1. vert. cos. wave (real)
  138.  VERTI_ADD_2    DW 100H           ;speed to go thru 2. vert. cos. wave (real)
  139.  COS_RUNXADD1   DB 0              ;current pos. in 1. hor. speed cos. wave
  140.  COS_RUNXADD2   DB 0              ;current pos. in 2. hor. speed cos. wave
  141.  COS_RUNYADD1   DB 0              ;current pos. in 1. vert. speed cos. wave
  142.  COS_RUNYADD2   DB 0              ;current pos. in 2. vert. speed cos. wave
  143.  RCOS_POS       DW 0              ;current pos. in red cosinus wave
  144.  GCOS_POS       DW 0              ;current pos. in green cosinus wave
  145.  BCOS_POS       DW 0              ;current pos. in blue cosuins wave
  146.  UPDOWN_FLAG    DB 255            ;flag if plasma face has to faded up or down
  147.  GOTO_BW_FLAG   DB 0              ;flag if color have to be faded to black&w
  148.  R_FASTNES      DW 400H           ;speed to go thru red cosinus wave (real)
  149.  G_FASTNES      DW 200H           ;speed to go thru green cosinus wave (real)
  150.  B_FASTNES      DW 300H           ;speed to go thru blue cosinus wave (real)
  151.  HOME_FLAG      DB 0              ;flag if this part has to be finished
  152.  BW_DONE_FLG    DB 0              ;flag if the bw-move was successful
  153.  FADE_DONE_FLG  DB 0              ;flag if the rgb speed set was successful
  154.  LOUDNES        DW 04040H         ;the start master volume for left and right
  155.  SONG_NAME      DB "FANTA.MOD",0  ;the name of the mod to play
  156. ;------------------------------------------------------------------------------
  157.  PLASMA_IMAGE   DB "{MARKER}PLASFACE.BIN"
  158.                                   ;free space to
  159.                 DB 2980 DUP (0)   ;link in the plasma picture
  160. ;------------------------------------------------------------------------------
  161.  LOGO_PICTURE   DB "{MARKER}80X15   .BIN"
  162.                                   ;free space to link in
  163.                 DB 1180 DUP (0)   ;the legend design logo
  164. ;------------------------------------------------------------------------------
  165.  COLOR_CONVERT  LABEL BYTE        ;create
  166.                 I=0               ;a table
  167.                 REPT 128          ;to supress
  168.                 DB 128+I          ;bad lookin'
  169.                 I=I+1             ;wrap around
  170.                 ENDM              ;effects
  171.                 I=0               ;'coz the plasma routine
  172.                 REPT 128          ;creates values from 0 to 255
  173.                 DB 255-I          ;while only 128 colors are
  174.                 I=I+1             ;hold free for the plasma
  175.                 ENDM
  176. ;------------------------------------------------------------------------------
  177. ;==============================================================================
  178.  .CODE
  179. ;==============================================================================
  180. ;******************************************************************************
  181. ;HELPMACROS
  182. ;******************************************************************************
  183. ;------------------------------------------------------------------------------
  184. ;Explanation:waits for the vertical display retrace
  185. ;Inputs :none
  186. ;Outputs:none
  187. ;Registers destroyed:AX,DX
  188. ;Possible errors:none
  189. ;Cycles used on 386:
  190. ;------------------------------------------------------------------------------
  191.  WAIT_VSYNC     MACRO
  192.                 LOCAL @@VS1,@@VS2
  193.                 MOV DX,3DAH       ;load DX with vga status port
  194.  @@VS1:
  195.                 IN AL,DX          ;load AL with value from this port
  196.                 TEST AL,8         ;is there still a retrace ?
  197.                 JZ @@VS1          ;yes,then loop until this retrace ends
  198.  @@VS2:
  199.                 IN AL,DX          ;load AL with vga status
  200.                 TEST AL,8         ;is there a display phase ?
  201.                 JNZ @@VS2         ;yes,then wait until a new retrace starts
  202.                 ENDM
  203. ;------------------------------------------------------------------------------
  204. ;******************************************************************************
  205. ;HELPPROCEDURES
  206. ;******************************************************************************
  207. ;------------------------------------------------------------------------------
  208. ;Explanation:draws a plasma on screen
  209. ;Inputs :ES contains vga page segment,DS data segment
  210. ;Outputs:none
  211. ;Registers destroyed:AX,BX,CX,DX,SI,DI
  212. ;Possible errors:none
  213. ;Cycles used on 386:
  214. ;------------------------------------------------------------------------------
  215.  DO_PLASMA      PROC NEAR
  216.                 MOV DX,3C4H       ;load DX with sequencer address
  217.                 MOV AX,0F02H      ;and enable writing to all planes
  218.                 OUT DX,AX         ;by sending above value to sequencer
  219.                 MOV DI,WORD PTR [PLASMA_POS]
  220.                                   ;load DI with current plasma position
  221.                 MOV SI,WORD PTR [PLASMA_PICTURE]
  222.                                   ;load SI with current facepicture offset
  223.                 MOV AH,BYTE PTR [PLASMA_HEIGTH]
  224.                                   ;load AH with current plasma heigth
  225.                 MOV AL,BYTE PTR [COSPOSY1]
  226.                                   ;load AL with 1. hor. wave phase
  227.                                   ;offset
  228.                 MOV BYTE PTR [OFFSET RUN_Y1_POS+1],AL
  229.                                   ;and load integer part of current
  230.                                   ;1. hor. wave position with AL
  231.                 MOV AL,BYTE PTR [COSPOSY2]
  232.                                   ;do so with
  233.                 MOV BYTE PTR [OFFSET RUN_Y2_POS+1],AL
  234.                                   ;2. horizontal cosinus wave
  235.  @@LV:
  236.                 PUSH AX           ;save AX and DI
  237.                 PUSH DI           ;on stack
  238.                 MOV AH,BYTE PTR [PLASMA_WIDTH]
  239.                                   ;load AH with current plasma width
  240.                 MOV AL,BYTE PTR [COSPOSX1]
  241.                                   ;load AL with 1. vert. wave phase offset
  242.                 MOV BYTE PTR [OFFSET RUN_X1_POS+1],AL
  243.                                   ;and load integer part of current wave
  244.                                   ;position with this value
  245.                 MOV AL,BYTE PTR [COSPOSX2]
  246.                                   ;do so with
  247.                 MOV BYTE PTR [OFFSET RUN_X2_POS+1],AL
  248.                                   ;2. vertical cosinus wave
  249.                 MOV DL,BYTE PTR [OFFSET RUN_Y1_POS+1]
  250.                                   ;load DL and DH with current vertical
  251.                 MOV DH,BYTE PTR [OFFSET RUN_Y2_POS+1]
  252.                                   ;cosinus wave positions
  253.  @@LH:
  254.                 MOV BX,BP         ;load BX with BP (BP is a runvariable)
  255.                 MOV AL,BL         ;load AL with lower part of BP
  256.                 ADD AL,AH         ;add AH to AL (AH is random)
  257.                 XOR BH,BH         ;clear BH
  258.                 MOV BL,DL         ;load BL with current 1. vertical wave pos.
  259.                 ADD AL,BYTE PTR [BX]
  260.                                   ;so we get a pointer on the cosinus table
  261.                                   ;and add value from this table to AL
  262.                 MOV BL,DH         ;do so with second vertical
  263.                 ADD AL,BYTE PTR [BX]
  264.                                   ;wave position
  265.                 MOV BL,BYTE PTR [OFFSET RUN_X1_POS+1]
  266.                                   ;load BL with current 1. horizontal cosinus
  267.                                   ;wave position
  268.                 ADD AL,BYTE PTR [BX]
  269.                                   ;use BX as pointer to the cosinus table and
  270.                                   ;add table entry to AL
  271.                 MOV BL,BYTE PTR [OFFSET RUN_X2_POS+1]
  272.                                   ;do so with second horizontal cosinus
  273.                 ADD AL,BYTE PTR [BX]
  274.                                   ;wave position
  275.                 MOV BL,BYTE PTR [IMAGE_LIFT]
  276.                                   ;load BL with current picture value
  277.                                   ;multiplier
  278.                 PUSH AX           ;save AX on stack
  279.                 MOV AL,BYTE PTR [SI]
  280.                                   ;load AL with entry from plasma face buffer
  281.                 MUL BL            ;multiply entry by image lift value
  282.                 SHL AH,2          ;shift result in AH
  283.                 MOV BL,AH         ;load BL with result
  284.                 POP AX            ;restore AX from stack
  285.                 ADD AL,BL         ;and add result to AL
  286.                 MOV BX,OFFSET COLOR_CONVERT
  287.                                   ;load BX with offset of color convert table
  288.                 XLAT              ;and load AL with table entry
  289.                 STOSB             ;store result in screen memory
  290.                 MOV BX,WORD PTR [HORIZ_ADD_1]
  291.                                   ;load BX with 1. horizontal wave speed
  292.                 ADD WORD PTR [RUN_X1_POS],BX
  293.                                   ;and add it to current wave position
  294.                                   ;(we're simulating a real addition here)
  295.                 MOV BX,WORD PTR [HORIZ_ADD_2]
  296.                                   ;do so with second horizontal wave
  297.                 ADD WORD PTR [RUN_X2_POS],BX
  298.                                   ;and it's speed
  299.                 INC SI            ;go forward in plasma face buffer
  300.                 DEC AH            ;decrement loop counter
  301.                 JNZ @@LH          ;all horizontal dots done in this line ?
  302.                                   ;no,then jump
  303.                 POP DI            ;else restore plasma position offset
  304.                 ADD DI,80         ;and add 80 for a line jump
  305.                 MOV BX,WORD PTR [VERTI_ADD_1]
  306.                                   ;add wave speed of 1. vertical wave
  307.                 ADD WORD PTR [RUN_Y1_POS],BX
  308.                                   ;to it's current offset
  309.                 MOV BX,WORD PTR [VERTI_ADD_2]
  310.                                   ;and do so with
  311.                 ADD WORD PTR [RUN_Y2_POS],BX
  312.                                   ;second vertical cosinus wave
  313.                 POP AX            ;restore line counter in AH
  314.                 DEC AH            ;and decrement it
  315.                 JNZ @@LV          ;all lines done yet ? no,then jump
  316.                 RET               ;else return
  317.  DO_PLASMA      ENDP
  318. ;------------------------------------------------------------------------------
  319. ;Explanation:simulates a random set of the plasma and color variable
  320. ;Inputs :none
  321. ;Outputs:none
  322. ;Registers destroyed:AX,BX,CX,DX
  323. ;Possible errors:none
  324. ;Cycles used on 386:
  325. ;------------------------------------------------------------------------------
  326.  CALC_PLASM_RND PROC NEAR
  327.                 MOV CL,FS:[4]     ;load CL,CH,DL,DH
  328.                 MOV CH,FS:[9]     ;with current
  329.                 MOV DL,FS:[12]    ;values
  330.                 MOV DH,FS:[17]    ;from use dma buffer
  331.                 SHR CL,5          ;divide CL by 32
  332.                 SHR CH,6          ;divide CH by 64
  333.                 SHR DL,5          ;divide DL by 32
  334.                 SHR DH,4          ;and divide DH by 16
  335.                 ADD BYTE PTR [COSPOSX1],CL
  336.                                   ;add CL to 1.hwave phase offset
  337.                 SUB BYTE PTR [COSPOSX2],CH
  338.                                   ;decrement CH from 2.hwave phase offset
  339.                 ADD BYTE PTR [COSPOSY1],DL
  340.                                   ;add DL to 1.vwave phase offset
  341.                 SUB BYTE PTR [COSPOSY2],DH
  342.                                   ;decrement DH from 2.vwave phase offset
  343.                 XOR BH,BH         ;clear BH
  344.                 MOV BL,BYTE PTR [COS_RUNXADD1]
  345.                                   ;load BL with 1.hwave speed cosinus pos.
  346.                 MOV AL,BYTE PTR [BX]
  347.                                   ;load AL with speed from cosinus table
  348.                 XOR AH,AH         ;clear AH
  349.                 SHL AX,3;2        ;multiply AX by 8
  350.                 ADD AX,100H       ;add 100H (minimal speed)
  351.                 MOV WORD PTR [HORIZ_ADD_1],AX
  352.                                   ;and save result as new 1.hwave speed
  353.                 MOV BL,BYTE PTR [COS_RUNXADD2]
  354.                                   ;do so with
  355.                 MOV AL,BYTE PTR [BX]
  356.                                   ;all other waves
  357.                 XOR AH,AH
  358.                 SHL AX,3;2
  359.                 ADD AX,100H
  360.                 MOV WORD PTR [HORIZ_ADD_2],AX
  361.                 MOV BL,BYTE PTR [COS_RUNYADD1]
  362.                 MOV AL,BYTE PTR [BX]
  363.                 XOR AH,AH
  364.                 SHL AX,3;2
  365.                 ADD AX,100H
  366.                 MOV WORD PTR [VERTI_ADD_1],AX
  367.                 MOV BL,BYTE PTR [COS_RUNYADD2]
  368.                 MOV AL,BYTE PTR [BX]
  369.                 XOR AH,AH
  370.                 SHL AX,3;2
  371.                 ADD AX,100H
  372.                 MOV WORD PTR [VERTI_ADD_2],AX
  373.                 MOV CL,FS:[0]     ;load CL
  374.                 MOV CH,FS:[7]     ;CH,DL and
  375.                 MOV DL,FS:[11]    ;DH with values from
  376.                 MOV DH,FS:[13]    ;use dma buffer
  377.                 SHR CL,5;4        ;divide CL by 32
  378.                 SHR CH,4;3        ;divide CH by 16
  379.                 SHR DL,4;3        ;divide DL by 16
  380.                 SHR DH,5;4        ;divide DH by 32
  381.                 ADD BYTE PTR [COS_RUNXADD1],CL
  382.                                   ;and add CL,CH,DL,CH
  383.                 SUB BYTE PTR [COS_RUNXADD2],CH
  384.                                   ;to waves
  385.                 ADD BYTE PTR [COS_RUNYADD1],DL
  386.                                   ;speed cosinus positions
  387.                 SUB BYTE PTR [COS_RUNYADD2],DH
  388.                 MOV CL,FS:[32]    ;load CL,CH,DL with
  389.                 MOV CH,FS:[67]    ;values from
  390.                 MOV DL,FS:[21]    ;use dma buffer
  391.                 SHR CL,6          ;divide CL by 64
  392.                 SHR CH,7          ;divide CH by 128
  393.                 SHR DL,6          ;and divide DL by 64
  394.                 CMP BYTE PTR [GOTO_BW_FLAG],255
  395.                                   ;move colors to black&white
  396.                 JZ MOVE_TO_BW     ;yes,then jump
  397.                 ADD BYTE PTR [COSPOSC1],CL
  398.                                   ;else add CL to red cosinus phase offset
  399.                 SUB BYTE PTR [COSPOSC2],CH
  400.                                   ;add CH to green cosinus phase offset
  401.                 SUB BYTE PTR [COSPOSC3],DL
  402.                                   ;and add DL to blue cosinus phase offset
  403.                 RET               ;then leave this damned procedure
  404.  MOVE_TO_BW:
  405.                 CMP BYTE PTR [BW_DONE_FLG],63
  406.                                   ;move to bw done ?
  407.                 JZ FADE_OUT       ;yes,then start fading out
  408.                 CMP BYTE PTR [COSPOSC1],128
  409.                                   ;else check if red cosinus phase offset is
  410.                                   ;in then dead point of the cosinus
  411.                 JZ SKIP_R_CORRECT ;yes,then skip moving phase offset
  412.                 INC BYTE PTR [COSPOSC1]
  413.                                   ;else move it forward
  414.                 JMP R_CORREC_DONE ;and jump
  415.  SKIP_R_CORRECT:
  416.                 OR BYTE PTR [BW_DONE_FLG],1
  417.                                   ;set bit 0 in bw_done flag
  418.  R_CORREC_DONE:
  419.                 CMP BYTE PTR [COSPOSC2],128
  420.                                   ;do so with green
  421.                 JZ SKIP_G_CORRECT
  422.                 INC BYTE PTR [COSPOSC2]
  423.                 JMP G_CORREC_DONE
  424.  SKIP_G_CORRECT:
  425.                 OR BYTE PTR [BW_DONE_FLG],2
  426.  G_CORREC_DONE:
  427.                 CMP BYTE PTR [COSPOSC3],128
  428.                                   ;do so with blue
  429.                 JZ SKIP_B_CORRECT
  430.                 INC BYTE PTR [COSPOSC3]
  431.                 JMP B_CORREC_DONE
  432.  SKIP_B_CORRECT:
  433.                 OR BYTE PTR [BW_DONE_FLG],4
  434.  B_CORREC_DONE:
  435.                 CMP WORD PTR [R_FASTNES],100H
  436.                                   ;is red cosinus wave speed = 1 ?
  437.                 JBE SKIP_RSPEED_COR
  438.                                   ;yes,then skip correcting it
  439.                 SUB WORD PTR [R_FASTNES],10H
  440.                                   ;else correct it a little bit
  441.                 JMP R_SPEEDSET_DONE
  442.                                   ;and jump
  443.  SKIP_RSPEED_COR:
  444.                 OR BYTE PTR [BW_DONE_FLG],8
  445.                                   ;set bit 4 of bw_done flag
  446.  R_SPEEDSET_DONE:
  447.                 CMP WORD PTR [G_FASTNES],100H
  448.                                   ;do so with green
  449.                 JBE SKIP_GSPEED_COR
  450.                 SUB WORD PTR [G_FASTNES],10H
  451.                 JMP G_SPEEDSET_DONE
  452.  SKIP_GSPEED_COR:
  453.                 OR BYTE PTR [BW_DONE_FLG],16
  454.  G_SPEEDSET_DONE:
  455.                 CMP WORD PTR [B_FASTNES],100H
  456.                                   ;do so with blue
  457.                 JBE SKIP_BSPEED_COR
  458.                 SUB WORD PTR [B_FASTNES],10H
  459.                 JMP B_SPEEDSET_DONE
  460.  SKIP_BSPEED_COR:
  461.                 OR BYTE PTR [BW_DONE_FLG],32
  462.  B_SPEEDSET_DONE:
  463.                 RET               ;leave procedure
  464.  FADE_OUT:
  465.                 CMP WORD PTR [R_FASTNES],0
  466.                                   ;is red cosinus wave speed 0 ?
  467.                 JBE SKIP_RSPEED_COR2
  468.                                   ;yes,then skip calculating it to 0
  469.                 SUB WORD PTR [R_FASTNES],1
  470.                                   ;else calculate new speed
  471.                 JMP R_SPEEDSET_DONE2
  472.                                   ;and jump
  473.  SKIP_RSPEED_COR2:
  474.                 OR BYTE PTR [FADE_DONE_FLG],1
  475.                                   ;set bit 0 in fade done flag
  476.  R_SPEEDSET_DONE2:
  477.                 CMP WORD PTR [G_FASTNES],0
  478.                                   ;do so for green
  479.                 JBE SKIP_GSPEED_COR2
  480.                 SUB WORD PTR [G_FASTNES],1
  481.                 JMP G_SPEEDSET_DONE2
  482.  SKIP_GSPEED_COR2:
  483.                 OR BYTE PTR [FADE_DONE_FLG],2
  484.  G_SPEEDSET_DONE2:
  485.                 CMP WORD PTR [B_FASTNES],0
  486.                                   ;do so for blue
  487.                 JBE SKIP_BSPEED_COR2
  488.                 SUB WORD PTR [B_FASTNES],1
  489.                 JMP B_SPEEDSET_DONE2
  490.  SKIP_BSPEED_COR2:
  491.                 OR BYTE PTR [FADE_DONE_FLG],4
  492.  B_SPEEDSET_DONE2:
  493.                 CMP BYTE PTR [FADE_DONE_FLG],7
  494.                                   ;are all speeds zero ?
  495.                 JNZ MORE_BW_MOVES ;no,then correct'em until they are
  496.                 MOV BYTE PTR [HOME_FLAG],255
  497.                                   ;else set exit flag
  498.  MORE_BW_MOVES:
  499.                 RET               ;and return
  500.  CALC_PLASM_RND ENDP
  501. ;------------------------------------------------------------------------------
  502. ;Explanation:set maximum scan line register
  503. ;Inputs :none
  504. ;Outputs:none
  505. ;Registers destroyed:AX,DX,DS
  506. ;Possible errors:none
  507. ;Cycles used on 386:
  508. ;------------------------------------------------------------------------------
  509.  SET_MSL_REG    PROC
  510.                 MOV AX,@DATA      ;load DS with data segment
  511.                 MOV DS,AX         ;using AX register
  512.                 MOV DX,03D4H      ;load DX with crtc port
  513.                 MOV AL,9          ;and send msl index in AL
  514.                 MOV AH,BYTE PTR [LINE_DOUBLE]
  515.                                   ;and new msl value in AH
  516.                 OUT DX,AX         ;to crtc
  517.                 RET               ;return
  518.  SET_MSL_REG    ENDP
  519. ;------------------------------------------------------------------------------
  520. ;Explanation:cycle plasma colors (cycling means randomly creating)
  521. ;Inputs :DS contains data segment
  522. ;Outputs:none
  523. ;Registers destroyed:AX,BX,CX,DX,SI
  524. ;Possible errors:none
  525. ;Cycles used on 386:
  526. ;------------------------------------------------------------------------------
  527.  CYCLE_COLORS   PROC NEAR
  528.                 MOV SI,OFFSET COSTABLE_COLOR
  529.                                   ;load SI with offset of color cosinus tab.
  530.                 XOR BH,BH         ;clear BH and
  531.                 XOR AL,AL         ;AL
  532.                 MOV AH,BYTE PTR [COSPOSC1]
  533.                                   ;load AL with red cosinus phase offset
  534.                 MOV WORD PTR [RCOS_POS],AX
  535.                                   ;and store AX in current red offset
  536.                 MOV AH,BYTE PTR [COSPOSC2]
  537.                                   ;do so with green
  538.                 MOV WORD PTR [GCOS_POS],AX
  539.                 MOV AH,BYTE PTR [COSPOSC3]
  540.                                   ;and blue
  541.                 MOV WORD PTR [BCOS_POS],AX
  542.                 MOV DX,03C8H      ;load DX with pel index port
  543.                 MOV AL,128        ;and send start color
  544.                 OUT DX,AL         ;to pel
  545.                 INC DX            ;load DX with pel data port
  546.                 MOV CX,128        ;load CX with number of colors to do
  547.  CYCLE_COL_LOOP:
  548.                 PUSH CX           ;save loop counter on stack
  549.                 MOV BL,BYTE PTR [RCOS_POS+1]
  550.                                   ;load BL with current red cosinus pos.
  551.                 MOV AL,[SI+BX]    ;and load AL with entry from color costab.
  552.                 OUT DX,AL         ;send AL to pel
  553.                 MOV BL,BYTE PTR [GCOS_POS+1]
  554.                                   ;do so with green
  555.                 MOV AL,[SI+BX]
  556.                 OUT DX,AL
  557.                 MOV BL,BYTE PTR [BCOS_POS+1]
  558.                                   ;and blue
  559.                 MOV AL,[SI+BX]
  560.                 OUT DX,AL
  561.                 POP CX            ;restore loop counter
  562.                 MOV AX,WORD PTR [R_FASTNES]
  563.                                   ;load AX with red cosinus speed (real)
  564.                 ADD WORD PTR [RCOS_POS],AX
  565.                                   ;and add it to current red cosinus wave
  566.                                   ;position
  567.                 MOV AX,WORD PTR [G_FASTNES]
  568.                                   ;do so with green
  569.                 ADD WORD PTR [GCOS_POS],AX
  570.                 MOV AX,WORD PTR [B_FASTNES]
  571.                                   ;do so with blue
  572.                 ADD WORD PTR [BCOS_POS],AX
  573.                 LOOP CYCLE_COL_LOOP
  574.                                   ;redo until 128 colors are set
  575.                 RET               ;and then leave
  576.  CYCLE_COLORS   ENDP
  577. ;------------------------------------------------------------------------------
  578. ;Explanation:controls the plasma face mix in timing
  579. ;Inputs :DS contains data register
  580. ;Outputs:none
  581. ;Registers destroyed:none
  582. ;Possible errors:none
  583. ;Cycles used on 386:
  584. ;------------------------------------------------------------------------------
  585.  MIX_IMAGE      PROC NEAR
  586.                 CMP WORD PTR [COUNTER2],0
  587.                                   ;is it time to start a new picture
  588.                                   ;mix in or out phase ?
  589.                 JZ DO_IMAGE       ;yes,then jump
  590.                 DEC WORD PTR [COUNTER2]
  591.                                   ;else decrement counter
  592.                 RET               ;and return
  593.  DO_IMAGE:
  594.                 DEC WORD PTR [COUNTER]
  595.                                   ;decrement lift up delay counter
  596.                 JNZ END_IMAGE_MIX ;is it time to lift picture a little bit ?
  597.                                   ;no,then jump
  598.                 MOV WORD PTR [COUNTER],LIFT_DELAY
  599.                                   ;else reload lift delay counter
  600.                 CMP BYTE PTR [UPDOWN_FLAG],0
  601.                                   ;lift picture up or down ?
  602.                 JNZ IMAGE_UP      ;up,then jump
  603.                 DEC BYTE PTR [IMAGE_LIFT]
  604.                                   ;else lift it down a little bit
  605.                 CMP BYTE PTR [IMAGE_LIFT],0
  606.                                   ;is it lifted down fully ?
  607.                 JNZ END_IMAGE_MIX ;no,then jump
  608.                 MOV BYTE PTR [UPDOWN_FLAG],255
  609.                                   ;else set up down flag
  610.                 MOV WORD PTR [COUNTER2],IMAGE_DELAY
  611.                                   ;reload second counter
  612.                 RET               ;and return
  613.  IMAGE_UP:
  614.                 INC BYTE PTR [IMAGE_LIFT]
  615.                                   ;lift picture up a little bit
  616.                 CMP BYTE PTR [IMAGE_LIFT],45
  617.                                   ;is it lifted up enough ?
  618.                 JNZ END_IMAGE_MIX ;no,then jump
  619.                 MOV WORD PTR [COUNTER2],IMAGE_DELAY
  620.                                   ;else reload second counter
  621.                 MOV BYTE PTR [UPDOWN_FLAG],0
  622.                                   ;set up down flag
  623.                 RET               ;and return
  624.  END_IMAGE_MIX:
  625.                 RET               ;return (a second time)
  626.  MIX_IMAGE      ENDP
  627. ;------------------------------------------------------------------------------
  628. ;Explanation:initializes the black&white phase coupling
  629. ;Inputs :DS contains data segment
  630. ;Outputs:none
  631. ;Registers destroyed:none
  632. ;Possible errors:none
  633. ;Cycles used on 386:
  634. ;------------------------------------------------------------------------------
  635.  INIT_BW_MOVE   PROC NEAR
  636.                 MOV BYTE PTR [GOTO_BW_FLAG],255
  637.                                   ;set do_bw_flag
  638.                 RET               ;and return
  639.  INIT_BW_MOVE   ENDP
  640. ;------------------------------------------------------------------------------
  641. ;Explanation:draws the legend desing logo on the screen
  642. ;Inputs :DS contains data segment
  643. ;Outputs:none
  644. ;Registers destroyed:AX,BX,CX,DX,DI,SI
  645. ;Possible errors:none
  646. ;Cycles used on 386:
  647. ;------------------------------------------------------------------------------
  648.  DO_LOGOPLAS    PROC NEAR
  649.                 MOV DX,3C4H       ;enable writing to all planes
  650.                 MOV AX,0F02H      ;at one time
  651.                 OUT DX,AX         ;by setting vga sequencer
  652.                 MOV DI,LOGO_X+LOGO_Y*80
  653.                                   ;load DI with logo position on screen
  654.                 MOV SI,OFFSET LOGO_PICTURE
  655.                                   ;load SI with offset of logo buffer
  656.                 MOV AH,LOGO_HEIGTH;load AH with logo height
  657.                 MOV DL,BYTE PTR [OFFSET RUN_Y1_POS+1]
  658.                                   ;load DL with 1.vwave phase offset
  659.                 MOV DH,BYTE PTR [OFFSET RUN_Y2_POS+1]
  660.                                   ;load DH with 2.vwave phase offset
  661.  @@LV2:
  662.                 PUSH AX           ;save AX and DI
  663.                 PUSH DI           ;on stack
  664.                 MOV AH,LOGO_LENGTH;load AH with logo width
  665.                 MOV CL,BYTE PTR [OFFSET RUN_X1_POS+1]
  666.                                   ;load CL with 1.hwave phase offset
  667.                 MOV CH,BYTE PTR [OFFSET RUN_X2_POS+1]
  668.                                   ;load CH with 2.hwave phase offset
  669.  @@LH2:
  670.                 MOV BX,BP         ;load BX with BP
  671.                 MOV AL,BL         ;load AL with lower part of BP
  672.                 ADD AL,AH         ;add AH (AH is random)
  673.                 XOR BH,BH         ;clear BH
  674.                 MOV BL,DL         ;and add
  675.                 ADD AL,BYTE PTR [BX]
  676.                 MOV BL,DH         ;values
  677.                 ADD AL,BYTE PTR [BX]
  678.                 MOV BL,CL         ;of the four
  679.                 ADD AL,BYTE PTR [BX]
  680.                 MOV BL,CH         ;cosinus waves
  681.                 ADD AL,BYTE PTR [BX]
  682.                                   ;together
  683.                 MOV BL,BYTE PTR [SI]
  684.                                   ;load BL with value from logo picture
  685.                 SHL BL,1          ;multiply it by 2
  686.                 ADD AL,BL         ;add it to cosinus calculation result in
  687.                                   ;AL
  688.                 CMP BL,0          ;is logo pixel black ?
  689.                 JNZ LOGO_SET      ;no,then set it
  690.                 MOV AL,0          ;else load AL with zero
  691.  LOGO_SET:
  692.                 AND AL,127        ;mask out highest bit
  693.                 STOSB             ;and set value in AL onto screen
  694.                 ADD CL,1          ;move forward in 1. and 2. hwave
  695.                 ADD CH,2          ;cosinus wave table
  696.                 INC SI            ;get next logo picture position
  697.                 DEC AH            ;decrement pixel counter
  698.                 JNZ @@LH2         ;all pixels done in this line ? no,then
  699.                                   ;redo until all are done
  700.                 POP DI            ;get old DI from stack
  701.                 ADD DL,2          ;move forward in 1. and 2. vwave
  702.                 ADD DH,3          ;cosinus wave table
  703.                 POP AX            ;pop AX from stack
  704.                 ADD DI,80         ;count DI forward one line
  705.                 DEC AH            ;decrement line counter
  706.                 JNZ @@LV2         ;all lines done ? no,then do until
  707.                 RET               ;return
  708.  DO_LOGOPLAS    ENDP
  709. ;------------------------------------------------------------------------------
  710. ;Explanation:fades up logo colors while redrawing logo,cycling colors and so on
  711. ;Inputs :DS contains data segment
  712. ;Outputs:none
  713. ;Registers destroyed:AX,BX,CX,DX,SI,DI
  714. ;Possible errors:none
  715. ;Cycles used on 386:
  716. ;------------------------------------------------------------------------------
  717.  FADE_IN_LOGO   PROC NEAR
  718.                 MOV AH,64         ;load AH with number of steps to do
  719.  DO_MORE_COLFADE:
  720.                 PUSH AX           ;save loop counter on stack
  721.                 WAIT_VSYNC        ;wait for vertical retrace
  722.                 WAIT_VSYNC        ;twice
  723.                 POP AX            ;restore loop counter
  724.                 MOV DX,3C8H       ;load DX with pel index port
  725.                 MOV AL,0          ;load AL with start color
  726.                 OUT DX,AL         ;and send it to pel
  727.                 INC DX            ;load DX with pel data port
  728.                 MOV CX,384        ;load CX with loops to do
  729.                 MOV SI,OFFSET PALETTE
  730.                                   ;load SI with offset of palette datas
  731.  @@PL1:
  732.                 LODSB             ;load AL with palette table entry
  733.                 SUB AL,AH         ;decrement loop counter
  734.                 JNB NO_COLOR_UNDERFLW
  735.                                   ;jump,if it didn't crossed zero
  736.                 MOV AL,0          ;else set it to zero
  737.  NO_COLOR_UNDERFLW:
  738.                 OUT DX,AL         ;and send result to pel
  739.                 LOOP @@PL1        ;redo until 128 colors are set
  740.                 PUSH AX           ;save loop counter on satck again
  741.                 CALL DO_PLASMA    ;draw plasma
  742.                 CALL DO_LOGOPLAS  ;draw logo plasma
  743.                 CALL CALC_PLASM_RND
  744.                                   ;randomize plasma variables
  745.                 DEC BP            ;decrement plasma intern variable
  746.                 POP AX            ;restore AX
  747.                 DEC AH            ;decrement loop counter
  748.                 JNZ DO_MORE_COLFADE
  749.                                   ;all loops done ? no,then do until it is
  750.                 RET               ;return to calling procedure
  751.  FADE_IN_LOGO   ENDP
  752. ;------------------------------------------------------------------------------
  753. ;Explanation:resizes plasma on screen
  754. ;Inputs :DS contains data segment
  755. ;Outputs:none
  756. ;Registers destroyed:AX,BX,CX,DX,SI,DI,BP
  757. ;Possible errors:none
  758. ;Cycles used on 386:
  759. ;------------------------------------------------------------------------------
  760.  BIGGER_PLASMA  PROC NEAR
  761.                 WAIT_VSYNC        ;wait for vertical retrace
  762.                 CMP BYTE PTR [PLASMA_WIDTH],P_WIDTH
  763.                                   ;has plasma width reached his end value ?
  764.                 JNZ MORE_SCALE    ;no,then do more width scale
  765.                 RET               ;else return
  766.  MORE_SCALE:
  767.                 INC BYTE PTR [PLASMA_WIDTH]
  768.                                   ;increment plasma width
  769.                 DEC WORD PTR [PLASMA_POS]
  770.                                   ;and decrement plasma x position
  771.                 CMP BYTE PTR [PLASMA_HEIGTH],P_HEIGTH
  772.                                   ;has plasma heigth reached his maximum ?
  773.                 JZ NO_MORE_HSCALE ;yes,then end plasma scaling
  774.                 INC BYTE PTR [PLASMA_HEIGTH]
  775.                                   ;else increment plasma height
  776.                 SUB WORD PTR [PLASMA_POS],80
  777.                                   ;and move plasma up one line
  778.  NO_MORE_HSCALE:
  779.                 CALL CYCLE_COLORS ;randomize plasma colors
  780.                 CALL DO_PLASMA    ;redraw plasma
  781.                 CALL DO_LOGOPLAS  ;redraw logo plasma
  782.                 CALL CALC_PLASM_RND
  783.                                   ;randomize plasma variables
  784.                 DEC BP            ;decrement plasm intern variables
  785.                 JMP BIGGER_PLASMA ;and jump to scale more times
  786.  BIGGER_PLASMA  ENDP
  787. ;------------------------------------------------------------------------------
  788. ;Explanation:sets the second 128 colors to zero
  789. ;Inputs :DS contains data segment
  790. ;Outputs:none
  791. ;Registers destroyed:AX,CX,DX
  792. ;Possible errors:none
  793. ;Cycles used on 386:
  794. ;------------------------------------------------------------------------------
  795.  PLASMA_BLACK   PROC NEAR
  796.                 MOV DX,3C8H       ;load DX with pel index port
  797.                 MOV AL,128        ;load AL with start color
  798.                 OUT DX,AL         ;and send it to pel
  799.                 INC DX            ;load DX with pel data port
  800.                 MOV CX,384        ;load CX with number of r,g and b cycles
  801.                                   ;to do
  802.                 MOV AL,0          ;load AL with 0
  803.  PAL_BLACK:
  804.                 OUT DX,AL         ;send it to pel
  805.                 LOOP PAL_BLACK    ;and redo until all colors are done
  806.                 RET               ;leave procedure
  807.  PLASMA_BLACK   ENDP
  808. ;------------------------------------------------------------------------------
  809. ;Explanation:initializes the vga card for our requierments
  810. ;Inputs :none
  811. ;Outputs:none
  812. ;Registers destroyed:AX,CX,DX
  813. ;Possible errors:none
  814. ;Cycles used on 386:
  815. ;------------------------------------------------------------------------------
  816.  INIT_VGACARD   PROC NEAR
  817.                 MOV AX,13H        ;set video mode 13H
  818.                 INT 10H           ;via video interrupt
  819.                 MOV DX,3C4H       ;initialize sequencer
  820.                 MOV AX,604H       ;to allow
  821.                 OUT DX,AX         ;chain 4 mode
  822.                 MOV DX,3D4H       ;initialize CRT controller
  823.                 MOV AX,14H        ;to support
  824.                 OUT DX,AX         ;chain 4 mode
  825.                 MOV AX,0E317H     ;allowed
  826.                 OUT DX,AX         ;by sequencer
  827.                 CALL PLASMA_BLACK ;set second 128 colors to zero
  828.                 CALL SET_MSL_REG  ;initialize line doubling
  829.                 RET               ;return
  830.  INIT_VGACARD   ENDP
  831. ;------------------------------------------------------------------------------
  832. ;Explanation:fades out logo colors and background sound
  833. ;Inputs :DS contains data segment
  834. ;Outputs:none
  835. ;Registers destroyed:AX,BX,CX,DX
  836. ;Possible errors:none
  837. ;Cycles used on 386:
  838. ;------------------------------------------------------------------------------
  839.  FADE_OUT_LOGO  PROC NEAR
  840.                 MOV AH,64         ;load AH with number of fade out steps to do
  841.  DO_MORE_COLFADE2:
  842.                 PUSH AX           ;save counter on stack
  843.                 WAIT_VSYNC        ;wait for vertical retrace
  844.                 POP AX            ;restore counter
  845.                 MOV DX,3C8H       ;load DX with pel index port
  846.                 MOV AL,0          ;load AL with start color
  847.                 OUT DX,AL         ;and send it to pel
  848.                 INC DX            ;load DX with pel data port
  849.                 MOV CX,384        ;load CX with number of rgb triple parts to
  850.                                   ;do
  851.                 MOV SI,OFFSET PALETTE
  852.                                   ;load SI with palette table offset
  853.  @@PL2:
  854.                 LODSB             ;load AL with palette table entry
  855.                 MOV BL,AH         ;load BL with counter
  856.                 XOR BL,63         ;negate it
  857.                 SUB AL,BL         ;and decrement it from table entry
  858.                 JNB NO_COLOR_UNDERFLW2
  859.                                   ;crossed result zero ? no,then jump
  860.                 MOV AL,0          ;else load AL with zero
  861.  NO_COLOR_UNDERFLW2:
  862.                 OUT DX,AL         ;and send AL to pel
  863.                 LOOP @@PL2        ;redo until all 128 colors are done
  864.                 PUSH AX           ;push counter on stack
  865.                 CALL DO_PLASMA    ;redraw plasma
  866.                 CALL DO_LOGOPLAS  ;redraw logo plasma
  867.                 CALL CALC_PLASM_RND
  868.                                   ;randomize plasma variables
  869.                 DEC BP            ;decrement plasma intern variable
  870.                 SUB WORD PTR [LOUDNES],0101H
  871.                                   ;decrement loudness for left and right
  872.                                   ;channel
  873.                 MOV CX,WORD PTR [LOUDNES]
  874.                                   ;load CX with new loudness
  875.                 MOV AH,10H        ;and set it
  876.                 PUSH ES           ;using really cool
  877.                 INT 80H           ;use driver interrupt
  878.                 POP ES            ;restore ES
  879.                 POP AX            ;pop counter from stack
  880.                 DEC AH            ;decrement counter
  881.                 JNZ DO_MORE_COLFADE2
  882.                                   ;and redo until all is faded out
  883.                 RET               ;return
  884.  FADE_OUT_LOGO  ENDP
  885. ;------------------------------------------------------------------------------
  886. ;Explanation:
  887. ;Inputs :
  888. ;Outputs:
  889. ;Registers destroyed:
  890. ;Possible errors:none
  891. ;Cycles used on 386:
  892. ;------------------------------------------------------------------------------
  893.  INIT_SOUND     PROC NEAR
  894.                 MOV AH,0FH
  895.                 INT 80H
  896.                 MOV AH,01H
  897.                 INT 80H
  898.                 MOV AX,@DATA
  899.                 MOV DS,AX
  900.                 MOV DX,OFFSET SONG_NAME
  901.                 MOV AH,21H
  902.                 INT 80H
  903.                 MOV AH,10H
  904.                 MOV CX,4040H
  905.                 INT 80H
  906.                 MOV AH,30H
  907.                 MOV CL,1
  908.                 INT 80H
  909.                 RET
  910.  INIT_SOUND     ENDP
  911. ;------------------------------------------------------------------------------
  912. ;Explanation:
  913. ;Inputs :
  914. ;Outputs:
  915. ;Registers destroyed:
  916. ;Possible errors:none
  917. ;Cycles used on 386:
  918. ;------------------------------------------------------------------------------
  919.  STOP_SOUND     PROC NEAR
  920.                 MOV AH,32H
  921.                 INT 80H
  922.                 MOV AH,40H
  923.                 INT 80H
  924.                 MOV AH,0FFH
  925.                 INT 80H
  926.                 RET
  927.  STOP_SOUND     ENDP
  928. ;------------------------------------------------------------------------------
  929. ;******************************************************************************
  930. ;RUNTIMECODE
  931. ;******************************************************************************
  932. ;------------------------------------------------------------------------------
  933.  START:
  934.                 MOV BX,500        ;free conventional dos memory
  935.                 MOV AH,4AH        ;using the good
  936.                 INT 21H           ;old dos
  937.                 CALL INIT_VGACARD ;init vga card for our requierment
  938.                 CALL INIT_SOUND   ;init use-driver for playing nice music
  939.                 CLD               ;clear direction flag
  940.                 MOV AH,0D1H       ;get use-driver dma buffer segment
  941.                 INT 80H           ;by calling use_int
  942.                 PUSH ES           ;load FS with dma segment in ES
  943.                 POP FS            ;using stack
  944.                 MOV AX,@DATA      ;load DS with data segment
  945.                 MOV DS,AX         ;using AX
  946.                 MOV AX,0A000H     ;and load ES with vga screen segment
  947.                 MOV ES,AX         ;using AX register
  948.                 CALL FADE_IN_LOGO ;fade in legend design logo
  949.                 CALL BIGGER_PLASMA;and scale plasma
  950.  MAINLOOP:
  951. ;                WAIT_VSYNC        ;wait for fuckin' vsync
  952.                 CALL CYCLE_COLORS ;cycle the plasma colors
  953.                 CALL DO_PLASMA    ;redraw plasma with new colors and form
  954.                 CALL DO_LOGOPLAS  ;redraw plasma woth new colors and form
  955.                 CALL CALC_PLASM_RND
  956.                                   ;randomize plasma values (randomize :-))
  957.                 CALL MIX_IMAGE    ;and mix plasma face into plasma
  958.                 DEC BP            ;decrement BP (plasma intern variable)
  959.                 CMP BYTE PTR [HOME_FLAG],0
  960.                                   ;is the home flag set ?
  961.                 JNZ REALLY_BYE    ;yeap,then start exit procedure
  962.                 MOV AH,1          ;else check if a key was pressed
  963.                 INT 16H           ;using keyboard interrupt
  964.                 JNZ BYE           ;yeap,then init exit part
  965.                 JMP MAINLOOP      ;else redo plasma scum
  966.  BYE:
  967.                 CALL INIT_BW_MOVE ;initialize black&white fade
  968.                 JMP MAINLOOP      ;and redo plasma scum
  969.  REALLY_BYE:
  970.                 CALL FADE_OUT_LOGO;fade down logo (and music volume)
  971.                 CALL STOP_SOUND   ;stop music playing
  972.  SKIP_DEMOPART:
  973.                 XOR AH,AH         ;clear keyboard buffer
  974.                 INT 16H           ;by calling keyboard interrupt
  975.                 MOV AX,3          ;set video mode 3
  976.                 INT 10H           ;using video interrupt
  977.                 MOV AX,4C00H      ;return
  978.                 INT 21H           ;via dos
  979. ;------------------------------------------------------------------------------
  980.  END START
  981.