Mercurial > repos > blastem
comparison 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 |
comparison
equal
deleted
inserted
replaced
2579:bd8d1babbfb5 | 2580:939b818df589 |
---|---|
171 #INT_PENDING_SR_CHANGE | 171 #INT_PENDING_SR_CHANGE |
172 if 254 = int_pending | 172 if 254 = int_pending |
173 int_pending = int_priority | 173 int_pending = int_priority |
174 int_pending_num = int_num | 174 int_pending_num = int_num |
175 | 175 |
176 end | |
177 | |
178 check_user_mode_swap_ssp_usp | |
179 | |
180 cycles 6 | |
181 #save status reg | |
182 a7 -= 6 | |
183 m68k_get_sr | |
184 scratch2 = a7 | |
185 ocall write_16 | |
186 | |
187 #update status register | |
188 status &= 0x78 | |
189 status |= int_pending | |
190 status |= 0x20 | |
191 | |
192 #Interrupt ack cycle | |
193 int_ack = int_pending | |
194 cycles 4 | |
195 if int_ack_handler | |
196 pcall int_ack_handler int_ack_fun context | |
197 end | |
198 if int_pending_num | |
176 else | 199 else |
200 int_pending_num = int_pending + 24 | |
201 end | |
177 | 202 |
178 check_user_mode_swap_ssp_usp | 203 #save pc |
179 | 204 scratch2 = a7 + 2 |
180 cycles 6 | 205 scratch1 = pc - 2 |
181 #save status reg | 206 m68k_write32_lowfirst scratch1 |
182 sub 6 a7 a7 | 207 |
183 m68k_get_sr | 208 scratch1 = int_pending_num << 2 |
184 mov a7 scratch2 | 209 int_pending = 255 #INT_PENDING_NONE |
185 ocall write_16 | 210 int_pending_num = 0 |
186 | 211 m68k_read32 |
187 #update status register | 212 mov scratch1 pc |
188 and 0x78 status status | 213 m68k_prefetch |
189 or int_priority status status | 214 update_sync |
190 or 0x20 status status | |
191 | |
192 #Interrupt ack cycle | |
193 mov int_pending int_ack | |
194 cycles 4 | |
195 if int_ack_handler | |
196 pcall int_ack_handler int_ack_fun context | |
197 end | |
198 if int_pending_num | |
199 else | |
200 int_pending_num = int_pending + 24 | |
201 end | |
202 | |
203 #save pc | |
204 add 2 a7 scratch2 | |
205 m68k_write32_lowfirst pc | |
206 | |
207 lsl int_pending_num 2 scratch1 | |
208 m68k_read32 | |
209 mov scratch1 pc | |
210 update_sync | |
211 end | |
212 end | 215 end |
213 end | 216 end |
214 | 217 |
215 m68k_run_op | 218 m68k_run_op |
216 dispatch prefetch | 219 dispatch prefetch |