16Fermer18
PpHdLe 15/06/2004 à 14:32
Nouvelle version de PreOS:
NewLine1111:
        pea     (a0)                    ; Preserve a0
        move.l  (4+2)(sp),a0          ; Read address of crash
        cmpi.w  #$FFF1,(a0)             ; Check long jump
        bne.s   \NoLongJmp              ; No long jump
                adda.l  2(a0),a0        ; Compute target address
                move.l  a0,(4+2)(sp)    ; Save jump
                move.l  (sp)+,a0        ; Reload a0
                rte                     ; Jump to function
\NoLongJmp:
; We don't have to save any registers since
; it is else a crash, a function call or a ROM_CALL
        addq.l  #4,sp                   ; Pop a0
        move.w  (sp)+,d1                ; Get Old SR
        addq.l  #4,sp                   ; Skip Address of the 'crash'
        move.w  (a0)+,d0                ; We get the instruction and a0 ->next instruction
        subi.w  #$F800,d0               ; Is it > $F800 ? 
        bls.s   crash_handler           ; No, so it is a crash (First_Window isn't a ROM_CALL)
                move.l  a0,a1
                cmp.w   #$FFF0-$F800,d0
                bne.s   \NoRelJsr
                        adda.l  (a0)+,a1        ; Get the Sub Routine
                        bra.s   \JumpRet        ; Jsr with a 32 bits offset     
\NoRelJsr       cmp.w   #$FFF2-$F800,d0
                bne.s   \NoBigRomCall
                        move.w  (a0)+,d0        ; Read Offset
                        lsr.w   #2,d0
\NoBigRomCall
                move.l  ($C8).w,a1              ; The address of the rom_call table in ROM
                cmp.w   -(a1),d0                ; Compare rom_call and number of entries
                bcc.s   crash_handler           ; Out of range ? => Crash
                        lsl.w   #2,d0           ; * 4
                        move.l  2(a1,d0.w),a1   ; + ($C8) MAX: 8000 rom_calls
\JumpRet                move.w  d1,SR           ; Restore SR
                        pea     (a0)            ; Push return address
                        jmp     (a1)            ; Jump to Rom_call function