home *** CD-ROM | disk | FTP | other *** search
/ Groovy Bytes: Behind the Moon / groovybytes.iso / GROOVY / DISKMAGS / IMPHOB_9.ZIP / IMP9_EX!.ZIP / UNR_GELL.ZIP / GELL.ASM next >
Encoding:
Assembly Source File  |  1994-12-30  |  4.3 KB  |  176 lines

  1.  
  2.  
  3.  
  4.  
  5. ; ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ GEL PICTURE ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  6. ; Code: Unreal, 
  7. ; Gfx:  Tees.
  8. ; PUBLISHED WITH IMPHOBIA. Use this source anyway You like.
  9.  
  10.  
  11.  
  12. .MODEL LARGE
  13. .STACK
  14. CODE SEGMENT PUBLIC USE16 PARA 'CODE'
  15. MODEL LARGE
  16.  
  17. ASSUME cs:CODE
  18. JUMPS
  19. .386C
  20.  
  21. sinelen   equ 360*2-1        ; these two little craps are here in order
  22. sinelen2  equ 360*2-1        ; to have free hand in changing sinetable
  23.                 ; so that they can be two different
  24.  
  25. pict        dw    0    ; alloc places seg addy here
  26. pict2        dw    0    ; alloc places seg addy here
  27. Value_S        dw     0    ; actual pos in sinetable 1
  28. Value_S2       dw     180    ; actual pos in sinetable 2
  29. Cnter        dw     0    ; counter value
  30.  
  31. ; ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░includes░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  32.  
  33. INCLUDE INC.INC
  34. include iff
  35. include sin3
  36.  
  37. ; ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░macros░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  38.  
  39. ; ax = movement value
  40. DrawY MACRO
  41.     xchg    ah,al        ; ax*256
  42.     add    di,ax        ; add to di
  43.     shr    ax,2        ; ax/4   (ax*256 + ax*64 = ax*320 )
  44.     add    di,ax        
  45.  
  46. BEP = 0                ; counters
  47. BIP = 10
  48.  
  49.     rept     95        ; this states how high is pic
  50.     mov    al,byte ptr ds:[si][BEP]     ; pixel from 1st buff...
  51.     mov     byte ptr es:[di][biP],al     ; ...into another one...
  52.     BEP=BEP+320
  53.     BIP=BIP+320
  54.     endm
  55.     ENDM
  56.  
  57. ;══════════════════════════════════════════════════════════════════════════════
  58.  
  59. SineY MACRO
  60. LOCAL GELIZE, BOTTOM
  61.         mov     ax,pict            ; from this place
  62.     mov    ds,ax
  63.     mov    si,0
  64.         mov     ax,pict2        ; into this one
  65.     mov    es,ax
  66.     mov    di,0
  67.     mov    dx,di
  68.     mov    bx,Value_S        ; here starts value from sinetable
  69.         mov     cx,170            ; that's the X size of pic
  70. Gelize: add    bx,2            ; next sine value (2 bcoz word)
  71.     cmp    bx,sinelen        ; end of sinetable?
  72.     jle    Bottom            ; if nope, then Bottom
  73.     mov    bx,0            ; reset counter
  74. Bottom:    mov    ax,word ptr fs:[bx][sinus]    ; take the sine value
  75.         add     ax,512            ; kill minus sign
  76.         shr     ax,5            ; and divide by 32
  77.     DrawY                ; call the macro moving line in Y
  78.     inc    dx            ; next x position
  79.     mov    di,dx            ; update destroyed registers
  80.     mov    si,dx
  81.     dec    cx
  82.     jnz    Gelize
  83.     ENDM
  84. ;══════════════════════════════════════════════════════════════════════════════
  85. ; This one is lousy 200 bytes moving stuff... nothin' to say...
  86. DrawX MACRO
  87.         push    cx
  88.         add     di,ax
  89.         mov     cx,50
  90.         rep     movsd
  91.         pop     cx
  92.         ENDM
  93. ;══════════════════════════════════════════════════════════════════════════════
  94. SineX MACRO
  95.         PUSHA
  96.         mov     ax,pict2        ; That's the buffer where are the
  97.     mov    ds,ax            ; effects of Siney's works
  98.     mov    si,0
  99.         mov     ax,0a000h        ; Screen
  100.     mov    es,ax
  101.         mov     di,0
  102.  
  103.         mov     cx,120            ; how many lines 
  104.     mov    dx,di            ; this thing keeps good si and di
  105.         mov     bx,Value_S2        ; sine start value
  106. sGelize:add     bx,2            ; usual sine stuff
  107.     cmp    bx,sinelen
  108.         jle     sBottom
  109.     mov    bx,0
  110. sBottom:mov    ax,word ptr fs:[bx][sinus]
  111.         add     ax,512
  112.         shr     ax,3            ; div by 8
  113.         DrawX                ; sine by x
  114.  
  115.         add     dx,320            ; next Y line
  116.     mov    di,dx
  117.     mov    si,dx
  118.  
  119.     dec    cx
  120.         jnz     sGelize
  121.         POPA
  122.         ENDM
  123.  
  124.  
  125. ; ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░START!░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  126.  
  127. Start:    mov    ax,13h
  128.     int    10h            ; set mode
  129.     SetBlock 64000/16        ; set progsize
  130.  
  131.     Alloc    64000/16,pict        ; alloc some mem for buffers
  132.     Alloc    64000/16,pict2
  133.     Filldd    pict,0,16000,0        ; fill buffers with 0's
  134.     Filldd    pict2,0,16000,0
  135.  
  136.         mov     dx,3d4h
  137.         mov     al,9
  138.         out     dx,al
  139.         inc     dx
  140.         mov     ax,2
  141.         out     dx,al            ; stretch the view
  142.  
  143.     IFF    code,teesgel,pict    ; depack picture to pict
  144.     mov    ax,seg CODE        ; set fs to CODE, it's just an ex,
  145.     mov    fs,ax            ; I could aswell use CS. 
  146. HERE:    SINEY                ; wobble Y
  147.         SineX                ; wobble X
  148.     call    RAMK
  149.  
  150.     add    Value_S,2        ; test sine pointers
  151.     cmp    Value_S,sinelen
  152.     jb         Value_Sok
  153.     mov    Value_S,0
  154. Value_Sok:
  155.         add     Value_S2,2
  156.         cmp     Value_S2,sinelen2
  157.         jb         Value_Sok2
  158.         mov     Value_S2,0
  159. Value_Sok2:
  160.     in    al,60h            ; esc Pressed
  161.     cmp    al,1
  162.     jne    Here
  163.  
  164.     free    pict            ; free memory allocated b'fore
  165.     free    pict2
  166.     mov    ax,3
  167.     int    10h
  168.     mov    ax,4c00h
  169.     int    21h
  170.  
  171.  
  172. teesgel label                ; here's great Tees picture.
  173.      include pic.inc
  174. CODE ENDS
  175. End Start
  176.