asmcoder.cpp 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. // asmcoder.cpp
  2. // by [email protected]
  3. // testroutine for asmcoder class
  4. // see asmcoder.h for readme
  5. #define WIN32_LEAN_AND_MEAN
  6. #include <windows.h>
  7. #include <stdio.h>
  8. #include <time.h>
  9. #include "asmcoder.h"
  10. void (__fastcall *plot)(void *s,int argb);
  11. int (__fastcall *point)(void*s);
  12. void (__fastcall *span)(void *s,int *argb,int n);
  13. void main()
  14. {
  15. void *pixmap;
  16. int n;
  17. AsmCoder *coder=new AsmCoder();
  18. pixmap=new int[640*480];
  19. plot=(void (__fastcall *)(void*,int))new char[96];
  20. point=(int (__fastcall *)(void*))new char[96];
  21. span=(void (__fastcall *)(void*,int*,int))new char[96];
  22. // n=coder->CodePlot(plot,16,0,0xf800,0x07e0,0x001f); //0:5:6:5
  23. // printf("plotcode size=%d\n",n);
  24. // n=coder->CodePoint(point,16,0,0xf800,0x07e0,0x001f); //0:5:6:5
  25. // printf("pointcode size=%d\n",n);
  26. n=coder->CodePlot(plot,24,0,0xff0000,0xff00,0xff); //0:5:6:5
  27. printf("plotcode size=%d\n",n);
  28. n=coder->CodePoint(point,24,0,0xff0000,0xff00,0x00ff); //0:5:6:5
  29. printf("pointcode size=%d\n",n);
  30. n=coder->CodeSpan(span,24,0,0xff0000,0xff00,0x00ff); //0:5:6:5
  31. printf("scancode size=%d\n",n);
  32. printf("&plot=0x%x\n",(int)plot);
  33. printf("&pixmap=0x%x\n",(int)pixmap);
  34. plot(pixmap,0x818283);
  35. // short *b=(short *)pixmap;
  36. int *b=(int *)pixmap;
  37. printf("b[0]=0x%x\n",b[0]);
  38. n=point(pixmap);
  39. printf("point(0,0)=0x%x\n",n);
  40. int pdat[]={0x8080,0x707070,0x606060};
  41. span(pixmap,pdat,3);
  42. delete (void *)plot;
  43. delete (void *)point;
  44. delete pixmap;
  45. delete coder;
  46. return;
  47. }
  48. // void (__fastcall *plot)(int x,int y,int argb,Surface *s)=(void (__fastcall *)(int,int,int,Surface*))code;
  49. void ortest()
  50. {
  51. __asm{
  52. or eax,0xff00ff00
  53. or eax,-100
  54. }
  55. }