home *** CD-ROM | disk | FTP | other *** search
/ Fujiology Archive / fujiology_archive_v1_0.iso / !MAGS / !BONUS / COVERDSK / STFORMAT / STF10.ZIP / STF10.MSA / DEVPACST.V2_EXAMPLE.S < prev    next >
Text File  |  1987-04-21  |  4KB  |  189 lines

  1.  
  2. * a sample GEM program supplied with DevpacST version 2
  3.  
  4. * macro to call a given AES routine
  5. aes    macro    aes_number
  6.     moveq    #\1,d0
  7.     bsr    CALL_AES
  8.     endm
  9.  
  10. appl_init    macro
  11.     aes    10
  12.     endm
  13.  
  14. appl_exit    macro
  15.     aes    19
  16.     endm
  17.  
  18. form_alert    macro    button,string
  19.     move.w    \1,int_in
  20.     move.l    \2,addr_in
  21.     aes    52
  22.     endm
  23.  
  24. graf_mouse    macro    num<,addr>
  25.     move.w    \1,int_in
  26.     IFNC    '\2',''
  27.     move.l    \2,addr_in
  28.     ENDC
  29.     aes    78
  30.     endm
  31.  
  32.     SECTION    TEXT
  33. start
  34.     move.l    4(a7),a3        base page
  35.     move.l    #mystack,a7
  36.     move.l    $c(a3),d0        text len
  37.     add.l    $14(a3),d0        data len
  38.     add.l    $1c(a3),d0        BSS len
  39.     add.l    #$100,d0        basepage
  40.     move.l    d0,-(sp)
  41.     move.l    a3,-(sp)
  42.     clr.w    -(sp)
  43.     move.w    #$4a,-(sp)
  44.     trap    #1            shrink memory
  45.     lea    12(sp),sp
  46.  
  47.     appl_init
  48.  
  49. * set the mouse to an arrow
  50.     graf_mouse    #0        arrow please
  51.  
  52.     form_alert    #1,#about_alert
  53.  
  54.     appl_exit            tell GEM I've finished
  55.  
  56. * now quit to the desktop
  57.     clr.w    -(a7)            status code
  58.     move.w    #$4c,-(a7)        P_TERM
  59.     trap    #1            and go away
  60.  
  61.     SECTION    DATA
  62. about_alert    dc.b    '[1][A test program written|'
  63.         dc.b    'with DevpacST Version 2|'
  64.         dc.b    'ST Format Demo Version|'
  65.         dc.b    'Full version from HiSoft|'
  66.         dc.b    'Phone: +44 525 718181' 
  67.         dc.b    '][ Great ]',0
  68.  
  69.     SECTION    BSS
  70.     ds.b    256            stack space
  71. mystack    ds.w    1            (stacks go backwards)
  72.  
  73.     SECTION    TEXT
  74. * call an AES routine
  75. * in:    d0.w=AES function number
  76. * out    d0.w=int_out value
  77. * uses    d0-d2/a0-a2
  78. * (assumes control4 needs to be zero)
  79. CALL_AES    lea    control,a1
  80.     move.w    d0,(a1)+            store the op code
  81.     sub.w    #10,d0
  82.     mulu    #3,d0            size is the priority, not speed
  83.     lea    gem_ctrl_list,a0
  84.     add.w    d0,a0            points to the entry
  85.     moveq    #0,d0
  86.     move.b    (a0)+,d0
  87.     move.w    d0,(a1)+        do control1
  88.     move.b    (a0)+,d0
  89.     move.w    d0,(a1)+        and control2
  90.     move.b    (a0)+,d0
  91.     move.w    d0,(a1)+        and control3
  92.     clr.w    (a1)            assumes control4=0 (all except RSRC_GADDR)
  93.     move.l    #aes_params,d1
  94.     move.w    #200,d0            function number
  95.     trap    #2
  96.     move.w    int_out,d0        usually a returned value
  97.     rts
  98.  
  99.     SECTION    DATA
  100. * this is a table of pointers to all the AES arrays
  101. aes_params    dc.l    control,global,int_in,int_out,addr_in,addr_out
  102.  
  103. * this is the list of Control parameters for the AES calls
  104. * contains control(1..3), comment is the function number
  105. * (an asterisk indicates it is not defined)
  106. gem_ctrl_list
  107.     dc.b    0,1,0    10
  108.     dc.b    2,1,1    11
  109.     dc.b    2,1,1    12
  110.     dc.b    0,1,1    13
  111.     dc.b    2,1,1    14
  112.     dc.b    1,1,1    15
  113.     dc.b    0,0,0    16*
  114.     dc.b    0,0,0    17*
  115.     dc.b    0,0,0    18*
  116.     dc.b    0,1,0    19
  117.     dc.b    0,1,0    20
  118.     dc.b    3,5,0    21
  119.     dc.b    5,5,0    22
  120.     dc.b    0,1,1    23
  121.     dc.b    2,1,0    24
  122.     dc.b    16,7,1    25
  123.     dc.b    2,1,0    26
  124.     dc.b    0,0,0    27*
  125.     dc.b    0,0,0    28*
  126.     dc.b    0,0,0    29*
  127.     dc.b    1,1,1    30
  128.     dc.b    2,1,1    31
  129.     dc.b    2,1,1    32
  130.     dc.b    2,1,1    33
  131.     dc.b    1,1,2    34
  132.     dc.b    1,1,1    35
  133.     dc.b    0,0,0    36*
  134.     dc.b    0,0,0    37*
  135.     dc.b    0,0,0    38*
  136.     dc.b    0,0,0    39*
  137.     dc.b    2,1,1    40
  138.     dc.b    1,1,1    41
  139.     dc.b    6,1,1    42
  140.     dc.b    4,1,1    43
  141.     dc.b    1,3,1    44
  142.     dc.b    2,1,1    45
  143.     dc.b    4,2,1    46
  144.     dc.b    8,1,1    47
  145.     dc.b    0,0,0    48*
  146.     dc.b    0,0,0    49*
  147.     dc.b    1,1,1    50
  148.     dc.b    9,1,0    51
  149.     dc.b    1,1,1    52
  150.     dc.b    1,1,0    53
  151.     dc.b    0,5,1    54
  152.     dc.b    0,0,0    55*
  153.     dc.b    0,0,0    56*
  154.     dc.b    0,0,0    57*
  155.     dc.b    0,0,0    58*
  156.     dc.b    0,0,0    59*
  157.     dc.b    0,0,0    60*
  158.     dc.b    0,0,0    61*
  159.     dc.b    0,0,0    62*
  160.     dc.b    0,0,0    63*
  161.     dc.b    0,0,0    64*
  162.     dc.b    0,0,0    65*
  163.     dc.b    0,0,0    66*
  164.     dc.b    0,0,0    67*
  165.     dc.b    0,0,0    68*
  166.     dc.b    0,0,0    69*
  167.     dc.b    4,3,0    70
  168.     dc.b    8,3,0    71
  169.     dc.b    6,1,0    72
  170.     dc.b    8,1,0    73
  171.     dc.b    8,1,0    74
  172.     dc.b    4,1,1    75
  173.     dc.b    3,1,1    76
  174.     dc.b    0,5,0    77
  175.     dc.b    1,1,1    78
  176.     even
  177.  
  178.     SECTION    BSS
  179. * these don't need initialising so can go in the BSS section
  180. control        ds.w    5
  181. global        ds.w    14
  182. int_in        ds.w    16
  183. int_out        ds.w    7
  184. addr_in        ds.l    3
  185. addr_out    ds.l    1
  186.  
  187.  
  188. * the program proper
  189.