现在的汇编几乎有C的大部分功能,看下这段DX的代码,和C中的比较一下看看:仅仅语法稍有不同。
汇编:
d3dev9 Clear,pd3dDevice,0,NULL,D3DCLEAR_TARGET or D3DCLEAR_ZBUFFER,0h,FP4(1.0f),0
d3dev9 BeginScene,pd3dDevice
d3dev9 SetVertexDeclaration,pd3dDevice,SMWL
d3dev9 SetVertexShader,pd3dDevice,VSJM
d3dev9 SetPixelShader,pd3dDevice,PSJM
d3dev9 SetRenderState,pd3dDevice,D3DRS_ALPHABLENDENABLE,1
d3dev9 SetStreamSource,pd3dDevice,0,ddhcq,128d,12d
d3dev9 SetStreamSource,pd3dDevice,1,ddhcq,164d,8d
d3dev9 SetTexture,pd3dDevice,0,wl2
d3dev9 SetVertexShaderConstantF,pd3dDevice,8,addr sbx,1
d3dev9 DrawPrimitive,pd3dDevice,D3DPT_TRIANGLESTRIP,0,2
d3dev9 SetRenderState,pd3dDevice,D3DRS_ALPHABLENDENABLE,0
d3dev9 EndScene,pd3dDevice
d3dev9 Present,pd3dDevice,NULL,NULL,NULL,NULL
VC++:
pd3dDevice->( 0, NULL, D3DCLEAR_TARGET|D3DCLEAR_ZBUFFER,D3DCOLOR_XRGB(0,0,0), 1.0f, 0 );
pd3dDevice->BeginScene();
pd3dDevice->SetVertexDeclaration(SMWL);
pd3dDevice->SetVertexShader(VSJM);
pd3dDevice->SetPixelShader(PSJM);
pd3dDevice->SetRenderState(D3DRS_ALPHABLENDENABLE,1);
pd3dDevice->SetStreamSource(0,ddhcq,128,12);
pd3dDevice->SetStreamSource(1,ddhcq,164,8);
pd3dDevice->SetTexture(0,wl2);
pd3dDevice->SetVertexShaderConstantF(8,(float*)&sbx,1);
pd3dDevice->DrawPrimitive(D3DPT_TRIANGLESTRIP,0,2);
pd3dDevice->SetRenderState(D3DRS_ALPHABLENDENABLE,0);
pd3dDevice->EndScene();
pd3dDevice->Present( NULL, NULL, NULL, NULL );