home *** CD-ROM | disk | FTP | other *** search
- far code
- far data
- public _PrivHndlr
- PrivVect equ $20 ; Address of Privlege error vector
- ;
- ; This installs a handler for privilege violations
- ; caused when a 68010 executes a "move sr,ea" instruction
- ; in user mode.
- ;
- ; It was inspired by Scott Turner's "DeciGEL" program.
- ;
- ;
- ; code to handle move sr,ea instructions. this actually modifies
- ; code in place to a MOVE CCR,ea instruction, thus it is NO GOOD
- ; at all for code in ROM. (So big deal, eh?)
- ;
- _PrivHndlr:
- movem.l D0/A0,-(SP) ; Save registers
- move.l 10(SP),A0 ; Pointer to opcode
- move.w (A0),D0 ; Pickup opcode
- andi.w #$ffc0,D0 ; Mask out EA field
- cmpi.w #$40C0,D0 ; Is it a MOVE SR,ea?
- bne ReallyIllegal
- bset #1,(A0) ; Convert it to MOVE CCR,ea
- movem.l (sp)+,d0/a0 ; restore regs
- rte ; Rerun new opcode
-
- ReallyIllegal:
- movem.l (sp)+,d0/a0 ; restore regs
- Prev:
- jmp $FC0000 ; To previous handler, patched on
- ; installation of new handler
-
- ;
- ; This is where we branch to start up Transformer
- Emu_Start:
- lea Prev+2(pc),a0 ;save pointer to old handler
- move.l PrivVect,(a0)
- lea _PrivHndlr(pc),a0 ;install new vector
- move.l a0,PrivVect
- ;
- ; We fall through to the beginning of the Transformer here
- ;
- end
-