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

  1.  ; Program Name: DONGLE.S
  2.  ;      Version: 1.003
  3.  
  4.  ;     Version 1.003 added (pc) to the following instruction:
  5.  
  6.  ; move.w    int_out(pc), d4      ; Store menu identification number in D4.
  7.  
  8.  ; Assembly Instructions:
  9.  
  10.  ;     Assemble in Relocatable mode and save with a PRG extension.  From
  11.  ; the desktop, change the extension to ACC and copy DONGLE.ACC to the
  12.  ; C partition of the hard disk.
  13.  
  14.  ; Execution Instructions:
  15.  
  16.  ;     Before this program is executed, trap 11 must be installed via the
  17.  ; execution of program DONGTRAP.PRG.  Execute this program by selecting
  18.  ; it from the accessory menu.
  19.  
  20. program_start:
  21.  lea       stack(pc), a7        ; A7 points to program's stack address.
  22.  lea       aes_pb(pc), a3       ; aes_pb = AES parameter block.
  23.  lea       control(pc), a4      ; A4 is pointer for array "control".
  24.  move.w    #$C8, d3             ; *** AES call number in D3.
  25.  
  26. initialize_application:
  27.  move.w    #$A, (a4)            ; Function = appl_init = AES $A.
  28.  move.w    #1, 4(a4)            ; Return one int_out parameter.
  29.  move.l    a3, d1               ; A3 contains address of aes parameter block.
  30.  move.w    d3, d0               ; D3 contains AES call number.
  31.  trap      #2                   ; apid returned in int_out[0] and global[2].
  32.  
  33. menu_installation:             
  34.  move.w    #$23, (a4)           ; Function = menu_register = AES $23.
  35.  move.w    #1, 2(a4)            ; Pass one int_in parameter.         
  36.  move.w    #1, 6(a4)            ; Pass one addr_in parameter.
  37.  move.w    int_out(pc), int_in  ; Application identification to int_in[0].
  38.  move.l    #menu_text, addr_in  ; Menu text address to addr_in[0].
  39.  move.l    a3, d1               ; Address of aes parameter block to D1.
  40.  move.w    d3, d0               ; D3 contains AES call number.
  41.  trap      #2                   ; Menu identification number returned
  42.                                 ; in int_out[0].
  43.  move.w    int_out(pc), d4      ; Store menu identification number in D4.
  44.  
  45.  ; MAIN ACCESSORY LOOP
  46.  
  47. wait_for_message:               ; Relinquish processor control.
  48.  move.w    #$17, (a4)           ; Function = evnt_mesag = AES $17.
  49.  move.w    #0, 2(a4)
  50.  move.l    #message, addr_in    ; Address of message array to addr_in.
  51.  move.l    a3, d1               ; Address of aes parameter block to D1.
  52.  move.w    d3, d0               ; AES call number to D0.
  53.  trap      #2                   ; Message received is placed in array
  54.                                 ; "message".
  55.  
  56. ; Enters here only when a message is received.
  57.  
  58. message_handler:                ; Entrance point when message is received.
  59.  cmpi.w    #$28, message        ; Compare AC OPEN code with message[0].
  60.  bne.s     wait_for_message     ; Execute the evnt_mesag function.
  61.  move.w    message+8, d0        ; id_selected (message[4]) = menu ID of
  62.                                 ; item user selected.
  63.  cmp.w     d4, d0               ; Was this application selected.
  64.  bne.s     wait_for_message     ; Execute the evnt_mesag function.
  65.  
  66. invoke_software_dongle:
  67.  trap       #11
  68.  bra        wait_for_message
  69.  
  70.  data
  71. menu_text:       dc.b '  DONGLE  ',0
  72.  align                    ; Align storage on a word boundary.
  73.  ;
  74.  ; AES PARAMETER BLOCK
  75.  ; 
  76. aes_pb:          dc.l   control,global,int_in,int_out,addr_in,addr_out
  77.  ;
  78.  ; AES CONTROL TABLE
  79.  ;
  80.  bss
  81. control:          ds.w    5
  82. global:           ds.w    3
  83.                   ds.l    6
  84. int_in:           ds.w    1     ; Input parameter.
  85. int_out:          ds.w    1     ; Output parameter.
  86. addr_in:          ds.l    1     ; Input address.
  87. addr_out:         ds.l    1     ; Output address.
  88.  ;
  89.  ; OTHER VARIABLES
  90.  ;
  91. message:          ds.w    8
  92.                   ds.l   48
  93. stack:            ds.l    0
  94. program_end:      ds.l    0
  95.  end
  96.  
  97.