home *** CD-ROM | disk | FTP | other *** search
/ SPACE 1 / SPACE - Library 1 - Volume 1.iso / misc~1 / 199 / lib / aes.c < prev    next >
Encoding:
C/C++ Source or Header  |  1988-03-14  |  13.8 KB  |  939 lines

  1. /* 
  2.  * the AES library
  3.  * contains AES calls for GEM
  4.  */
  5.  
  6. extern int    ct0, ct1, ct2, ct3, ct4, ct5, ct6;
  7. extern int    ii0, ii1, ii2, ii3, ii4, ii5, ii6, ii7, ii8, ii9,
  8.         ii10, ii11, ii12, ii13, ii14, ii15;
  9. extern int    io0, io1, io2, io3, io4, io5, io6, iox[40];
  10. extern int    pi0, pi1, pi2, pi3, pi4, pi5, pi6, pi7, pix[6];
  11. extern int    po0, po1, po2, po3, pox[12];
  12. extern int     *ai0, *ai1;
  13. extern int    *ao0;
  14. extern int    *aes0, *aes1, *aes2, *aes3, *aes4, *aes5;
  15. extern int    *vdi0, *vdi1, *vdi2, *vdi3, *vdi4;
  16. extern int    global[16];
  17.  
  18. /* 
  19.  * the c runtime start up routine for GEM processes
  20.  * no argv argc stuff, no stdio (use TOS routines for file access)
  21.  *
  22.  * assumes a startup prg.s of
  23.  *    . _bstk 2048
  24.  *    . _estk 4
  25.  *    taa 7 6
  26.  *    lll 4 0
  27.  *    sgl _estk
  28.  *    lag _estk 7
  29.  *    jsr _cprg
  30.  * plus definitions for all the above externs
  31.  */
  32.  
  33. #define SETBLK    0x4A
  34. #define EXIT    0x4C
  35.  
  36. _cprg(tpa) long tpa; {
  37.     int i;
  38.     long x, *lp;
  39.  
  40.     /* compute size of program, give memory back to TOS */
  41.     lp = tpa;
  42.     x = lp[3] + lp[5] + lp[7] + 0x100;
  43.     if (trap(1, SETBLK, 0, tpa, x))
  44.         appl_exit(-1);
  45.  
  46.     /* set up the aespb and vdipb arrays */
  47.     aes0 = &ct0;
  48.     aes1 = global;
  49.     aes2 = &ii0;
  50.     aes3 = &io0;
  51.     aes4 = &ai0;
  52.     aes5 = &ao0;
  53.     vdi0 = &ct0;
  54.     vdi1 = &ii0;
  55.     vdi2 = &pi0;
  56.     vdi3 = &io0;
  57.     vdi4 = &po0;
  58.     
  59.     /* run the program */
  60.     i = main();
  61.  
  62.     /* close up shop */
  63.     appl_exit(i);
  64. }
  65.  
  66. /* GEM application handling */
  67.  
  68. appl_init() {
  69.     ct0 = 10;
  70.     ct2 = 1;
  71.     ct1 = ct3 = ct4 = 0;
  72.     aes();
  73.     return io0;
  74. }
  75.  
  76. appl_read(id,length,pbuff) char *pbuff; {
  77.     ct0 = 11;
  78.     ct1 = 2;
  79.     ct2 = ct3 = 1;
  80.     ct4 = 0;
  81.     ii0= id;
  82.     ii1 = length;
  83.     ai0 = pbuff;
  84.     aes();
  85.     return io0;
  86. }
  87.  
  88. appl_write(id,length,pbuff) char *pbuff; {
  89.     ct0 = 12;
  90.     ct1 = 2;
  91.     ct2 = ct3 = 1;
  92.     ct4 = 0;
  93.     ii0= id;
  94.     ii1 = length;
  95.     ai0 = pbuff;
  96.     aes();
  97.     return io0;
  98. }
  99.  
  100. appl_find(pname) char *pname; {
  101.     ct0 = 13;
  102.     ct1 = ct4 = 0;
  103.     ct2 = ct3 = 1;
  104.     ai0 = pname;
  105.     aes();
  106.     return io0;
  107. }
  108.  
  109. appl_tplay(mem,num,scale) char *mem; {
  110.     ct0 = 14;
  111.     ct1 = 2;
  112.     ct2 = ct3 = 1;
  113.     ct4 = 0;
  114.     ii0= num;
  115.     ii1 = scale;
  116.     ai0 = mem;
  117.     aes();
  118.     return io0;
  119. }
  120.  
  121. appl_trecord(mem,count) char *mem; {
  122.     ct0 = 15;
  123.     ct1 = ct2 = ct3 = 1;
  124.     ct4 = 0;
  125.     ii0 = count;
  126.     ai0 = mem;
  127.     aes();
  128.     return io0;
  129. }
  130.  
  131. appl_exit(i) { trap(1, EXIT, i); }
  132.  
  133.  
  134. /* GEM Event handling library */
  135.  
  136. evnt_keybd() {
  137.     ct0 = 20;
  138.     ct1 = ct3 = ct4 = 0;
  139.     ct2 = 1;
  140.     aes();
  141.     return io0;
  142. }
  143.  
  144. evnt_button(clicks,mask,state,mx,my,button,kstate) 
  145.         int *mx,*my,*button,*kstate; {
  146.     ct0 = 21;
  147.     ct1= 3;
  148.     ct2 = 5;
  149.     ct3 = ct4 = 0;
  150.     ii0 = clicks;
  151.     ii1 = mask;
  152.     ii2 = state;
  153.     aes();
  154.     *mx = io1;
  155.     *my = io2;
  156.     *button = io3;
  157.     *kstate = io4;
  158.     return io0;
  159. }
  160.  
  161. evnt_mouse(flags,x,y,width,height,mx,my,button,kstate)
  162.         int *mx,*my,*button,*kstate; {
  163.     ct0 = 22;
  164.     ct1 = ct2 = 5;
  165.     ct3 = ct4 = 0;
  166.     ii0 = flags;
  167.     ii1 = x;
  168.     ii2 = y;
  169.     ii3 = width;
  170.     ii4 = height;
  171.     aes();
  172.     *mx = io1;
  173.     *my = io2;
  174.     *button = io3;
  175.     *kstate = io4;
  176.     return io0;
  177. }
  178.  
  179. evnt_mesag(pbuff) char *pbuff; {
  180.     ct0 = 23;
  181.     ct1 = ct4 = 0;
  182.     ct2 = ct3 = 1;
  183.     ai0 = pbuff;
  184.     aes();
  185.     return io0;
  186. }
  187.  
  188. evnt_timer(locount,hicount) {
  189.     ct0 = 24;
  190.     ct1 = 2;
  191.     ct2 = 1;
  192.     ct3 = ct4 = 0;
  193.     ii0 = locount;
  194.     ii1 = hicount;
  195.     aes();
  196.     return io0;
  197. }
  198.  
  199. evnt_multi(flags,bclicks,bmask,bstate,mlflags,mlx,mly,mlwidth,mlheight,
  200.     m2flags,m2x,m2y,m2width,m2height,mgpbuff,tlocount,thicount,
  201.     mox,moy,mobutton,mokstate,kreturn,breturn) 
  202.     int *mox,*moy,*mobutton,*mokstate,*kreturn,*breturn; char *mgpbuff; {
  203.  
  204.     ct0 = 25;
  205.     ct1 = 16;
  206.     ct2 = 7;
  207.     ct3 = 1;
  208.     ct4 = 0;
  209.     ii0 = flags;
  210.     ii1 = bclicks;
  211.     ii2 = bmask;
  212.     ii3 = mlflags;
  213.     ii4 = mlflags;
  214.     ii5 = mlx;
  215.     ii6 = mly;
  216.     ii7 = mlwidth;
  217.     ii8 = mlheight;
  218.     ii9 = m2flags;
  219.     ii10 = m2x;
  220.     ii11 = m2y;
  221.     ii12 = m2width;
  222.     ii13 = m2height;
  223.     ii14 = tlocount;
  224.     ii15 = thicount;
  225.     ai0 = mgpbuff;
  226.     aes();
  227.     *mox = io1;
  228.     *moy = io2;
  229.     *mobutton = io3;
  230.     *mokstate = io4;
  231.     *kreturn = io5;
  232.     *breturn = io6;
  233.     return io0;
  234. }
  235.  
  236. evnt_dclick(new,getset) {
  237.     ct0 = 26;
  238.     ct1 = 2;
  239.     ct2 = 1;
  240.     ct3 = ct4 = 0;
  241.     ii0 = new;
  242.     ii1 = getset;
  243.     aes();
  244.     return io0;
  245. }
  246.  
  247. /* AES: resource handling */
  248.     
  249. rsrc_load(pfname) char *pfname; {
  250.     ct0 = 110;
  251.     ct1 = ct4 = 0;
  252.     ct2 = ct3 = 1;
  253.     ai0 = pfname;
  254.     aes();
  255.     return io0;
  256. }
  257.  
  258. rsrc_free() {
  259.     ct0 = 111;
  260.     ct1 = ct3 = ct4 = 0;
  261.     ct2 = 1;
  262.     aes();
  263.     return io0;
  264. }
  265.  
  266. rsrc_gaddr(type, index, addr) long **addr; {
  267.     ct0 = 112;
  268.     ct1 = 2;
  269.     ct2 = ct4 = 1;
  270.     ct3 = 0;
  271.     ii0 = type;
  272.     ii1 = index;
  273.     aes();
  274.     *addr = ao0;
  275.     return io0;
  276. }
  277.  
  278. rsrc_saddr(type, index, addr) long *addr; {
  279.     ct0 = 113;
  280.     ct1 = 2;
  281.     ct2 = ct3 = 1;
  282.     ct4 = 0;
  283.     ii0 = type;
  284.     ii1 = index;
  285.     ai0 = addr;
  286.     aes();
  287.     return io0;
  288. }
  289.  
  290. rsrc_obfix(tree,object) int *tree; {
  291.     ct0 = 114;
  292.     ct1 = ct2 = ct3 = 1;
  293.     ct4 = 0;
  294.     ii0 = object;
  295.     ai0 = tree;
  296.     aes();
  297.     return io0;
  298. }
  299.  
  300. /* shell handling */
  301.  
  302. shel_read(pcmd,ptail) char *pcmd, *ptail; {
  303.     ct0 = 120;
  304.     ct1 = ct4 = 0;
  305.     ct2 = 1;
  306.     ct3 = 2;
  307.     ai0 = pcmd;
  308.     ai1 = ptail;
  309.     aes();
  310.     return io0;
  311. }
  312.  
  313. shel_write(doex,isgr,iscr,pcmd,ptail) char *pcmd, *ptail; {
  314.     ct0 = 121;
  315.     ct1 = 3;
  316.     ct2 = 1;
  317.     ct3 = 2;
  318.     ct4 = 0;
  319.     ii0 = doex;
  320.     ii1 = isgr;
  321.     ii2 = iscr;
  322.     ai0 = pcmd;
  323.     ai1 = ptail;
  324.     aes();
  325.     return io0;
  326. }
  327.  
  328. shel_find(pbuff) char *pbuff; {
  329.     ct0 = 124;
  330.     ct1 = ct4 = 0;
  331.     ct2 = ct3 = 1;
  332.     ai0 = pbuff;
  333.     aes();
  334.     return io0;
  335. }
  336.  
  337. shel_envrn(pvalue,parm) long *pvalue; char *parm; {
  338.     ct0 = 125;
  339.     ct1 = ct4 = 0;
  340.     ct2 = 1;
  341.     ct3 = 3;
  342.     ai0 = pvalue;
  343.     ai1 = parm;
  344.     aes();
  345.     return io0;
  346. }
  347.  
  348. /* graphics handling */
  349.  
  350. graf_handle(wchar, hchar, wbox, hbox) int *wchar, *hchar, *wbox, *hbox; {
  351.     ct0 = 77;
  352.     ct2 = 5;
  353.     ct1 = ct3 = ct4 = 0;
  354.     aes();
  355.     *wchar = io1;
  356.     *hchar = io2;
  357.     *wbox = io3;
  358.     *hbox = io4;
  359.     return io0;
  360. }
  361.  
  362. graf_rubberbox(x, y, minw, minh, lastw, lasth) int *lastw, *lasth; { 
  363.     ct0 = 70;
  364.     ct1 = 4;
  365.     ct2 = 3;
  366.     ct3 = ct4 = 0;
  367.     ii0 = x;
  368.     ii1 = y;
  369.     ii2 = minw;
  370.     ii3 = minh;
  371.     aes();
  372.     *lastw = io1;
  373.     *lasth = io2;
  374.     return io0;
  375. }
  376.  
  377. graf_dragbox(dw, dh, sx, sy, bx, by, bw, bh, endx, endy) int *endx, *endy; {
  378.     ct0 = 71;
  379.     ct1 = 8;
  380.     ct2 = 3;
  381.     ct3 = ct4 = 0;
  382.     ii0 = dw;
  383.     ii1 = dh;
  384.     ii2 = sx;
  385.     ii3 = sy;
  386.     ii4 = bx;
  387.     ii5 = by;
  388.     ii6 = bw;
  389.     ii7 = bh;
  390.     aes();
  391.     *endx = io1;
  392.     *endy = io2;
  393.     return io0;
  394. }
  395.  
  396. graf_movebox(w, h, sx, sy, dx, dy) {
  397.     ct0 = 72;
  398.     ct1 = 6;
  399.     ct2 = 1;
  400.     ct3 = ct4 = 0;
  401.     ii0 = w;
  402.     ii1 = h;
  403.     ii2 = sx;
  404.     ii3 = sy;
  405.     ii4 = dx;
  406.     ii5 = dy;
  407.     aes();
  408.     return io0;
  409. }
  410.  
  411. graf_growbox(bx, by, bw, bh, ex, ey, ew, eh) {
  412.     ct0 = 73;
  413.     ct1 = 8;
  414.     ct2 = 1;
  415.     ct3 = ct4 = 0;
  416.     aes2 = &bx;
  417.     aes();
  418.     aes2 = &ii0;
  419.     return io0;
  420. }
  421.     
  422. graf_shrinkbox(ex, ey, ew, eh, bx, by, bw, bh) {
  423.     ct0 = 73;
  424.     ct1 = 8;
  425.     ct2 = 1;
  426.     ct3 = ct4 = 0;
  427.     aes2 = &ex;
  428.     aes();
  429.     aes2 = &ii0;
  430.     return io0;
  431. }
  432.  
  433. graf_watchbox(tree, obj, instate, outstate) int *tree; { 
  434.     ct0 = 75;
  435.     ct1 = 4;
  436.     ct2 = ct3 = 1;
  437.     ct4 = 0;
  438.     ii1 = obj;
  439.     ii2 = instate;
  440.     ii3 = outstate;
  441.     ai0 = tree;
  442.     aes();
  443.     return io0;
  444. }
  445.  
  446. graf_slidebox(tree, parent, obj, vh) int *tree; { 
  447.     ct0 = 76;
  448.     ct1 = 3;
  449.     ct2 = ct3 = 1;
  450.     ct4 = 0;
  451.     ii0 = parent;
  452.     ii1 = obj;
  453.     ii2 = vh;
  454.     ai0 = tree;
  455.     aes();
  456.     return io0;
  457. }
  458.  
  459. graf_mouse(type, shape) int *shape; { 
  460.     ct0 = 78;
  461.     ct1 = ct2 = ct3 = 1;
  462.     ct4 = 0;
  463.     ii0 = type;
  464.     ai0 = shape;
  465.     aes();
  466.     return io0;
  467. }
  468.  
  469. graf_mkstate(x, y, mstate, kstate) int *x, *y, *mstate, *kstate; { 
  470.     ct0 = 79;
  471.     ct1 = ct3 = ct4 = 0;
  472.     ct2 = 5;
  473.     aes();
  474.     *x = io1;
  475.     *y = io2;
  476.     *mstate = io3;
  477.     *kstate = io4;
  478.     return io0;
  479. }
  480.  
  481. /* scrap handling */
  482.  
  483. scrp_read(pscrap) char *pscrap; {
  484.     ct0 = 80;
  485.     ct1 = ct4 = 0;
  486.     ct2 = ct3 = 1;
  487.     ai0 = pscrap;
  488.     return io0;
  489. }
  490.  
  491. scrp_write(pscrap) char *pscrap; {
  492.     ct0 = 81;
  493.     ct1 = ct4 = 0;
  494.     ct2 = ct3 = 1;
  495.     ai0 = pscrap;
  496.     return io0;
  497. }
  498.  
  499. /* file selector handling */
  500.  
  501. fsel_input(inpath,insel,exbutton) char *inpath, *insel; int *exbutton; {
  502.     ct0 = 90;
  503.     ct1 = ct4 = 0;
  504.     ct2 = ct3 = 2;
  505.     ai0 = inpath;
  506.     ai1 = insel;
  507.     aes();
  508.     *exbutton = io1;
  509.     return io0;
  510. }
  511.  
  512. /* window handling */
  513.  
  514. wind_get(handle, gfld, gw1, gw2, gw3, gw4) int *gw1, *gw2, *gw3, *gw4; {
  515.     ct0 = 104;
  516.     ct1 = 2;
  517.     ct2 = 5;
  518.     ct3 = ct4 = 0;
  519.     ii0 = handle;
  520.     ii1 = gfld;
  521.     aes();
  522.     *gw1 = io1;
  523.     *gw2 = io2;
  524.     *gw3 = io3;
  525.     *gw4 = io4;
  526.     return io0;
  527. }
  528.  
  529. wind_create(kind, x, y, w, h) {
  530.     ct0 = 100;
  531.     ct1 = 5;
  532.     ct2 = 1;
  533.     ct3 = ct4 = 0;
  534.     ii0 = kind;
  535.     ii1 = x;
  536.     ii2 = y;
  537.     ii3 = w;
  538.     ii4 = h;
  539.     aes();
  540.     return io0;
  541. }
  542.  
  543. wind_set(handle, field, s1, s2, s3, s4) {
  544.     ct0 = 105;
  545.     ct1 = 6;
  546.     ct2 = 1;
  547.     ct3 = ct4 = 0;
  548.     ii0 = handle;
  549.     ii1 = field;
  550.     ii2 = s1;
  551.     ii3 = s2;
  552.     ii4 = s3;
  553.     ii5 = s4;
  554.     aes();
  555.     return io0;
  556. }
  557.  
  558. wind_open(handle, x, y, w, h) {
  559.     ct0 = 101;
  560.     ct1 = ct2 = 5;
  561.     ct3 = ct4 = 0;
  562.     ii0 = handle;
  563.     ii1 = x;
  564.     ii2 = y;
  565.     ii3 = w;
  566.     ii4 = h;
  567.     aes();
  568.     return io0;
  569. }
  570.  
  571. wind_close(handle) { 
  572.     ct0 = 102;
  573.     ct1 = ct2 = 1;
  574.     ct3 = ct4 = 0;
  575.     ii0 = handle;
  576.     aes();
  577.     return io0;
  578. }
  579.  
  580. wind_delete(handle) {
  581.     ct0 = 103;
  582.     ct1 = ct2 = 1;
  583.     ct3 = ct4 = 0;
  584.     ii0 = handle;
  585.     aes();
  586.     return io0;
  587. }
  588.  
  589. wind_find(x, y) {
  590.     ct0 = 106;
  591.     ct1 = 2;
  592.     ct2 = 1;
  593.     ct3 = ct4 = 0;
  594.     ii0 = x;
  595.     ii1 = y;
  596.     aes();
  597.     return io0;
  598. }
  599.  
  600. wind_update(n) {
  601.     ct0 = 107;
  602.     ct1 = ct2 = 1;
  603.     ct3 = ct4 = 0;
  604.     ii0 = n;
  605.     aes();
  606.     return io0;
  607. }
  608.  
  609. wind_calc(
  610.     type, kind, xi, yi, wi, hi, 
  611.     xo, yo, wo, ho) int *xo, *yo, *wo, *ho; {
  612.     ct0 = 108;
  613.     ct1 = 6;
  614.     ct2 = 5;
  615.     ct3 = ct4 = 0;
  616.     ii0 = type;
  617.     ii1 = kind;
  618.     ii2 = xi;
  619.     ii3 = yi;
  620.     ii4 = wi;
  621.     ii5 = hi;
  622.     aes();
  623.     *xo = io1;
  624.     *yo = io2;
  625.     *wo = io3;
  626.     *ho = io4;
  627.     return io0;
  628. }
  629.  
  630. /* event handling */
  631.  
  632. event_multi(
  633.   flags, clicks, mask, state, 
  634.   af, ax, ay, aw, ah,
  635.   bf, bx, by, bw, bh,
  636.   buff, lo, hi,
  637.   ox, oy, obut, ostate, okret, obret) 
  638.     int *ox, *oy, *obut, *ostate, *okret, *obret;
  639. {
  640.     ct0 = 25;
  641.     ct1 = 16;
  642.     ct2 = 7;
  643.     ct3 = 1;
  644.     ct4 = 0;
  645.     ii0 = flags;
  646.     ii1 = clicks;
  647.     ii2 = mask;
  648.     ii3 = state;
  649.     ii4 = af;
  650.     ii5 = ax;
  651.     ii6 = ay;
  652.     ii7 = aw;
  653.     ii8 = ah;
  654.     ii9 = bf;
  655.     ii10 = bx;
  656.     ii11 = by;
  657.     ii12 = bw;
  658.     ii13 = bh;
  659.     ii14 = lo;
  660.     ii15 = hi;
  661.     ai0 = buff;
  662.     aes();
  663.     *ox = io1;
  664.     *oy = io2;
  665.     *obut = io3;
  666.     *ostate = io4;
  667.     *okret = io5;
  668.     *obret = io6;
  669.     return io0;
  670. }
  671.  
  672. /* object handling */
  673.  
  674. objc_add(tree,parent,child) int *tree; {
  675.     ct0 = 40;
  676.     ct1 = 2;
  677.     ct2 = ct3 = 1;
  678.     ct4 = 0;
  679.     ii0 = parent;
  680.     ii1 = child;
  681.     ai0 = tree;
  682.     aes();
  683.     return io0;
  684. }
  685.  
  686. objc_delete(tree,object) int *tree; {
  687.     ct0 = 41;
  688.     ct1 = ct2 = ct3 = 1;
  689.     ct4 = 0;
  690.     ii0 = object;
  691.     ai0 = tree;
  692.     aes();
  693.     return io0;
  694. }
  695.  
  696. objc_draw(tree, start, depth, xclip, yclip, wclip, hclip) int *tree; { 
  697.     ct0 = 42;
  698.     ct1 = 6;
  699.     ct2 = ct3 = 1;
  700.     ct4 = 0;
  701.     ii0 = start;
  702.     ii1 = depth;
  703.     ii2 = xclip;
  704.     ii3 = yclip;
  705.     ii4 = wclip;
  706.     ii5 = hclip;
  707.     ai0 = tree;
  708.     aes();
  709.     return io0;
  710. }
  711.  
  712. objc_find(tree, start, depth, x, y) int *tree; { 
  713.     ct0 = 43;
  714.     ct1 = 4;
  715.     ct2 = ct3 = 1;
  716.     ct4 = 0;
  717.     ii0 = start;
  718.     ii1 = depth;
  719.     ii2 = x;
  720.     ii3 = y;
  721.     ai0 = tree;
  722.     aes();
  723.     return io0;
  724. }
  725.  
  726. objc_offset(tree, object, xoff, yoff) int *tree, *xoff, *yoff; {
  727.     ct0 = 43;
  728.     ct1 = 1;
  729.     ct2 = 3;
  730.     ct3 = 1;
  731.     ct4 = 0;
  732.     ii0 = object;
  733.     ai0 = tree;
  734.     aes();
  735.     *xoff = io1;
  736.     *yoff = io2;
  737.     return io0;
  738. }
  739.  
  740. objc_order(tree,object,newpos) int *tree; {
  741.     ct0 = 45;
  742.     ct1 = 2;
  743.     ct2 = ct3 = 1;
  744.     ct4 = 0;
  745.     ii0 = object;
  746.     ii1 = newpos;
  747.     ai0 = tree;
  748.     aes();
  749.     return io0;
  750. }
  751.  
  752. objc_edit(tree, object, ch, idx, kind, newidx) int *tree, *newidx; {
  753.     ct0 = 46;
  754.     ct1 = 4;
  755.     ct2 = 2;
  756.     ct3 = 1;
  757.     ct4 = 0;
  758.     ii0 = object;
  759.     ii1 = ch;
  760.     ii2 = idx;
  761.     ii3 = kind;
  762.     ai0 = tree;
  763.     aes();
  764.     *newidx = io1;
  765.     return io0;
  766. }
  767.  
  768. objc_change(tree, object, resvd, x, y, w, h, state, redraw) int *tree; {
  769.     ct0 = 47;
  770.     ct1 = 8;
  771.     ct2 = ct3 = 1;
  772.     ct4 = 0;
  773.     ii0 = object;
  774.     ii1 = resvd;
  775.     ii2 = x;
  776.     ii3 = y;
  777.     ii4 = w;
  778.     ii5 = h;
  779.     ii6 = state;
  780.     ii7 = redraw;
  781.     ai0 = tree;
  782.     aes();
  783.     return io0;
  784. }
  785.  
  786. /* menu handling */
  787.  
  788. menu_bar(tree, show) int *tree; { 
  789.     ct0 = 30;
  790.     ct1 = ct2 = ct3 = 1;
  791.     ct4 = 0;
  792.     ii0 = show;
  793.     ai0= tree;
  794.     aes();
  795.     return io0;
  796. }
  797.  
  798. menu_icheck(tree, item, check) int *tree; {
  799.     ct0 = 31;
  800.     ct1 = 2;
  801.     ct2 = ct3 = 1;
  802.     ct4 = 0;
  803.     ii0 = item;
  804.     ii1 = check;
  805.     ai0 = tree;
  806.     aes();
  807.     return io0;
  808. }
  809.  
  810. menu_ienable(tree, item, enable) int *tree; {
  811.     ct0 = 32;
  812.     ct1 = 2;
  813.     ct2 = ct3 = 1;
  814.     ct4 = 0;
  815.     ii0 = item;
  816.     ii1 = enable;
  817.     ai0 = tree;
  818.     aes();
  819.     return io0;
  820. }
  821.  
  822. menu_tnormal(tree, title, normal) int *tree; {
  823.     ct0 = 33;
  824.     ct1 = 2;
  825.     ct2 = ct3 = 1;
  826.     ct4 = 0;
  827.     ii0 = title;
  828.     ii1 = normal;
  829.     ai0 = tree;
  830.     aes();
  831.     return io0;
  832. }
  833.  
  834. menu_text(tree, item, text) int *tree; char *text; {
  835.     ct0 = 34;
  836.     ct1 = ct2 = 1;
  837.      ct3 = 2;
  838.     ct4 = 0;
  839.     ii0 = item;
  840.     ai0 = tree;
  841.     ai1 = text;
  842.     aes();
  843.     return io0;
  844. }
  845.  
  846. menu_register(id, string) char *string; {
  847.     ct0 = 35;
  848.     ct1 = ct2 = ct3 = 1;
  849.     ct4 = 0;
  850.     ii0 = id;
  851.     ai0 = string;
  852.     aes();
  853.     return io0;
  854. }
  855.  
  856. /* form handling */
  857.  
  858. form_pf(fmt, args) char *fmt; int args; {
  859.     extern char _pfb[1];
  860.     _dopf(_pfb, fmt, &args);
  861.     form_alert(0, _pfb);
  862. }
  863.  
  864. form_do(tree, start) int *tree; {
  865.     ct0 = 50;
  866.     ct1 = ct3 = 1;
  867.     ct2 = 2;
  868.     ct4 = 0;
  869.     ii0 = start;
  870.     ai0 = tree;
  871.     aes();
  872.     return io0;
  873. }
  874.  
  875. form_dial(flag, sx, sy, sw, sh, bx, by, bw, bh) {
  876.     ct0 = 51;
  877.     ct1 = 9;
  878.     ct3 = ct2 = 1;
  879.     ct4 = 0;
  880.     ii0 = flag;
  881.     ii1 = sx;
  882.     ii2 = sy;
  883.     ii3 = sw;
  884.     ii4 = sh;
  885.     ii5 = bx;
  886.     ii6 = by;
  887.     ii7 = bw;
  888.     ii8 = bh;
  889.     aes();
  890.     return io0;
  891. }
  892.  
  893. form_center(tree, x, y, w, h) int *tree, *x, *y, *w, *h; {
  894.     ct0 = 54;
  895.     ct1 = 0;
  896.     ct3 = 5;
  897.     ct2 = 1;
  898.     ct4 = 0;
  899.     ai0 = tree;
  900.     aes();
  901.     *x = io1;
  902.     *y = io2;
  903.     *w = io3;
  904.     *h = io4;
  905.     return io0;
  906. }
  907.  
  908. form_error(num) {
  909.     ct0 = 53;
  910.     ct1 = ct2 = 1;
  911.     ct3 = ct4 = 0;
  912.     ii0 = num;
  913.     aes();
  914.     return io0;
  915. }
  916.  
  917. form_alert(button, string) char *string; {
  918.     ct0 = 52;
  919.     ct1 = ct2 = ct3 = 1;
  920.     ct4 = 0;
  921.     ii0 = button;
  922.     ai0 = string;
  923.     aes();
  924.     return io0;
  925. }
  926.  
  927.  
  928. /* AES and VDI support routines */
  929.  
  930. aes() {
  931.     /* 
  932.          * load address of aes parameter block into a0
  933.          * transfer a0 to d1
  934.          * load 200 into d0
  935.          * trap #2
  936.          */
  937.     asm( lag aes0 0   tad 0 1   ldw 200 0   trp 2 );
  938. }
  939.