home *** CD-ROM | disk | FTP | other *** search
/ The Equalizer BBS / equalizer-bbs-collection_2004.zip / equalizer-bbs-collection / DEMOSCENE-STUFF / TIMESRC.ZIP / GNBG.ASM < prev    next >
Assembly Source File  |  1994-02-26  |  7KB  |  299 lines

  1.         .386p
  2. code32  segment para public use32
  3.         assume cs:code32, ds:code32
  4.  
  5. include pmode.inc
  6. include argc.inc
  7. include vrt.inc
  8. include v.inc
  9.  
  10. public  _vidptr, _pagehibyte
  11.  
  12. public  _gnbg_setup, _gnbg_draw, _gnbg_flip
  13.  
  14. ;▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
  15. ; DATA
  16. ;▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
  17. align 4
  18. gnbgtbl         label   word
  19. include gnbgtbl.m
  20.  
  21. gnbgtbltbl      label   dword
  22. temp=offset gnbgtbl
  23. rept 320
  24.         dd      temp
  25. temp=temp+2*100
  26. endm
  27. temp=offset gnbgtbl
  28. rept 319
  29.         dd      temp
  30. temp=temp+2*100
  31. endm
  32.  
  33. _vidptr         dd      ?               ; ptr to work video page
  34.  
  35. ressubtbl       dd      80*16-4,80*16-8,0
  36. resbittbl       db      11h,33h,0ffh
  37. resshftbl       db      1,2,1
  38.  
  39. vpdir           dw      0               ; viewpoint direction (0-319)
  40. vploc           dw      8080h           ; viewpoint loc, Y*256+X
  41.  
  42. skewptr         dd      gnbgtbl         ; ptr to row to skew
  43. skewcounter     dw      10fh            ; counter between skewing
  44. skewmode        db      0               ; 0=wait, 1=skewing
  45. skewindex       db      3
  46. skewtbl         db      1,-3,5,-3
  47.  
  48. mtblvpdir       db      5,0,0e7h,0f0h,0, 5,-7,6,-5,9,-6,7,-9
  49. mtblvpy         db      3,0,0c0h,0c0h,0, 3,-1,5,-3,1,-5,1,-3
  50. mtblvpx         db      1,0,060h,0c0h,0, 1,-5,1,-3,3,-1,5,-3
  51.  
  52. _pagehibyte     db      91h
  53. ovrtcounter     db      ?
  54.  
  55. ;▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
  56. ; CODE
  57. ;▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
  58.  
  59. ;░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  60. ; Set up draw system
  61. ; Out:
  62. ;   EAX,EBX,ECX,EDX,ESI,EDI,EBP - ?
  63. ;░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  64. _gnbg_setup:
  65.         mov dx,3d4h                     ; set up CRTC regs needed
  66.         @outw 3213h
  67.         @outb 0ch
  68.  
  69.         mov al,'3'                      ; chek for unlimited speed switch
  70.         call _cchekswitch
  71.         jc short setupf1
  72.         mov flipl0m0,9090h
  73. setupf1:
  74.  
  75.         xor ebx,ebx                     ; check forced switch resolution
  76.         mov al,'0'
  77. setupl0:
  78.         call _cchekswitch
  79.         jnc short setupf0
  80.         inc ebx
  81.         inc eax
  82.         cmp al,'3'
  83.         jb setupl0
  84.  
  85.         mov al,byte ptr _vrt_timer      ; time draw and set resolution
  86.         mov ovrtcounter,al
  87.         push eax
  88. setupl1:
  89.         cmp al,byte ptr _vrt_timer
  90.         je setupl1
  91.         call _gnbg_draw
  92.         pop eax
  93.         sub al,byte ptr _vrt_timer
  94.         xor ebx,ebx
  95.         cmp al,-3
  96.         adc bl,0
  97.         cmp al,-5
  98.         adc bl,0
  99.  
  100. setupf0:
  101.         mov al,resbittbl[ebx]
  102.         mov resbit[-1],al
  103.         mov eax,ressubtbl[ebx*4]
  104.         mov ressub[-4],eax
  105.         mov al,resshftbl[ebx]
  106.         mov resshf[-1],al
  107.  
  108.         ret
  109.  
  110. ;░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  111. ; Handle all grafix crap for drawing 256x256 buffer to screen
  112. ; Out:
  113. ;   EAX,EBX,ECX,EDX,ESI,EDI,EBP - ?
  114. ;░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  115. _gnbg_draw:
  116.         cmp skewmode,0                  ; do skew
  117.         jne short drawf1
  118.         dec skewcounter
  119.         jnz short drawf2
  120.         mov skewcounter,175h
  121.         mov skewmode,1
  122.         mov al,skewindex
  123.         inc al
  124.         and al,3
  125.         mov skewindex,al
  126.         jmp short drawf2
  127. drawf1:
  128.         mov ebx,skewptr
  129.         movzx eax,skewindex
  130.         movsx eax,skewtbl[eax]
  131.         mov cl,80
  132. drawl3:
  133. rept 4
  134.         add [ebx],ax
  135.         add ebx,200
  136. endm
  137.         dec cl
  138.         jnz drawl3
  139.         sub ebx,320*200-2
  140.         cmp ebx,offset gnbgtbl+200
  141.         jb short drawf3
  142.         mov ebx,offset gnbgtbl
  143.         mov skewmode,0
  144. drawf3:
  145.         mov skewptr,ebx
  146. drawf2:
  147.  
  148.         mov dx,vploc                    ; do movement on X and Y
  149.         mov edi,offset mtblvpy
  150.         call drawr0
  151.         add dh,al
  152.         mov edi,offset mtblvpx
  153.         call drawr0
  154.         add dl,al
  155.         mov vploc,dx
  156.         mov si,dx
  157.  
  158.         mov edi,offset mtblvpdir        ; do direction spin
  159.         call drawr0
  160.         movsx eax,al
  161.         add ax,vpdir
  162.         cmp ax,320
  163.         jb short drawf0
  164.         jl short drawf0a
  165.         sub ax,320
  166.         jmp short drawf0
  167. drawf0a:
  168.         add ax,320
  169. drawf0:
  170.         mov vpdir,ax
  171.         movzx eax,ax
  172.         lea ebx,[eax*4+offset gnbgtbltbl]
  173.  
  174.         mov al,ovrtcounter              ; wait for draw safe
  175. drawl0:
  176.         cmp al,byte ptr _vrt_timer
  177.         je drawl0
  178.  
  179.         movzx edi,_pagehibyte           ; draw bottom of screen
  180.         shl edi,8
  181.         push edi
  182.         add di,100*199
  183.         mov es,_vidsel
  184.         mov ds,_bufsel
  185.         mov al,11h              ; 2baddedh
  186. resbit          label   byte
  187.         mov ecx,-101
  188. drawl1:
  189.         mov dx,3c5h
  190.         out dx,al
  191.         mov ah,80
  192.         mov edx,2
  193. drawl1a:
  194.         mov ebp,cs:[ebx]
  195.         push esi
  196. rept 100
  197.         add si,[ebp]
  198.         add ebp,edx
  199.         movs byte ptr es:[di],byte ptr ds:[si]
  200.         add edi,ecx
  201. endm
  202.         pop esi
  203.         add ebx,16
  204.         add edi,100*100+1
  205.         dec ah
  206.         jnz drawl1a
  207.         sub ebx,80*16-4         ; 2baddedh
  208. ressub          label   dword
  209.         sub edi,80
  210.         db 0c0h,0e0h,1          ; shl al,1 ; 2baddedh
  211. resshf          label   byte
  212.         jnc drawl1
  213.         mov ds,cs:_seldata
  214.         mov es,_seldata
  215.  
  216.         mov dx,3c5h                     ; mirror to top of screen
  217.         @outb 0fh
  218.         mov dl,0ceh
  219.         @outw 4105h
  220.         pop edi
  221.         add edi,0a0000h
  222.         sub edi,_code32a
  223.         mov _vidptr,edi
  224.         add edi,100*99
  225.         lea esi,[edi+100]
  226.         xor ecx,ecx
  227.         mov bl,10
  228.         mov eax,-180
  229.         mov edx,20
  230. drawl2:
  231. rept 10
  232.         mov cl,80
  233.         rep movsb
  234.         add esi,edx
  235.         add edi,eax
  236. endm
  237.         dec bl
  238.         jnz drawl2
  239.         mov dx,3ceh
  240.         @outw 4005h
  241.  
  242.         ret
  243. ;-----------------------------------------------------------------------------
  244. drawr0:
  245.         mov al,[edi]
  246.         cmp byte ptr [edi+1],0
  247.         jne short drawr0f0
  248.         mov bl,[edi+2]
  249.         dec bl
  250.         jnz short drawr0f1
  251.         mov bl,[edi+4]
  252.         inc bl
  253.         and bl,7
  254.         mov [edi+4],bl
  255.         mov byte ptr [edi+1],1
  256.         mov bl,[edi+3]
  257. drawr0f1:
  258.         mov [edi+2],bl
  259.         ret
  260. drawr0f0:
  261.         movzx ebx,byte ptr [edi+4]
  262.         cmp al,[edi+ebx+5]
  263.         je short drawr0f2
  264.         setl bl
  265.         setg bh
  266.         add al,bl
  267.         sub al,bh
  268.         mov [edi],al
  269.         ret
  270. drawr0f2:
  271.         mov byte ptr [edi+1],0
  272.         ret
  273.  
  274. ;░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  275. ; Flip video page
  276. ; Out:
  277. ;   EAX,EBX,ECX,EDX,ESI,EDI,EBP - ?
  278. ;░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  279. _gnbg_flip:
  280.         mov ah,ovrtcounter
  281. flipl0:
  282.         mov al,byte ptr _vrt_timer
  283.         sub al,ah
  284.         cmp al,3
  285. flipl0m0        label   word
  286.         jb short flipl0
  287.         mov dx,3d5h
  288.         mov al,_pagehibyte
  289.         out dx,al
  290.         mov ah,byte ptr _vrt_timer
  291.         mov ovrtcounter,ah
  292.         xor al,0b0h
  293.         mov _pagehibyte,al
  294.         ret
  295.  
  296. code32  ends
  297.         end
  298.  
  299.