Переглянути джерело

* another little optimization of UpdateScreen

Tomas Hajny 24 роки тому
батько
коміт
67c9365e28
2 змінених файлів з 127 додано та 119 видалено
  1. 79 78
      api/os2/video.inc
  2. 48 41
      rtl/os2/video.pp

+ 79 - 78
api/os2/video.inc

@@ -436,88 +436,86 @@ begin
     if LockUpdateScreen = 0 then
     if LockUpdateScreen = 0 then
         begin
         begin
             if not (Force) then
             if not (Force) then
-                begin
+                asm
+                    cld
 {$IFDEF BIT_32}
 {$IFDEF BIT_32}
-                    asm
-                        cld
-                        mov esi, VideoBuf
-                        mov edi, OldVideoBuf
-                        mov eax, VideoBufSize
-                        mov ecx, eax
-                        shr ecx
-                        shr ecx
-                        repe
-                        cmpsd
-                        inc cx
-                        mov SOfs, ecx
-                        or ecx, ecx
-                        jz @no_update
-                        mov Force, 1
-                        std
-                        mov edi, eax
-                        mov esi, VideoBuf
-                        add eax, esi
-                        sub eax, 4
-                        mov esi, eax
-                        mov eax, OldVideoBuf
-                        add eax, edi
-                        sub eax, 4
-                        mov edi, eax
-                        repe
-                        cmpsd
-                        inc ecx
-                        shl ecx
-                        shl ecx
-                        mov CLen, ecx
-                        cld
+                    mov esi, VideoBuf
+                    mov edi, OldVideoBuf
+                    mov eax, VideoBufSize
+                    mov ecx, eax
+                    shr ecx, 1
+                    shr ecx, 1
+                    repe
+                    cmpsd
+                    je @no_update
+                    inc ecx
+                    mov edx, eax
+                    mov ebx, ecx
+                    shl ebx, 1
+                    shl ebx, 1
+                    sub edx, ebx
+                    mov SOfs, edx
+                    mov Force, 1
+                    std
+                    mov edi, eax
+                    mov esi, VideoBuf
+                    add eax, esi
+                    sub eax, 4
+                    mov esi, eax
+                    mov eax, OldVideoBuf
+                    add eax, edi
+                    sub eax, 4
+                    mov edi, eax
+                    repe
+                    cmpsd
+                    inc ecx
+                    shl ecx, 1
+                    shl ecx, 1
+                    mov CLen, ecx
 @no_update:
 @no_update:
-                    end;
-                    SOfs := VideoBufSize - (SOfs shl 2);
 {$ELSE}
 {$ELSE}
-                    asm
-                        cld
-                        push ds
-                        lds si, VideoBuf
-                        les di, OldVideoBuf
-                        mov ax, word ptr VideoBufSize
-                        mov cx, ax
-                        shr cx
-                        repe
-                        cmpsw
-                        inc cx
-                        mov SOfs, cx
-                        or cx, cx
-                        jz @no_update
-                        mov Force, 1
-                        std
-                        mov di, ax
-                        mov si, offset VideoBuf
-                        add ax, si
-                        dec ax
-                        dec ax
-                        mov si, ax
-                        mov ax, offset OldVideoBuf
-                        add ax, di
-                        dec ax
-                        dec ax
-                        mov di, ax
-                        repe
-                        cmpsw
-                        inc cx
-                        shl cx
-                        mov CLen, cx
-                        cld
+                    push ds
+                    lds si, VideoBuf
+                    les di, OldVideoBuf
+                    mov ax, word ptr VideoBufSize
+                    mov cx, ax
+                    shr cx, 1
+                    repe
+                    cmpsw
+                    jz @no_update
+                    inc cx
+                    mov dx, ax
+                    mov bx, cx
+                    shl bx, 1
+                    sub dx, bx
+                    mov SOfs, dx
+                    mov Force, 1
+                    std
+                    mov di, ax
+                    mov si, offset VideoBuf
+                    add ax, si
+                    dec ax
+                    dec ax
+                    mov si, ax
+                    mov ax, offset OldVideoBuf
+                    add ax, di
+                    dec ax
+                    dec ax
+                    mov di, ax
+                    repe
+                    cmpsw
+                    inc cx
+                    shl cx, 1
+                    mov CLen, cx
 @no_update:
 @no_update:
-                        pop ds
-                    end;
-                    Inc (SOfs);
-                    SOfs := VideoBufSize - (SOfs shl 1);
+                    pop ds
 {$ENDIF}
 {$ENDIF}
-                end else
-                    begin
-                        SOfs := 0;
-                        CLen := VideoBufSize;
-                    end;
+                end
+            else
+                begin
+                    SOfs := 0;
+                    CLen := VideoBufSize;
+                end;
             if Force then
             if Force then
                 begin
                 begin
                     VioShowBuf (SOfs, CLen, 0);
                     VioShowBuf (SOfs, CLen, 0);
@@ -531,7 +529,10 @@ end;
 {
 {
 
 
   $Log$
   $Log$
-  Revision 1.11  2000-10-15 20:52:56  hajny
+  Revision 1.12  2001-01-23 20:21:45  hajny
+    * another little optimization of UpdateScreen
+
+  Revision 1.11  2000/10/15 20:52:56  hajny
     * optimization of UpdateScreen finished
     * optimization of UpdateScreen finished
 
 
   Revision 1.10  2000/10/11 20:10:04  hajny
   Revision 1.10  2000/10/11 20:10:04  hajny

+ 48 - 41
rtl/os2/video.pp

@@ -370,46 +370,50 @@ begin
     if LockUpdateScreen = 0 then
     if LockUpdateScreen = 0 then
         begin
         begin
             if not (Force) then
             if not (Force) then
-                begin
-                    asm
-                        cld
-                        mov esi, VideoBuf
-                        mov edi, OldVideoBuf
-                        mov eax, VideoBufSize
-                        mov ecx, eax
-                        shr ecx
-                        shr ecx
-                        repe
-                        cmpsd
-                        je @no_update
-                        inc cx
-                        mov SOfs, ecx
-                        mov Force, 1
-                        std
-                        mov edi, eax
-                        mov esi, VideoBuf
-                        add eax, esi
-                        sub eax, 4
-                        mov esi, eax
-                        mov eax, OldVideoBuf
-                        add eax, edi
-                        sub eax, 4
-                        mov edi, eax
-                        repe
-                        cmpsd
-                        inc ecx
-                        shl ecx
-                        shl ecx
-                        mov CLen, ecx
-                        cld
+            if not (Force) then
+                asm
+                    cld
+{$IFDEF BIT_32}
+                    mov esi, VideoBuf
+                    mov edi, OldVideoBuf
+                    mov eax, VideoBufSize
+                    mov ecx, eax
+                    shr ecx, 1
+                    shr ecx, 1
+                    repe
+                    cmpsd
+                    je @no_update
+                    inc ecx
+                    mov edx, eax
+                    mov ebx, ecx
+                    shl ebx, 1
+                    shl ebx, 1
+                    sub edx, ebx
+                    mov SOfs, edx
+                    mov Force, 1
+                    std
+                    mov edi, eax
+                    mov esi, VideoBuf
+                    add eax, esi
+                    sub eax, 4
+                    mov esi, eax
+                    mov eax, OldVideoBuf
+                    add eax, edi
+                    sub eax, 4
+                    mov edi, eax
+                    repe
+                    cmpsd
+                    inc ecx
+                    shl ecx, 1
+                    shl ecx, 1
+                    mov CLen, ecx
 @no_update:
 @no_update:
-                    end;
-                    SOfs := VideoBufSize - (SOfs shl 2);
-                end else
-                    begin
-                        SOfs := 0;
-                        CLen := VideoBufSize;
-                    end;
+                end
+            else
+                begin
+                    SOfs := 0;
+                    CLen := VideoBufSize;
+                end;
             if Force then
             if Force then
                 begin
                 begin
                     VioShowBuf (SOfs, CLen, 0);
                     VioShowBuf (SOfs, CLen, 0);
@@ -426,10 +430,13 @@ initialization
 finalization
 finalization
   UnRegisterVideoModes;
   UnRegisterVideoModes;
 end.
 end.
+
 {
 {
   $Log$
   $Log$
-  Revision 1.1  2001-01-13 11:03:58  peter
+  Revision 1.2  2001-01-23 20:23:56  hajny
+    * another little optimization of UpdateScreen
+
+  Revision 1.1  2001/01/13 11:03:58  peter
     * API 2 RTL commit
     * API 2 RTL commit
 
 
 }
 }
-