home *** CD-ROM | disk | FTP | other *** search
/ Otherware / Otherware_1_SB_Development.iso / mac / developm / scnote / tesample.002 / TESampleGlue.s < prev    next >
Text File  |  1989-06-01  |  4KB  |  123 lines

  1. #
  2. #    Apple Macintosh Developer Technical Support
  3. #
  4. #    MultiFinder-Aware TextEdit Sample Application
  5. #
  6. #    TESample
  7. #
  8. #    TESample.a    -    Assembler Source
  9. #
  10. #    Copyright ⌐ 1989 Apple Computer, Inc.
  11. #    All rights reserved.
  12. #
  13. #    Versions:    
  14. #                1.00                08/88
  15. #                1.01                11/88
  16. #                1.02                04/89
  17. #                1.03                06/89
  18. #
  19. #    Components:
  20. #                TESample.p            June 1, 1989
  21. #                TESample.c            June 1, 1989
  22. #                TESampleGlue.a        June 1, 1989    -MPW only-
  23. #                TESample.r            June 1, 1989
  24. #                TESample.h            June 1, 1989
  25. #                PTESample.make        June 1, 1989    -MPW only-
  26. #                CTESample.make        June 1, 1989    -MPW only-
  27. #                TESampleGlue.s        June 1, 1989    -A/UX only-
  28. #                TESampleAUX.r        June 1, 1989    -A/UX only-
  29. #                Makefile            June 1, 1989    -A/UX only-
  30. #
  31. #    TESample is an example application that demonstrates how 
  32. #    to initialize the commonly used toolbox managers, operate 
  33. #    successfully under MultiFinder, handle desk accessories and 
  34. #    create, grow, and zoom windows. The fundamental TextEdit 
  35. #    toolbox calls and TextEdit autoscroll are demonstrated. It 
  36. #    also shows how to create and maintain scrollbar controls.
  37. #
  38. #    It does not by any means demonstrate all the techniques you 
  39. #    need for a large application. In particular, Sample does not 
  40. #    cover exception handling, multiple windows/documents, 
  41. #    sophisticated memory management, printing, or undo. All of 
  42. #    these are vital parts of a normal full-sized application.
  43. #
  44. #    This application is an example of the form of a Macintosh 
  45. #    application; it is NOT a template. It is NOT intended to be 
  46. #    used as a foundation for the next world-class, best-selling, 
  47. #    600K application. A stick figure drawing of the human body may 
  48. #    be a good example of the form for a painting, but that does not 
  49. #    mean it should be used as the basis for the next Mona Lisa.
  50. #
  51. #    We recommend that you review this program or Sample before 
  52. #    beginning a new application. Sample is a simple app. which doesnUt 
  53. #    use TextEdit or the Control Manager.
  54. #
  55.  
  56. #
  57. #    AsmClikLoop
  58. #
  59. #    This routine gets called by the TextEdit Manager from TEClick.
  60. #    It calls the old, default click loop routine that scrolls the
  61. #    text, and then calls our own Pascal routine that handles
  62. #    tracking the scroll bars to follow along.  It doesn't bother
  63. #    with saving registers A0 and D0, because they are trashed
  64. #    anyway by TextEdit.
  65. #
  66.  
  67.     text
  68.  
  69.     global AsmClikLoop
  70. AsmClikLoop:
  71.  
  72. #    movem.l    %d1/%d2/%a1,-(%sp)        # d0 and a0 need not be saved
  73.     jsr    GetOldClikLoop            # get the old clikloop
  74. #    movem.l    (%sp)+,%d1/%d2/%a1        # restore the world as it was
  75.  
  76.     jsr    (%a0)                # and execute old clikloop
  77.  
  78. #    movem.l    %d1/%d2/%a1,-(%sp)        # d0 and a0 need not be saved
  79.     jsr    CClikLoop            # do our clikloop
  80. #    movem.l    (%sp)+,%d1/%d2/%a1        # restore the world as it was
  81.     move.l    &1,%d0            # clear the zero flag so textedit keeps going
  82.     rts
  83.  
  84.  
  85. # A/UX C doesn't now how to generate a Pascal calling sequence for a ROM
  86. # call-back routine.  So this routine takes the place of the VActionProc
  87. # declared in the TESample.c source.  This code, in turn, translates the
  88. # Pascal calling sequence into the C calling sequence and calls the 
  89. # VActionProc in TESample.c, now called CVActionProc
  90. # void        VActionProc (theControl,partCode)
  91. # ControlHandle    theControl;
  92. # short        partCode;
  93.  
  94.     global    VActionProc
  95. VActionProc:
  96.     move.w    4(%a7),-(%a7)
  97.     clr.w    -(%a7)
  98.     move.l    10(%a7),-(%a7)
  99.     jsr    CVActionProc        # Call the C version
  100.     move.l    8(%a7),%a1
  101.     add.l    &18,%a7
  102.     jmp    (%a1)
  103.  
  104. # A/UX C doesn't now how to generate a Pascal calling sequence for a ROM
  105. # call-back routine.  So this routine takes the place of the HActionProc
  106. # declared in the TESample.c source.  This code, in turn, translates the
  107. # Pascal calling sequence into the C calling sequence and calls the 
  108. # HActionProc in TESample.c, now called CHActionProc
  109. # void        HActionProc (theControl,partCode)
  110. # ControlHandle    theControl;
  111. # short        partCode;
  112.  
  113.     global    HActionProc
  114. HActionProc:
  115.     move.w    4(%a7),-(%a7)
  116.     clr.w    -(%a7)
  117.     move.l    10(%a7),-(%a7)
  118.     jsr    CHActionProc        # Call the C version
  119.     move.l    8(%a7),%a1
  120.     add.l    &18,%a7
  121.     jmp    (%a1)
  122.  
  123.