home *** CD-ROM | disk | FTP | other *** search
/ The Equalizer BBS / equalizer-bbs-collection_2004.zip / equalizer-bbs-collection / DEMOSCENE-STUFF / ESCPLASM.ZIP / PLASMA.ASM < prev    next >
Assembly Source File  |  1994-12-05  |  20KB  |  699 lines

  1. ideal
  2. model large
  3. p386n
  4. stack 256
  5.  
  6. assume cs:plasma 
  7.  
  8. segment  plasma
  9.  
  10. ;---------------------------------------------
  11. start1:       mov ax,data1
  12.               mov ds,ax
  13.               assume ds:data1
  14.               ;
  15.               mov ax,0003h
  16.               int 10h
  17.               ;
  18.               mov ah,09h
  19.               mov dx,offset textpage
  20.               int 21h
  21.               ;
  22. warte_ab:     mov ah,06h
  23.               mov dl,255
  24.               int 21h
  25.               cmp al," "
  26.               jne warte_ab
  27.               ;
  28.               call init80x200
  29.               ;
  30.               call set_blue 
  31.               ;
  32.               call set_values
  33.               ;
  34.               mov [ds:source_table],offset c_table1
  35.               ;
  36. askkey1:      mov di,4000h
  37.               mov dx,03c4h
  38.               mov ax,0a02h
  39.               out dx,ax
  40.               ;
  41.               call hretrace
  42.               ;
  43.               mov dx,03c8h
  44.               xor al,al
  45.               out dx,al
  46.               inc dx
  47.               mov al,44h
  48.               out dx,al
  49.               out dx,al
  50.               out dx,al
  51.               ;
  52.               call plasma_loop
  53.               ;
  54.               call hretrace
  55.               ;
  56.               mov dx,03c8h
  57.               xor al,al
  58.               out dx,al
  59.               inc dx
  60.               out dx,al
  61.               out dx,al
  62.               out dx,al
  63.               ;
  64.               mov dx,03d4h
  65.               mov ax,400ch
  66.               out dx,ax
  67.               mov ax,1e08h
  68.               out dx,ax
  69.               mov dx,03c0h
  70.               mov al,33
  71.               out dx,al
  72.               mov al,01
  73.               out dx,al
  74.               call waitborder
  75.               ;
  76.               mov di,4000h
  77.               mov dx,03c4h
  78.               mov ax,0502h
  79.               out dx,ax
  80.               ;
  81.               call plasma_loop2
  82.               ;
  83.               mov dx,03d4h
  84.               mov ax,400ch
  85.               out dx,ax
  86.               mov ax,1f08h
  87.               out dx,ax
  88.               mov dx,03c0h
  89.               mov al,33
  90.               out dx,al
  91.               mov al,00 
  92.               out dx,al
  93.               call waitborder
  94.               ;
  95.               mov ah,06h
  96.               xor al,al
  97.               mov dl,255
  98.               int 21h
  99.               ;
  100.               cmp al,"a"
  101.               je inc_xinc
  102.               cmp al,"b"
  103.               je dec_xinc
  104.               ;
  105.               cmp al,"c"
  106.               je inc_yinc
  107.               cmp al,"d"
  108.               je dec_yinc
  109.               ;
  110.               cmp al,"e"
  111.               je inc_zinc
  112.               cmp al,"f"
  113.               je dec_zinc
  114.               ;
  115.               cmp al," "
  116.               je end_it
  117.               ;
  118.               cmp al,"g"
  119.               je inc_xinc2
  120.               cmp al,"h"
  121.               je dec_xinc2
  122.               ;
  123.               cmp al,"i"
  124.               je inc_yinc2
  125.               cmp al,"j"
  126.               je dec_yinc2
  127.               ;
  128.               cmp al,"k"
  129.               je inc_zinc2
  130.               cmp al,"l"
  131.               je dec_zinc2
  132.               ;
  133.               cmp al,"m"
  134.               je inc_xinc3
  135.               cmp al,"n"
  136.               je dec_xinc3
  137.               ;
  138.               cmp al,"o"
  139.               je inc_yinc3
  140.               cmp al,"p"
  141.               je dec_yinc3
  142.               ;
  143.               cmp al,"q"
  144.               je inc_zinc3
  145.               cmp al,"r"
  146.               je dec_zinc3
  147.               ;
  148.               jmp askkey1
  149.               ;
  150. end_it:       jmp exit
  151.               ;
  152. inc_xinc:     inc [ds:xinc]
  153.               jmp askkey1
  154. dec_xinc:     dec [ds:xinc]
  155.               jmp askkey1
  156. inc_yinc:     inc [ds:yinc]
  157.               jmp askkey1
  158. dec_yinc:     dec [ds:yinc]
  159.               jmp askkey1
  160. inc_zinc:     inc [ds:zinc]
  161.               jmp askkey1
  162. dec_zinc:     dec [ds:zinc]
  163.               jmp askkey1
  164. inc_xinc2:    inc [ds:xinc2]
  165.               jmp askkey1
  166. dec_xinc2:    dec [ds:xinc2]
  167.               jmp askkey1
  168. inc_yinc2:    inc [ds:yinc2]
  169.               jmp askkey1
  170. dec_yinc2:    dec [ds:yinc2]
  171.               jmp askkey1
  172. inc_zinc2:    inc [ds:zinc2]
  173.               jmp askkey1
  174. dec_zinc2:    dec [ds:zinc2]
  175.               jmp askkey1
  176. inc_xinc3:    inc [ds:xinc3]
  177.               jmp askkey1
  178. dec_xinc3:    dec [ds:xinc3]
  179.               jmp askkey1
  180. inc_yinc3:    inc [ds:yinc3]
  181.               jmp askkey1
  182. dec_yinc3:    dec [ds:yinc3]
  183.               jmp askkey1
  184. inc_zinc3:    inc [ds:zinc3]
  185.               jmp askkey1
  186. dec_zinc3:    dec [ds:zinc3]
  187.               jmp askkey1
  188. ;-----------------------------------------------------------------------------
  189. ;init an 80x200 grafixmode with 256 colors
  190. ;
  191. init80x200:   mov ax,0013h
  192.               int 10h
  193.               ;
  194.               mov dx,03c4h
  195.               mov al,04h
  196.               out dx,al
  197.               inc dx
  198.               in al,dx
  199.               and al,11110111b
  200.               out dx,al
  201.               dec dx
  202.               ;
  203.               mov ax,0f02h
  204.               out dx,ax
  205.               ;
  206.               mov dx,03d4h
  207.               mov al,14h
  208.               out dx,al
  209.               inc dx
  210.               in al,dx
  211.               and al,10111111b
  212.               out dx,al
  213.               dec dx
  214.               mov al,17h
  215.               out dx,al
  216.               inc dx
  217.               in al,dx
  218.               or al,01000000b
  219.               out dx,al
  220.               ;
  221.               mov ax,0a000h
  222.               mov es,ax
  223.               assume es:0a000h
  224.               ;
  225.               mov cx,8000h
  226.               xor di,di
  227.               xor ax,ax
  228.               cld
  229.               rep stosw
  230.               ;
  231.               retn
  232. ;-------------------------------------------
  233. ; checks your pc for cpu-type
  234. ;
  235. askcpu:      pushf
  236.              xor bx,bx
  237.              push bx
  238.              popf
  239.              pushf
  240.              pop bx
  241.              and bx,0f000h
  242.              cmp bx,0f000h
  243.              je less286
  244.              mov bx,07000h
  245.              push bx
  246.              popf
  247.              pushf
  248.              pop bx
  249.              and bx,07000h
  250.              jne cpu386
  251.              mov [ds:cpu_type],1
  252.              popf
  253.              retn
  254. cpu386:      mov [ds:cpu_type],2
  255.              popf
  256.              retn
  257. less286:     mov [ds:cpu_type],0
  258.              popf
  259.              retn
  260. ;-------------------------------------------
  261. ; checks your pc for co-cpu-type
  262. ;
  263. askco:       mov [byte cs:check1],90h
  264.              mov [byte cs:check2],90h         
  265. check1:      finit             
  266.              mov [byte ds:cpz+1],0
  267. check2:      fstcw [word ds:cpz]
  268.              mov ah,[byte ds:cpz+1]
  269.              cmp ah,03h
  270.              jne no_co
  271.              and [ds:cpz],0ff7fh
  272.              fldcw [word ds:cpz]
  273.              fdisi
  274.              fstcw [word ds:cpz]
  275.              test [ds:cpz],80h
  276.              jne co087
  277.              finit
  278.              fld1
  279.              fldz
  280.              fdivp st(1),st
  281.              fld st(0)
  282.              fchs
  283.              fcompp st(1)
  284.              fstcw [word ds:cpz]
  285.              mov ax,[ds:cpz]
  286.              sahf
  287.              je co287
  288.              mov [ds:co_type],3
  289.              retn
  290. co087:       mov [ds:co_type],1
  291.              retn
  292. co287:       mov [ds:co_type],2
  293.              retn
  294. no_co:       mov [ds:co_type],0
  295.              retn
  296. ;-------------------------------------------
  297. ; checks for an installed v86-driver
  298. ;
  299. askv86:      mov ax,3567h
  300.              int 21h
  301.              mov si,offset sign
  302.              mov di,000ah
  303.              mov al,[ds:si]
  304.              cmp al,[es:di]
  305.              jne nov86
  306.              mov al,[ds:si+1]
  307.              cmp al,[es:di+1]
  308.              jne nov86
  309.              mov al,[ds:si+2]
  310.              cmp al,[es:di+2]
  311.              jne nov86
  312.              mov [ds:is_v86],1
  313.              retn
  314. nov86:       mov [ds:is_v86],0
  315.              retn
  316. ;----------------------------------------------
  317. ; Waits till the rasterline is in the border
  318. ;
  319. waitborder:   mov dx,03dah
  320. wb1:          in al,dx
  321.               test al,08h
  322.               jne wb1
  323. wb2:          in al,dx
  324.               test al,08h
  325.               je wb2
  326.               ret 
  327. hretrace:     mov dx,03dah
  328. hr1:          in al,dx
  329.               test al,01h
  330.               jne hr1
  331. hr2:          in al,dx
  332.               test al,01h
  333.               je hr2
  334.               retn
  335. ;---------------------------------------------
  336. ; - DS:DI = Offset of colortable in RAM
  337. ;
  338. setpal:         assume ds:data1
  339.                 mov dx,3C8h                 
  340.                 xor al,al   
  341.                 out dx,al
  342.                 cli
  343.                 inc dx
  344.                 mov cx,256
  345. setpal2:        mov al,[ds:di]
  346.                 out dx,al
  347.                 mov al,[ds:di+1]
  348.                 out dx,al
  349.                 mov al,[ds:di+2]
  350.                 out dx,al
  351.                 add di,03h
  352.                 loop setpal2
  353.                 sti
  354.                 retn
  355. ;-------------------------------------------
  356. exit:          mov ax,0003h
  357.                int 10h
  358.                ;
  359.                mov ax,4c00h
  360.                int 21h
  361.                ;
  362. ;-------------------------------------------
  363. set_plasma:    mov cx,80
  364. set_loop1:     xor ah,ah
  365.                mov bx,offset sinus_table
  366.                mov si,[ds:xpos]  
  367.                mov al,[ds:bx+si]
  368.                mov si,[ds:ypos]   
  369.               ; mov bx,offset cosinus_table
  370.                add al,[ds:bx+si]
  371.                mov si,[ds:zpos]
  372.                shr al,1
  373.                add al,[ds:bx+si]
  374.                ;
  375.                mov si,ax
  376.                mov bx,[ds:source_table]
  377.                ;
  378.                mov al,[ds:bx+si]
  379.                mov [es:di],al
  380.                ;
  381.                clc
  382.                mov al,[byte ds:xpos]
  383.                adc al,[ds:xinc]
  384.                mov [byte ds:xpos],al
  385.                ;
  386.                clc
  387.                mov al,[byte ds:ypos]
  388.                adc al,[ds:yinc]
  389.                mov [byte ds:ypos],al
  390.                ;
  391.                clc
  392.                mov al,[byte ds:zpos]
  393.                adc al,[ds:zinc]
  394.                mov [byte ds:zpos],al
  395.                ;
  396.                inc di
  397.                loop set_loop1
  398.                retn
  399. ;--------------------------------------------
  400. plasma_loop:   mov cx,200
  401. set_loop2:     push cx
  402.                call set_plasma
  403.                pop cx
  404.                ;
  405.                clc
  406.                mov al,[ds:xdist]
  407.                adc al,[ds:xinc2]
  408.                mov [ds:xdist],al
  409.                mov [byte ds:xpos],al
  410.                ;
  411.                clc
  412.                mov al,[ds:ydist]
  413.                adc al,[ds:yinc2]
  414.                mov [ds:ydist],al
  415.                mov [byte ds:ypos],al
  416.                ;
  417.                clc
  418.                mov al,[ds:zdist]
  419.                adc al,[ds:zinc2]
  420.                mov [ds:zdist],al
  421.                mov [byte ds:zpos],al
  422.                ;
  423.                loop set_loop2
  424.                ;
  425.                clc
  426.                mov al,[ds:xteq]
  427.                adc al,[ds:xinc3]
  428.                mov [ds:xteq],al
  429.                mov [ds:xdist],al
  430.                mov [byte ds:xpos],al
  431.                ;
  432.                clc
  433.                mov al,[ds:yteq]
  434.                adc al,[ds:yinc3]
  435.                mov [ds:yteq],al
  436.                mov [ds:ydist],al
  437.                mov [byte ds:ypos],al
  438.                ;
  439.                clc
  440.                mov al,[ds:zteq]
  441.                adc al,[ds:zinc3]
  442.                mov [ds:zteq],al
  443.                mov [ds:zdist],al
  444.                mov [byte ds:zpos],al
  445.                ;
  446.                retn
  447. ;--------------------------------------------
  448. set_plasma2:    mov cx,80
  449. set_loop21:     xor ah,ah
  450.                mov bx,offset sinus_table
  451.                mov si,[ds:xposa]  
  452.                mov al,[ds:bx+si]
  453.                mov si,[ds:yposa]   
  454.               ; mov bx,offset cosinus_table
  455.                add al,[ds:bx+si]
  456.                mov si,[ds:zposa]
  457.                shr al,1
  458.                add al,[ds:bx+si]
  459.                ;
  460.                mov si,ax
  461.                mov bx,[ds:source_table]
  462.                ;
  463.                mov al,[ds:bx+si]
  464.                add al,64
  465.                mov [es:di],al
  466.                ;
  467.                clc
  468.                mov al,[byte ds:xposa]
  469.                adc al,[ds:xinca]
  470.                mov [byte ds:xposa],al
  471.                ;
  472.                clc
  473.                mov al,[byte ds:yposa]
  474.                adc al,[ds:yinca]
  475.                mov [byte ds:yposa],al
  476.                ;
  477.                clc
  478.                mov al,[byte ds:zposa]
  479.                adc al,[ds:zinca]
  480.                mov [byte ds:zposa],al
  481.                ;
  482.                inc di
  483.                loop set_loop21
  484.                retn
  485. ;--------------------------------------------
  486. plasma_loop2:   mov cx,200
  487. set_loop22:     push cx
  488.                call set_plasma2
  489.                pop cx
  490.                ;
  491.                clc
  492.                mov al,[ds:xdista]
  493.                adc al,[ds:xinc2a]
  494.                mov [ds:xdista],al
  495.                mov [byte ds:xposa],al
  496.                ;
  497.                clc
  498.                mov al,[ds:ydista]
  499.                adc al,[ds:yinc2a]
  500.                mov [ds:ydista],al
  501.                mov [byte ds:yposa],al
  502.                ;
  503.                clc
  504.                mov al,[ds:zdista]
  505.                adc al,[ds:zinc2a]
  506.                mov [ds:zdista],al
  507.                mov [byte ds:zposa],al
  508.                ;
  509.                loop set_loop22
  510.                ;
  511.                clc
  512.                mov al,[ds:xteqa]
  513.                adc al,[ds:xinc3a]
  514.                mov [ds:xteqa],al
  515.                mov [ds:xdista],al
  516.                mov [byte ds:xposa],al
  517.                ;
  518.                clc
  519.                mov al,[ds:yteqa]
  520.                adc al,[ds:yinc3a]
  521.                mov [ds:yteqa],al
  522.                mov [ds:ydista],al
  523.                mov [byte ds:yposa],al
  524.                ;
  525.                clc
  526.                mov al,[ds:zteqa]
  527.                adc al,[ds:zinc3a]
  528.                mov [ds:zteqa],al
  529.                mov [ds:zdista],al
  530.                mov [byte ds:zposa],al
  531.                ;
  532.                retn
  533. ;--------------------------------------------
  534. set_blue:      mov dx,03c8h
  535.                mov si,offset colorpal
  536.                xor al,al
  537.                out dx,al
  538.                inc dx
  539.                mov cx,64
  540.                xor ah,ah
  541. set_loop3:     xor al,al
  542.                out dx,al
  543.                mov [ds:si],al
  544.                out dx,al
  545.                mov [ds:si+1],al
  546.                mov al,ah
  547.                out dx,al
  548.                mov [ds:si+2],al
  549.                inc ah
  550.                add si,03h
  551.                loop set_loop3
  552.                mov cx,64
  553.                xor ah,ah
  554. set_loop4:     mov al,ah
  555.                out dx,al
  556.                mov [ds:si],al
  557.                xor al,al
  558.                out dx,al
  559.                mov [ds:si+1],al
  560.                out dx,al
  561.                mov [ds:si+2],al
  562.                inc ah
  563.                add si,03h
  564.                loop set_loop4
  565.                retn
  566. ;-------------------------------------------
  567. set_values:    mov cx,21
  568.                mov si,offset values
  569.                mov di,offset xpos
  570. set_val:       mov al,[ds:si]
  571.                mov [ds:di],al
  572.                inc si
  573.                loop set_val
  574.                retn
  575. ;--------------------------------------------
  576. ends  plasma
  577.                
  578. segment  data1
  579.  
  580. cpz          dw 0000
  581. cpu_type     db 00
  582. co_type      db 00
  583. sign         db "EMM"
  584. is_v86       db 00
  585.  
  586. xpos         dw 00
  587. ypos         dw 00
  588. zpos         dw 00
  589.  
  590. xinc         db 02
  591. yinc         db 02
  592. zinc         db 01
  593.  
  594. xdist        db 00
  595. ydist        db 00
  596. zdist        db 00
  597.  
  598. xinc2        db 01 
  599. yinc2        db 255
  600. zinc2        db 02
  601.  
  602. xteq         db 00
  603. yteq         db 00
  604. zteq         db 00
  605.  
  606. xinc3        db 02
  607. yinc3        db 01 
  608. zinc3        db 255
  609.  
  610. xposa         dw 01
  611. yposa         dw 02
  612. zposa         dw 01
  613.  
  614. xinca         db 01
  615. yinca         db 02
  616. zinca         db 02
  617.  
  618. xdista        db 01
  619. ydista        db 02
  620. zdista        db 01
  621.  
  622. xinc2a        db 254
  623. yinc2a        db 01 
  624. zinc2a        db 02
  625.  
  626. xteqa         db 01
  627. yteqa         db 02
  628. zteqa         db 01
  629.  
  630. xinc3a        db 255
  631. yinc3a        db 01 
  632. zinc3a        db 02  
  633.  
  634. source_table dw 0000
  635.  
  636. filename     db "values.dat",0
  637.  
  638. fadepal      db 256*3 dup (0)
  639. colorpal     db 256*3 dup (0)
  640.  
  641. sinus_table  db 00,00,01,01,02,02,03,03,04,04,05,05,06,06,07,07
  642.              db 08,08,09,09,10,10,11,11,12,12,13,13,14,14,15,15
  643.              db 16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23
  644.              db 24,24,25,25,26,26,27,27,28,28,29,29,30,30,31,31
  645.              db 32,32,33,33,34,34,35,35,36,36,37,37,38,38,39,39
  646.              db 40,40,41,41,42,42,43,43,44,44,45,45,46,46,47,47
  647.              db 48,48,49,49,50,50,51,51,52,52,53,53,54,54,55,55
  648.              db 56,56,57,57,58,58,59,59,60,60,61,61,62,62,63,63
  649.              db 64,64,65,65,66,66,67,67,68,68,69,69,70,70,71,71
  650.              db 72,72,73,73,74,74,75,75,76,76,77,77,78,78,79,79
  651.              db 79,79,78,78,77,77,76,76,75,75,74,74,73,73,72,72
  652.              db 71,71,70,70,69,69,68,68,67,67,66,66,65,65,64,64
  653.              db 63,62,61,60,59,58,57,56,55,54,53,52,51,50,49,48
  654.              db 47,46,45,44,43,42,41,40,39,38,37,36,35,34,33,32
  655.              db 31,30,29,28,27,26,25,24,23,22,21,20,19,18,17,16
  656.              db 15,14,13,12,11,10,09,08,07,06,05,04,03,02,01,00
  657.  
  658. c_table1     db 01,02,03,04,05,06,07,08,09,10,11,12,13,14,15,16
  659.              db 17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32
  660.              db 33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48
  661.              db 49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,63
  662.              db 63,63,62,61,60,59,58,57,56,55,54,53,52,51,50,49
  663.              db 48,47,46,45,44,43,42,41,40,39,38,37,36,35,34,33
  664.              db 32,31,30,29,28,27,26,25,24,23,22,21,20,19,18,17
  665.              db 16,15,14,13,12,11,10,09,08,07,06,05,04,03,02,01
  666.              db 01,02,03,04,05,06,07,08,09,10,11,12,13,14,15,16
  667.              db 17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32
  668.              db 33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48
  669.              db 49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,63
  670.              db 63,63,62,61,60,59,58,57,56,55,54,53,52,51,50,49
  671.              db 48,47,46,45,44,43,42,41,40,39,38,37,36,35,34,33
  672.              db 32,31,30,29,28,27,26,25,24,23,22,21,20,19,18,17
  673.              db 16,15,14,13,12,11,10,09,08,07,06,05,04,03,02,01
  674.  
  675. include 'values.db'             
  676.  
  677. textpage     db "PLASMA-ROUTINE V1.0 (d) may 1994 by Capella/Escape Cooperation",13,10
  678.              db "Released on 11.12.1994",13,10
  679.              db "(use this only to learn out of it......)",13,10,10
  680.              db 13,10," FUNCTION-KEYS IN THIS LITTLE PLASMA-ROUTINE",13,10,10
  681.              db "A/B    - inc/dec X-position of blue plasma",13,10
  682.              db "C/D    - inc/dec Y-position of blue plasma",13,10
  683.              db "E/F    - inc/dec Z-position of blue plasma",13,10,10
  684.              db "G/H    - inc/dec X-distance of blue plasma",13,10
  685.              db "I/J    - inc/dec Y-distance of blue plasma",13,10
  686.              db "K/L    - inc/dec Z-distance of blue plasma",13,10,10
  687.              db "M/N    - inc/dec X-speed of blue plasma",13,10
  688.              db "O/P    - inc/dec Y-speed of blue plasma",13,10
  689.              db "Q/R    - inc/dec Z-speed of blue plasma",13,10,10,10
  690.              db "Press 'space' now to go on and press it again to leave....",13,10,"$"
  691.  
  692. ends  data1
  693.  
  694. end start1
  695.  
  696.  
  697.  
  698.  
  699.