home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 15 / AACD15.ISO / AACD / Programming / Python2 / Python20_source / Amiga_Misc / unused / amigalibsmodule_asm.asm next >
Encoding:
Assembly Source File  |  1996-02-18  |  2.7 KB  |  152 lines

  1. ************************************************************************
  2. *
  3. *    amigalibsmodule_asm.asm
  4. *
  5. *    ©1996 Irmen de Jong.
  6. *
  7. * Low-level assembly interface to the amiga library call,
  8. * part of the amigalibs module from Python1.3.
  9. * See amigalibsmodule.c for the C code of this module.
  10. *
  11. * This source defines 1 function: amigalibs_calllib.
  12. * This function parses the register specification, puts the appropriate
  13. * values into the specified registers, and calls the desired LVO.
  14. *
  15. * After the call, control is returned to the C code.
  16. * D0/D1/A0/A1 are not saved.
  17. *
  18. *
  19. *    HISTORY
  20. *    ~~~~~~~
  21. *
  22. * 16-feb-96    created.
  23. * 18-feb-96    implemented register loading.
  24. *
  25. ************************************************************************
  26.  
  27.     
  28.  
  29. *
  30. *    VERY IMPORTANT NOTICE:
  31. *    ~~~~~~~~~~~~~~~~~~~~~~
  32. *
  33. * Due to the fact that a6 must contain the library base, and a5 the LVO-to-call,
  34. * the following functions CAN NOT BE USED:
  35. *
  36. * FROM CIA.RESOURCE: (maybe if you remove a6 from the LVO by hand)
  37. *    AddICRVector(resource,iCRBit,interrupt)(a6,d0/a1)
  38. *    RemICRVector(resource,iCRBit,interrupt)(a6,d0/a1)
  39. *    AbleICR(resource,mask)(a6,d0)
  40. *    SetICR(resource,mask)(a6,d0)
  41. *
  42. * FROM EXEC.LIBRARY:
  43. *    Supervisor(userFunction)(a5)
  44. *
  45. * FROM GRAPHICS.LIBRARY:
  46. *    LockLayerRom(layer)(a5)
  47. *    UnlockLayerRom(layer)(a5)
  48. *    AttemptLockLayerRom(layer)(a5)
  49. *
  50.  
  51.  
  52.  
  53. *
  54. * ULONG
  55. * amigalibs_calllib(register __a0 struct Library *libbase, 
  56. *                  register __d0 LONG LVOvalue,
  57. *                  register __d1 UWORD regspec,
  58. *                  register __a1 ULONG *regs);
  59. *
  60.  
  61.     SECTION amigalibs,CODE
  62.  
  63.     XDEF    _amigalibs_calllib
  64.  
  65. _amigalibs_calllib:
  66.     movem.l    d2-d7/a2-a6,-(sp)
  67.     move.l    a0,a5
  68.     move.l    a0,a6
  69.     add.l    d0,a5            ; a6=libbase, a5=LVO to call
  70.     move.l    a5,-(sp)
  71.     move.l    a1,a5
  72.  
  73.     move.l    d1,d7
  74.     lsr.l    #1,d7
  75.     bcc.s    .0
  76.     move.l    (a5),d0        ; D0
  77.  
  78. .0    lea    4(a5),a5
  79.     lsr.l    #1,d7
  80.     bcc.s    .1
  81.     move.l    (a5),d1        ; D1
  82.  
  83. .1    lea    4(a5),a5
  84.     lsr.l    #1,d7
  85.     bcc.s    .2
  86.     move.l    (a5),d2        ; D2
  87.  
  88. .2    lea    4(a5),a5
  89.     lsr.l    #1,d7
  90.     bcc.s    .3
  91.     move.l    (a5),d3        ; D3
  92.  
  93. .3    lea    4(a5),a5
  94.     lsr.l    #1,d7
  95.     bcc.s    .4
  96.     move.l    (a5),d4        ; D4
  97.  
  98. .4    lea    4(a5),a5
  99.     lsr.l    #1,d7
  100.     bcc.s    .5
  101.     move.l    (a5),d5        ; D5
  102.  
  103. .5    lea    4(a5),a5
  104.     lsr.l    #1,d7
  105.     bcc.s    .6
  106.     move.l    (a5),d6        ; D6
  107.  
  108. .6    lea    4(a5),a5
  109.     lsr.l    #1,d7
  110.     ; bcc.s    .7
  111.     move.l    (a5),d7_value    ; D7 -- special case
  112.  
  113. .7    lea    4(a5),a5
  114.     lsr.l    #1,d7
  115.     bcc.s    .8
  116.     move.l    (a5),a0        ; A0
  117.  
  118. .8    lea    4(a5),a5
  119.     lsr.l    #1,d7
  120.     bcc.s    .9
  121.     move.l    (a5),a1        ; A1
  122.  
  123. .9    lea    4(a5),a5
  124.     lsr.l    #1,d7
  125.     bcc.s    .10
  126.     move.l    (a5),a2        ; A2
  127.  
  128. .10    lea    4(a5),a5
  129.     lsr.l    #1,d7
  130.     bcc.s    .11
  131.     move.l    (a5),a3        ; A3
  132.  
  133. .11    lea    4(a5),a5
  134.     lsr.l    #1,d7
  135.     bcc.s    .12
  136.     move.l    (a5),a4        ; A4
  137.  
  138. .12
  139.     ; A5, A6, A7 ARE NOT INITIALISED!!! (for obvious reasons)
  140.  
  141.     move.l    (sp)+,a5
  142.     move.l    d7_value(pc),d7    ; get D7
  143.     jsr    (a5)        ; call library function
  144.     movem.l    (sp)+,d2-d7/a2-a6
  145.     rts
  146.  
  147. d7_value
  148.     dc.l    0
  149.  
  150.     END
  151.  
  152.