home *** CD-ROM | disk | FTP | other *** search
/ Crawly Crypt Collection 1 / crawlyvol1.bin / program / books / 68k_book / arp_src / prg_9bp.s < prev    next >
Text File  |  1985-11-20  |  2KB  |  50 lines

  1.  ; Program Name: DONGTRAP.S
  2.  
  3.  ; Assembly Instructions:
  4.  
  5.  ;   Assemble in PC-relative and save the assembled program with a PRG suffix.
  6.  ; Copy DONGTRAP.PRG to the AUTO folder on the C partition of the hard disk.
  7.  
  8.  ; Program Function:
  9.  
  10.  ;   This program installs the custom trap invoke by DONGLE.ACC, the
  11.  ; SWITCH/BACK software dongle.
  12.  
  13. program_start:                  ; Calculate program size and retain result.
  14.  lea        program_end, a3     ; Fetch program end address.
  15.  suba.l     4(a7), a3           ; Subtract basepage address.
  16.  
  17. enter_supervisor_mode:
  18.  move.l    #0, -(sp)
  19.  move.w    #$20, -(sp)          ; Function = SUPER.
  20.  trap      #1                   ; Supervisor mode is active after TRAP.
  21.  addq.l    #6, sp               ; D0 = SSP.
  22.  
  23. install_trap_11_routine:        ; Note: pointer = vector = pointer.
  24.  lea        trap_11_routine, a0 ; Fetch address of trap #11 routine.
  25.  move.l     a0, $AC             ; Store trap address at pointer address.
  26.  
  27. enter_user_mode:
  28.  move.l    d0, -(sp)            ; D0 contains SSP.
  29.  move.w    #$20, -(sp)          ; Function = SUPER.
  30.  trap      #1                   ; User mode is active after TRAP.
  31.  addq.l    #6, sp
  32.  
  33. relinquish_processor_control:   ; Maintain memory residency.
  34.  move.w     #0, -(sp)           ; Exit code.
  35.  move.l     a3, -(sp)           ; Program size.
  36.  move.w     #$31, -(sp)         ; Function = ptermres = GEMDOS $31.
  37.  trap       #1
  38.  
  39. trap_11_routine:
  40.  move.w     SR, -(a7)
  41.  move.w     #$2700, SR
  42.  movem.l    d0-a6, -(a7)
  43.  move.l     usp, a0
  44.  move.l     a0, -(a7)
  45.  lea        $D42C, a0
  46.  jmp        (a0)
  47.  
  48. program_end:  ds.l       0
  49.  end
  50.