home *** CD-ROM | disk | FTP | other *** search
/ PC Underground / UNDERGROUND.ISO / doom / source / _vgapas.asm < prev    next >
Encoding:
Assembly Source File  |  1995-02-05  |  3.7 KB  |  169 lines

  1. ;----------------------------------------------------------------------------
  2. ; Mode13h - DOS 16bit realmode (Turbo Pascal version)
  3. ; Copyright (c) 1994,95 by J.E. Hoffmann
  4. ; All rights reserved
  5. ;----------------------------------------------------------------------------
  6.   TITLE _VGAPAS.ASM
  7.   
  8.  
  9.   MODEL LARGE,PASCAL
  10.  
  11.  
  12.   IDEAL
  13.   NOJUMPS
  14.   LOCALS @@
  15.  
  16.  
  17.  
  18.   INCLUDE "_VGAXASM.INC"
  19.  
  20.  
  21.  
  22.   PUBLIC Init13h
  23.   PUBLIC Done13h
  24.   PUBLIC IsColorVGA
  25.   PUBLIC WaitVertRetrace
  26.   PUBLIC ClearScreen
  27.   PUBLIC ShowVBuffer
  28.   PUBLIC SetDACBlock
  29.  
  30.  
  31.   DATASEG
  32.     OldMode      db 3
  33.     EXTRN _VirtualVSeg :WORD
  34.  
  35.  
  36.  
  37.   CODESEG
  38.   P386N
  39.  
  40.  
  41.  
  42. ;≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡
  43. ; extern void pascal far Init13h(void);
  44. ;≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡
  45.   PROC Init13h FAR
  46.        mov    ah,0Fh
  47.        int    10h
  48.        mov    [OldMode],al
  49.        mov    ax,0013h
  50.        int    10h
  51.        ret
  52.   ENDP
  53.  
  54.  
  55.  
  56. ;≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡
  57. ; extern void pascal far Done13h(void);
  58. ;≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡
  59.   PROC Done13h FAR
  60.        movzx  ax,[OldMode]
  61.        int    10h
  62.        ret
  63.   ENDP
  64.  
  65.  
  66.  
  67. ;≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡
  68. ; extern int pascal far IsColorVGA(void);
  69. ;≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡
  70.   PROC IsColorVGA FAR
  71.        mov    ax,1A00h
  72.        int    10h
  73.        cmp    al,1Ah
  74.        jne    @@10
  75.        cmp    bl,08h
  76.        jne    @@10
  77.        mov    ax,1
  78.        jmp    @@12
  79.   @@10:
  80.        xor    ax,ax
  81.   @@12:
  82.        ret
  83.   ENDP
  84.  
  85.  
  86.  
  87. ;≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡
  88. ; extern void pascal far WaitVertRetrace(void);
  89. ;≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡
  90.   PROC WaitVertRetrace FAR
  91.        mov    dx,GR_InputStatus1
  92.   @@11:
  93.        in     al,dx
  94.        test   al,08h
  95.        jne    @@11
  96.   @@12:
  97.        in     al,dx
  98.        test   al,08h
  99.        je     @@12
  100.        ret
  101.   ENDP
  102.  
  103.  
  104.  
  105. ;≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡
  106. ; extern void pascal far ClearScreen(char Col);
  107. ;≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡
  108.   PROC ClearScreen FAR Col :Byte
  109.        pusha
  110.        push   es
  111.        mov    es,[_VirtualVSeg]
  112.        xor    di,di
  113.        mov    cx,64000/4
  114.        mov    al,[Col]
  115.        mov    ah,al
  116.        push   ax
  117.        rol    eax,16
  118.        pop    ax
  119.        repne  stosd
  120.        pop    es
  121.        popa
  122.        ret
  123.   ENDP
  124.  
  125.  
  126.  
  127. ;≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡
  128. ; extern void pascal far ShowVBuffer(void);
  129. ;≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡
  130.   PROC ShowVBuffer FAR
  131.        push   ds
  132.        mov    ax,0A000h
  133.        mov    es,ax
  134.        xor    di,di
  135.        mov    ax,[_VirtualVSeg]
  136.        mov    ds,ax
  137.        xor    si,si
  138.        mov    cx,64000/4
  139.        repne  movsd
  140.        pop    ds
  141.        ret
  142.   ENDP
  143.  
  144.  
  145.  
  146. ;≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡
  147. ; extern void pascal far SetDACBlock(char StartReg, int Count, void *Block);
  148. ;≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡
  149.   PROC SetDACBlock FAR StartReg:Byte, Count:Word, Block :DWord
  150.        push   ds
  151.        cld
  152.        lds    si,[Block]
  153.        mov    dx,DC_PELAddressWriteMode
  154.        mov    al,[StartReg]
  155.        out    dx,al
  156.        inc    dx
  157.        mov    ax,[Count]
  158.        mov    cx,ax
  159.        shl    cx,1
  160.        add    cx,ax
  161.        repne  outsb
  162.        pop    ds
  163.        ret
  164.   ENDP
  165.   END
  166.  
  167.  
  168.  
  169.