gfx_dma.c 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  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. // check: Heart of the alien, jaguar xj 220
  11. PICO_INTERNAL void DmaSlowCell(u32 source, u32 a, int len, unsigned char inc)
  12. {
  13. unsigned char *base;
  14. u32 asrc, a2;
  15. u16 *r;
  16. base = Pico_mcd->word_ram1M[Pico_mcd->s68k_regs[3]&1];
  17. switch (Pico.video.type)
  18. {
  19. case 1: // vram
  20. r = PicoMem.vram;
  21. for(; len; len--)
  22. {
  23. asrc = cell_map(source >> 2) << 2;
  24. asrc |= source & 2;
  25. // if(a&1) d=(d<<8)|(d>>8); // ??
  26. VideoWriteVRAM(a, *(u16 *)(base + asrc));
  27. source += 2;
  28. // AutoIncrement
  29. a=(u16)(a+inc);
  30. }
  31. Pico.est.rendstatus |= PDRAW_SPRITES_MOVED;
  32. break;
  33. case 3: // cram
  34. Pico.m.dirtyPal = 1;
  35. r = PicoMem.cram;
  36. for(a2=a&0x7f; len; len--)
  37. {
  38. asrc = cell_map(source >> 2) << 2;
  39. asrc |= source & 2;
  40. r[a2>>1] = *(u16 *)(base + asrc);
  41. source += 2;
  42. // AutoIncrement
  43. a2+=inc;
  44. // good dest?
  45. if(a2 >= 0x80) break;
  46. }
  47. a=(a&0xff00)|a2;
  48. break;
  49. case 5: // vsram[a&0x003f]=d;
  50. r = PicoMem.vsram;
  51. for(a2=a&0x7f; len; len--)
  52. {
  53. asrc = cell_map(source >> 2) << 2;
  54. asrc |= source & 2;
  55. r[a2>>1] = *(u16 *)(base + asrc);
  56. source += 2;
  57. // AutoIncrement
  58. a2+=inc;
  59. // good dest?
  60. if(a2 >= 0x80) break;
  61. }
  62. a=(a&0xff00)|a2;
  63. break;
  64. }
  65. // remember addr
  66. Pico.video.addr=(u16)a;
  67. }