Outils pour utilisateurs

Outils du site


back2root:tutoriaux:vga-avance-dac-part-3

Différences

Ci-dessous, les différences entre deux révisions de la page.

Lien vers cette vue comparative

Les deux révisions précédentesRévision précédente
Prochaine révision
Révision précédente
tutoriaux:vga-avance-dac-part-3 [2021/05/02 23:16] fraterback2root:tutoriaux:vga-avance-dac-part-3 [2023/01/08 00:39] (Version actuelle) frater
Ligne 1: Ligne 1:
-====== Tutoriaux: VGA Avancée - DAC - Part 3 ======+====== VGA Avancée - DAC - Part 3 ======
  
 ===== CopperList avancée ===== ===== CopperList avancée =====
Ligne 14: Ligne 14:
  
 === Wait: 0x10 === === Wait: 0x10 ===
- 
  
 Aucune modification n'est apportée a cette instruction. Aucune modification n'est apportée a cette instruction.
Ligne 26: Ligne 25:
 Cette instruction prends les valeurs du dernier "SetColor" (y compris la couleur) pour faire varier les intensités jusqu'aux nouvelles valeurs paramètres, et ce depuis la ligne courant jusqu'à la ligne cible. Cette instruction prends les valeurs du dernier "SetColor" (y compris la couleur) pour faire varier les intensités jusqu'aux nouvelles valeurs paramètres, et ce depuis la ligne courant jusqu'à la ligne cible.
  
-Byte 0 Byte 1 Byte 2 Byte 3  Byte 4 Byte 5 +Byte 0 Byte 1 Byte 2 Byte 3 Byte 4 Byte 5 0x30 LineH LineL Red Green Blue
-0x30 LineH LineL Red Green Blue+
  
-Les bytes "LineH" et "LineL" sont les octets de poids fort et faible du mot qui défini la ligne "cible", celle-ci DOIT être inférieur à copper_maxrow, sans quoi l'excécution des copper s'arretent avec un code d'erreur.+Les bytes "LineH" et "LineL" sont les octets de poids fort et faible du mot qui défini la ligne "cible", celle-ci DOIT être inférieur à copper_maxrow, sans quoi l’exécution des copper s’arrêtent avec un code d'erreur.
  
 === EOC: 0xFF === === EOC: 0xFF ===
Ligne 40: Ligne 38:
 #include "dos.h" #include "dos.h"
 #include "conio.h" #include "conio.h"
- +
 typedef unsigned char BYTE; typedef unsigned char BYTE;
 typedef unsigned int  WORD; typedef unsigned int  WORD;
- +
 // copper_maxrow is a parameter to avoid copper/raster to turn forever // copper_maxrow is a parameter to avoid copper/raster to turn forever
 // copper_error must be set to 0 to run // copper_error must be set to 0 to run
- +
 int    copper_maxrow    = 400; int    copper_maxrow    = 400;
 BYTE   copper_error      = 0; BYTE   copper_error      = 0;
- +
 #define PRECIS             8 #define PRECIS             8
- +
 BYTE copperlistv2[] = BYTE copperlistv2[] =
   {   {
Ligne 60: Ligne 58:
     0x30, 0x00, 0xC8, 0xFF, 0xFF, 0x00,         // GradiantTo 0x32 0xFF,0xFF,0x00  : Yellow     0x30, 0x00, 0xC8, 0xFF, 0xFF, 0x00,         // GradiantTo 0x32 0xFF,0xFF,0x00  : Yellow
     0x30, 0x00, 0xFA, 0xFF, 0x00, 0x00,         // GradiantTo 0x64 0x09,0x0f,0x34  : Red     0x30, 0x00, 0xFA, 0xFF, 0x00, 0x00,         // GradiantTo 0x64 0x09,0x0f,0x34  : Red
-    0x30, 0x01, 0x2C, 0x00, 0x00, 0x00,         // GradiantTo 0x96 0x00,0x00,0x00  : Black     +    0x30, 0x01, 0x2C, 0x00, 0x00, 0x00,         // GradiantTo 0x96 0x00,0x00,0x00  : Black
     0xFF                                        // EOC     0xFF                                        // EOC
-    +
   };   };
- +
 void DrawCopperListv2(char *copperlist) void DrawCopperListv2(char *copperlist)
 { {
Ligne 73: Ligne 71:
   WORD  line_end=0, line_start=0;                 // line end line start   WORD  line_end=0, line_start=0;                 // line end line start
   WORD  line_delta=0;                             // delta between end and start   WORD  line_delta=0;                             // delta between end and start
- +
   if (copper_error!=0)   if (copper_error!=0)
     return;     return;
- +
     asm {     asm {
         push  ds         push  ds
         push  si         push  si
         lds   si,copperlist         lds   si,copperlist
-        xor    cx,cx                     // reset cx : line counter+        xor    cx,cx                  // reset cx : line counter
         xor    bx,bx         xor    bx,bx
         mov   dx,0x3DA }              // wait for stable know pos (0)         mov   dx,0x3DA }              // wait for stable know pos (0)
Ligne 92: Ligne 90:
         test  al,0x08         test  al,0x08
         je    w2 }         je    w2 }
-  + 
-start:asm {                            // protection+start:asm {                           // protection
         mov   al,0x05                 // error 1         mov   al,0x05                 // error 1
-        cmp   cx,copper_maxrow        // line counter copper > max ?+        cmp   cx,copper_maxrow        // line counter copper> max ?
         jb    start2                  // go         jb    start2                  // go
-        jmp    eocl }                  // exit +        jmp    eocl }                 // exit 
- +
 start2: asm { start2: asm {
-        lodsb                          // load copper list operand+        lodsb                         // load copper list operand
         cmp   al,0xFF                 // eocl ?         cmp   al,0xFF                 // eocl ?
         jne   start3         jne   start3
         xor    al,al         xor    al,al
         jmp    eocl }         jmp    eocl }
- +
 start3: asm { start3: asm {
         cmp   al,0x10                 // wait ?         cmp   al,0x10                 // wait ?
         jne    start4         jne    start4
         jmp    wait_line }         jmp    wait_line }
- +
 start4:asm { start4:asm {
         cmp   al,0x20                 // setcolor ?         cmp   al,0x20                 // setcolor ?
         jne    start5         jne    start5
         jmp    set_color }         jmp    set_color }
- +
 start5:asm { start5:asm {
         cmp   al,0x30                 // gradient ?         cmp   al,0x30                 // gradient ?
         je    gradient         je    gradient
- +
         mov   al,0xFF                 // unknown command         mov   al,0xFF                 // unknown command
         jmp   eocl }         jmp   eocl }
- +
 // ------------------------------------- GRADIENT // ------------------------------------- GRADIENT
 gradient: asm { gradient: asm {
-        mov    line_start,cx            // preserve line start+        mov    line_start,cx          // preserve line start
         lodsw         lodsw
-        mov    bh,al                   // reverse endian+        mov    bh,al                  // reverse endian
         mov   bl,ah         mov   bl,ah
-        mov   line_end,bx              // preserve line end +        mov   line_end,bx             // preserve line end 
-       +
         // calculate the number of line between line_start and line_end         // calculate the number of line between line_start and line_end
-        sub    bx,cx  +        sub    bx,cx 
-        mov    line_delta,bx           // pct_max = line count between line_start and end  +        mov    line_delta,bx          // pct_max = line count between line_start and end 
-  + 
-        lodsb                          // load red_end +        lodsb                         // load red_end 
-        shr    al,2                    // reduce to 6 bits only +        shr    al,2                   // reduce to 6 bits only 
-        mov    red_end,al              // preserve red target+        mov    red_end,al             // preserve red target
         mov    ah,al         mov    ah,al
-         + 
-        mov    bl,red_prec                  // bl = red start +        mov    bl,red_prec            // bl = red start 
-        sub    al,bl                    // end - start +        sub    al,bl                  // end - start 
-        mov   red_step,al              // calculate Red Stepping +        mov   red_step,al             // calculate Red Stepping 
-        mov    red_prec,ah                  // +        mov    red_prec,ah            // 
-  + 
-        lodsb                          // load green_end+        lodsb                         // load green_end
         shr    al,2         shr    al,2
         mov    green_end,al         mov    green_end,al
         mov    ah,al         mov    ah,al
-        mov    bl,green_prec                // get green start+        mov    bl,green_prec          // get green start
         sub    al,bl         sub    al,bl
-        mov   green_step,al            // calculate green stepping+        mov   green_step,al           // calculate green stepping
         mov    green_prec,ah         mov    green_prec,ah
-  + 
-        lodsb                          // load blue_end+        lodsb                         // load blue_end
         shr    al,2         shr    al,2
         mov    blue_end,al         mov    blue_end,al
Ligne 161: Ligne 159:
         sub    al,bl         sub    al,bl
         mov   blue_step,al         mov   blue_step,al
-        mov    blue_prec,ah }              // calculate Blue Stepping +        mov    blue_prec,ah }         // calculate Blue Stepping 
- +
 gr_start: asm { gr_start: asm {
-        inc    cx                      // cx = cx+1 +        inc    cx                     // cx = cx+1 
-        cmp   cx,line_end              // gradient complet ?+        cmp   cx,line_end             // gradient complet ?
         jb    gradient_hbl         jb    gradient_hbl
-        jmp    start  }                 // next operant +        jmp    start  }               // next operant 
- +
 gradient_hbl:asm { gradient_hbl:asm {
-        mov    dx,0x3da }              // read input state+        mov    dx,0x3da }             // read input state
 gr_in_retrace:asm  { gr_in_retrace:asm  {
-        in    al,dx                    // test if we are redrawing+        in    al,dx                   // test if we are redrawing
         test  al,1         test  al,1
         jne    gr_in_retrace }         jne    gr_in_retrace }
- +
 gr_in_display:asm  { gr_in_display:asm  {
         in    al,dx         in    al,dx
         test  al,1                    // wait for hbl (horizontal return)         test  al,1                    // wait for hbl (horizontal return)
         je    gr_in_display         je    gr_in_display
- +
         mov    ax,cx         mov    ax,cx
-        sub    ax,line_start            // pct_current(ax) = currentline(cx) - line_start +        sub    ax,line_start          // pct_current(ax) = currentline(cx) - line_start 
-        mov    bx,line_delta            // bx = line_start - line_end +        mov    bx,line_delta          // bx = line_start - line_end 
- +
         xor   dx,dx         xor   dx,dx
-        shl   ax,PRECIS                // increase precision+        shl   ax,PRECIS               // increase precision
         div   bx                      // pct_current / pct_max         div   bx                      // pct_current / pct_max
-        mov    bx,ax                   // bx = percentage 0..100 +        mov    bx,ax                  // bx = percentage 0..100 
- +
         cli         cli
         mov   al,color         mov   al,color
Ligne 195: Ligne 193:
         out   dx,al                   // select color index         out   dx,al                   // select color index
         inc   dx         inc   dx
- +
         xor   ax,ax         xor   ax,ax
         mov   al,red_step         mov   al,red_step
-        imul  bl                      // must be signed multiplication +        imul  bl                      // must be signed multiplication
         shr   ax,PRECIS         shr   ax,PRECIS
         add   al,red_prec         add   al,red_prec
-        out    dx,al                    // set RED to dac+        out    dx,al                  // set RED to dac
         mov    red_end,al         mov    red_end,al
- +
         xor   ax,ax         xor   ax,ax
         mov   al,green_step         mov   al,green_step
-        imul  bl                      // must be signed multiplication +        imul  bl                      // must be signed multiplication
         shr   ax,PRECIS         shr   ax,PRECIS
         add   al,green_prec         add   al,green_prec
-        out    dx,al                     // set GREEN to dac+        out    dx,al                  // set GREEN to dac
         mov    green_end,al         mov    green_end,al
- +
         xor   ax,ax         xor   ax,ax
         mov   al,blue_step         mov   al,blue_step
-        imul  bl                      // must be signed multiplication +        imul  bl                      // must be signed multiplication
         shr   ax,PRECIS         shr   ax,PRECIS
         add   al,blue_prec         add   al,blue_prec
-        out    dx,al                    // set BLUE to dac+        out    dx,al                  // set BLUE to dac
         mov    blue_end,al         mov    blue_end,al
         sti         sti
- +
         jmp   gr_start }              // new line         jmp   gr_start }              // new line
- +
 // ------------------------------------- WAIT // ------------------------------------- WAIT
 wait_line:asm  { wait_line:asm  {
         lodsw         lodsw
-        mov    bh,al                    // swap byte endian encoding craps +        mov    bh,al                  // swap byte endian encoding craps 
-        mov   bl,ah                    // bx = line word +        mov   bl,ah                   // bx = line word 
-        mov    dx,0x3da }              // input state +        mov    dx,0x3da }             // input state 
- +
 wait_next: asm { wait_next: asm {
-        inc    cx                      // cx = cx+1 +        inc    cx                     // cx = cx+1 
-        cmp   cx,bx                   // current line >= wait_line ?+        cmp   cx,bx                   // current line>= wait_line ?
         jae   wait_end }              // YES : next operand please         jae   wait_end }              // YES : next operand please
- +
 in_retrace:asm  { in_retrace:asm  {
-        in    al,dx                    // read input state, test if we are redrawing+        in    al,dx                   // read input state, test if we are redrawing
         test  al,1         test  al,1
         jne    in_retrace }         jne    in_retrace }
Ligne 244: Ligne 242:
         je    in_display         je    in_display
         jmp   wait_next }             // new line         jmp   wait_next }             // new line
- +
 wait_end:asm { wait_end:asm {
         jmp    start }         jmp    start }
- +
 // ------------------------------------- SETCOLOR // ------------------------------------- SETCOLOR
 set_color: asm { set_color: asm {
         cli         cli
-        lodsb                          // get color index+        lodsb                         // get color index
         mov   color,al         mov   color,al
         mov    dx,0x3c8         mov    dx,0x3c8
         out   dx,al                   // select color index         out   dx,al                   // select color index
         inc   dx                      // mov   dx,0x3c9         inc   dx                      // mov   dx,0x3c9
-  + 
-        lodsb                          // get RED level+        lodsb                         // get RED level
         shr    al,2         shr    al,2
         mov   red_prec,al         mov   red_prec,al
-        out    dx,al                    // set RED to dac +        out    dx,al                  // set RED to dac 
-  + 
-        lodsb                          // get GREEN level+        lodsb                         // get GREEN level
         shr    al,2         shr    al,2
         mov   green_prec,al         mov   green_prec,al
-        out    dx,al                    // set GREEN to dac +        out    dx,al                  // set GREEN to dac 
-  + 
-        lodsb                          // get BLUE level+        lodsb                         // get BLUE level
         shr    al,2         shr    al,2
         mov   blue_prec,al         mov   blue_prec,al
-        out    dx,al                    // set BLUE to dac+        out    dx,al                  // set BLUE to dac
         sti         sti
         jmp   start }                 // get next operand         jmp   start }                 // get next operand
- +
 eocl:asm { eocl:asm {
         sti         sti
         pop    si         pop    si
         pop    ds         pop    ds
-        mov   copper_error, al       // set error (if any) +        mov   copper_error, al        // set error (if any) 
-  + 
-        xor    al,al                   // normally we should restore whole DAC's status +        xor    al,al                  // normally we should restore whole DAC's status 
-        mov    dx,0x3c8                // but we only reset color 0 to black+        mov    dx,0x3c8               // but we only reset color 0 to black
         out    dx,al         out    dx,al
         inc    dx         inc    dx
-        out    dx,al                   // turn to RGB 0,0,0+        out    dx,al                  // turn to RGB 0,0,0
         out    dx,al         out    dx,al
         out    dx,al  }         out    dx,al  }
 } }
- +
 void main() void main()
 { {
   unsigned char running=1;   unsigned char running=1;
- +
   textmode(3);   textmode(3);
   clrscr();   clrscr();
- +
   while (running)   while (running)
   {   {
Ligne 304: Ligne 302:
     }     }
     // do some stuffs     // do some stuffs
- +
     printf("T h i s  I s  T h e  T e s t\n");     printf("T h i s  I s  T h e  T e s t\n");
     DrawCopperListv2(copperlistv2);     DrawCopperListv2(copperlistv2);
   }   }
- +
   printf("\n error: %i\n",copper_error);   printf("\n error: %i\n",copper_error);
 } }
 +
 +
 </code> </code>
  
 == Commentaire sur les sources == == Commentaire sur les sources ==
  
 +<WRAP center round info 95%>
 A cause des limitations du x86 concernant les jump conditionnels (near) il a fallut mettre en place un structure de type switch case. A cause des limitations du x86 concernant les jump conditionnels (near) il a fallut mettre en place un structure de type switch case.
  
-Le build-in assembler de borland C++ n'est pas capable de faire de sauts conditionnel au delà d'un delta de -126 +127; car l'oppérande n'est que de 2 octets, pour contourner ce problème il aurait fallut écrire le code assembleur .386 dans un fichier .asm et ensuite le linker au code C, ce qui aurait permis de réduire la "boucle" comme ceci:+Le build-in assembler de borland C++ n'est pas capable de faire de sauts conditionnel au delà d'un delta de -126 +127; car l'oppérande n'est que de 2 octets, pour contourner ce problème il aurait fallut écrire le code assembleur .386 dans un fichier .asm et ensuite le linker au code C, ce qui aurait permis de réduire la "boucle" comme ci-dessous. 
 + 
 +</WRAP>
  
 <code asm> <code asm>
         mov   al,0x05                 // error 1         mov   al,0x05                 // error 1
-        cmp   cx,copper_maxrow        // line counter copper > max ?+        cmp   cx,copper_maxrow        // line counter copper> max ?
         jae   eocl                    // exit         jae   eocl                    // exit
  
Ligne 334: Ligne 337:
         je    gradient         je    gradient
         jmp   eocl                    // unknown command         jmp   eocl                    // unknown command
 +
 +
 </code> </code>
  
Ligne 345: Ligne 350:
           locals           locals
           .386           .386
- +
 PRECIS              EQU       8 PRECIS              EQU       8
- +
 CODESEG CODESEG
-  + 
-; public variables   +; public variables 
- +
 _copper_error        db        0                       ; error reporting _copper_error        db        0                       ; error reporting
 _copper_maxrow      dw        400                      ; max linescan _copper_maxrow      dw        400                      ; max linescan
- +
 public _copper_error public _copper_error
 public _copper_maxrow public _copper_maxrow
- +
 ; private variables ; private variables
- +
 ;color               db        0                   ; color set or starting of gradient ;color               db        0                   ; color set or starting of gradient
 ;red_prec            db        0 ;red_prec            db        0
 ;green_prec          db        0 ;green_prec          db        0
 ;blue_prec           db        0 ;blue_prec           db        0
-    +
 ;red_step            db        0                   ; steps (end color - start color) ;red_step            db        0                   ; steps (end color - start color)
 ;green_step          db        0 ;green_step          db        0
 ;blue_step           db        0 ;blue_step           db        0
- +
 ;red_end             db        0                   ; end color ;red_end             db        0                   ; end color
 ;green_end           db        0 ;green_end           db        0
 ;blue_end            db        0 ;blue_end            db        0
-       +
 ;line_end            dw        0                   ; line end line start ;line_end            dw        0                   ; line end line start
 ;line_start          dw        0 ;line_start          dw        0
Ligne 378: Ligne 383:
  
 public    _DrawCopperList public    _DrawCopperList
- +
 _DrawCopperList PROC C FAR _DrawCopperList PROC C FAR
         ARG      CopperList:DWORD         ARG      CopperList:DWORD
Ligne 386: Ligne 391:
 local   red_end:byte , green_end:byte , blue_end:byte local   red_end:byte , green_end:byte , blue_end:byte
 local   line_end: word, line_start: word, line_delta: word local   line_end: word, line_start: word, line_delta: word
-  +
-        +
         push  ds         push  ds
         push  si         push  si
-        +
         lds   si,copperlist         lds   si,copperlist
-        +
         cmp    cs:_copper_error,0         cmp    cs:_copper_error,0
-        jne    clean_eocl       +        jne    clean_eocl 
-        +
         xor    ecx,ecx                 ; reset cx : line counter         xor    ecx,ecx                 ; reset cx : line counter
         xor    ebx,ebx         xor    ebx,ebx
- +
         mov   dx,03DAh                 ; wait for stable know pos (0)         mov   dx,03DAh                 ; wait for stable know pos (0)
 w1:     in    al,dx w1:     in    al,dx
         test  al,08h         test  al,08h
-        jne   w1 +        jne   w1
 w2:     in    al,dx w2:     in    al,dx
         test  al,08h         test  al,08h
-        je    w2  +        je    w2 
- +
 start:  mov   al,01h                  ; error 1 start:  mov   al,01h                  ; error 1
-        cmp   cx,CS:_copper_maxrow    ; line counter copper > max ?+        cmp   cx,CS:_copper_maxrow    ; line counter copper> max ?
         jae   eocl                    ; exit         jae   eocl                    ; exit
  
         lodsb                         ; load copper list operand         lodsb                         ; load copper list operand
         cmp   al,0FFh                 ; eocl ?         cmp   al,0FFh                 ; eocl ?
-        je    clean_eocl  +        je    clean_eocl 
- +
         cmp   al,010h                 ; wait ?         cmp   al,010h                 ; wait ?
         je    wait_line         je    wait_line
- +
         cmp   al,020h                 ; setcolor ?         cmp   al,020h                 ; setcolor ?
         je    set_color         je    set_color
-        +
         cmp   al,030h                 ; gradient ?         cmp   al,030h                 ; gradient ?
         je    gradient         je    gradient
- +
         mov   al,002h                 ; unknown command         mov   al,002h                 ; unknown command
         jmp   eocl         jmp   eocl
- +
 ; ------------------------------------- GRADIENT ; ------------------------------------- GRADIENT
-gradient: +gradient:
         mov    line_start,cx          ; preserve line start         mov    line_start,cx          ; preserve line start
         lodsw         lodsw
Ligne 434: Ligne 438:
         mov    bl,ah         mov    bl,ah
         mov    line_end,bx            ; preserve line end         mov    line_end,bx            ; preserve line end
-        +
         ; calculate the number of line between line_start and line_end         ; calculate the number of line between line_start and line_end
-        sub    bx,cx  +        sub    bx,cx 
-        mov    line_delta,bx          ; pct_max = line count between line_start and end  +        mov    line_delta,bx          ; pct_max = line count between line_start and end 
- +
         lodsb                         ; load red_end         lodsb                         ; load red_end
         shr    al,2                   ; reduce to 6 bits only         shr    al,2                   ; reduce to 6 bits only
         mov    red_end,al             ; preserve red target         mov    red_end,al             ; preserve red target
         mov    ah,al         mov    ah,al
-        +
         mov    bl,red_prec            ; bl = red start         mov    bl,red_prec            ; bl = red start
         sub    al,bl                  ; end - start         sub    al,bl                  ; end - start
         mov    red_step,al            ; calculate Red Stepping         mov    red_step,al            ; calculate Red Stepping
         mov    red_prec,ah         mov    red_prec,ah
- +
         lodsb                         ; load green_end         lodsb                         ; load green_end
         shr    al,2         shr    al,2
Ligne 457: Ligne 461:
         mov    green_step,al          ; calculate green stepping         mov    green_step,al          ; calculate green stepping
         mov    green_prec,ah         mov    green_prec,ah
- +
         lodsb                         ; load blue_end         lodsb                         ; load blue_end
         shr    al,2         shr    al,2
Ligne 466: Ligne 470:
         mov    blue_step,al         mov    blue_step,al
         mov    blue_prec,ah           ; calculate Blue Stepping         mov    blue_prec,ah           ; calculate Blue Stepping
- +
 gr_start: gr_start:
         inc    cx                     ; cx = cx+1         inc    cx                     ; cx = cx+1
Ligne 472: Ligne 476:
         jb     gradient_hbl         jb     gradient_hbl
         jmp    start                  ; next operant         jmp    start                  ; next operant
- +
 gradient_hbl: gradient_hbl:
         mov    dx,03DAh               ; read input state         mov    dx,03DAh               ; read input state
-        +
 gr_in_retrace: gr_in_retrace:
         in     al,dx                  ; test if we are redrawing         in     al,dx                  ; test if we are redrawing
         test   al,1         test   al,1
-        jne    gr_in_retrace  +        jne    gr_in_retrace 
- +
 gr_in_display: gr_in_display:
         in     al,dx         in     al,dx
Ligne 490: Ligne 494:
         sub    ax,line_start          ; pct_current(ax) = currentline(cx) - line_start         sub    ax,line_start          ; pct_current(ax) = currentline(cx) - line_start
         mov    bx,line_delta          ; bx = line_start - line_end         mov    bx,line_delta          ; bx = line_start - line_end
- +
         xor    dx,dx         xor    dx,dx
         shl    eax,PRECIS             ; increase precision         shl    eax,PRECIS             ; increase precision
         div    bx                     ; pct_current / pct_max         div    bx                     ; pct_current / pct_max
         mov    bx,ax                  ; bx = percentage 0..100         mov    bx,ax                  ; bx = percentage 0..100
- +
         cli         cli
         mov    al,color         mov    al,color
Ligne 501: Ligne 505:
         out    dx,al                   ; select color index         out    dx,al                   ; select color index
         inc    dx         inc    dx
- +
         xor    eax,eax         xor    eax,eax
         mov    al,red_step         mov    al,red_step
-        imul   bl                     ; must be signed multiplication +        imul   bl                     ; must be signed multiplication
         shr    ax,PRECIS         shr    ax,PRECIS
         add    al,red_prec         add    al,red_prec
         out    dx,al                  ; set RED to dac         out    dx,al                  ; set RED to dac
         mov    red_end,al         mov    red_end,al
- +
         xor    ax,ax         xor    ax,ax
         mov    al,green_step         mov    al,green_step
-        imul   bl                     ; must be signed multiplication +        imul   bl                     ; must be signed multiplication
         shr    ax,PRECIS         shr    ax,PRECIS
         add    al,green_prec         add    al,green_prec
         out    dx,al                  ; set GREEN to dac         out    dx,al                  ; set GREEN to dac
         mov    green_end,al         mov    green_end,al
- +
         xor    ax,ax         xor    ax,ax
         mov    al,blue_step         mov    al,blue_step
-        imul   bl                     ; must be signed multiplication +        imul   bl                     ; must be signed multiplication
         shr    ax,PRECIS         shr    ax,PRECIS
         add    al,blue_prec         add    al,blue_prec
Ligne 526: Ligne 530:
         mov    blue_end,al         mov    blue_end,al
         sti         sti
- +
         jmp    gr_start               ; new line         jmp    gr_start               ; new line
- +
 ; ------------------------------------- WAIT ; ------------------------------------- WAIT
 wait_line: wait_line:
Ligne 535: Ligne 539:
         mov    bl,ah                   ; bx = line word         mov    bl,ah                   ; bx = line word
         mov    dx,03DAh                ; input state         mov    dx,03DAh                ; input state
- +
 wait_next: wait_next:
         inc    cx                      ; cx = cx+1         inc    cx                      ; cx = cx+1
-        cmp    cx,bx                   ; current line >= wait_line ?+        cmp    cx,bx                   ; current line>= wait_line ?
         jae    wait_end                ; YES : next operand please         jae    wait_end                ; YES : next operand please
- +
 in_retrace: in_retrace:
         in     al,dx                   ; read input state, test if we are redrawing         in     al,dx                   ; read input state, test if we are redrawing
         test   al,1         test   al,1
-        jne    in_retrace +        jne    in_retrace
 in_display: in_display:
         in     al,dx         in     al,dx
Ligne 550: Ligne 554:
         je     in_display         je     in_display
         jmp    wait_next               ; new line         jmp    wait_next               ; new line
- +
 wait_end: wait_end:
-        jmp    start  +        jmp    start 
- +
 ; ------------------------------------- SETCOLOR ; ------------------------------------- SETCOLOR
-set_color: +set_color:
         cli         cli
         lodsb                          ; get color index         lodsb                          ; get color index
Ligne 562: Ligne 566:
         out    dx,al                   ; select color index         out    dx,al                   ; select color index
         inc    dx                      ; mov   dx,0x3c9         inc    dx                      ; mov   dx,0x3c9
- +
         lodsb                          ; get RED level         lodsb                          ; get RED level
         shr    al,2         shr    al,2
         mov    red_prec,al         mov    red_prec,al
         out    dx,al                   ; set RED to dac         out    dx,al                   ; set RED to dac
- +
         lodsb                          ; get GREEN level         lodsb                          ; get GREEN level
         shr    al,2         shr    al,2
         mov    green_prec,al         mov    green_prec,al
         out    dx,al                   ; set GREEN to dac         out    dx,al                   ; set GREEN to dac
- +
         lodsb                          ; get BLUE level         lodsb                          ; get BLUE level
         shr    al,2         shr    al,2
Ligne 579: Ligne 583:
         sti         sti
         jmp    start                   ; get next operand         jmp    start                   ; get next operand
- +
 clean_eocl: clean_eocl:
         xor    al,al         xor    al,al
Ligne 586: Ligne 590:
         pop    si         pop    si
         pop    ds         pop    ds
- +
         xor    al,al                   ; normally we should restore whole DAC's status         xor    al,al                   ; normally we should restore whole DAC's status
         mov    dx,03C8h                ; but we only reset color 0 to black         mov    dx,03C8h                ; but we only reset color 0 to black
Ligne 593: Ligne 597:
         out    dx,al                   ; turn to RGB 0,0,0         out    dx,al                   ; turn to RGB 0,0,0
         out    dx,al         out    dx,al
-        out    dx,al  +        out    dx,al
         ret         ret
 _DrawCopperList endp _DrawCopperList endp
-      +
       END       END
-</code>       + 
-      + 
 +</code> 
 === le header .h === === le header .h ===
  
Ligne 613: Ligne 619:
 #endif #endif
 </code> </code>
-  + 
-<nspages tutoriaux -simpleList -h1 -exclude:start -textPages="Tutoriaux disponible"> +<nspages back2root/tutoriaux -simpleList -h1 -exclude:start -textPages="Tutoriaux disponible"> 
 + 
back2root/tutoriaux/vga-avance-dac-part-3.1619990190.txt.gz · Dernière modification : 2021/05/02 23:16 de frater