home *** CD-ROM | disk | FTP | other *** search
/ PC Interdit / pc-interdit.iso / graph / wobbler.asm < prev    next >
Assembly Source File  |  1994-10-07  |  2KB  |  65 lines

  1. extrn WaitRetrace:far
  2.  
  3. data segment public
  4.   extrn sinus:dataptr           ;table des sinus
  5. data ends
  6.  
  7.  
  8. code segment public
  9. assume cs:code,ds:data
  10.  
  11. public make_wob
  12. make_wob proc pascal wob_pos,wob_hauteur,wob_offset:word
  13.   xor cx,cx                     ;initialise le compteur de lignes
  14.   call waitretrace              ;synchronisation avec le rayon cathodique
  15.  
  16. next_line:
  17.   inc cx                        ;incrémente le compteur de lignes
  18.  
  19.   mov bx,cx                    ;détermine la position à l'intérieur du wobbler
  20.   sub bx,wob_pos
  21.   mov si,bx                     ;mémorise pour la fin
  22.  
  23.   add bx,wob_offset        ;ajoute l'offset pour provoquer le déplacement
  24.   and bx,63                ;valeurs de 0..63 uniquement (dimension du tableau)
  25.   shl bx,1                 ;accès au tableau par mot
  26.   mov bx,sinus[bx]         ;lit la valeur en bx
  27.  
  28.   cli                      ;inhibe les interruptions, portion TRES critique
  29.   mov dx,3dah              ;sélectionne le registre 1 de l'Input Status 
  30.  
  31. in_display:
  32.   in al,dx                 ;attend le retour de balayage horizontal
  33.   test al,1
  34.   je in_display
  35. in_retrace:
  36.   in al,dx                      ;attend l'affichage
  37.   test al,1
  38.   jne in_retrace
  39.  
  40.   cmp cx,wob_pos                ;ligne souhaitée atteinte ?
  41.   jb next_line                  ;non -> fixe valeur standard
  42.  
  43.   mov dx,3d4h               ;sélectionne le registre 4 (Horizontal Sync Start)
  44.   mov al,4                  ;du CRTC
  45.   mov ah,bl                 ;lit le sinus
  46.   out dx,ax                 ;et le reporte
  47.  
  48.   cmp si,wob_hauteur            ;fini ?
  49.   jb next_line
  50.  
  51.   mov dx,3dah
  52. attente:
  53.   in al,dx                      ;attend le retour de balayage horizontal
  54.   test al,1
  55.   jne attente
  56.   mov dx,3d4h                   ;réinitialise Sync Start
  57.   mov ax,5504h
  58.   out dx,ax
  59.   sti                           ;rétablit les interruptions
  60.   ret
  61. make_wob endp
  62.  
  63. code ends
  64. end
  65.