expansion.pas 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. {
  2. This file is part of the Free Pascal run time library.
  3. A file in Amiga system run time library.
  4. Copyright (c) 1998-2003 by Nils Sjoholm
  5. member of the Amiga RTL development team.
  6. See the file COPYING.FPC, included in this distribution,
  7. for details about the copyright.
  8. This program is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  11. **********************************************************************}
  12. {
  13. History:
  14. Added the defines use_amiga_smartlink and
  15. use_auto_openlib. Implemented autoopening of
  16. the library.
  17. 14 Jan 2003.
  18. Update for AmigaOS 3.9.
  19. Changed start code for unit.
  20. 01 Feb 2003.
  21. Changed cardinal > longword.
  22. 09 Feb 2003.
  23. [email protected] Nils Sjoholm
  24. }
  25. {$IFNDEF FPC_DOTTEDUNITS}
  26. UNIT expansion;
  27. {$ENDIF FPC_DOTTEDUNITS}
  28. INTERFACE
  29. {$IFDEF FPC_DOTTEDUNITS}
  30. USES Amiga.Core.Exec, Amiga.Core.Configvars, Amiga.Core.Amigados;
  31. {$ELSE FPC_DOTTEDUNITS}
  32. USES exec, configvars, amigados;
  33. {$ENDIF FPC_DOTTEDUNITS}
  34. Const
  35. EXPANSIONNAME : PAnsiChar = 'expansion.library';
  36. { flags for the AddDosNode() call }
  37. ADNB_STARTPROC = 0;
  38. ADNF_STARTPROC = 1;
  39. VAR ExpansionBase : pLibrary = nil;
  40. FUNCTION AddBootNode(bootPri : LONGINT location 'd0'; flags : ULONG location 'd1'; deviceNode : pDeviceNode location 'a0'; configDev : pConfigDev location 'a1') : wordbool; syscall ExpansionBase 036;
  41. PROCEDURE AddConfigDev(configDev : pConfigDev location 'a0'); syscall ExpansionBase 030;
  42. FUNCTION AddDosNode(bootPri : LONGINT location 'd0'; flags : ULONG location 'd1'; deviceNode : pDeviceNode location 'a0') : wordbool; syscall ExpansionBase 150;
  43. PROCEDURE AllocBoardMem(slotSpec : ULONG location 'd0'); syscall ExpansionBase 042;
  44. FUNCTION AllocConfigDev : pConfigDev; syscall ExpansionBase 048;
  45. FUNCTION AllocExpansionMem(numSlots : ULONG location 'd0'; slotAlign : ULONG location 'd1') : POINTER; syscall ExpansionBase 054;
  46. PROCEDURE ConfigBoard(board : POINTER location 'a0'; configDev : pConfigDev location 'a1'); syscall ExpansionBase 060;
  47. PROCEDURE ConfigChain(baseAddr : POINTER location 'a0'); syscall ExpansionBase 066;
  48. FUNCTION FindConfigDev(const oldConfigDev : pConfigDev location 'a0'; manufacturer : LONGINT location 'd0'; product : LONGINT location 'd1') : pConfigDev; syscall ExpansionBase 072;
  49. PROCEDURE FreeBoardMem(startSlot : ULONG location 'd0'; slotSpec : ULONG location 'd1'); syscall ExpansionBase 078;
  50. PROCEDURE FreeConfigDev(configDev : pConfigDev location 'a0'); syscall ExpansionBase 084;
  51. PROCEDURE FreeExpansionMem(startSlot : ULONG location 'd0'; numSlots : ULONG location 'd1'); syscall ExpansionBase 090;
  52. FUNCTION GetCurrentBinding(const currentBinding : pCurrentBinding location 'a0'; bindingSize : ULONG location 'd0') : ULONG; syscall ExpansionBase 138;
  53. FUNCTION MakeDosNode(const parmPacket : POINTER location 'a0') : pDeviceNode; syscall ExpansionBase 144;
  54. PROCEDURE ObtainConfigBinding; syscall ExpansionBase 120;
  55. FUNCTION ReadExpansionByte(const board : POINTER location 'a0'; offset : ULONG location 'd0') : BYTE; syscall ExpansionBase 096;
  56. PROCEDURE ReadExpansionRom(const board : POINTER location 'a0'; configDev : pConfigDev location 'a1'); syscall ExpansionBase 102;
  57. PROCEDURE ReleaseConfigBinding; syscall ExpansionBase 126;
  58. PROCEDURE RemConfigDev(configDev : pConfigDev location 'a0'); syscall ExpansionBase 108;
  59. PROCEDURE SetCurrentBinding(currentBinding : pCurrentBinding location 'a0'; bindingSize : ULONG location 'd0'); syscall ExpansionBase 132;
  60. PROCEDURE WriteExpansionByte(board : POINTER location 'a0'; offset : ULONG location 'd0'; byte : ULONG location 'd1'); syscall ExpansionBase 114;
  61. IMPLEMENTATION
  62. const
  63. { Change VERSION and LIBVERSION to proper values }
  64. VERSION : string[2] = '0';
  65. LIBVERSION : longword = 0;
  66. initialization
  67. ExpansionBase := OpenLibrary(EXPANSIONNAME,LIBVERSION);
  68. finalization
  69. if Assigned(ExpansionBase) then
  70. CloseLibrary(ExpansionBase);
  71. END. (* UNIT EXPANSION *)