home *** CD-ROM | disk | FTP | other *** search
/ Freelog 8 / Freelog008.iso / Prog / VGA_C.C < prev    next >
C/C++ Source or Header  |  2000-02-06  |  1KB  |  110 lines

  1. //CODE EN C REALISE PAR SIRACUSA WALTER/wiSdom
  2. //CODE EN ASSEMBLEUR REALISE PAR Gilles Baillou
  3.  
  4. #include "vga.h"
  5.  
  6. void InitVGA(void)
  7. {
  8. asm{
  9. mov ax,13h
  10. int 10h
  11. }
  12. }
  13.  
  14. void InitTexte(void)
  15. {
  16. asm{
  17. mov ax,03h
  18. int 10h
  19. }
  20. }
  21.  
  22. void CpyBlk2(short xs,short ys,word l,word h,short xd,short yd,bytef *src,bytef *dst)
  23. {
  24. asm{
  25. les di,dst
  26. lds si,src
  27. imul cx,yd,320
  28. add di,cx
  29. add di,xd
  30. imul cx,ys,320
  31. add si,cx
  32. add si,xs
  33. mov bx,320
  34. sub bx,l
  35.  
  36. mov ax,h
  37. }
  38. continu:
  39. ;
  40.  
  41. asm{
  42. mov cx,l
  43. shr cx,1
  44. rep movsw
  45. adc cx,cx
  46. rep movsb
  47.  
  48.  
  49. add di,bx
  50. add si,bx
  51.  
  52. dec ax
  53. jnz continu
  54. }
  55.  
  56. //En C ceci donne:
  57. /*  register byte i,j;
  58.   wordf *s2;
  59.   wordf *d2;
  60.  
  61.   src+=(ys<<8)+(ys<<6)+xs;
  62.   dst+=(yd<<8)+(yd<<6)+xd;
  63.   l=l>>1;
  64.  
  65.   for(j=0;j<h;j++)
  66.   {
  67.     s2=(wordf *)src;
  68.     d2=(wordf *)dst;
  69.     for(i=0;i<l;i++) *(d2++)=*(s2++);
  70.     src+=320;
  71.     dst+=320;
  72.   }*/
  73. }
  74.  
  75.  
  76. void CpyBnd(short ys,word h,short yd,bytef *src,bytef *dst)
  77. {
  78. asm{
  79. les di,dst
  80. lds si,src
  81. imul cx,yd,320
  82. add di,cx
  83. imul cx,ys,320
  84. add si,cx
  85.  
  86. mov cx,h
  87. imul cx,320
  88.  
  89. shr cx,1
  90. rep movsw
  91. adc cx,cx
  92. rep movsb
  93. }
  94. //En C ceci donne:
  95. /*  register word i;
  96.   dwordf *s4;
  97.   dwordf *d4;
  98.  
  99.   src+=(ys<<8)+(ys<<6);
  100.   dst+=(yd<<8)+(yd<<6);
  101.  
  102.   s4=(dwordf *)src;
  103.   d4=(dwordf *)dst;
  104.   h=(h<<6)+(h<<4); //h = (h*320) / 4
  105.  
  106.   for(i=0;i<h;i++) d4[i]=s4[i];*/
  107.  
  108.  
  109. }
  110.