videoport.c 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614
  1. /*
  2. * PicoDrive
  3. * (c) Copyright Dave, 2004
  4. * (C) notaz, 2006-2009
  5. *
  6. * This work is licensed under the terms of MAME license.
  7. * See COPYING file in the top-level directory.
  8. */
  9. #include "pico_int.h"
  10. #define NEED_DMA_SOURCE
  11. #include "memory.h"
  12. extern const unsigned char hcounts_32[];
  13. extern const unsigned char hcounts_40[];
  14. #ifndef UTYPES_DEFINED
  15. typedef unsigned char u8;
  16. typedef unsigned short u16;
  17. typedef unsigned int u32;
  18. #define UTYPES_DEFINED
  19. #endif
  20. int (*PicoDmaHook)(unsigned int source, int len, unsigned short **base, unsigned int *mask) = NULL;
  21. static __inline void AutoIncrement(void)
  22. {
  23. Pico.video.addr=(unsigned short)(Pico.video.addr+Pico.video.reg[0xf]);
  24. }
  25. static NOINLINE void VideoWrite128(u32 a, u16 d)
  26. {
  27. // nasty
  28. a = ((a & 2) >> 1) | ((a & 0x400) >> 9) | (a & 0x3FC) | ((a & 0x1F800) >> 1);
  29. ((u8 *)PicoMem.vram)[a] = d;
  30. }
  31. static void VideoWrite(u16 d)
  32. {
  33. unsigned int a = Pico.video.addr;
  34. switch (Pico.video.type)
  35. {
  36. case 1: if (a & 1)
  37. d = (u16)((d << 8) | (d >> 8));
  38. PicoMem.vram [(a >> 1) & 0x7fff] = d;
  39. if (a - ((unsigned)(Pico.video.reg[5]&0x7f) << 9) < 0x400)
  40. Pico.est.rendstatus |= PDRAW_DIRTY_SPRITES;
  41. break;
  42. case 3: Pico.m.dirtyPal = 1;
  43. PicoMem.cram [(a >> 1) & 0x3f] = d; break;
  44. case 5: PicoMem.vsram[(a >> 1) & 0x3f] = d; break;
  45. case 0x81:
  46. a |= Pico.video.addr_u << 16;
  47. VideoWrite128(a, d);
  48. break;
  49. //default:elprintf(EL_ANOMALY, "VDP write %04x with bad type %i", d, Pico.video.type); break;
  50. }
  51. AutoIncrement();
  52. }
  53. static unsigned int VideoRead(void)
  54. {
  55. unsigned int a=0,d=0;
  56. a=Pico.video.addr; a>>=1;
  57. switch (Pico.video.type)
  58. {
  59. case 0: d=PicoMem.vram [a & 0x7fff]; break;
  60. case 8: d=PicoMem.cram [a & 0x003f]; break;
  61. case 4: d=PicoMem.vsram[a & 0x003f]; break;
  62. default:elprintf(EL_ANOMALY, "VDP read with bad type %i", Pico.video.type); break;
  63. }
  64. AutoIncrement();
  65. return d;
  66. }
  67. static int GetDmaLength(void)
  68. {
  69. struct PicoVideo *pvid=&Pico.video;
  70. int len=0;
  71. // 16-bit words to transfer:
  72. len =pvid->reg[0x13];
  73. len|=pvid->reg[0x14]<<8;
  74. len = ((len - 1) & 0xffff) + 1;
  75. return len;
  76. }
  77. static void DmaSlow(int len, unsigned int source)
  78. {
  79. u32 inc = Pico.video.reg[0xf];
  80. u32 a = Pico.video.addr;
  81. u16 *r, *base = NULL;
  82. u32 mask = 0x1ffff;
  83. elprintf(EL_VDPDMA, "DmaSlow[%i] %06x->%04x len %i inc=%i blank %i [%u] @ %06x",
  84. Pico.video.type, source, a, len, inc, (Pico.video.status&8)||!(Pico.video.reg[1]&0x40),
  85. SekCyclesDone(), SekPc);
  86. Pico.m.dma_xfers += len;
  87. if (Pico.m.dma_xfers < len) // lame 16bit var
  88. Pico.m.dma_xfers = ~0;
  89. SekCyclesBurnRun(CheckDMA());
  90. if ((source & 0xe00000) == 0xe00000) { // Ram
  91. base = (u16 *)PicoMem.ram;
  92. mask = 0xffff;
  93. }
  94. else if (PicoAHW & PAHW_MCD)
  95. {
  96. u8 r3 = Pico_mcd->s68k_regs[3];
  97. elprintf(EL_VDPDMA, "DmaSlow CD, r3=%02x", r3);
  98. if (source < 0x20000) { // Bios area
  99. base = (u16 *)Pico_mcd->bios;
  100. } else if ((source & 0xfc0000) == 0x200000) { // Word Ram
  101. if (!(r3 & 4)) { // 2M mode
  102. base = (u16 *)(Pico_mcd->word_ram2M + (source & 0x20000));
  103. } else {
  104. if (source < 0x220000) { // 1M mode
  105. int bank = r3 & 1;
  106. base = (u16 *)(Pico_mcd->word_ram1M[bank]);
  107. } else {
  108. DmaSlowCell(source - 2, a, len, inc);
  109. return;
  110. }
  111. }
  112. source -= 2;
  113. } else if ((source & 0xfe0000) == 0x020000) { // Prg Ram
  114. base = (u16 *)Pico_mcd->prg_ram_b[r3 >> 6];
  115. source -= 2; // XXX: test
  116. }
  117. }
  118. else
  119. {
  120. // if we have DmaHook, let it handle ROM because of possible DMA delay
  121. u32 source2;
  122. if (PicoDmaHook && (source2 = PicoDmaHook(source, len, &base, &mask)))
  123. source = source2;
  124. else // Rom
  125. base = m68k_dma_source(source);
  126. }
  127. if (!base) {
  128. elprintf(EL_VDPDMA|EL_ANOMALY, "DmaSlow[%i] %06x->%04x: invalid src", Pico.video.type, source, a);
  129. return;
  130. }
  131. // operate in words
  132. source >>= 1;
  133. mask >>= 1;
  134. switch (Pico.video.type)
  135. {
  136. case 1: // vram
  137. r = PicoMem.vram;
  138. if (inc == 2 && !(a & 1) && a + len * 2 < 0x10000
  139. && !(((source + len - 1) ^ source) & ~mask))
  140. {
  141. // most used DMA mode
  142. memcpy((char *)r + a, base + (source & mask), len * 2);
  143. a += len * 2;
  144. }
  145. else
  146. {
  147. for(; len; len--)
  148. {
  149. u16 d = base[source++ & mask];
  150. if(a & 1) d=(d<<8)|(d>>8);
  151. r[a >> 1] = d;
  152. // AutoIncrement
  153. a = (u16)(a + inc);
  154. }
  155. }
  156. Pico.est.rendstatus |= PDRAW_DIRTY_SPRITES;
  157. break;
  158. case 3: // cram
  159. Pico.m.dirtyPal = 1;
  160. r = PicoMem.cram;
  161. for (; len; len--)
  162. {
  163. r[(a / 2) & 0x3f] = base[source++ & mask];
  164. // AutoIncrement
  165. a += inc;
  166. }
  167. break;
  168. case 5: // vsram
  169. r = PicoMem.vsram;
  170. for (; len; len--)
  171. {
  172. r[(a / 2) & 0x3f] = base[source++ & mask];
  173. // AutoIncrement
  174. a += inc;
  175. }
  176. break;
  177. case 0x81: // vram 128k
  178. a |= Pico.video.addr_u << 16;
  179. for(; len; len--)
  180. {
  181. VideoWrite128(a, base[source++ & mask]);
  182. // AutoIncrement
  183. a = (a + inc) & 0x1ffff;
  184. }
  185. Pico.video.addr_u = a >> 16;
  186. break;
  187. default:
  188. if (Pico.video.type != 0 || (EL_LOGMASK & EL_VDPDMA))
  189. elprintf(EL_VDPDMA|EL_ANOMALY, "DMA with bad type %i", Pico.video.type);
  190. break;
  191. }
  192. // remember addr
  193. Pico.video.addr=(u16)a;
  194. }
  195. static void DmaCopy(int len)
  196. {
  197. u16 a = Pico.video.addr;
  198. u8 *vr = (u8 *)PicoMem.vram;
  199. u8 inc = Pico.video.reg[0xf];
  200. int source;
  201. elprintf(EL_VDPDMA, "DmaCopy len %i [%u]", len, SekCyclesDone());
  202. Pico.m.dma_xfers += len;
  203. if (Pico.m.dma_xfers < len)
  204. Pico.m.dma_xfers = ~0;
  205. Pico.video.status |= 2; // dma busy
  206. source =Pico.video.reg[0x15];
  207. source|=Pico.video.reg[0x16]<<8;
  208. for (; len; len--)
  209. {
  210. vr[a] = vr[source++ & 0xffff];
  211. // AutoIncrement
  212. a=(u16)(a+inc);
  213. }
  214. // remember addr
  215. Pico.video.addr=a;
  216. Pico.est.rendstatus |= PDRAW_DIRTY_SPRITES;
  217. }
  218. static NOINLINE void DmaFill(int data)
  219. {
  220. u16 a = Pico.video.addr;
  221. u8 *vr = (u8 *)PicoMem.vram;
  222. u8 high = (u8)(data >> 8);
  223. u8 inc = Pico.video.reg[0xf];
  224. int source;
  225. int len, l;
  226. len = GetDmaLength();
  227. elprintf(EL_VDPDMA, "DmaFill len %i inc %i [%u]", len, inc, SekCyclesDone());
  228. Pico.m.dma_xfers += len;
  229. if (Pico.m.dma_xfers < len) // lame 16bit var
  230. Pico.m.dma_xfers = ~0;
  231. Pico.video.status |= 2; // dma busy
  232. switch (Pico.video.type)
  233. {
  234. case 1: // vram
  235. for (l = len; l; l--) {
  236. // Write upper byte to adjacent address
  237. // (here we are byteswapped, so address is already 'adjacent')
  238. vr[a] = high;
  239. // Increment address register
  240. a = (u16)(a + inc);
  241. }
  242. break;
  243. case 3: // cram
  244. case 5: { // vsram
  245. // TODO: needs fifo; anyone using these?
  246. static int once;
  247. if (!once++)
  248. elprintf(EL_STATUS|EL_ANOMALY|EL_VDPDMA, "TODO: cram/vsram fill");
  249. }
  250. default:
  251. a += len * inc;
  252. break;
  253. }
  254. // remember addr
  255. Pico.video.addr = a;
  256. // register update
  257. Pico.video.reg[0x13] = Pico.video.reg[0x14] = 0;
  258. source = Pico.video.reg[0x15];
  259. source |= Pico.video.reg[0x16] << 8;
  260. source += len;
  261. Pico.video.reg[0x15] = source;
  262. Pico.video.reg[0x16] = source >> 8;
  263. Pico.est.rendstatus |= PDRAW_DIRTY_SPRITES;
  264. }
  265. static NOINLINE void CommandDma(void)
  266. {
  267. struct PicoVideo *pvid=&Pico.video;
  268. u32 len, method;
  269. u32 source;
  270. if ((pvid->reg[1]&0x10)==0) return; // DMA not enabled
  271. len = GetDmaLength();
  272. source =Pico.video.reg[0x15];
  273. source|=Pico.video.reg[0x16] << 8;
  274. source|=Pico.video.reg[0x17] << 16;
  275. method=pvid->reg[0x17]>>6;
  276. if (method < 2)
  277. DmaSlow(len, source << 1); // 68000 to VDP
  278. else if (method == 3)
  279. DmaCopy(len); // VRAM Copy
  280. else
  281. return;
  282. source += len;
  283. Pico.video.reg[0x13] = Pico.video.reg[0x14] = 0;
  284. Pico.video.reg[0x15] = source;
  285. Pico.video.reg[0x16] = source >> 8;
  286. }
  287. static NOINLINE void CommandChange(void)
  288. {
  289. struct PicoVideo *pvid = &Pico.video;
  290. unsigned int cmd, addr;
  291. cmd = pvid->command;
  292. // Get type of transfer 0xc0000030 (v/c/vsram read/write)
  293. pvid->type = (u8)(((cmd >> 2) & 0xc) | (cmd >> 30));
  294. if (pvid->type == 1) // vram
  295. pvid->type |= pvid->reg[1] & 0x80; // 128k
  296. // Get address 0x3fff0003
  297. addr = (cmd >> 16) & 0x3fff;
  298. addr |= (cmd << 14) & 0xc000;
  299. pvid->addr = (u16)addr;
  300. pvid->addr_u = (u8)((cmd >> 2) & 1);
  301. }
  302. static void DrawSync(int blank_on)
  303. {
  304. if (Pico.m.scanline < 224 && !(PicoOpt & POPT_ALT_RENDERER) &&
  305. !PicoSkipFrame && Pico.est.DrawScanline <= Pico.m.scanline) {
  306. //elprintf(EL_ANOMALY, "sync");
  307. PicoDrawSync(Pico.m.scanline, blank_on);
  308. }
  309. }
  310. PICO_INTERNAL_ASM void PicoVideoWrite(unsigned int a,unsigned short d)
  311. {
  312. struct PicoVideo *pvid=&Pico.video;
  313. //if (Pico.m.scanline < 224)
  314. // elprintf(EL_STATUS, "PicoVideoWrite [%06x] %04x", a, d);
  315. a&=0x1c;
  316. switch (a)
  317. {
  318. case 0x00: // Data port 0 or 2
  319. // try avoiding the sync..
  320. if (Pico.m.scanline < 224 && (pvid->reg[1]&0x40) &&
  321. !(!pvid->pending &&
  322. ((pvid->command & 0xc00000f0) == 0x40000010 && PicoMem.vsram[pvid->addr>>1] == d))
  323. )
  324. DrawSync(0);
  325. if (pvid->pending) {
  326. CommandChange();
  327. pvid->pending=0;
  328. }
  329. // preliminary FIFO emulation for Chaos Engine, The (E)
  330. if (!(pvid->status & SR_VB) && (pvid->reg[1] & 0x40) && !(PicoOpt&POPT_DIS_VDP_FIFO)) // active display?
  331. {
  332. int use = pvid->type == 1 ? 2 : 1;
  333. pvid->lwrite_cnt -= use;
  334. if (pvid->lwrite_cnt < 0)
  335. SekCyclesLeft = 0;
  336. elprintf(EL_ASVDP, "VDP data write: %04x [%06x] {%i} #%i @ %06x", d, Pico.video.addr,
  337. Pico.video.type, pvid->lwrite_cnt, SekPc);
  338. }
  339. VideoWrite(d);
  340. if ((pvid->command&0x80) && (pvid->reg[1]&0x10) && (pvid->reg[0x17]>>6)==2)
  341. DmaFill(d);
  342. break;
  343. case 0x04: // Control (command) port 4 or 6
  344. if (pvid->pending)
  345. {
  346. // Low word of command:
  347. pvid->command &= 0xffff0000;
  348. pvid->command |= d;
  349. pvid->pending = 0;
  350. CommandChange();
  351. // Check for dma:
  352. if (d & 0x80) {
  353. DrawSync(0);
  354. CommandDma();
  355. }
  356. }
  357. else
  358. {
  359. if ((d&0xc000)==0x8000)
  360. {
  361. // Register write:
  362. int num=(d>>8)&0x1f;
  363. int dold=pvid->reg[num];
  364. int blank_on = 0;
  365. pvid->type=0; // register writes clear command (else no Sega logo in Golden Axe II)
  366. if (num > 0x0a && !(pvid->reg[1]&4)) {
  367. elprintf(EL_ANOMALY, "%02x written to reg %02x in SMS mode @ %06x", d, num, SekPc);
  368. return;
  369. }
  370. if (num == 1 && !(d&0x40) && SekCyclesDone() - Pico.t.m68c_line_start <= 488-390)
  371. blank_on = 1;
  372. DrawSync(blank_on);
  373. pvid->reg[num]=(unsigned char)d;
  374. switch (num)
  375. {
  376. case 0x00:
  377. elprintf(EL_INTSW, "hint_onoff: %i->%i [%u] pend=%i @ %06x", (dold&0x10)>>4,
  378. (d&0x10)>>4, SekCyclesDone(), (pvid->pending_ints&0x10)>>4, SekPc);
  379. goto update_irq;
  380. case 0x01:
  381. elprintf(EL_INTSW, "vint_onoff: %i->%i [%u] pend=%i @ %06x", (dold&0x20)>>5,
  382. (d&0x20)>>5, SekCyclesDone(), (pvid->pending_ints&0x20)>>5, SekPc);
  383. goto update_irq;
  384. case 0x05:
  385. //elprintf(EL_STATUS, "spritep moved to %04x", (unsigned)(Pico.video.reg[5]&0x7f) << 9);
  386. if (d^dold) Pico.est.rendstatus |= PDRAW_SPRITES_MOVED;
  387. break;
  388. case 0x0c:
  389. // renderers should update their palettes if sh/hi mode is changed
  390. if ((d^dold)&8) Pico.m.dirtyPal = 2;
  391. break;
  392. }
  393. return;
  394. update_irq:
  395. #ifndef EMU_CORE_DEBUG
  396. // update IRQ level
  397. if (!SekShouldInterrupt()) // hack
  398. {
  399. int lines, pints, irq=0;
  400. lines = (pvid->reg[1] & 0x20) | (pvid->reg[0] & 0x10);
  401. pints = (pvid->pending_ints&lines);
  402. if (pints & 0x20) irq = 6;
  403. else if (pints & 0x10) irq = 4;
  404. SekInterrupt(irq); // update line
  405. if (irq) SekEndRun(24); // make it delayed
  406. }
  407. #endif
  408. }
  409. else
  410. {
  411. // High word of command:
  412. pvid->command&=0x0000ffff;
  413. pvid->command|=d<<16;
  414. pvid->pending=1;
  415. }
  416. }
  417. break;
  418. // case 0x08: // 08 0a - HV counter - lock up
  419. // case 0x0c: // 0c 0e - HV counter - lock up
  420. // case 0x10: // 10 12 - PSG - handled by caller
  421. // case 0x14: // 14 16 - PSG - handled by caller
  422. // case 0x18: // 18 1a - no effect?
  423. case 0x1c: // 1c 1e - debug
  424. pvid->debug = d;
  425. pvid->debug_p = 0;
  426. if (d & (1 << 6)) {
  427. pvid->debug_p |= PVD_KILL_A | PVD_KILL_B;
  428. pvid->debug_p |= PVD_KILL_S_LO | PVD_KILL_S_HI;
  429. }
  430. switch ((d >> 7) & 3) {
  431. case 1:
  432. pvid->debug_p &= ~(PVD_KILL_S_LO | PVD_KILL_S_HI);
  433. pvid->debug_p |= PVD_FORCE_S;
  434. break;
  435. case 2:
  436. pvid->debug_p &= ~PVD_KILL_A;
  437. pvid->debug_p |= PVD_FORCE_A;
  438. break;
  439. case 3:
  440. pvid->debug_p &= ~PVD_KILL_B;
  441. pvid->debug_p |= PVD_FORCE_B;
  442. break;
  443. }
  444. break;
  445. }
  446. }
  447. PICO_INTERNAL_ASM unsigned int PicoVideoRead(unsigned int a)
  448. {
  449. a&=0x1c;
  450. if (a==0x04) // control port
  451. {
  452. struct PicoVideo *pv=&Pico.video;
  453. unsigned int d;
  454. d=pv->status;
  455. //if (PicoOpt&POPT_ALT_RENDERER) d|=0x0020; // sprite collision (Shadow of the Beast)
  456. if (SekCyclesDone() - Pico.t.m68c_line_start >= 488-88)
  457. d|=0x0004; // H-Blank (Sonic3 vs)
  458. d |= ((pv->reg[1]&0x40)^0x40) >> 3; // set V-Blank if display is disabled
  459. d |= (pv->pending_ints&0x20)<<2; // V-int pending?
  460. if (d&0x100) pv->status&=~0x100; // FIFO no longer full
  461. pv->pending = 0; // ctrl port reads clear write-pending flag (Charles MacDonald)
  462. elprintf(EL_SR, "SR read: %04x @ %06x", d, SekPc);
  463. return d;
  464. }
  465. // H-counter info (based on Generator):
  466. // frame:
  467. // | <- hblank? -> |
  468. // start <416> hint <36> hdisplay <38> end // CPU cycles
  469. // |---------...---------|------------|-------------|
  470. // 0 B6 E4 FF // 40 cells
  471. // 0 93 E8 FF // 32 cells
  472. // Gens (?) v-render
  473. // start <hblank=84> hint hdisplay <404> |
  474. // |---------------------|--------------------------|
  475. // E4 (hc[0x43]==0) 07 B1 // 40
  476. // E8 (hc[0x45]==0) 05 91 // 32
  477. // check: Sonic 3D Blast bonus, Cannon Fodder, Chase HQ II, 3 Ninjas kick back, Road Rash 3, Skitchin', Wheel of Fortune
  478. if ((a&0x1c)==0x08)
  479. {
  480. unsigned int d;
  481. d = (SekCyclesDone() - Pico.t.m68c_line_start) & 0x1ff; // FIXME
  482. if (Pico.video.reg[12]&1)
  483. d = hcounts_40[d];
  484. else d = hcounts_32[d];
  485. elprintf(EL_HVCNT, "hv: %02x %02x [%u] @ %06x", d, Pico.video.v_counter, SekCyclesDone(), SekPc);
  486. return d | (Pico.video.v_counter << 8);
  487. }
  488. if (a==0x00) // data port
  489. {
  490. return VideoRead();
  491. }
  492. return 0;
  493. }
  494. unsigned char PicoVideoRead8DataH(void)
  495. {
  496. return VideoRead() >> 8;
  497. }
  498. unsigned char PicoVideoRead8DataL(void)
  499. {
  500. return VideoRead();
  501. }
  502. // FIXME: broken mess
  503. unsigned char PicoVideoRead8CtlH(void)
  504. {
  505. u8 d = (u8)(Pico.video.status >> 8);
  506. if (d & 1)
  507. Pico.video.status &= ~0x100; // FIFO no longer full
  508. Pico.video.pending = 0;
  509. elprintf(EL_SR, "SR read (h): %02x @ %06x", d, SekPc);
  510. return d;
  511. }
  512. unsigned char PicoVideoRead8CtlL(void)
  513. {
  514. u8 d = (u8)Pico.video.status;
  515. //if (PicoOpt&POPT_ALT_RENDERER) d|=0x0020; // sprite collision (Shadow of the Beast)
  516. d |= ((Pico.video.reg[1]&0x40)^0x40) >> 3; // set V-Blank if display is disabled
  517. d |= (Pico.video.pending_ints&0x20)<<2; // V-int pending?
  518. if (SekCyclesDone() - Pico.t.m68c_line_start >= 488-88) d |= 4; // H-Blank
  519. Pico.video.pending = 0;
  520. elprintf(EL_SR, "SR read (l): %02x @ %06x", d, SekPc);
  521. return d;
  522. }
  523. unsigned char PicoVideoRead8HV_H(void)
  524. {
  525. elprintf(EL_HVCNT, "vcounter: %02x [%u] @ %06x", Pico.video.v_counter, SekCyclesDone(), SekPc);
  526. return Pico.video.v_counter;
  527. }
  528. // FIXME: broken
  529. unsigned char PicoVideoRead8HV_L(void)
  530. {
  531. u32 d = (SekCyclesDone() - Pico.t.m68c_line_start) & 0x1ff; // FIXME
  532. if (Pico.video.reg[12]&1)
  533. d = hcounts_40[d];
  534. else d = hcounts_32[d];
  535. elprintf(EL_HVCNT, "hcounter: %02x [%u] @ %06x", d, SekCyclesDone(), SekPc);
  536. return d;
  537. }
  538. // vim:shiftwidth=2:ts=2:expandtab