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

  1.  ; Program Name: PRG_6EP.S
  2.  ;      Version: 1.001
  3.  
  4.  ; Assembly Instructions:
  5.  
  6.  ;     Assemble in PC-relative mode and save with a PRG extension.
  7.  
  8.  ; Execution Instructions:
  9.  
  10.  ;     Execute from the desktop.
  11.  
  12.  ; Program Function:
  13.  
  14.  ;     Turns off keyclick sound.  Refer to PRG_6DP.S for documentation.
  15.  
  16.  ; Program Purpose:
  17.  
  18.  ;   1. Illustrate the use of XBIOS function $26.  This function forces a
  19.  ;      subroutine to be executed in the supervisor mode.  The subroutine
  20.  ;      may be located at any address in memory.  Function $26 expects the
  21.  ;      address of the subroutine to be on the stack.
  22.  
  23.  ;   2. Point out error in Internals book (The example in the Internals
  24.  ;      book is garbage).  The "address" which must be pushed on the stack 
  25.  ;      is the address of a subroutine that is terminated with an RTS
  26.  ;      instruction.  See page 3-13 of the Peel book.
  27.  
  28.  ;   3. Illustrate the confusion created by writers of reference books when
  29.  ;      they are not consistent in their usage of number bases.  To wit:
  30.  ;      in the Internals book, GEMDOS function numbers are presented in
  31.  ;      hexadecimal.  The index of these functions are immediately followed
  32.  ;      by the BIOS and XBIOS functions, which are numbered in decimal.  I
  33.  ;      will try remember to use the following notation to express the BIOS
  34.  ;      and XBIOS in both number bases so that it will be easier for you to
  35.  ;      look them up in the Internals book:
  36.  
  37.  ;      Function = superexec = XBIOS $26 (dec 38).
  38.  
  39.  ;      Where (dec 38) indicates that the digits 38 are the decimal 
  40.  ;      equivalent of the hexadecimal number 26.
  41.  
  42. mainline:
  43.  lea        stack, a7           ; Point A7 to this program's stack.
  44.  
  45. execute_subroutine_in_supervisor_mode:
  46.  pea        turn_key_click_off  ; Push address of subroutine onto stack.
  47.  move.w     #$26, -(sp)         ; Function = superexec = XBIOS $26 (dec 38).
  48.  trap       #14                 ; XBIOS call.
  49.  addq.l     #6, sp
  50.  
  51. terminate:
  52.  move.w     #0, -(sp)           ; Function = p_term_old = GEMDOS $0.
  53.  trap       #1                  ; GEMDOS call.
  54.  
  55. turn_key_click_off:             ; Subroutine to be executed in supervisor
  56.  move.b     #6, $484            ; mode.  
  57.  rts
  58.      
  59.              ds.l    24         ; Stack.
  60. stack:       ds.l     0         ; Address of stack.
  61. program_end: ds.l     0
  62.  end
  63.