Mercurial > repos > blastem
diff m68k.cpu @ 2580:939b818df589
Get 68K interrupts working in new CPU core
author | Michael Pavone <pavone@retrodev.com> |
---|---|
date | Sat, 08 Feb 2025 11:40:42 -0800 |
parents | 9b01541cbd60 |
children | 0f7609fe03f2 |
line wrap: on
line diff
--- a/m68k.cpu Fri Feb 07 23:32:15 2025 -0800 +++ b/m68k.cpu Sat Feb 08 11:40:42 2025 -0800 @@ -173,42 +173,45 @@ int_pending = int_priority int_pending_num = int_num - else + end + + check_user_mode_swap_ssp_usp + + cycles 6 + #save status reg + a7 -= 6 + m68k_get_sr + scratch2 = a7 + ocall write_16 + + #update status register + status &= 0x78 + status |= int_pending + status |= 0x20 - check_user_mode_swap_ssp_usp - - cycles 6 - #save status reg - sub 6 a7 a7 - m68k_get_sr - mov a7 scratch2 - ocall write_16 - - #update status register - and 0x78 status status - or int_priority status status - or 0x20 status status - - #Interrupt ack cycle - mov int_pending int_ack - cycles 4 - if int_ack_handler - pcall int_ack_handler int_ack_fun context - end - if int_pending_num - else - int_pending_num = int_pending + 24 - end - - #save pc - add 2 a7 scratch2 - m68k_write32_lowfirst pc - - lsl int_pending_num 2 scratch1 - m68k_read32 - mov scratch1 pc - update_sync + #Interrupt ack cycle + int_ack = int_pending + cycles 4 + if int_ack_handler + pcall int_ack_handler int_ack_fun context + end + if int_pending_num + else + int_pending_num = int_pending + 24 end + + #save pc + scratch2 = a7 + 2 + scratch1 = pc - 2 + m68k_write32_lowfirst scratch1 + + scratch1 = int_pending_num << 2 + int_pending = 255 #INT_PENDING_NONE + int_pending_num = 0 + m68k_read32 + mov scratch1 pc + m68k_prefetch + update_sync end end