28 |
|
XDEF _AtomicAnd |
29 |
|
XDEF _AtomicOr |
30 |
|
XDEF _MoveVBR |
31 |
– |
XDEF _TimevalTo64 |
32 |
– |
XDEF _TimevalToMacTime |
31 |
|
XDEF _Execute68k |
32 |
|
XDEF _Execute68kTrap |
33 |
|
XDEF _TrapHandlerAsm |
35 |
|
XDEF _Scod060Patch1 |
36 |
|
XDEF _Scod060Patch2 |
37 |
|
XDEF _ThInitFPUPatch |
38 |
+ |
XDEF _AsmTriggerNMI |
39 |
|
|
40 |
|
XREF _OldTrapHandler |
41 |
|
XREF _OldExceptionHandler |
107 |
|
rte |
108 |
|
|
109 |
|
* |
111 |
– |
* Convert timeval to 64 bit microseconds |
112 |
– |
* |
113 |
– |
|
114 |
– |
_TimevalTo64 move.l 4(sp),a0 ;Pointer to timeval |
115 |
– |
move.l 8(sp),a1 ;Pointer to high longword of result, low longword is returned in d0 |
116 |
– |
|
117 |
– |
move.l d2,-(sp) |
118 |
– |
|
119 |
– |
move.l TV_SECS(a0),d0 ;Convert to 64 bit microseconds |
120 |
– |
mulu.l #1000000,d1:d0 |
121 |
– |
add.l TV_MICRO(a0),d0 |
122 |
– |
moveq #0,d2 |
123 |
– |
addx.l d2,d1 |
124 |
– |
move.l d1,(a1) |
125 |
– |
|
126 |
– |
move.l (sp)+,d2 |
127 |
– |
rts |
128 |
– |
|
129 |
– |
* |
130 |
– |
* Convert timeval to Mac time value (>0: milliseconds, <0: microseconds) |
131 |
– |
* |
132 |
– |
|
133 |
– |
_TimevalToMacTime |
134 |
– |
move.l 4(sp),a0 ;Pointer to timeval |
135 |
– |
|
136 |
– |
move.l d2,-(sp) |
137 |
– |
|
138 |
– |
move.l TV_SECS(a0),d0 ;Convert to 64 bit microseconds |
139 |
– |
mulu.l #1000000,d1:d0 |
140 |
– |
add.l TV_MICRO(a0),d0 |
141 |
– |
moveq #0,d2 |
142 |
– |
addx.l d2,d1 |
143 |
– |
|
144 |
– |
tst.l d1 ;Too large for 32 bit microseconds? |
145 |
– |
bne.s 1$ |
146 |
– |
cmp.l #$7fffffff,d0 |
147 |
– |
bhi.s 1$ |
148 |
– |
|
149 |
– |
neg.l d0 ;No, return negative microseconds |
150 |
– |
bra.s 2$ |
151 |
– |
|
152 |
– |
1$ divu.l #1000,d1:d0 ;Yes, return milliseconds |
153 |
– |
|
154 |
– |
2$ move.l (sp)+,d2 |
155 |
– |
rts |
156 |
– |
|
157 |
– |
* |
110 |
|
* Execute 68k subroutine (must be ended with rts) |
111 |
|
* r->a[7] and r->sr are unused! |
112 |
|
* |
184 |
|
pea 1$ |
185 |
|
move.w _EmulatedSR,d0 |
186 |
|
move.w d0,-(sp) |
187 |
< |
or.w #$0100,d0 ;Set interrupt level in SR |
187 |
> |
or.w #$2100,d0 ;Set interrupt level in SR, enter (virtual) supervisor mode |
188 |
|
move.w d0,_EmulatedSR |
189 |
< |
move.l $64.w,a0 ;Jump to MacOS interrupt handler |
190 |
< |
jmp (a0) |
189 |
> |
move.l $64.w,-(sp) ;Jump to MacOS interrupt handler |
190 |
> |
rts |
191 |
|
|
192 |
|
1$ move.l (sp)+,d0 ;Restore d0 |
193 |
|
rts |
278 |
|
* Trap handler of main task |
279 |
|
* |
280 |
|
|
281 |
< |
_TrapHandlerAsm cmp.l #4,(sp) ;Illegal instruction? |
281 |
> |
_TrapHandlerAsm: |
282 |
> |
cmp.l #4,(sp) ;Illegal instruction? |
283 |
|
beq.s doillinstr |
284 |
|
cmp.l #10,(sp) ;A-Line exception? |
285 |
|
beq.s doaline |
286 |
|
cmp.l #8,(sp) ;Privilege violation? |
287 |
|
beq.s doprivviol |
288 |
+ |
cmp.l #9,(sp) ;Trace? |
289 |
+ |
beq dotrace |
290 |
+ |
cmp.l #3,(sp) ;Illegal Address? |
291 |
+ |
beq.s doilladdr |
292 |
+ |
|
293 |
+ |
cmp.l #32,(sp) |
294 |
+ |
blt 1$ |
295 |
+ |
cmp.l #47,(sp) |
296 |
+ |
ble doTrapXX ; Vector 32-47 : TRAP #0 - 15 Instruction Vectors |
297 |
+ |
|
298 |
+ |
1$ move.l _OldTrapHandler,-(sp) ;No, jump to old trap handler |
299 |
+ |
rts |
300 |
+ |
|
301 |
+ |
* |
302 |
+ |
* TRAP #0 - 15 Instruction Vectors |
303 |
+ |
* |
304 |
+ |
|
305 |
+ |
doTrapXX move.l a0,(sp) ;Save a0 |
306 |
+ |
move.l usp,a0 ;Get user stack pointer |
307 |
+ |
move.l 2*4(sp),-(a0) ;Copy 4-word stack frame to user stack |
308 |
+ |
move.l 1*4(sp),-(a0) |
309 |
+ |
move.l a0,usp ;Update USP |
310 |
+ |
move.l (sp)+,a0 ;Restore a0 |
311 |
+ |
|
312 |
+ |
addq.l #4*2,sp ;Remove exception frame from supervisor stack |
313 |
+ |
andi #$d8ff,sr ;Switch to user mode, enable interrupts |
314 |
|
|
315 |
< |
move.l _OldTrapHandler,-(sp) ;No, jump to old trap handler |
315 |
> |
move.l $2d*4.w,-(sp) ;Jump to MacOS exception handler |
316 |
|
rts |
317 |
|
|
318 |
+ |
|
319 |
+ |
* |
320 |
+ |
* trace Vector |
321 |
+ |
* |
322 |
+ |
|
323 |
+ |
dotrace move.l a0,(sp) ;Save a0 |
324 |
+ |
|
325 |
+ |
move.l usp,a0 ;Get user stack pointer |
326 |
+ |
move.l 3*4(sp),-(a0) ;Copy 6-word stack frame to user stack |
327 |
+ |
move.l 2*4(sp),-(a0) |
328 |
+ |
move.l 1*4(sp),-(a0) |
329 |
+ |
move.l a0,usp ;Update USP |
330 |
+ |
move.l (sp)+,a0 ;Restore a0 |
331 |
+ |
|
332 |
+ |
lea 6*2(sp),sp ;Remove exception frame from supervisor stack |
333 |
+ |
andi #$18ff,sr ;Switch to user mode, enable interrupts, disable trace |
334 |
+ |
|
335 |
+ |
move.l $24.w,-(sp) ;Jump to MacOS exception handler |
336 |
+ |
rts |
337 |
+ |
|
338 |
+ |
|
339 |
|
* |
340 |
|
* A-Line handler: call MacOS A-Line handler |
341 |
|
* |
354 |
|
rts |
355 |
|
|
356 |
|
* |
357 |
+ |
* Illegal address handler |
358 |
+ |
* |
359 |
+ |
|
360 |
+ |
doilladdr move.l a0,(sp) ;Save a0 |
361 |
+ |
|
362 |
+ |
move.l usp,a0 ;Get user stack pointer |
363 |
+ |
move.l 3*4(sp),-(a0) ;Copy 6-word stack frame to user stack |
364 |
+ |
move.l 2*4(sp),-(a0) |
365 |
+ |
move.l 1*4(sp),-(a0) |
366 |
+ |
move.l a0,usp ;Update USP |
367 |
+ |
move.l (sp)+,a0 ;Restore a0 |
368 |
+ |
|
369 |
+ |
lea 6*2(sp),sp ;Remove exception frame from supervisor stack |
370 |
+ |
andi #$d8ff,sr ;Switch to user mode, enable interrupts |
371 |
+ |
|
372 |
+ |
move.l $0c.w,-(sp) ;Jump to MacOS exception handler |
373 |
+ |
rts |
374 |
+ |
|
375 |
+ |
|
376 |
+ |
* |
377 |
|
* Illegal instruction handler: call IllInstrHandler() (which calls EmulOp()) |
378 |
|
* to execute extended opcodes (see emul_op.h) |
379 |
|
* |
380 |
|
|
381 |
< |
doillinstr move.l a6,(sp) ;Save a6 |
381 |
> |
doillinstr movem.l a0/d0,-(sp) |
382 |
> |
move.w ([6+2*4,sp]),d0 |
383 |
> |
and.w #$ff00,d0 |
384 |
> |
cmp.w #$7100,d0 |
385 |
> |
movem.l (sp)+,a0/d0 |
386 |
> |
beq 1$ |
387 |
> |
|
388 |
> |
move.l a0,(sp) ;Save a0 |
389 |
> |
move.l usp,a0 ;Get user stack pointer |
390 |
> |
move.l 8(sp),-(a0) ;Copy stack frame to user stack |
391 |
> |
move.l 4(sp),-(a0) |
392 |
> |
move.l a0,usp ;Update USP |
393 |
> |
move.l (sp)+,a0 ;Restore a0 |
394 |
> |
|
395 |
> |
add.w #3*4,sp ;Remove exception frame from supervisor stack |
396 |
> |
andi #$d8ff,sr ;Switch to user mode, enable interrupts |
397 |
> |
|
398 |
> |
move.l $10.w,-(sp) ;Jump to MacOS exception handler |
399 |
> |
rts |
400 |
> |
|
401 |
> |
1$ move.l a6,(sp) ;Save a6 |
402 |
|
move.l usp,a6 ;Get user stack pointer |
403 |
|
|
404 |
|
move.l a6,-10(a6) ;Push USP (a7) |
453 |
|
cmp.w #$40d0,d0 ;move sr,(a0)? |
454 |
|
beq movefromsra0 |
455 |
|
cmp.w #$40d7,d0 ;move sr,(sp)? |
456 |
< |
beq movefromsra0 |
456 |
> |
beq movefromsrsp |
457 |
|
|
458 |
|
cmp.w #$f327,d0 ;fsave -(sp)? |
459 |
|
beq fsavepush |
460 |
|
cmp.w #$f35f,d0 ;frestore (sp)+? |
461 |
|
beq frestorepop |
462 |
+ |
cmp.w #$f32d,d0 ;fsave xxx(a5) ? |
463 |
+ |
beq fsavea5 |
464 |
+ |
cmp.w #$f36d,d0 ;frestore xxx(a5) ? |
465 |
+ |
beq frestorea5 |
466 |
|
|
467 |
|
cmp.w #$4e73,d0 ;rte? |
468 |
|
beq pvrte |
511 |
|
cmp.w #$f4f8,d0 ;cpusha dc/ic? |
512 |
|
beq cpushadcic |
513 |
|
|
514 |
+ |
cmp.w #$4e69,d0 ;move usp,a1 |
515 |
+ |
beq moveuspa1 |
516 |
+ |
cmp.w #$4e68,d0 ;move usp,a0 |
517 |
+ |
beq moveuspa0 |
518 |
+ |
|
519 |
+ |
cmp.w #$4e61,d0 ;move a1,usp |
520 |
+ |
beq moved1usp |
521 |
+ |
|
522 |
|
pv_unhandled move.l (sp),d0 ;Unhandled instruction, jump to handler in main.cpp |
523 |
|
move.l a6,(sp) ;Save a6 |
524 |
|
move.l usp,a6 ;Get user stack pointer |
560 |
|
move.w (a0)+,d0 ;Get SR from user stack |
561 |
|
move.w d0,8(sp) ;Store into CCR on exception stack frame |
562 |
|
and.w #$00ff,8(sp) |
563 |
< |
and.w #$2700,d0 ;Extract supervisor bits |
563 |
> |
and.w #$e700,d0 ;Extract supervisor bits |
564 |
|
move.w d0,_EmulatedSR ;And save them |
565 |
|
|
566 |
|
and.w #$0700,d0 ;Rethrow exception if interrupts are pending and reenabled |
586 |
|
or.w ([6,sp],2),d0 ;Or with immediate value |
587 |
|
move.w d0,4(sp) ;Store into CCR on stack |
588 |
|
and.w #$00ff,4(sp) |
589 |
< |
and.w #$2700,d0 ;Extract supervisor bits |
589 |
> |
and.w #$e700,d0 ;Extract supervisor bits |
590 |
|
move.w d0,_EmulatedSR ;And save them |
591 |
|
move.l (sp)+,d0 ;Restore d0 |
592 |
|
addq.l #4,2(sp) ;Skip instruction |
598 |
|
and.w ([6,sp],2),d0 ;And with immediate value |
599 |
|
storesr4 move.w d0,4(sp) ;Store into CCR on stack |
600 |
|
and.w #$00ff,4(sp) |
601 |
< |
and.w #$2700,d0 ;Extract supervisor bits |
601 |
> |
and.w #$e700,d0 ;Extract supervisor bits |
602 |
|
move.w d0,_EmulatedSR ;And save them |
603 |
|
|
604 |
|
and.w #$0700,d0 ;Rethrow exception if interrupts are pending and reenabled |
685 |
|
addq.l #2,2(sp) ;Skip instruction |
686 |
|
rte |
687 |
|
|
688 |
< |
; rte (only handles format 0) |
689 |
< |
pvrte move.l a0,-(sp) ;Save a0 |
688 |
> |
; frestore xxx(a5) +jl+ |
689 |
> |
frestorea5 move.l (sp),d0 ;Restore d0 |
690 |
> |
move.l a0,(sp) ;Save a0 |
691 |
> |
move.l a5,a0 ;Get base register |
692 |
> |
add.w ([6,sp],2),a0 ;Add offset to base register |
693 |
> |
frestore (a0) ;Restore FP state from (a0) |
694 |
> |
move.l (sp)+,a0 ;Restore a0 |
695 |
> |
addq.l #4,2(sp) ;Skip instruction |
696 |
> |
rte |
697 |
> |
|
698 |
> |
; fsave xxx(a5) +jl+ |
699 |
> |
fsavea5 move.l (sp),d0 ;Restore d0 |
700 |
> |
move.l a0,(sp) ;Save a0 |
701 |
> |
move.l a5,a0 ;Get base register |
702 |
> |
add.w ([6,sp],2),a0 ;Add offset to base register |
703 |
> |
fsave (a0) ;Push FP state to (a0) |
704 |
> |
move.l (sp)+,a0 ;Restore a0 |
705 |
> |
addq.l #4,2(sp) ;Skip instruction |
706 |
> |
rte |
707 |
> |
|
708 |
> |
; rte |
709 |
> |
pvrte movem.l a0/a1,-(sp) ;Save a0 and a1 |
710 |
|
move.l usp,a0 ;Get user stack pointer |
711 |
+ |
|
712 |
|
move.w (a0)+,d0 ;Get SR from user stack |
713 |
< |
move.w d0,8(sp) ;Store into CCR on exception stack frame |
714 |
< |
and.w #$00ff,8(sp) |
715 |
< |
and.w #$2700,d0 ;Extract supervisor bits |
713 |
> |
move.w d0,8+4(sp) ;Store into CCR on exception stack frame |
714 |
> |
and.w #$c0ff,8+4(sp) |
715 |
> |
and.w #$e700,d0 ;Extract supervisor bits |
716 |
|
move.w d0,_EmulatedSR ;And save them |
717 |
< |
move.l (a0)+,10(sp) ;Store return address in exception stack frame |
718 |
< |
addq.l #2,a0 ;Skip format word |
717 |
> |
move.l (a0)+,10+4(sp) ;Store return address in exception stack frame |
718 |
> |
|
719 |
> |
move.w (a0)+,d0 ;get format word |
720 |
> |
lsr.w #7,d0 ;get stack frame Id |
721 |
> |
lsr.w #4,d0 |
722 |
> |
and.w #$001e,d0 |
723 |
> |
move.w (StackFormatTable,pc,d0.w),d0 ; get total stack frame length |
724 |
> |
subq.w #4,d0 ; count only extra words |
725 |
> |
lea 16+4(sp),a1 ; destination address (in supervisor stack) |
726 |
> |
bra 1$ |
727 |
> |
|
728 |
> |
2$ move.w (a0)+,(a1)+ ; copy additional stack words back to supervisor stack |
729 |
> |
1$ dbf d0,2$ |
730 |
> |
|
731 |
|
move.l a0,usp ;Update USP |
732 |
< |
move.l (sp)+,a0 ;Restore a0 |
732 |
> |
movem.l (sp)+,a0/a1 ;Restore a0 and a1 |
733 |
|
move.l (sp)+,d0 ;Restore d0 |
734 |
|
rte |
735 |
|
|
736 |
+ |
; sizes of exceptions stack frames |
737 |
+ |
StackFormatTable: |
738 |
+ |
dc.w 4 ; Four-word stack frame, format $0 |
739 |
+ |
dc.w 4 ; Throwaway four-word stack frame, format $1 |
740 |
+ |
dc.w 6 ; Six-word stack frame, format $2 |
741 |
+ |
dc.w 6 ; MC68040 floating-point post-instruction stack frame, format $3 |
742 |
+ |
dc.w 8 ; MC68EC040 and MC68LC040 floating-point unimplemented stack frame, format $4 |
743 |
+ |
dc.w 4 ; Format $5 |
744 |
+ |
dc.w 4 ; Format $6 |
745 |
+ |
dc.w 30 ; MC68040 access error stack frame, Format $7 |
746 |
+ |
dc.w 29 ; MC68010 bus and address error stack frame, format $8 |
747 |
+ |
dc.w 10 ; MC68020 and MC68030 coprocessor mid-instruction stack frame, format $9 |
748 |
+ |
dc.w 16 ; MC68020 and MC68030 short bus cycle stack frame, format $a |
749 |
+ |
dc.w 46 ; MC68020 and MC68030 long bus cycle stack frame, format $b |
750 |
+ |
dc.w 12 ; CPU32 bus error for prefetches and operands stack frame, format $c |
751 |
+ |
dc.w 4 ; Format $d |
752 |
+ |
dc.w 4 ; Format $e |
753 |
+ |
dc.w 4 ; Format $f |
754 |
+ |
|
755 |
|
; move sr,dx |
756 |
|
movefromsrd0 addq.l #4,sp ;Skip saved d0 |
757 |
|
moveq #0,d0 |
813 |
|
movetosrd0 move.l (sp),d0 |
814 |
|
storesr2 move.w d0,4(sp) |
815 |
|
and.w #$00ff,4(sp) |
816 |
< |
and.w #$2700,d0 |
816 |
> |
and.w #$e700,d0 |
817 |
|
move.w d0,_EmulatedSR |
818 |
|
|
819 |
|
and.w #$0700,d0 ;Rethrow exception if interrupts are pending and reenabled |
858 |
|
beq.s movecvbra0 |
859 |
|
cmp.w #$9801,d0 ;movec vbr,a1? |
860 |
|
beq.s movecvbra1 |
861 |
+ |
cmp.w #$1801,d0 ;movec vbr,d1? |
862 |
+ |
beq movecvbrd1 |
863 |
|
cmp.w #$0002,d0 ;movec cacr,d0? |
864 |
|
beq.s moveccacrd0 |
865 |
|
cmp.w #$1002,d0 ;movec cacr,d1? |
868 |
|
beq.s movectcd0 |
869 |
|
cmp.w #$1003,d0 ;movec tc,d1? |
870 |
|
beq.s movectcd1 |
871 |
+ |
cmp.w #$1000,d0 ;movec sfc,d1? |
872 |
+ |
beq movecsfcd1 |
873 |
+ |
cmp.w #$1001,d0 ;movec dfc,d1? |
874 |
+ |
beq movecdfcd1 |
875 |
+ |
cmp.w #$0806,d0 ;movec urp,d0? |
876 |
+ |
beq movecurpd0 |
877 |
+ |
cmp.w #$0807,d0 ;movec srp,d0? |
878 |
+ |
beq.s movecsrpd0 |
879 |
+ |
cmp.w #$0004,d0 ;movec itt0,d0 |
880 |
+ |
beq.s movecitt0d0 |
881 |
+ |
cmp.w #$0005,d0 ;movec itt1,d0 |
882 |
+ |
beq.s movecitt1d0 |
883 |
+ |
cmp.w #$0006,d0 ;movec dtt0,d0 |
884 |
+ |
beq.s movecdtt0d0 |
885 |
+ |
cmp.w #$0007,d0 ;movec dtt1,d0 |
886 |
+ |
beq.s movecdtt1d0 |
887 |
|
|
888 |
|
bra pv_unhandled |
889 |
|
|
911 |
|
addq.l #4,2(sp) |
912 |
|
rte |
913 |
|
|
914 |
+ |
; movec vbr,d1 |
915 |
+ |
movecvbrd1 move.l (sp)+,d0 |
916 |
+ |
moveq.l #0,d1 ;VBR always appears to be at 0 |
917 |
+ |
addq.l #4,2(sp) |
918 |
+ |
rte |
919 |
+ |
|
920 |
|
; movec tc,d0 |
921 |
|
movectcd0 addq.l #4,sp |
922 |
|
moveq #0,d0 ;MMU is always off |
923 |
|
addq.l #4,2(sp) |
924 |
|
rte |
925 |
|
|
926 |
< |
; movec tc,d1 |
927 |
< |
movectcd1 addq.l #4,sp |
926 |
> |
; movec tc,d1 +jl+ |
927 |
> |
movectcd1 move.l (sp)+,d0 ;Restore d0 |
928 |
|
moveq #0,d1 ;MMU is always off |
929 |
|
addq.l #4,2(sp) |
930 |
|
rte |
931 |
|
|
932 |
+ |
; movec sfc,d1 +jl+ |
933 |
+ |
movecsfcd1 move.l (sp)+,d0 ;Restore d0 |
934 |
+ |
moveq #0,d1 |
935 |
+ |
addq.l #4,2(sp) |
936 |
+ |
rte |
937 |
+ |
|
938 |
+ |
; movec dfc,d1 +jl+ |
939 |
+ |
movecdfcd1 move.l (sp)+,d0 ;Restore d0 |
940 |
+ |
moveq #0,d1 |
941 |
+ |
addq.l #4,2(sp) |
942 |
+ |
rte |
943 |
+ |
|
944 |
+ |
movecurpd0 ; movec urp,d0 +jl+ |
945 |
+ |
movecsrpd0 ; movec srp,d0 |
946 |
+ |
movecitt0d0 ; movec itt0,d0 |
947 |
+ |
movecitt1d0 ; movec itt1,d0 |
948 |
+ |
movecdtt0d0 ; movec dtt0,d0 |
949 |
+ |
movecdtt1d0 ; movec dtt1,d0 |
950 |
+ |
addq.l #4,sp |
951 |
+ |
moveq.l #0,d0 ;MMU is always off |
952 |
+ |
addq.l #4,2(sp) ;skip instruction |
953 |
+ |
rte |
954 |
+ |
|
955 |
|
; movec x,cr |
956 |
|
movectocr move.w ([6,sp],2),d0 ;Get next instruction word |
957 |
|
|
958 |
|
cmp.w #$0801,d0 ;movec d0,vbr? |
959 |
|
beq.s movectovbr |
960 |
+ |
cmp.w #$1801,d0 ;movec d1,vbr? |
961 |
+ |
beq.s movectovbr |
962 |
|
cmp.w #$0002,d0 ;movec d0,cacr? |
963 |
|
beq.s movectocacr |
964 |
|
cmp.w #$1002,d0 ;movec d1,cacr? |
965 |
|
beq.s movectocacr |
966 |
+ |
cmp.w #$1000,d0 ;movec d1,sfc? |
967 |
+ |
beq.s movectoxfc |
968 |
+ |
cmp.w #$1001,d0 ;movec d1,dfc? |
969 |
+ |
beq.s movectoxfc |
970 |
|
|
971 |
|
bra pv_unhandled |
972 |
|
|
984 |
|
addq.l #4,2(sp) |
985 |
|
rte |
986 |
|
|
987 |
+ |
; movec x,sfc |
988 |
+ |
; movec x,dfc |
989 |
+ |
movectoxfc move.l (sp)+,d0 ;Ignore moves to SFC, DFC |
990 |
+ |
addq.l #4,2(sp) |
991 |
+ |
rte |
992 |
+ |
|
993 |
|
; cpusha |
994 |
|
cpushadc |
995 |
|
cpushadcic movem.l d1/a0-a1/a6,-(sp) ;Clear caches |
1000 |
|
addq.l #2,2(sp) |
1001 |
|
rte |
1002 |
|
|
1003 |
+ |
; move usp,a1 +jl+ |
1004 |
+ |
moveuspa1 move.l (sp)+,d0 |
1005 |
+ |
move usp,a1 |
1006 |
+ |
addq.l #2,2(sp) |
1007 |
+ |
rte |
1008 |
+ |
|
1009 |
+ |
; move usp,a0 +jl+ |
1010 |
+ |
moveuspa0 move.l (sp)+,d0 |
1011 |
+ |
move usp,a0 |
1012 |
+ |
addq.l #2,2(sp) |
1013 |
+ |
rte |
1014 |
+ |
|
1015 |
+ |
; move a1,usp +jl+ |
1016 |
+ |
moved1usp move.l (sp)+,d0 |
1017 |
+ |
move a1,usp |
1018 |
+ |
addq.l #2,2(sp) |
1019 |
+ |
rte |
1020 |
+ |
|
1021 |
+ |
; |
1022 |
+ |
; Trigger NMI (Pop up debugger) |
1023 |
+ |
; |
1024 |
+ |
|
1025 |
+ |
_AsmTriggerNMI move.l d0,-(sp) ;Save d0 |
1026 |
+ |
move.w #$007c,-(sp) ;Yes, fake NMI stack frame |
1027 |
+ |
pea 1$ |
1028 |
+ |
move.w _EmulatedSR,d0 |
1029 |
+ |
and.w #$f8ff,d0 ;Set interrupt level in SR |
1030 |
+ |
move.w d0,-(sp) |
1031 |
+ |
move.w d0,_EmulatedSR |
1032 |
+ |
|
1033 |
+ |
move.l $7c.w,-(sp) ;Jump to MacOS NMI handler |
1034 |
+ |
rts |
1035 |
+ |
|
1036 |
+ |
1$ move.l (sp)+,d0 ;Restore d0 |
1037 |
+ |
rts |
1038 |
+ |
|
1039 |
+ |
|
1040 |
|
END |