home *** CD-ROM | disk | FTP | other *** search
/ The Fred Fish Collection 1.5 / ffcollection-1-5-1992-11.iso / ff_disks / 300-399 / ff376.lzh / ToolLibrary / src / ToolLibrary.asm < prev    next >
Assembly Source File  |  1990-10-10  |  7KB  |  398 lines

  1. * 07.02.90: a6 wurde in der Library verändert, dadurch Absturz, wenn
  2. *           der Compiler annahm, daß a6 noch unverändert war. Bis auf
  3. *           Create/DeleteExt/StdIO beseitigt. Alles andere mit -ml 
  4. *           compiliert. Stof.c so angepaßt, daß mit -O compiliert werden 
  5. *           kann. Abfrage der einzelnen Funktionen wurde auf switch um-
  6. *           geschrieben.
  7. * 23.03.90: NewRequest angefügt.
  8. * 28.03.90: Neuer Parser (a-e x und pi durch switch erreicht 
  9. * 07.04.90: Alle Konstanten werden erkannt.
  10. * 30.05.90: left/right/mid/Umwftos umgewandelt, jetzt mit Zielangabe.
  11. *           Neue Funktionen. RastPort jetzt immer in A1
  12. * 10.06.90: left/right etc. auf VOID abgeändert, Calc_P auf LONG.
  13. * 11.07.90: IntuitionBase etc. über ToolBase erreichbar. SimpleMenu angefügt.
  14. * 03.08.90: -fi, SetDrMd in Print beseitigt
  15.  
  16.     include "exec/types.i"
  17.     include "exec/initializers.i"
  18.     include "exec/libraries.i"
  19.     include "exec/lists.i"
  20.     include "exec/resident.i"
  21.     include "exec/strings.i"
  22.     include "libraries/dos.i"
  23.     include "exec/io.i"
  24.  
  25. _LVOCloseLibrary    equ -414
  26. _LVOOpenLibrary        equ -552
  27. _LVORemove        equ -252
  28. _LVOFreeMem        equ -210
  29.  
  30. callsys    macro
  31.     jsr _LVO\1(a6)
  32.     endm
  33.  
  34. xlib    macro
  35.     xref    _LVO\1
  36.     endm
  37.  
  38. * Die vorhandenen Funktionen 
  39.  
  40.     xref    _berechnen
  41.     xref    _request
  42.     xref    _copy
  43.     xref    _check
  44.     xref    _checkback
  45.     xref    _AnzahlKlammern
  46.     xref    _left
  47.     xref    _right
  48.     xref    _mid
  49.     xref    _UmwStoF
  50.     xref    _Fak
  51.     xref    _NuK
  52.     xref    _EventAbfrage
  53.     xref    _CreatePort
  54.     xref    _DeletePort
  55.     xref    _CreateExtIO
  56.     xref    _DeleteExtIO
  57.     xref    _CreateStdIO
  58.     xref    _DeleteStdIO
  59.     xref    _UmwFtoS
  60.     xref    _Print
  61.     xref    _Free_Konst
  62.     xref    _Init_Konst
  63.     xref    _Set_Konst_P
  64.     xref    _Init_Mem
  65.     xref    _Free_Block
  66.     xref    _Init_Block
  67.     xref    _PreCalc
  68.     xref    _GetKonst_P
  69.     xref    _Calc_P
  70.     xref    _NewRequest
  71.     xref    _Box
  72.     xref    _Center
  73.     xref    _Gadget_On
  74.     xref    _Gadget_Off
  75.     xref    _GetPropPosH
  76.     xref    _GetPropPosV
  77.     xref    _SetPropPosH
  78.     xref    _SetPropPosV
  79.     xref    _PrepareTmpRas
  80.     xref    _ClearTmpRas
  81.     xref    _PrepareArea
  82.     xref    _ClearArea
  83.     xref    _LastMenu
  84.     xref    _LastItem
  85.     xref    _LastSub
  86.     xref    _AddMenu
  87.     xref    _AddItem
  88.     xref    _AddSub
  89.     xref    _GetItem
  90.     xref    _ClearMenu
  91.     xref    _FreeItem
  92.     xref    _FreeMenu
  93.     xref    _NewSetMenuStrip
  94.  
  95.     xlib    FreeMem
  96.     xlib    Remove
  97.     xlib    OpenLibrary
  98.     xlib    CloseLibrary
  99.  
  100.     xdef    _SysBase
  101.     xdef    _IntuitionBase
  102.     xdef    _GfxBase
  103.     xdef    _MathIeeeDoubBasBase
  104.     xdef    _MathIeeeDoubTransBase
  105.  
  106.  
  107. VERSION        equ    14
  108. REVISION    equ     3
  109.  
  110.  
  111.     STRUCTURE TestBase,LIB_SIZE
  112.         BPTR    extin_SegList
  113.         APTR    extin_SysBase
  114.         APTR    extin_GfxBase
  115.         APTR    extin_IntuitionBase
  116.         APTR    extin_MathIeeeDoubBasBase
  117.         APTR    extin_MathIeeeDoubTransBase
  118.         Label    extin_SIZEOF
  119.  
  120. TESTLIBNAME    macro
  121.     dc.b    'tool.library',0
  122.     endm
  123.  
  124.  
  125.     SECTION "Code",CODE
  126.  
  127.     moveq    #RETURN_FAIL,d0
  128.     rts
  129. ROMTag:
  130.     dc.w    RTC_MATCHWORD
  131.     dc.l    ROMTag
  132.     dc.l    EndCode
  133.     dc.b    RTF_AUTOINIT
  134.     dc.b    VERSION
  135.     dc.b    NT_LIBRARY
  136.     dc.b    0
  137.     dc.l    libraryName
  138.     dc.l    idString
  139.     dc.l    Init
  140.  
  141. libraryName:
  142.     TESTLIBNAME
  143.  
  144.     cnop    0,2
  145.  
  146. idString:
  147.     dc.b    'ToolLibrary 2.06 03-Aug-1990',CR,LF,0
  148.  
  149.     cnop    0,2
  150.  
  151. gfxName:
  152.     dc.b    'graphics.library',0
  153.  
  154.     cnop    0,2
  155.  
  156. intName:
  157.     dc.b    'intuition.library',0
  158.  
  159. mabName:
  160.     dc.b    'mathieeedoubbas.library',0
  161.  
  162. matName:
  163.     dc.b    'mathieeedoubtrans.library',0
  164.  
  165.     cnop    0,2
  166. Init:
  167.     dc.l    extin_SIZEOF
  168.     dc.l    funcTable
  169.     dc.l    dataTable
  170.     dc.l    .InitLib
  171.  
  172. funcTable:
  173.     dc.l    .OpenLib
  174.     dc.l    .CloseLib
  175.     dc.l    .ExpungeLib
  176.     dc.l    .ExtFuncLib
  177.     dc.l    _left
  178.     dc.l    _right
  179.     dc.l    _mid
  180.     dc.l    _UmwFtoS
  181.     dc.l    _copy
  182.     dc.l    _check
  183.     dc.l    _checkback
  184.     dc.l    _AnzahlKlammern
  185.     dc.l    _request
  186.     dc.l    _NewRequest
  187.     dc.l    _EventAbfrage
  188.     dc.l    _Print
  189.     dc.l    _Box
  190.     dc.l    _Center
  191.     dc.l    _Gadget_On
  192.     dc.l    _Gadget_Off
  193.     dc.l    _GetPropPosH
  194.     dc.l    _GetPropPosV
  195.     dc.l    _SetPropPosH
  196.     dc.l    _SetPropPosV
  197.     dc.l    _PrepareTmpRas
  198.     dc.l    _ClearTmpRas
  199.     dc.l    _PrepareArea
  200.     dc.l    _ClearArea
  201.     dc.l    _UmwStoF
  202.     dc.l    _Fak
  203.     dc.l    _NuK
  204.     dc.l    _berechnen
  205.     dc.l    _Init_Konst
  206.     dc.l    _Init_Mem
  207.     dc.l    _Init_Block
  208.     dc.l    _Set_Konst_P
  209.     dc.l    _GetKonst_P
  210.     dc.l    _PreCalc
  211.     dc.l    _Calc_P
  212.     dc.l    _Free_Konst
  213.     dc.l    _Free_Block
  214.     dc.l    .CreatePort
  215.     dc.l    .DeletePort
  216.     dc.l    .CreateExtIO
  217.     dc.l    .DeleteExtIO
  218.     dc.l    .CreateStdIO
  219.     dc.l    .DeleteStdIO
  220.     dc.l    _LastMenu
  221.     dc.l    _LastItem
  222.     dc.l    _LastSub
  223.     dc.l    _AddMenu
  224.     dc.l    _AddItem
  225.     dc.l    _AddSub
  226.     dc.l    _GetItem
  227.     dc.l    _ClearMenu
  228.     dc.l    _FreeItem
  229.     dc.l    _FreeMenu
  230.     dc.l    _NewSetMenuStrip
  231.     dc.l    -1
  232.  
  233.  
  234. dataTable:
  235.     INITBYTE     LH_TYPE,NT_LIBRARY
  236.     INITLONG    LN_NAME,libraryName
  237.     INITBYTE    LIB_FLAGS,LIBF_SUMUSED!LIBF_CHANGED
  238.     INITWORD    LIB_VERSION,VERSION
  239.     INITWORD    LIB_REVISION,REVISION
  240.     INITLONG    LIB_IDSTRING,idString
  241.     dc.l    0
  242.  
  243.  
  244. .InitLib:
  245.     move.l    a5,-(sp)
  246.     movea.l    d0,a5
  247.     move.l    a0,extin_SegList(a5)
  248.     lea    gfxName(pc),a1
  249.     moveq    #LIBRARY_VERSION,d0
  250.     callsys    OpenLibrary
  251.     tst    d0
  252.     beq.s    1$
  253.     move.l    d0,_GfxBase
  254.     move.l    d0,extin_GfxBase(a5)
  255.  
  256.     lea    intName(pc),a1
  257.     moveq    #LIBRARY_VERSION,d0
  258.     callsys    OpenLibrary
  259.     tst    d0
  260.     beq.s    1$
  261.     move.l    d0,_IntuitionBase
  262.     move.l    d0,extin_IntuitionBase(a5)
  263.  
  264.     lea    mabName(pc),a1
  265.     moveq    #LIBRARY_VERSION,d0
  266.     callsys    OpenLibrary
  267.     tst    d0
  268.     beq.s    1$
  269.     move.l    d0,_MathIeeeDoubBasBase
  270.     move.l    d0,extin_MathIeeeDoubBasBase(a5)
  271.  
  272.     lea    matName(pc),a1
  273.     moveq    #LIBRARY_VERSION,d0
  274.     callsys    OpenLibrary
  275.     tst    d0
  276.     beq.s    1$
  277.     move.l    d0,_MathIeeeDoubTransBase
  278.     move.l    d0,extin_MathIeeeDoubTransBase(a5)
  279.  
  280.     move.l    a6,extin_SysBase(a5)
  281.     move.l    a6,_SysBase
  282.     move.l    a5,d0
  283. 1$    movea.l    (sp)+,a5
  284.     rts
  285.  
  286. .OpenLib:
  287.     addq.w    #1,LIB_OPENCNT(a6)
  288.     bclr    #LIBB_DELEXP,LIB_FLAGS(a6)
  289.     move.l    a6,d0
  290.     rts
  291.  
  292. .CloseLib:
  293.     moveq    #0,d0
  294.     subq.w    #1,LIB_OPENCNT(a6)
  295.     bne.s    1$
  296.     btst    #LIBB_DELEXP,LIB_FLAGS(a6)
  297.     beq.s    1$
  298.     bsr.s    .ExpungeLib
  299. 1$    rts
  300.  
  301. .ExpungeLib:
  302.     movem.l    d2/a5/a6,-(sp)
  303.     tst.w    LIB_OPENCNT(a6)
  304.     beq.s    1$
  305.     bset    #LIBB_DELEXP,LIB_FLAGS(a6)
  306.     moveq    #0,d0
  307.     bra.s    2$
  308. 1$    move.l    a6,a5
  309.  
  310.     move.l    extin_SysBase(a5),a6
  311.     movea.l    extin_GfxBase(a5),a1
  312.     callsys    CloseLibrary
  313.     movea.l    extin_IntuitionBase(a5),a1
  314.     callsys    CloseLibrary
  315.     movea.l    extin_MathIeeeDoubBasBase(a5),a1
  316.     callsys    CloseLibrary
  317.     movea.l    extin_MathIeeeDoubTransBase(a5),a1
  318.     callsys    CloseLibrary
  319.  
  320.     move.l    a5,a1
  321.     callsys    Remove
  322.     move.l    extin_SegList(a5),d2
  323.     movea.l    a5,a1
  324.     moveq    #0,d0
  325.     move.w    LIB_NEGSIZE(a5),d0
  326.     suba.l    d0,a1
  327.     add.w    LIB_POSSIZE(a5),d0
  328.     callsys    FreeMem
  329.     move.l    d2,d0
  330. 2$    movem.l    (sp)+,d2/a5/a6
  331.     rts
  332.  
  333.  
  334. .ExtFuncLib:
  335.     moveq    #0,d0
  336.     rts
  337.  
  338.  
  339. * Konvertierungsroutinen (Parameter aus den Registern auf den Stack)
  340.  
  341. .CreatePort
  342.     move.l    a6,-(sp)
  343.     move.l    d0,-(a7)
  344.     move.l    a0,-(a7)
  345.     jsr    _CreatePort
  346.     add.l    #8,sp
  347.     move.l    (sp)+,a6
  348.     rts
  349.  
  350. .DeletePort
  351.     move.l    a6,-(sp)
  352.     move.l    a0,-(a7)
  353.     jsr    _DeletePort
  354.     addq.l    #4,sp
  355.     move.l    (sp)+,a6
  356.     rts
  357.  
  358. * Die Funktionen sind gleich, StdIO benutzt feste Speichergröße
  359. .CreateStdIO
  360.     moveq    #IOSTD_SIZE,d0
  361. .CreateExtIO
  362.     move.l    d0,-(a7)
  363.     move.l    a0,-(a7)
  364.     jsr    _CreateExtIO
  365.     add.l    #8,sp
  366.     rts
  367.  
  368. * Die Funktionen sind gleich, StdIO benutzt feste Speichergröße
  369.  
  370. .DeleteStdIO
  371.     moveq    #IOSTD_SIZE,d0
  372. .DeleteExtIO    
  373.     move.l    a0,-(a7)
  374.     jsr    _DeleteExtIO
  375.     addq.l    #4,sp
  376.     rts
  377.  
  378.  
  379.  
  380.         
  381.  
  382. EndCode:
  383.  
  384.     
  385.     section "data2",bss
  386.  
  387. * Die öffentlichen Symbole 
  388.  
  389. _SysBase        ds.l    1
  390. _GfxBase        ds.l    1
  391. _IntuitionBase        ds.l    1
  392. _MathIeeeDoubBasBase    ds.l    1
  393. _MathIeeeDoubTransBase    ds.l    1
  394.  
  395.  
  396.     end
  397.     
  398.