home *** CD-ROM | disk | FTP | other *** search
/ Groovy Bytes: Behind the Moon / groovybytes.iso / GROOVY / SND_TOOL / CDMP16.ZIP / SOURCE.ZIP / VGA.ASM < prev    next >
Encoding:
Assembly Source File  |  1995-01-30  |  3.0 KB  |  132 lines

  1. ;[]------------------------------------------------------------------------[]
  2. ;|                                                                          |
  3. ;| (c) 1993,1994 by Marc van Shaney , aka Kaya Memisoglu                    |
  4. ;|                                                                          |
  5. ;| Dieser Assembler-Source-Code unterliegt dem Urheberrecht von Kaya        |
  6. ;| Memisoglu und darf auch nur mit seiner schriftlichen Genehmigung         |
  7. ;| in kommerziellen Programmen verwendet werden.                            |
  8. ;| Ich übernehme keinerlei Verantwortung für eventuelle Schäden,die dieses  |
  9. ;| Programm verursacht.                                                     |
  10. ;|                                                                          |
  11. ;|                                                                          |
  12. ;| 18.12.1994 Kaya Memisoglu                                                |
  13. ;|                                                                          |
  14. ;[]------------------------------------------------------------------------[]
  15.  
  16.  
  17. P386
  18. JUMPS
  19.  
  20. LOCALS
  21. VGA_Width         equ  320
  22. VGA_Height        equ  200
  23. VGA_Segment       equ  0a000h
  24. VGA_Mode          equ  13h
  25. Char_Segment      equ  0f000h
  26. Char_Offset       equ  0fa6eh
  27. Text_Mode         equ  3
  28. Black             equ  240
  29. Background        equ  255
  30. VGA_Adresse       equ  0a0000000h
  31.  
  32. CRTC_Index        equ 3d4h
  33. CRTC_Data         equ 3d5h
  34. CRTC_Status       equ 3dah
  35. Display_Enable    equ 01
  36. Vertical_Sync     equ 08
  37.  
  38.  
  39. .MODEL USE16 LARGE
  40. .Code
  41.  
  42.  
  43. PUBLIC C Init_Graphic
  44. Init_Graphic PROC
  45.       push ds
  46.       mov al,VGA_Mode
  47.       mov ah,0
  48.       int 10h
  49.       mov ah,10h
  50.       mov al,01h
  51.       mov bh,0
  52.       int 10h
  53.  
  54.       pop ds
  55.       retcode
  56. Init_Graphic ENDP
  57.  
  58.  
  59.  
  60.  
  61.  
  62. PUBLIC C Exit_Graphic
  63. Exit_Graphic PROC
  64.       push ds
  65.  
  66.       mov al,Text_Mode
  67.       mov ah,0
  68.       int 10h
  69.  
  70.       pop ds
  71.       retcode
  72. Exit_Graphic ENDP
  73.  
  74.  
  75.  
  76.  
  77.  
  78.  
  79.  
  80.  
  81. PUBLIC C Set_Colour
  82. Set_Colour PROC
  83.       ARG COLOR:DATAPTR,Nummer:Word
  84.       push bp
  85.       mov bp,sp
  86.       cli
  87.  
  88.       les bx,COLOR              ;In ES:DI Zeiger auf Farbe
  89.       mov dx,03c8h
  90.       mov ax,Nummer             ;In AX die Farbnummer
  91.       out dx,al
  92.       inc dx                    ;Neue Portadresse
  93.       mov al,byte ptr[es:bx]
  94.       shr al,2                  ;2 Bit nach rechts verschieben
  95.       out dx,al
  96.       mov al,byte ptr[es:bx+1]
  97.       shr al,2                  ;2 Bit nach rechts verschieben
  98.       out dx,al
  99.       mov al,byte ptr[es:bx+2]
  100.       shr al,2                  ;2 Bit nach rechts verschieben
  101.       out dx,al
  102.  
  103.       sti
  104.       pop bp
  105.       retcode
  106. Set_Colour ENDP
  107.  
  108.  
  109.  
  110.  
  111. PUBLIC C Put_Frame
  112. Put_Frame PROC
  113.       ARG frame:dataptr
  114.       push bp
  115.       mov bp,sp
  116.       push si
  117.       push di
  118.  
  119.       mov cx,3e80h
  120.       lfs si,frame
  121.       mov ax,VGA_Segment
  122.       mov es,ax
  123.       xor di,di
  124.       rep movs dword ptr [es:di],[fs:si]
  125.  
  126.       pop di
  127.       pop si
  128.       pop bp
  129.       retcode
  130. Put_Frame ENDP
  131.  
  132. END