home *** CD-ROM | disk | FTP | other *** search
/ No Fragments Archive 10: Diskmags / nf_archive_10.iso / MAGS / ST_USER / 1993 / USERJN93.MSA / DEVPAC2_DESKACC.S < prev    next >
Text File  |  1993-04-20  |  3KB  |  110 lines

  1.  
  2. * a sample desk accessory supplied with DevpacST version 2
  3.  
  4. * Source code Copyright (C) 1988 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:20.4.88
  23.  
  24. * this is a conditional so that a program may be assembled as
  25. * an accessory or as stand-alone to debug
  26.  
  27. RUNNER    equ    0        1 for .PRG, 0 for .ACC
  28.  
  29. * NOTE: with this particular program assembled stand-alone there is no way
  30. * to exit from the program!
  31.  
  32.     IFEQ    RUNNER
  33.     OUTPUT    .ACC
  34.     ELSEIF
  35.     opt x+                dump long labels for debugging
  36.     OUTPUT    .PRG
  37.     ENDC
  38.  
  39.     include    gemmacro.s
  40.  
  41. * the program proper
  42.     IFEQ    RUNNER
  43. start    move.l    #mystack,a7        must have a stack!
  44.     ELSEIF
  45. start    move.l    4(a7),a3        base page
  46.     move.l    #mystack,a7
  47.     move.l    $c(a3),d0        text len
  48.     add.l    $14(a3),d0        data len
  49.     add.l    $1c(a3),d0        BSS len
  50.     add.l    #$100,d0        basepage
  51.     move.l    d0,-(sp)
  52.     move.l    a3,-(sp)
  53.     clr.w    -(sp)
  54.     move.w    #$4a,-(sp)
  55.     trap    #1            shrink memory
  56.     lea    12(sp),sp
  57.     ENDC
  58.  
  59.     appl_init
  60.     move.w    d0,ap_id        store the application id
  61.  
  62.     IFEQ    RUNNER
  63. * start by installing me in the Desk menu
  64.     menu_register    ap_id,#mymenu
  65.     ELSEIF
  66. * set the mouse to an arrow
  67.     graf_mouse    #0
  68.     bra    open_acc        then pretend an Open
  69.     ENDC
  70.  
  71. * the main loop of the application
  72. * the only interesting events are messages
  73. waitforevent
  74.     evnt_mesag    #messagebuf
  75.     move.l    #messagebuf,a0
  76.     move.w    (a0),d0            message type
  77.     cmp.w    #40,d0
  78.     beq    open_acc
  79. * check others here
  80.     bra.s    waitforevent
  81.  
  82. * here when I have to Open
  83. open_acc
  84.     form_alert    #1,#myalert
  85.     bra    waitforevent
  86.  
  87.     SECTION    DATA
  88.  
  89. * all C strings must end in a null
  90. mymenu    dc.b    '  HiSoft Demo',0
  91.  
  92. myalert dc.b    '[1][This is a Desk Accessory|'
  93.     dc.b    'written with DevpacST v2][ OK ]',0
  94.  
  95. * global constants
  96.     SECTION    BSS
  97.  
  98. ap_id        ds.w 1
  99. messagebuf    ds.b 16
  100.  
  101.     ds.l    100            stack space
  102. mystack    ds.w    1            (stacks go backwards)
  103.  
  104.  
  105. * if not linking then include the run-times
  106.  
  107.     IFEQ    __LK
  108.     include    aeslib.s
  109.     ENDC
  110.