home *** CD-ROM | disk | FTP | other *** search
/ Vectronix 2 / VECTRONIX2.iso / FILES_01 / DEVPAC31.LZH / EXAMPLES / DESKACC.S < prev    next >
Text File  |  1992-08-14  |  3KB  |  111 lines

  1.  
  2. * a sample desk accessory supplied with Devpac
  3.  
  4. * Source code Copyright (C) 1988,1992 HiSoft. All rights reserved.
  5. * No part of this source may be reproduced, transmitted,
  6. * transcribed, or stored in a retrieval system, or translated
  7. * in any form or by any means without the prior written
  8. * permission of HiSoft.
  9.  
  10. * HiSoft makes no representations or warranties with respect
  11. * to the contents hereof and specifically disclaims any
  12. * implied warranties or merchantability or fitness for any
  13. * particular purpose.
  14.  
  15. * feel free to use any or all of the object code
  16.  
  17. * If you cannot assemble this exactly as supplied, tell us.
  18. * If the object doesn't run after you have made any changes,
  19. * please do not tell us, as you're on your own once you
  20. * start messing with it!
  21.  
  22. * last changed:14.8.92
  23. * updated for Devpac 3
  24.  
  25. * this is a conditional so that a program may be assembled as
  26. * an accessory or as stand-alone to debug
  27.  
  28. RUNNER    equ    0        1 for .PRG, 0 for .ACC
  29.  
  30. * NOTE: with this particular program assembled stand-alone there is no way
  31. * to exit from the program!
  32.  
  33.     IFEQ    RUNNER
  34.     OUTPUT    .ACC
  35.     ELSEIF
  36.     opt x+                dump long labels for debugging
  37.     OUTPUT    .PRG
  38.     ENDC
  39.  
  40.     include    gemmacro.i
  41.  
  42. * the program proper
  43.     IFEQ    RUNNER
  44. start    move.l    #mystack,a7        must have a stack!
  45.     ELSEIF
  46. start    move.l    4(a7),a3        base page
  47.     move.l    #mystack,a7
  48.     move.l    $c(a3),d0        text len
  49.     add.l    $14(a3),d0        data len
  50.     add.l    $1c(a3),d0        BSS len
  51.     add.l    #$100,d0        basepage
  52.     move.l    d0,-(sp)
  53.     move.l    a3,-(sp)
  54.     clr.w    -(sp)
  55.     move.w    #$4a,-(sp)
  56.     trap    #1            shrink memory
  57.     lea    12(sp),sp
  58.     ENDC
  59.  
  60.     appl_init
  61.     move.w    d0,ap_id        store the application id
  62.  
  63.     IFEQ    RUNNER
  64. * start by installing me in the Desk menu
  65.     menu_register    ap_id,#mymenu
  66.     ELSEIF
  67. * set the mouse to an arrow
  68.     graf_mouse    #0
  69.     bra    open_acc        then pretend an Open
  70.     ENDC
  71.  
  72. * the main loop of the application
  73. * the only interesting events are messages
  74. waitforevent
  75.     evnt_mesag    #messagebuf
  76.     move.l    #messagebuf,a0
  77.     move.w    (a0),d0            message type
  78.     cmp.w    #40,d0
  79.     beq    open_acc
  80. * check others here
  81.     bra.s    waitforevent
  82.  
  83. * here when I have to Open
  84. open_acc
  85.     form_alert    #1,#myalert
  86.     bra    waitforevent
  87.  
  88.     SECTION    DATA
  89.  
  90. * all C strings must end in a null
  91. mymenu    dc.b    '  HiSoft Demo',0
  92.  
  93. myalert dc.b    '[1][This is a Desk Accessory|'
  94.     dc.b    'written with Devpac 3][ OK ]',0
  95.  
  96. * global constants
  97.     SECTION    BSS
  98.  
  99. ap_id        ds.w 1
  100. messagebuf    ds.b 16
  101.  
  102.     ds.l    100            stack space
  103. mystack    ds.w    1            (stacks go backwards)
  104.  
  105.  
  106. * if not linking then include the run-times
  107.  
  108.     IFEQ    __LK
  109.     include    aeslib.s
  110.     ENDC
  111.