home *** CD-ROM | disk | FTP | other *** search
/ Magazyn Amiga 13 / MA_Cover_13.bin / source / c / stefanb_src / private_projects / mmureset / kswriteable.c < prev    next >
Encoding:
C/C++ Source or Header  |  1992-09-06  |  996 b   |  38 lines

  1. void DoRemove(void);
  2.  
  3. long tc=0,tmptc=0;
  4.  
  5. void main(void)
  6. {
  7.  printf("KSWriteable V0.01\n");
  8.  DoRemove();
  9. }
  10.  
  11. void DoRemove(void)
  12. {
  13. #asm
  14.          machine  mc68020
  15.          mc68851
  16.          xref     _LVODisable,_LVOEnable
  17.          xref     _LVOSuperState
  18.          xref     _LVOUserState
  19.  
  20. Start:   movem.l  d0-d7/a0-a6,-(a7)
  21.          move.l   $4,a6
  22.          jsr      _LVODisable(a6)      ; Disable interrupts
  23.          jsr      _LVOSuperState(a6)   ; go to supervisor mode
  24.          move.l   d0,d7
  25. MagicCode:
  26.          pmove    tc,_tmptc            ; Save TC
  27.          pmove    _tc,tc               ; disable MMU
  28.          move.l   #$07F80019,$07FFF378 ; Remove write protection from
  29.          move.l   #$07F80019,$07FFF37C ; MMU Table for Kickstart RAM
  30.          pmove    _tmptc,tc            ; Restore TC
  31.  
  32.          move.l   d7,d0                ; go to user mode
  33.          jsr      _LVOUserState(a6)
  34.          jsr      _LVOEnable(a6)       ; Enable interrrupts
  35. End:     movem.l  (a7)+,d0-d7/a0-a6
  36. #endasm
  37. }
  38.