gfx_dma.c 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. /*
  2. * PicoDrive
  3. * (C) notaz, 2007
  4. *
  5. * This work is licensed under the terms of MAME license.
  6. * See COPYING file in the top-level directory.
  7. */
  8. #include "../pico_int.h"
  9. #include "cell_map.c"
  10. #ifndef UTYPES_DEFINED
  11. typedef unsigned short u16;
  12. #endif
  13. // check: Heart of the alien, jaguar xj 220
  14. PICO_INTERNAL void DmaSlowCell(unsigned int source, unsigned int a, int len, unsigned char inc)
  15. {
  16. unsigned char *base;
  17. unsigned int asrc, a2;
  18. u16 *r;
  19. base = Pico_mcd->word_ram1M[Pico_mcd->s68k_regs[3]&1];
  20. switch (Pico.video.type)
  21. {
  22. case 1: // vram
  23. r = PicoMem.vram;
  24. for(; len; len--)
  25. {
  26. asrc = cell_map(source >> 2) << 2;
  27. asrc |= source & 2;
  28. // if(a&1) d=(d<<8)|(d>>8); // ??
  29. r[a>>1] = *(u16 *)(base + asrc);
  30. source += 2;
  31. // AutoIncrement
  32. a=(u16)(a+inc);
  33. }
  34. Pico.est.rendstatus |= PDRAW_SPRITES_MOVED;
  35. break;
  36. case 3: // cram
  37. Pico.m.dirtyPal = 1;
  38. r = PicoMem.cram;
  39. for(a2=a&0x7f; len; len--)
  40. {
  41. asrc = cell_map(source >> 2) << 2;
  42. asrc |= source & 2;
  43. r[a2>>1] = *(u16 *)(base + asrc);
  44. source += 2;
  45. // AutoIncrement
  46. a2+=inc;
  47. // good dest?
  48. if(a2 >= 0x80) break;
  49. }
  50. a=(a&0xff00)|a2;
  51. break;
  52. case 5: // vsram[a&0x003f]=d;
  53. r = PicoMem.vsram;
  54. for(a2=a&0x7f; len; len--)
  55. {
  56. asrc = cell_map(source >> 2) << 2;
  57. asrc |= source & 2;
  58. r[a2>>1] = *(u16 *)(base + asrc);
  59. source += 2;
  60. // AutoIncrement
  61. a2+=inc;
  62. // good dest?
  63. if(a2 >= 0x80) break;
  64. }
  65. a=(a&0xff00)|a2;
  66. break;
  67. }
  68. // remember addr
  69. Pico.video.addr=(u16)a;
  70. }