Guest User

Untitled

a guest
Jul 7th, 2019
389
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Delphi 2.98 KB | None | 0 0
  1. {$ELSE}
  2.  
  3.                 // rcx          rdx           r8
  4. procedure PSetL(SCRPos:pointer;BKscr:pointer;Pix32:pointer);assembler;{$IFDEF FPC}nostackframe;{$ENDIF}
  5. asm
  6. //  ret
  7.   push rbx
  8.   push rsi
  9.   push rdi
  10.  
  11.  
  12.   mov rax,rcx
  13.   mov rcx, r8
  14.  
  15.   mov bl, 32
  16.  
  17.   test rdx,rdx
  18.   jnz @@output
  19.   xorps xmm0,xmm0
  20. @@top1:
  21.   movntps [rax+00h],xmm0
  22.   movntps [rax+10h],xmm0
  23.   movntps [rax+20h],xmm0
  24.   movntps [rax+30h],xmm0
  25.   movntps [rax+40h],xmm0
  26.   movntps [rax+50h],xmm0
  27.   movntps [rax+60h],xmm0
  28.   movntps [rax+70h],xmm0
  29. //  add rax, 80h
  30.   sub rax, -128
  31.   dec bl //rbx
  32.   jnz @@top1
  33. //  jmp @@done
  34.   pop rdi
  35.   pop rsi
  36.   pop rbx
  37.   ret
  38.  
  39. @@output:
  40.  
  41.   mov rdi,rdx
  42.   mov rsi, rcx //Pix32Tbl
  43.  
  44.   xor rdx,rdx
  45.   xor rcx,rcx
  46.  
  47. @@top://
  48.  
  49.   movzx ecx, word ptr [edi]
  50.   movzx edx,ch
  51.   xor ch,ch
  52.  
  53.   add ecx,ecx
  54.   add ecx,ecx
  55.  
  56.   add edx,edx
  57.   add edx,edx
  58.  
  59.   movaps xmm0, [rsi+rcx*8+0]
  60.   movaps xmm2, [rsi+rcx*8+16]
  61.   movaps xmm4, [rsi+rdx*8]
  62.   movaps xmm6, [rsi+rdx*8+16]
  63. //
  64.   movaps xmm5, xmm4     //111111 222222 333333 444444
  65.   movaps xmm7, xmm6
  66.   movaps xmm1, xmm0     //111111 222222 333333 444444
  67.   movaps xmm3, xmm2
  68. //
  69.   shufps xmm0,xmm0,50h  //111111 111111 222222 222222
  70.   shufps xmm1,xmm1,0fah //333333 333333 444444 444444
  71.   shufps xmm2,xmm2,50h
  72.   shufps xmm3,xmm3,0fah
  73. //
  74.   shufps xmm4,xmm4,50h  //111111 111111 222222 222222
  75.   shufps xmm5,xmm5,0fah //333333 333333 444444 444444
  76.   shufps xmm6,xmm6,50h
  77.   shufps xmm7,xmm7,0fah
  78. //
  79.   movntps [rax+00h],xmm0  
  80.   movntps [rax+10h],xmm1
  81.   movntps [rax+20h],xmm2
  82.   movntps [rax+30h],xmm3
  83.   movntps [rax+40h],xmm4  
  84.   movntps [rax+50h],xmm5
  85.   movntps [rax+60h],xmm6
  86.   movntps [rax+70h],xmm7
  87.  
  88.   sub rax, -128
  89.   add rdi, 2
  90.  
  91.   dec bl //rbx
  92.   jnz @@top
  93. @@done:
  94.   pop rdi
  95.   pop rsi
  96.   pop rbx
  97.  
  98. end;
  99. {$ENDIF}
  100.  
  101.  
  102.  
  103. procedure DrawScreen(ddWnd: hwnd; BKScreen:pointer; ScrollReg:integer);
  104. var
  105.    DDrawScreen:pointer;//,
  106.    x,y,data:integer;y2:byte;vb:Longbool;
  107.    ddsd: DDSURFACEDESC;
  108. begin
  109.   ddsd.dwSize := sizeof(ddsd);
  110.  
  111. { проверить доступность и восстановление экранов }
  112.  
  113.   if lpDDSBack.IsLost <> S_OK then begin
  114.      lpDDSBack.Restore;
  115.      lpDDSPrimary.Restore;
  116.   end;
  117.  
  118.  
  119.   if lpDDSBack.Lock (nil, ddsd, DDLOCK_SURFACEMEMORYPTR, 0) <> S_OK then exit;
  120.  
  121.   DDrawScreen := ddsd.lpSurface;
  122.  
  123.  
  124.   for y := 0 to 255 do begin
  125.       y2 := y-byte(ScrollReg-216);
  126.      PSetL(pointer(ULONG_PTR(DDrawScreen)+(y2*d_x)*4),
  127.            pointer(ULONG_PTR(BKScreen)+(y*64) ),
  128.            pix32tbl);//HScrollReg );
  129.  
  130.  { очистка неактивной части экрана в режиме "РП" }
  131.   if (ScrollReg and $200 = 0) and (y>63) then
  132.      PSetL(pointer(ULONG_PTR(DDrawScreen)+(y*d_x)*4),nil,nil);
  133.  
  134.  
  135.   end;{y}
  136.  
  137.  
  138.   if lpDDSBack.Unlock(nil) <> S_OK then exit;
  139.  
  140. //    lpDD.WaitForVerticalBlank(1,0);
  141.  
  142.  if lpDDSPrimary.Blt(@WndRect,lpDDSBack,nil, 0{ DDBLT_WAIT DDBLT_ASYNC }
  143.                   ,nil)
  144.     = DDERR_SURFACELOST then lpDDSPrimary.Restore;
  145.  
  146. end;
Advertisement
Add Comment
Please, Sign In to add comment