amigalib.pas 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. {
  2. This file is part of the Free Pascal run time library.
  3. Copyright (c) 2005-2015 Karoly Balogh
  4. abox.lib implementation for MorphOS/PowerPC
  5. MorphOS port was done on a free Pegasos II/G4 machine
  6. provided by Genesi
  7. See the file COPYING.FPC, included in this distribution,
  8. for details about the copyright.
  9. This program is distributed in the hope that it will be useful,
  10. but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  12. **********************************************************************}
  13. {$INLINE ON}
  14. unit amigalib
  15. deprecated 'Unit will be removed. Functions are moved to intuition, utility unit.';
  16. interface
  17. function DoMethod(obj : longword; const msg : array of LongWord): longword; inline;
  18. function DoMethod(obj : pointer; const msg : array of LongWord): longword; inline;
  19. function DoMethodA(obj : longword; msg1 : Pointer): longword; inline;
  20. function DoSuperMethod(class_: longword; obj : longword; const msg : array of LongWord): longword; inline;
  21. function DoSuperMethodA(class_: longword; obj : longword; msg1 : Pointer): longword; inline;
  22. function DoSuperMethodA(class_: pointer; obj : pointer; msg1 : Pointer): longword; inline;
  23. function DoSuperNew(class_: pointer; obj: pointer; const tags: array of LongWord): longword;
  24. { This procedure is used to pop Dispatcher arguments from the EmulHandle }
  25. procedure DISPATCHERARG(var cl; var obj; var msg);
  26. function HookEntry: PtrUInt;
  27. implementation
  28. uses
  29. exec, intuition, utility;
  30. function DoMethod(obj : longword; const msg : array of LongWord): longword; inline;
  31. begin
  32. DoMethod := Intuition.DoMethod(PObject_(Obj), Msg);
  33. end;
  34. function DoMethod(obj : pointer; const msg : array of LongWord): longword; inline;
  35. begin
  36. DoMethod := Intuition.DoMethod(PObject_(Obj), Msg);
  37. end;
  38. function DoMethodA(obj : longword; msg1 : Pointer): longword; inline;
  39. begin
  40. DoMethodA := Intuition.DoMethodA(PObject_(Obj), msg1);
  41. end;
  42. function DoSuperMethod(class_: longword; obj : longword; const msg : array of LongWord): longword; inline;
  43. begin
  44. DoSuperMethod := Intuition.DoSuperMethod(PIClass(Class_), PObject_(Obj), Msg);
  45. end;
  46. function DoSuperMethodA(class_: longword; obj : longword; msg1 : Pointer): longword; inline;
  47. begin
  48. DoSuperMethodA := Intuition.DoSuperMethodA(PIClass(class_), PObject_(obj), msg1);
  49. end;
  50. function DoSuperMethodA(class_: pointer; obj : pointer; msg1 : Pointer): longword; inline;
  51. begin
  52. DoSuperMethodA := Intuition.DoSuperMethodA(PIClass(class_), PObject_(Obj), Msg1);
  53. end;
  54. function DoSuperNew(class_: pointer; obj: pointer; const tags: array of LongWord): longword;
  55. begin
  56. DoSuperNew := Intuition.DoSuperNew(PIClass(class_), PObject_(Obj), Tags);
  57. end;
  58. { This procedure is used to pop Dispatcher arguments from the EmulHandle }
  59. procedure DISPATCHERARG(var cl; var obj; var msg);
  60. begin
  61. with GetEmulHandle^ do
  62. begin
  63. PtrUInt(cl) := reg[regA0];
  64. PtrUInt(obj) := reg[regA2];
  65. PtrUInt(msg) := reg[regA1];
  66. end;
  67. end;
  68. {
  69. // assembler implementation, kept for reference
  70. asm
  71. lwz r6,32(r2) // REG_a0
  72. stw r6,(r3) // cl
  73. lwz r6,40(r2) // REG_a2
  74. stw r6,(r4) // obj
  75. lwz r6,36(r2) // REG_a1
  76. stw r6,(r5) // msg
  77. end;}
  78. type
  79. THookSubEntryFunc = function(a, b, c: Pointer): PtrUInt;
  80. function HookEntry: PtrUInt;
  81. var
  82. hook: PHook;
  83. begin
  84. hook := REG_A0;
  85. HookEntry := THookSubEntryFunc(hook^.h_SubEntry)(hook, REG_A2, REG_A1);
  86. end;
  87. end.