MCPcopy Create free account
hub / github.com/WilliamLCobb/iNDS / execHardware

Method execHardware

desmume/src/NDSSystem.cpp:1788–1852  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1786}
1787
1788void Sequencer::execHardware()
1789{
1790 if(dispcnt.isTriggered())
1791 {
1792
1793 IF_DEVELOPER(DEBUG_statistics.sequencerExecutionCounters[1]++);
1794
1795 switch(dispcnt.param)
1796 {
1797 case ESI_DISPCNT_HStart:
1798 execHardware_hstart();
1799 //(used to be 3168)
1800 //hstart is actually 8 dots before the visible drawing begins
1801 //we're going to run 1 here and then run 7 in the next case
1802 dispcnt.timestamp += 1*6*2;
1803 dispcnt.param = ESI_DISPCNT_HStartIRQ;
1804 break;
1805 case ESI_DISPCNT_HStartIRQ:
1806 execHardware_hstart_irq();
1807 dispcnt.timestamp += 7*6*2;
1808 dispcnt.param = ESI_DISPCNT_HDraw;
1809 break;
1810
1811 case ESI_DISPCNT_HDraw:
1812 execHardware_hdraw();
1813 //duration of non-blanking period is ~1606 clocks (gbatek agrees) [but says its different on arm7]
1814 //im gonna call this 267 dots = 267*6=1602
1815 //so, this event lasts 267 dots minus the 8 dot preroll
1816 dispcnt.timestamp += (267-8)*6*2;
1817 dispcnt.param = ESI_DISPCNT_HBlank;
1818 break;
1819
1820 case ESI_DISPCNT_HBlank:
1821 execHardware_hblank();
1822 //(once this was 1092 or 1092/12=91 dots.)
1823 //there are surely 355 dots per scanline, less 267 for non-blanking period. the rest is hblank and then after that is hstart
1824 dispcnt.timestamp += ((355-267)*6*2);
1825 dispcnt.param = ESI_DISPCNT_HStart;
1826 break;
1827 }
1828 }
1829 sequencerNext = dispcnt.timestamp;
1830
1831#ifdef EXPERIMENTAL_WIFI_COMM
1832 if(wifi.isTriggered())
1833 {
1834 WIFI_usTrigger();
1835 wifi.timestamp += kWifiCycles;
1836 }
1837#endif
1838
1839 if(divider.isTriggered()) { divider.exec(); SEQUENCER_NEXT(divider.next()); }
1840 if(sqrtunit.isTriggered()) { sqrtunit.exec(); SEQUENCER_NEXT(sqrtunit.next()); }
1841 if(gxfifo.isTriggered()) { gxfifo.exec(); SEQUENCER_NEXT(gxfifo.next()); }
1842
1843
1844#define test(X,Y) if(dma_##X##_##Y .isTriggered()) { dma_##X##_##Y .exec(); SEQUENCER_NEXT(dma_##X##_##Y .next()); }
1845 test(0,0); test(0,1); test(0,2); test(0,3);

Callers 1

NDSSystem.cppFile · 0.80

Calls 9

execHardware_hstartFunction · 0.85
execHardware_hstart_irqFunction · 0.85
execHardware_hdrawFunction · 0.85
execHardware_hblankFunction · 0.85
WIFI_usTriggerFunction · 0.85
testEnum · 0.85
isTriggeredMethod · 0.45
execMethod · 0.45
nextMethod · 0.45

Tested by

no test coverage detected