Skip to content

Commit

Permalink
Merge branch 'feature/mp2000-test' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
ChainSwordCS committed Jul 31, 2024
2 parents 97447fe + 4e96ecc commit 4b8404c
Show file tree
Hide file tree
Showing 12 changed files with 413 additions and 96 deletions.
12 changes: 12 additions & 0 deletions arm7/source/irq.s
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,19 @@ my_irq_handler:

mov r0, #0x04000000
ldr r1, [r0, #0x214]
ldr r2, [r0, #0x210]
and r1, r2

//ands r2, r1, #(1 << 1)
//bne my_irq_handler_hblank

//ands r2, r1, #(1 << 2)
//bne my_irq_handler_vcount

//vcount
ands r2, r1, #(1 << 2)
bne vcount

//timer used for sound
ands r2, r1, #(1 << 6)
bne timer3
Expand All @@ -40,6 +46,12 @@ vblank:
pop {lr}
bx lr

vcount:
str r2, [r0, #0x214]
bl irq_vcount
pop {lr}
bx lr

//my_irq_handler_hblank:
// str r2, [r0, #0x214]
// bl hblank_irq
Expand Down
18 changes: 18 additions & 0 deletions arm7/source/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,19 @@ extern "C" void irq_vblank()
sPrevTouchDown = touchDown;
}

static u32 sRateCounter;

extern "C" void irq_vcount()
{
sRateCounter += 484839276;
if(sRateCounter >= 1116733440)
{
sRateCounter -= 1116733440;
while(REG_DISPSTAT & DISP_IN_HBLANK);
*(vu16*)0x04000006 = *(vu16*)0x04000006;//repeat line
}
}

extern "C" void my_irq_handler();

int writePowerManagement(int reg, int cmd)
Expand All @@ -49,6 +62,7 @@ int writePowerManagement(int reg, int cmd)

int main()
{
sRateCounter = 0;
//dmaFillWords(0, (void*)0x04000400, 0x100);

//REG_SOUNDCNT |= SOUND_ENABLE;
Expand Down Expand Up @@ -114,6 +128,10 @@ int main()
REG_DISPSTAT |= DISP_VBLANK_IRQ;
REG_IE |= IRQ_VBLANK;

//set vcount irq
REG_DISPSTAT = (REG_DISPSTAT & ~0xFF80) | 0xE400 | DISP_YTRIGGER_IRQ;
REG_IE |= IRQ_VCOUNT;

//irqSet(IRQ_VBLANK, vblank_irq_handler);
//irqEnable(IRQ_VBLANK);

Expand Down
Loading

0 comments on commit 4b8404c

Please sign in to comment.