Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- {$ELSE}
- // rcx rdx r8
- procedure PSetL(SCRPos:pointer;BKscr:pointer;Pix32:pointer);assembler;{$IFDEF FPC}nostackframe;{$ENDIF}
- asm
- // ret
- push rbx
- push rsi
- push rdi
- mov rax,rcx
- mov rcx, r8
- mov bl, 32
- test rdx,rdx
- jnz @@output
- xorps xmm0,xmm0
- @@top1:
- movntps [rax+00h],xmm0
- movntps [rax+10h],xmm0
- movntps [rax+20h],xmm0
- movntps [rax+30h],xmm0
- movntps [rax+40h],xmm0
- movntps [rax+50h],xmm0
- movntps [rax+60h],xmm0
- movntps [rax+70h],xmm0
- // add rax, 80h
- sub rax, -128
- dec bl //rbx
- jnz @@top1
- // jmp @@done
- pop rdi
- pop rsi
- pop rbx
- ret
- @@output:
- mov rdi,rdx
- mov rsi, rcx //Pix32Tbl
- xor rdx,rdx
- xor rcx,rcx
- @@top://
- movzx ecx, word ptr [edi]
- movzx edx,ch
- xor ch,ch
- add ecx,ecx
- add ecx,ecx
- add edx,edx
- add edx,edx
- movaps xmm0, [rsi+rcx*8+0]
- movaps xmm2, [rsi+rcx*8+16]
- movaps xmm4, [rsi+rdx*8]
- movaps xmm6, [rsi+rdx*8+16]
- //
- movaps xmm5, xmm4 //111111 222222 333333 444444
- movaps xmm7, xmm6
- movaps xmm1, xmm0 //111111 222222 333333 444444
- movaps xmm3, xmm2
- //
- shufps xmm0,xmm0,50h //111111 111111 222222 222222
- shufps xmm1,xmm1,0fah //333333 333333 444444 444444
- shufps xmm2,xmm2,50h
- shufps xmm3,xmm3,0fah
- //
- shufps xmm4,xmm4,50h //111111 111111 222222 222222
- shufps xmm5,xmm5,0fah //333333 333333 444444 444444
- shufps xmm6,xmm6,50h
- shufps xmm7,xmm7,0fah
- //
- movntps [rax+00h],xmm0
- movntps [rax+10h],xmm1
- movntps [rax+20h],xmm2
- movntps [rax+30h],xmm3
- movntps [rax+40h],xmm4
- movntps [rax+50h],xmm5
- movntps [rax+60h],xmm6
- movntps [rax+70h],xmm7
- sub rax, -128
- add rdi, 2
- dec bl //rbx
- jnz @@top
- @@done:
- pop rdi
- pop rsi
- pop rbx
- end;
- {$ENDIF}
- procedure DrawScreen(ddWnd: hwnd; BKScreen:pointer; ScrollReg:integer);
- var
- DDrawScreen:pointer;//,
- x,y,data:integer;y2:byte;vb:Longbool;
- ddsd: DDSURFACEDESC;
- begin
- ddsd.dwSize := sizeof(ddsd);
- { проверить доступность и восстановление экранов }
- if lpDDSBack.IsLost <> S_OK then begin
- lpDDSBack.Restore;
- lpDDSPrimary.Restore;
- end;
- if lpDDSBack.Lock (nil, ddsd, DDLOCK_SURFACEMEMORYPTR, 0) <> S_OK then exit;
- DDrawScreen := ddsd.lpSurface;
- for y := 0 to 255 do begin
- y2 := y-byte(ScrollReg-216);
- PSetL(pointer(ULONG_PTR(DDrawScreen)+(y2*d_x)*4),
- pointer(ULONG_PTR(BKScreen)+(y*64) ),
- pix32tbl);//HScrollReg );
- { очистка неактивной части экрана в режиме "РП" }
- if (ScrollReg and $200 = 0) and (y>63) then
- PSetL(pointer(ULONG_PTR(DDrawScreen)+(y*d_x)*4),nil,nil);
- end;{y}
- if lpDDSBack.Unlock(nil) <> S_OK then exit;
- // lpDD.WaitForVerticalBlank(1,0);
- if lpDDSPrimary.Blt(@WndRect,lpDDSBack,nil, 0{ DDBLT_WAIT DDBLT_ASYNC }
- ,nil)
- = DDERR_SURFACELOST then lpDDSPrimary.Restore;
- end;
Advertisement
Add Comment
Please, Sign In to add comment