Hello guys.
The 32X doesn't have any reset input.
It does have, though, a VRES interrupt, which is raised when the user presses the reset button on its Genesis.
I am trying to make a proper reset method.
I have tried to clear the register and have set PC = 0, but it doesn't seem to work (I'm testing with Mega Everdrive X3).
Would any of you happen to know what I am supposed to do in the VRES interrupt function ?
Reset and VRES
Moderator: BigEvilCorporation
-
- Very interested
- Posts: 2442
- Joined: Tue Dec 05, 2006 1:37 pm
- Location: Estonia, Rapla City
- Contact:
Re: Reset and VRES
I imagine you modify stack to have a new return address prior to exiting the interrupt and probably force caches to be flushed too.
Mida sa loed ? Nagunii aru ei saa
http://www.tmeeco.eu
Files of all broken links and images of mine are found here : http://www.tmeeco.eu/FileDen
http://www.tmeeco.eu
Files of all broken links and images of mine are found here : http://www.tmeeco.eu/FileDen
Re: Reset and VRES
Thank you Tmee for the answer.
Moreover, Chilly Willy posted his toolchain here viewtopic.php?f=7&t=3024, and in particular, there is the file examples/Yeti3D/platform/32X/sh2_crt0.s which states
and
Moreover, Chilly Willy posted his toolchain here viewtopic.php?f=7&t=3024, and in particular, there is the file examples/Yeti3D/platform/32X/sh2_crt0.s which states
Code: Select all
main_vres_irq:
mov.l mvri_mars_adapter,r1
mov.w r0,@(0x14,r1) /* clear VRES IRQ */
nop
nop
nop
nop
mov #0x0F,r0
shll2 r0
shll2 r0
ldc r0,sr /* disallow ints */
mov.l mvri_master_stk,r15
mov.l mvri_master_vres,r0
jmp @r0
nop
.align 2
mvri_mars_adapter:
.long 0x20004000
mvri_master_stk:
.long 0x0603FC00 /* Cold Start SP */
mvri_master_vres:
.long main_reset
Code: Select all
main_reset:
! do any master SH2 specific reset code here
mov.l slav_st,r0
mov.l slav_ok,r1
0:
mov.l @r0,r2
nop
nop
cmp/eq r1,r2
bf 0b /* wait for slave */
! recopy rom data to sdram
mov.l rom_header,r1
mov.l @r1,r2 /* src relative to start of rom */
mov.l @(4,r1),r3 /* dst relative to start of sdram */
mov.l @(8,r1),r4 /* size (longword aligned) */
mov.l rom_start,r1
add r1,r2
mov.l sdram_start,r1
add r1,r3
shlr2 r4 /* number of longs */
add #-1,r4
1:
mov.l @r2+,r0
mov.l r0,@r3
add #4,r3
dt r4
bf 1b
mov.l main_st,r0
mov.l main_ok,r1
mov.l r1,@r0 /* tell everyone reset complete */
mov.l main_go,r0
jmp @r0
nop