47 |
|
XREF _MainTask |
48 |
|
XREF _SysBase |
49 |
|
XREF _quit_emulator |
50 |
– |
XREF _kprintf |
50 |
|
|
51 |
|
SECTION text,CODE |
52 |
|
|
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 |
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 |
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) |
320 |
|
* trace Vector |
321 |
|
* |
322 |
|
|
323 |
< |
dotrace: move.l a0,(sp) ;Save a0 |
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 |
350 |
|
addq.l #8,sp ;Remove exception frame from supervisor stack |
351 |
|
andi #$d8ff,sr ;Switch to user mode, enable interrupts |
352 |
|
|
354 |
– |
IFNE 0 |
355 |
– |
|
356 |
– |
; move.w ([2,sp]),($3800) |
357 |
– |
|
358 |
– |
cmp.w #$a9c3,([2,sp]) |
359 |
– |
bne 1$ |
360 |
– |
|
361 |
– |
move.l d0,-(sp) |
362 |
– |
move.l a0,-(sp) |
363 |
– |
pea afmt(pc) |
364 |
– |
jsr _kprintf |
365 |
– |
lea 3*4(sp),sp |
366 |
– |
1$: |
367 |
– |
ENDC |
368 |
– |
|
353 |
|
move.l $28.w,-(sp) ;Jump to MacOS exception handler |
354 |
|
rts |
355 |
|
|
372 |
– |
afmt: dc.b 'a0=%08lx d0=%08lx\n',0 |
373 |
– |
cnop 0,4 |
374 |
– |
|
356 |
|
* |
357 |
|
* Illegal address handler |
358 |
|
* |
359 |
|
|
360 |
< |
doilladdr: move.l a0,(sp) ;Save a0 |
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 |
378 |
|
* to execute extended opcodes (see emul_op.h) |
379 |
|
* |
380 |
|
|
381 |
< |
doillinstr |
401 |
< |
movem.l a0/d0,-(sp) |
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 |
398 |
|
move.l $10.w,-(sp) ;Jump to MacOS exception handler |
399 |
|
rts |
400 |
|
|
401 |
< |
1$: |
422 |
< |
move.l a6,(sp) ;Save a6 |
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) |
696 |
|
rte |
697 |
|
|
698 |
|
; fsave xxx(a5) +jl+ |
699 |
< |
fsavea5: move.l (sp),d0 ;Restore d0 |
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 |
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$ |
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 |
|
movem.l (sp)+,a0/a1 ;Restore a0 and a1 |
930 |
|
rte |
931 |
|
|
932 |
|
; movec sfc,d1 +jl+ |
933 |
< |
movecsfcd1: move.l (sp)+,d0 ;Restore d0 |
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 |
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 |
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 |
1001 |
|
rte |
1002 |
|
|
1003 |
|
; move usp,a1 +jl+ |
1004 |
< |
moveuspa1: move.l (sp)+,d0 |
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 |
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 |
1016 |
> |
moved1usp move.l (sp)+,d0 |
1017 |
|
move a1,usp |
1018 |
|
addq.l #2,2(sp) |
1019 |
|
rte |
1022 |
|
; Trigger NMI (Pop up debugger) |
1023 |
|
; |
1024 |
|
|
1025 |
< |
_AsmTriggerNMI: |
1047 |
< |
move.l d0,-(sp) ;Save d0 |
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 |