picasso96api.pas 28 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964
  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) 2001-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. First version of unit Picasso96Api
  15. 27 Feb. 2001.
  16. Updated to fpc 1.0.7
  17. 08 Jan 2003
  18. Added the defines use_amiga_smartlink and
  19. use_auto_openlib.
  20. 12 Jan 2003.
  21. Changed cardinal > longword.
  22. Changed startcode for unit.
  23. 11 Feb 2003.
  24. [email protected]
  25. }
  26. {$mode objfpc}
  27. {$I useamigasmartlink.inc}
  28. {$ifdef use_amiga_smartlink}
  29. {$smartlink on}
  30. {$endif use_amiga_smartlink}
  31. UNIT PICASSO96API;
  32. INTERFACE
  33. USES Exec, utility, graphics, intuition;
  34. { Picasso96.h -- include File
  35. (C) Copyright 1996-98 Alexander Kneer & Tobias Abt
  36. All Rights Reserved.
  37. }
  38. const
  39. PICASSO96APINAME : PChar = 'Picasso96API.library';
  40. {************************************************************************}
  41. { Types for RGBFormat used
  42. }
  43. type
  44. RGBFTYPE = (
  45. RGBFB_NONE,
  46. RGBFB_CLUT,
  47. RGBFB_R8G8B8,
  48. RGBFB_B8G8R8,
  49. RGBFB_R5G6B5PC,
  50. RGBFB_R5G5B5PC,
  51. RGBFB_A8R8G8B8,
  52. RGBFB_A8B8G8R8,
  53. RGBFB_R8G8B8A8,
  54. RGBFB_B8G8R8A8,
  55. RGBFB_R5G6B5,
  56. RGBFB_R5G5B5,
  57. RGBFB_B5G6R5PC,
  58. RGBFB_B5G5R5PC,
  59. RGBFB_Y4U2V2,
  60. RGBFB_Y4U1V1,
  61. RGBFB_MaxFormats);
  62. const
  63. RGBFF_NONE = 1 shl 0;
  64. RGBFF_CLUT = 1 shl 1;
  65. RGBFF_R8G8B8 = 1 shl 2;
  66. RGBFF_B8G8R8 = 1 shl 3;
  67. RGBFF_R5G6B5PC = 1 shl 4;
  68. RGBFF_R5G5B5PC = 1 shl 5;
  69. RGBFF_A8R8G8B8 = 1 shl 6;
  70. RGBFF_A8B8G8R8 = 1 shl 7;
  71. RGBFF_R8G8B8A8 = 1 shl 8;
  72. RGBFF_B8G8R8A8 = 1 shl 9;
  73. RGBFF_R5G6B5 = 1 shl 10;
  74. RGBFF_R5G5B5 = 1 shl 11;
  75. RGBFF_B5G6R5PC = 1 shl 12;
  76. RGBFF_B5G5R5PC = 1 shl 13;
  77. RGBFF_Y4U2V2 = 1 shl 14;
  78. RGBFF_Y4U1V1 = 1 shl 15;
  79. RGBFF_HICOLOR = ((((RGBFF_R5G6B5PC or RGBFF_R5G5B5PC) or RGBFF_R5G6B5) or RGBFF_R5G5B5) or RGBFF_B5G6R5PC) or RGBFF_B5G5R5PC;
  80. RGBFF_TRUECOLOR = RGBFF_R8G8B8 or RGBFF_B8G8R8;
  81. RGBFF_TRUEALPHA = ((RGBFF_A8R8G8B8 or RGBFF_A8B8G8R8) or RGBFF_R8G8B8A8) or RGBFF_B8G8R8A8;
  82. { }
  83. { Flags for p96AllocBitMap
  84. }
  85. BMF_USERPRIVATE = $8000;
  86. { private user bitmap that will never
  87. be put to a board, but may be used as a temporary render buffer and accessed
  88. with OS blit functions, too. Bitmaps allocated with this flag do not need to
  89. be locked. }
  90. { }
  91. { Attributes for p96GetBitMapAttr
  92. }
  93. P96BMA_WIDTH = 0;
  94. P96BMA_HEIGHT = 1;
  95. P96BMA_DEPTH = 2;
  96. P96BMA_MEMORY = 3;
  97. P96BMA_BYTESPERROW = 4;
  98. P96BMA_BYTESPERPIXEL = 5;
  99. P96BMA_BITSPERPIXEL = 6;
  100. P96BMA_RGBFORMAT = 7;
  101. P96BMA_ISP96 = 8;
  102. P96BMA_ISONBOARD = 9;
  103. P96BMA_BOARDMEMBASE = 10;
  104. P96BMA_BOARDIOBASE = 11;
  105. P96BMA_BOARDMEMIOBASE = 12;
  106. { }
  107. { Attributes for p96GetModeIDAttr
  108. }
  109. P96IDA_WIDTH = 0;
  110. P96IDA_HEIGHT = 1;
  111. P96IDA_DEPTH = 2;
  112. P96IDA_BYTESPERPIXEL = 3;
  113. P96IDA_BITSPERPIXEL = 4;
  114. P96IDA_RGBFORMAT = 5;
  115. P96IDA_ISP96 = 6;
  116. P96IDA_BOARDNUMBER = 7;
  117. P96IDA_STDBYTESPERROW = 8;
  118. P96IDA_BOARDNAME = 9;
  119. P96IDA_COMPATIBLEFORMATS = 10;
  120. P96IDA_VIDEOCOMPATIBLE = 11;
  121. P96IDA_PABLOIVCOMPATIBLE = 12;
  122. P96IDA_PALOMAIVCOMPATIBLE = 13;
  123. { }
  124. { Tags for p96BestModeIDTagList
  125. }
  126. P96BIDTAG_Dummy = TAG_USER + 96;
  127. P96BIDTAG_FormatsAllowed = P96BIDTAG_Dummy + $0001;
  128. P96BIDTAG_FormatsForbidden = P96BIDTAG_Dummy + $0002;
  129. P96BIDTAG_NominalWidth = P96BIDTAG_Dummy + $0003;
  130. P96BIDTAG_NominalHeight = P96BIDTAG_Dummy + $0004;
  131. P96BIDTAG_Depth = P96BIDTAG_Dummy + $0005;
  132. P96BIDTAG_VideoCompatible = P96BIDTAG_Dummy + $0006;
  133. P96BIDTAG_PabloIVCompatible = P96BIDTAG_Dummy + $0007;
  134. P96BIDTAG_PalomaIVCompatible = P96BIDTAG_Dummy + $0008;
  135. { }
  136. { Tags for p96RequestModeIDTagList
  137. }
  138. P96MA_Dummy = (TAG_USER + $10000) + 96;
  139. P96MA_MinWidth = P96MA_Dummy + $0001;
  140. P96MA_MinHeight = P96MA_Dummy + $0002;
  141. P96MA_MinDepth = P96MA_Dummy + $0003;
  142. P96MA_MaxWidth = P96MA_Dummy + $0004;
  143. P96MA_MaxHeight = P96MA_Dummy + $0005;
  144. P96MA_MaxDepth = P96MA_Dummy + $0006;
  145. P96MA_DisplayID = P96MA_Dummy + $0007;
  146. P96MA_FormatsAllowed = P96MA_Dummy + $0008;
  147. P96MA_FormatsForbidden = P96MA_Dummy + $0009;
  148. P96MA_WindowTitle = P96MA_Dummy + $000a;
  149. P96MA_OKText = P96MA_Dummy + $000b;
  150. P96MA_CancelText = P96MA_Dummy + $000c;
  151. P96MA_Window = P96MA_Dummy + $000d;
  152. P96MA_PubScreenName = P96MA_Dummy + $000e;
  153. P96MA_Screen = P96MA_Dummy + $000f;
  154. P96MA_VideoCompatible = P96MA_Dummy + $0010;
  155. P96MA_PabloIVCompatible = P96MA_Dummy + $0011;
  156. P96MA_PalomaIVCompatible = P96MA_Dummy + $0012;
  157. { }
  158. { Tags for p96OpenScreenTagList
  159. }
  160. P96SA_Dummy = (TAG_USER + $20000) + 96;
  161. P96SA_Left = P96SA_Dummy + $0001;
  162. P96SA_Top = P96SA_Dummy + $0002;
  163. P96SA_Width = P96SA_Dummy + $0003;
  164. P96SA_Height = P96SA_Dummy + $0004;
  165. P96SA_Depth = P96SA_Dummy + $0005;
  166. P96SA_DetailPen = P96SA_Dummy + $0006;
  167. P96SA_BlockPen = P96SA_Dummy + $0007;
  168. P96SA_Title = P96SA_Dummy + $0008;
  169. P96SA_Colors = P96SA_Dummy + $0009;
  170. P96SA_ErrorCode = P96SA_Dummy + $000a;
  171. P96SA_Font = P96SA_Dummy + $000b;
  172. P96SA_SysFont = P96SA_Dummy + $000c;
  173. P96SA_Type = P96SA_Dummy + $000d;
  174. P96SA_BitMap = P96SA_Dummy + $000e;
  175. P96SA_PubName = P96SA_Dummy + $000f;
  176. P96SA_PubSig = P96SA_Dummy + $0010;
  177. P96SA_PubTask = P96SA_Dummy + $0011;
  178. P96SA_DisplayID = P96SA_Dummy + $0012;
  179. P96SA_DClip = P96SA_Dummy + $0013;
  180. P96SA_ShowTitle = P96SA_Dummy + $0014;
  181. P96SA_Behind = P96SA_Dummy + $0015;
  182. P96SA_Quiet = P96SA_Dummy + $0016;
  183. P96SA_AutoScroll = P96SA_Dummy + $0017;
  184. P96SA_Pens = P96SA_Dummy + $0018;
  185. P96SA_SharePens = P96SA_Dummy + $0019;
  186. P96SA_BackFill = P96SA_Dummy + $001a;
  187. P96SA_Colors32 = P96SA_Dummy + $001b;
  188. P96SA_VideoControl = P96SA_Dummy + $001c;
  189. P96SA_RGBFormat = P96SA_Dummy + $001d;
  190. P96SA_NoSprite = P96SA_Dummy + $001e;
  191. P96SA_NoMemory = P96SA_Dummy + $001f;
  192. P96SA_RenderFunc = P96SA_Dummy + $0020;
  193. P96SA_SaveFunc = P96SA_Dummy + $0021;
  194. P96SA_UserData = P96SA_Dummy + $0022;
  195. P96SA_Alignment = P96SA_Dummy + $0023;
  196. P96SA_FixedScreen = P96SA_Dummy + $0024;
  197. P96SA_Exclusive = P96SA_Dummy + $0025;
  198. P96SA_ConstantBytesPerRow = P96SA_Dummy + $0026;
  199. { }
  200. {
  201. }
  202. MODENAMELENGTH = 48;
  203. type
  204. pubyte = ^ubyte;
  205. PP96Mode = ^TP96Mode;
  206. TP96Mode = record
  207. Node : tNode;
  208. Description : array[0..(MODENAMELENGTH)-1] of char;
  209. Width : UWORD;
  210. Height : UWORD;
  211. Depth : UWORD;
  212. DisplayID : ULONG;
  213. end;
  214. { }
  215. { Structure to describe graphics data
  216. short description of the entries:
  217. Memory: pointer to graphics data
  218. BytesPerRow: distance in bytes between one pixel and its neighbour up
  219. or down.
  220. pad: private, not used.
  221. RGBFormat: RGBFormat of the data.
  222. }
  223. PRenderInfo = ^TRenderInfo;
  224. TRenderInfo = record
  225. Memory : APTR;
  226. BytesPerRow : WORD;
  227. pad : WORD;
  228. RGBFormat : RGBFTYPE;
  229. end;
  230. { }
  231. { Structure for p96WriteTrueColorData() and p96ReadTrueColorData()
  232. short description of the entries:
  233. PixelDistance: distance in bytes between the red (must be the same as
  234. for the green or blue) component of one pixel and its
  235. next neighbour to the left or right.
  236. BytesPerRow: distance in bytes between the red (must be the same as
  237. for the green or blue) component of one pixel and its
  238. next neighbour up or down.
  239. RedData: pointer to the red component of the upper left pixel.
  240. GreenData, BlueData: the same as above.
  241. examples (for an array width of 640 pixels):
  242. a) separate arrays for each color:
  243. (1, 640, red, green, blue );
  244. b) plain 24 bit RGB data:
  245. (3, 640 3, array, array+1, array+2 );
  246. c) 24 bit data, arranged as ARGB:
  247. (4, 640 4, array+1, array+2, array+3 );
  248. }
  249. PTrueColorInfo = ^TTrueColorInfo;
  250. TTrueColorInfo = record
  251. PixelDistance : ULONG;
  252. BytesPerRow : ULONG;
  253. RedData : PUBYTE;
  254. GreenData : PUBYTE;
  255. BlueData : PUBYTE;
  256. end;
  257. { }
  258. { Tags for PIPs
  259. }
  260. const
  261. P96PIP_Dummy = (TAG_USER + $30000) + 96;
  262. { RGBFTYPE (I) }
  263. P96PIP_SourceFormat = P96PIP_Dummy + 1;
  264. { struct BitMap (G) }
  265. P96PIP_SourceBitMap = P96PIP_Dummy + 2;
  266. { struct RastPort (G) }
  267. P96PIP_SourceRPort = P96PIP_Dummy + 3;
  268. { ULONG (I) }
  269. P96PIP_SourceWidth = P96PIP_Dummy + 4;
  270. { ULONG (I) }
  271. P96PIP_SourceHeight = P96PIP_Dummy + 5;
  272. { ULONG (I) default: PIPT_MemoryWindow }
  273. P96PIP_Type = P96PIP_Dummy + 6;
  274. { LONG (I) }
  275. P96PIP_ErrorCode = P96PIP_Dummy + 7;
  276. { ULONG (IGS) default: 0 }
  277. P96PIP_Brightness = P96PIP_Dummy + 8;
  278. { ULONG (I) default: 0 }
  279. P96PIP_Left = P96PIP_Dummy + 9;
  280. { ULONG (I) default: 0 }
  281. P96PIP_Top = P96PIP_Dummy + 10;
  282. { ULONG (I) default: inner width of window }
  283. P96PIP_Width = P96PIP_Dummy + 11;
  284. { ULONG (I) default: inner height of window }
  285. P96PIP_Height = P96PIP_Dummy + 12;
  286. { ULONG (I) default: PIPRel_Width|PIPRel_Height }
  287. P96PIP_Relativity = P96PIP_Dummy + 13;
  288. { struct ColorSpec (IS)
  289. ti_Data is an array of struct ColorSpec,
  290. terminated by ColorIndex = -1. Specifies
  291. initial screen palette colors.
  292. Also see P96PIP_Colors32.
  293. This only works with CLUT PIPs on non-CLUT
  294. screens. For CLUT PIPs on CLUT screens the
  295. PIP colors share the screen palette.
  296. }
  297. P96PIP_Colors = P96PIP_Dummy + 14;
  298. { ULONG (IS)
  299. Tag to set the palette colors at 32 bits-per-gun.
  300. ti_Data is a pointer to a table to be passed to
  301. the graphics.library/LoadRGB32() function.
  302. This format supports both runs of color
  303. registers and sparse registers. See the
  304. autodoc for that function for full details.
  305. Any color set here has precedence over
  306. the same register set by P96PIP_Colors.
  307. This only works with CLUT PIPs on non-CLUT
  308. screens. For CLUT PIPs on CLUT screens the
  309. PIP colors share the screen palette.
  310. }
  311. P96PIP_Colors32 = P96PIP_Dummy + 15;
  312. P96PIP_NoMemory = P96PIP_Dummy + 16;
  313. P96PIP_RenderFunc = P96PIP_Dummy + 17;
  314. P96PIP_SaveFunc = P96PIP_Dummy + 18;
  315. P96PIP_UserData = P96PIP_Dummy + 19;
  316. P96PIP_Alignment = P96PIP_Dummy + 20;
  317. P96PIP_ConstantBytesPerRow = P96PIP_Dummy + 21;
  318. P96PIP_AllowCropping = P96PIP_Dummy + 22;
  319. P96PIP_InitialIntScaling = P96PIP_Dummy + 23;
  320. PIPT_MemoryWindow = 0;
  321. PIPT_VideoWindow = 1;
  322. PIPT_NUMTYPES = 2;
  323. P96PIPT_MemoryWindow = PIPT_MemoryWindow;
  324. P96PIPT_VideoWindow = PIPT_VideoWindow;
  325. { P96PIP_Left is relative to the right side (negative value) }
  326. PIPRel_Right = 1;
  327. { P96PIP_Top is relative to the bottom (negative value) }
  328. PIPRel_Bottom = 2;
  329. { P96PIP_Width is amount of pixels not used by PIP at the
  330. right side of the window (negative value) }
  331. PIPRel_Width = 4;
  332. { P96PIP_Height is amount of pixels not used by PIP at the
  333. window bottom (negative value) }
  334. PIPRel_Height = 8;
  335. { couldn't get normal memory }
  336. PIPERR_NOMEMORY = 1;
  337. { Failed to attach to a screen }
  338. PIPERR_ATTACHFAIL = 2;
  339. { PIP not available for other reason }
  340. PIPERR_NOTAVAILABLE = 3;
  341. { couldn't get a free pen for occlusion }
  342. PIPERR_OUTOFPENS = 4;
  343. { type, width, height or format invalid }
  344. PIPERR_BADDIMENSIONS = 5;
  345. { couldn't open window }
  346. PIPERR_NOWINDOW = 6;
  347. { specified alignment is not ok }
  348. PIPERR_BADALIGNMENT = 7;
  349. { pip would be cropped, but isn't allowed to }
  350. PIPERR_CROPPED = 8;
  351. { }
  352. { Tags for P96GetRTGDataTagList
  353. }
  354. P96RD_Dummy = (TAG_USER + $40000) + 96;
  355. P96RD_NumberOfBoards = P96RD_Dummy + 1;
  356. { }
  357. { Tags for P96GetBoardDataTagList
  358. }
  359. P96BD_Dummy = (TAG_USER + $50000) + 96;
  360. P96BD_BoardName = P96BD_Dummy + 1;
  361. P96BD_ChipName = P96BD_Dummy + 2;
  362. P96BD_TotalMemory = P96BD_Dummy + 4;
  363. P96BD_FreeMemory = P96BD_Dummy + 5;
  364. P96BD_LargestFreeMemory = P96BD_Dummy + 6;
  365. P96BD_MonitorSwitch = P96BD_Dummy + 7;
  366. P96BD_RGBFormats = P96BD_Dummy + 8;
  367. P96BD_MemoryClock = P96BD_Dummy + 9;
  368. { }
  369. { }
  370. VAR P96Base : pLibrary;
  371. FUNCTION p96AllocBitMap(SizeX : Ulong; SizeY : Ulong; Depth : Ulong; Flags : Ulong; Friend : pBitMap; RGBFormat : RGBFTYPE) : pBitMap;
  372. PROCEDURE p96FreeBitMap(BitMap : pBitMap);
  373. FUNCTION p96GetBitMapAttr(BitMap : pBitMap; Attribute : Ulong) : Ulong;
  374. FUNCTION p96LockBitMap(BitMap : pBitMap; Buffer : pCHAR; Size : Ulong) : LONGINT;
  375. PROCEDURE p96UnlockBitMap(BitMap : pBitMap; Lock : LONGINT);
  376. FUNCTION p96BestModeIDTagList(Tags : pTagItem) : Ulong;
  377. FUNCTION p96RequestModeIDTagList(Tags : pTagItem) : Ulong;
  378. FUNCTION p96AllocModeListTagList(Tags : pTagItem) : pList;
  379. PROCEDURE p96FreeModeList(List : pList);
  380. FUNCTION p96GetModeIDAttr(Mode : Ulong; Attribute : Ulong) : Ulong;
  381. FUNCTION p96OpenScreenTagList(Tags : pTagItem) : pScreen;
  382. FUNCTION p96CloseScreen(Screen : pScreen) : BOOLEAN;
  383. PROCEDURE p96WritePixelArray(ri : pRenderInfo; SrcX : WORD; SrcY : WORD; rp : pRastPort; DestX : WORD; DestY : WORD; SizeX : WORD; SizeY : WORD);
  384. PROCEDURE p96ReadPixelArray(ri : pRenderInfo; DestX : WORD; DestY : WORD; rp : pRastPort; SrcX : WORD; SrcY : WORD; SizeX : WORD; SizeY : WORD);
  385. FUNCTION p96WritePixel(rp : pRastPort; x : WORD; y : WORD; color : Ulong) : Ulong;
  386. FUNCTION p96ReadPixel(rp : pRastPort; x : WORD; y : WORD) : Ulong;
  387. PROCEDURE p96RectFill(rp : pRastPort; MinX : WORD; MinY : WORD; MaxX : WORD; MaxY : WORD; color : Ulong);
  388. PROCEDURE p96WriteTrueColorData(tci : pTrueColorInfo; SrcX : WORD; SrcY : WORD; rp : pRastPort; DestX : WORD; DestY : WORD; SizeX : WORD; SizeY : WORD);
  389. PROCEDURE p96ReadTrueColorData(tci : pTrueColorInfo; DestX : WORD; DestY : WORD; rp : pRastPort; SrcX : WORD; SrcY : WORD; SizeX : WORD; SizeY : WORD);
  390. FUNCTION p96PIP_OpenTagList(Tags : pTagItem) : pWindow;
  391. FUNCTION p96PIP_Close(Window : pWindow) : BOOLEAN;
  392. FUNCTION p96PIP_SetTagList(Window : pWindow; Tags : pTagItem) : LONGINT;
  393. FUNCTION p96PIP_GetTagList(Window : pWindow; Tags : pTagItem) : LONGINT;
  394. FUNCTION p96GetRTGDataTagList(Tags : pTagItem) : LONGINT;
  395. FUNCTION p96GetBoardDataTagList(Board : Ulong; Tags : pTagItem) : LONGINT;
  396. FUNCTION p96EncodeColor(RGBFormat : RGBFTYPE; Color : Ulong) : Ulong;
  397. {
  398. Functions and procedures with array of const go here
  399. }
  400. FUNCTION p96BestModeIDTags(const Tags : Array Of Const) : longword;
  401. FUNCTION p96RequestModeIDTags(const Tags : Array Of Const) : longword;
  402. FUNCTION p96AllocModeListTags(const Tags : Array Of Const) : pList;
  403. FUNCTION p96OpenScreenTags(const Tags : Array Of Const) : pScreen;
  404. FUNCTION p96PIP_OpenTags(const Tags : Array Of Const) : pWindow;
  405. FUNCTION p96PIP_SetTags(Window : pWindow; const Tags : Array Of Const) : LONGINT;
  406. FUNCTION p96PIP_GetTags(Window : pWindow; const Tags : Array Of Const) : LONGINT;
  407. FUNCTION p96GetRTGDataTags(const Tags : Array Of Const) : LONGINT;
  408. FUNCTION p96GetBoardDataTags(Board : longword; const Tags : Array Of Const) : LONGINT;
  409. {You can remove this include and use a define instead}
  410. {$I useautoopenlib.inc}
  411. {$ifdef use_init_openlib}
  412. procedure InitPICASSO96APILibrary;
  413. {$endif use_init_openlib}
  414. {This is a variable that knows how the unit is compiled}
  415. var
  416. PICASSO96APIIsCompiledHow : longint;
  417. IMPLEMENTATION
  418. uses
  419. {$ifndef dont_use_openlib}
  420. msgbox,
  421. {$endif dont_use_openlib}
  422. tagsarray;
  423. FUNCTION p96AllocBitMap(SizeX : Ulong; SizeY : Ulong; Depth : Ulong; Flags : Ulong; Friend : pBitMap; RGBFormat : RGBFTYPE) : pBitMap;
  424. BEGIN
  425. ASM
  426. MOVE.L A6,-(A7)
  427. MOVE.L SizeX,D0
  428. MOVE.L SizeY,D1
  429. MOVE.L Depth,D2
  430. MOVE.L Flags,D3
  431. MOVEA.L Friend,A0
  432. MOVE.L RGBFormat,D7
  433. MOVEA.L P96Base,A6
  434. JSR -030(A6)
  435. MOVEA.L (A7)+,A6
  436. MOVE.L D0,@RESULT
  437. END;
  438. END;
  439. PROCEDURE p96FreeBitMap(BitMap : pBitMap);
  440. BEGIN
  441. ASM
  442. MOVE.L A6,-(A7)
  443. MOVEA.L BitMap,A0
  444. MOVEA.L P96Base,A6
  445. JSR -036(A6)
  446. MOVEA.L (A7)+,A6
  447. END;
  448. END;
  449. FUNCTION p96GetBitMapAttr(BitMap : pBitMap; Attribute : Ulong) : Ulong;
  450. BEGIN
  451. ASM
  452. MOVE.L A6,-(A7)
  453. MOVEA.L BitMap,A0
  454. MOVE.L Attribute,D0
  455. MOVEA.L P96Base,A6
  456. JSR -042(A6)
  457. MOVEA.L (A7)+,A6
  458. MOVE.L D0,@RESULT
  459. END;
  460. END;
  461. FUNCTION p96LockBitMap(BitMap : pBitMap; Buffer : pCHAR; Size : Ulong) : LONGINT;
  462. BEGIN
  463. ASM
  464. MOVE.L A6,-(A7)
  465. MOVEA.L BitMap,A0
  466. MOVEA.L Buffer,A1
  467. MOVE.L Size,D0
  468. MOVEA.L P96Base,A6
  469. JSR -048(A6)
  470. MOVEA.L (A7)+,A6
  471. MOVE.L D0,@RESULT
  472. END;
  473. END;
  474. PROCEDURE p96UnlockBitMap(BitMap : pBitMap; Lock : LONGINT);
  475. BEGIN
  476. ASM
  477. MOVE.L A6,-(A7)
  478. MOVEA.L BitMap,A0
  479. MOVE.L Lock,D0
  480. MOVEA.L P96Base,A6
  481. JSR -054(A6)
  482. MOVEA.L (A7)+,A6
  483. END;
  484. END;
  485. FUNCTION p96BestModeIDTagList(Tags : pTagItem) : Ulong;
  486. BEGIN
  487. ASM
  488. MOVE.L A6,-(A7)
  489. MOVEA.L Tags,A0
  490. MOVEA.L P96Base,A6
  491. JSR -060(A6)
  492. MOVEA.L (A7)+,A6
  493. MOVE.L D0,@RESULT
  494. END;
  495. END;
  496. FUNCTION p96RequestModeIDTagList(Tags : pTagItem) : Ulong;
  497. BEGIN
  498. ASM
  499. MOVE.L A6,-(A7)
  500. MOVEA.L Tags,A0
  501. MOVEA.L P96Base,A6
  502. JSR -066(A6)
  503. MOVEA.L (A7)+,A6
  504. MOVE.L D0,@RESULT
  505. END;
  506. END;
  507. FUNCTION p96AllocModeListTagList(Tags : pTagItem) : pList;
  508. BEGIN
  509. ASM
  510. MOVE.L A6,-(A7)
  511. MOVEA.L Tags,A0
  512. MOVEA.L P96Base,A6
  513. JSR -072(A6)
  514. MOVEA.L (A7)+,A6
  515. MOVE.L D0,@RESULT
  516. END;
  517. END;
  518. PROCEDURE p96FreeModeList(List : pList);
  519. BEGIN
  520. ASM
  521. MOVE.L A6,-(A7)
  522. MOVEA.L List,A0
  523. MOVEA.L P96Base,A6
  524. JSR -078(A6)
  525. MOVEA.L (A7)+,A6
  526. END;
  527. END;
  528. FUNCTION p96GetModeIDAttr(Mode : Ulong; Attribute : Ulong) : Ulong;
  529. BEGIN
  530. ASM
  531. MOVE.L A6,-(A7)
  532. MOVE.L Mode,D0
  533. MOVE.L Attribute,D1
  534. MOVEA.L P96Base,A6
  535. JSR -084(A6)
  536. MOVEA.L (A7)+,A6
  537. MOVE.L D0,@RESULT
  538. END;
  539. END;
  540. FUNCTION p96OpenScreenTagList(Tags : pTagItem) : pScreen;
  541. BEGIN
  542. ASM
  543. MOVE.L A6,-(A7)
  544. MOVEA.L Tags,A0
  545. MOVEA.L P96Base,A6
  546. JSR -090(A6)
  547. MOVEA.L (A7)+,A6
  548. MOVE.L D0,@RESULT
  549. END;
  550. END;
  551. FUNCTION p96CloseScreen(Screen : pScreen) : BOOLEAN;
  552. BEGIN
  553. ASM
  554. MOVE.L A6,-(A7)
  555. MOVEA.L Screen,A0
  556. MOVEA.L P96Base,A6
  557. JSR -096(A6)
  558. MOVEA.L (A7)+,A6
  559. TST.W D0
  560. BEQ.B @end
  561. MOVEQ #1,D0
  562. @end: MOVE.B D0,@RESULT
  563. END;
  564. END;
  565. PROCEDURE p96WritePixelArray(ri : pRenderInfo; SrcX : WORD; SrcY : WORD; rp : pRastPort; DestX : WORD; DestY : WORD; SizeX : WORD; SizeY : WORD);
  566. BEGIN
  567. ASM
  568. MOVE.L A6,-(A7)
  569. MOVEA.L ri,A0
  570. MOVE.L SrcX,D0
  571. MOVE.L SrcY,D1
  572. MOVEA.L rp,A1
  573. MOVE.L DestX,D2
  574. MOVE.L DestY,D3
  575. MOVE.L SizeX,D4
  576. MOVE.L SizeY,D5
  577. MOVEA.L P96Base,A6
  578. JSR -102(A6)
  579. MOVEA.L (A7)+,A6
  580. END;
  581. END;
  582. PROCEDURE p96ReadPixelArray(ri : pRenderInfo; DestX : WORD; DestY : WORD; rp : pRastPort; SrcX : WORD; SrcY : WORD; SizeX : WORD; SizeY : WORD);
  583. BEGIN
  584. ASM
  585. MOVE.L A6,-(A7)
  586. MOVEA.L ri,A0
  587. MOVE.L DestX,D0
  588. MOVE.L DestY,D1
  589. MOVEA.L rp,A1
  590. MOVE.L SrcX,D2
  591. MOVE.L SrcY,D3
  592. MOVE.L SizeX,D4
  593. MOVE.L SizeY,D5
  594. MOVEA.L P96Base,A6
  595. JSR -108(A6)
  596. MOVEA.L (A7)+,A6
  597. END;
  598. END;
  599. FUNCTION p96WritePixel(rp : pRastPort; x : WORD; y : WORD; color : Ulong) : Ulong;
  600. BEGIN
  601. ASM
  602. MOVE.L A6,-(A7)
  603. MOVEA.L rp,A1
  604. MOVE.L x,D0
  605. MOVE.L y,D1
  606. MOVE.L color,D2
  607. MOVEA.L P96Base,A6
  608. JSR -114(A6)
  609. MOVEA.L (A7)+,A6
  610. MOVE.L D0,@RESULT
  611. END;
  612. END;
  613. FUNCTION p96ReadPixel(rp : pRastPort; x : WORD; y : WORD) : Ulong;
  614. BEGIN
  615. ASM
  616. MOVE.L A6,-(A7)
  617. MOVEA.L rp,A1
  618. MOVE.L x,D0
  619. MOVE.L y,D1
  620. MOVEA.L P96Base,A6
  621. JSR -120(A6)
  622. MOVEA.L (A7)+,A6
  623. MOVE.L D0,@RESULT
  624. END;
  625. END;
  626. PROCEDURE p96RectFill(rp : pRastPort; MinX : WORD; MinY : WORD; MaxX : WORD; MaxY : WORD; color : Ulong);
  627. BEGIN
  628. ASM
  629. MOVE.L A6,-(A7)
  630. MOVEA.L rp,A1
  631. MOVE.L MinX,D0
  632. MOVE.L MinY,D1
  633. MOVE.L MaxX,D2
  634. MOVE.L MaxY,D3
  635. MOVE.L color,D4
  636. MOVEA.L P96Base,A6
  637. JSR -126(A6)
  638. MOVEA.L (A7)+,A6
  639. END;
  640. END;
  641. PROCEDURE p96WriteTrueColorData(tci : pTrueColorInfo; SrcX : WORD; SrcY : WORD; rp : pRastPort; DestX : WORD; DestY : WORD; SizeX : WORD; SizeY : WORD);
  642. BEGIN
  643. ASM
  644. MOVE.L A6,-(A7)
  645. MOVEA.L tci,A0
  646. MOVE.L SrcX,D0
  647. MOVE.L SrcY,D1
  648. MOVEA.L rp,A1
  649. MOVE.L DestX,D2
  650. MOVE.L DestY,D3
  651. MOVE.L SizeX,D4
  652. MOVE.L SizeY,D5
  653. MOVEA.L P96Base,A6
  654. JSR -132(A6)
  655. MOVEA.L (A7)+,A6
  656. END;
  657. END;
  658. PROCEDURE p96ReadTrueColorData(tci : pTrueColorInfo; DestX : WORD; DestY : WORD; rp : pRastPort; SrcX : WORD; SrcY : WORD; SizeX : WORD; SizeY : WORD);
  659. BEGIN
  660. ASM
  661. MOVE.L A6,-(A7)
  662. MOVEA.L tci,A0
  663. MOVE.L DestX,D0
  664. MOVE.L DestY,D1
  665. MOVEA.L rp,A1
  666. MOVE.L SrcX,D2
  667. MOVE.L SrcY,D3
  668. MOVE.L SizeX,D4
  669. MOVE.L SizeY,D5
  670. MOVEA.L P96Base,A6
  671. JSR -138(A6)
  672. MOVEA.L (A7)+,A6
  673. END;
  674. END;
  675. FUNCTION p96PIP_OpenTagList(Tags : pTagItem) : pWindow;
  676. BEGIN
  677. ASM
  678. MOVE.L A6,-(A7)
  679. MOVEA.L Tags,A0
  680. MOVEA.L P96Base,A6
  681. JSR -144(A6)
  682. MOVEA.L (A7)+,A6
  683. MOVE.L D0,@RESULT
  684. END;
  685. END;
  686. FUNCTION p96PIP_Close(Window : pWindow) : BOOLEAN;
  687. BEGIN
  688. ASM
  689. MOVE.L A6,-(A7)
  690. MOVEA.L Window,A0
  691. MOVEA.L P96Base,A6
  692. JSR -150(A6)
  693. MOVEA.L (A7)+,A6
  694. TST.W D0
  695. BEQ.B @end
  696. MOVEQ #1,D0
  697. @end: MOVE.B D0,@RESULT
  698. END;
  699. END;
  700. FUNCTION p96PIP_SetTagList(Window : pWindow; Tags : pTagItem) : LONGINT;
  701. BEGIN
  702. ASM
  703. MOVE.L A6,-(A7)
  704. MOVEA.L Window,A0
  705. MOVEA.L Tags,A1
  706. MOVEA.L P96Base,A6
  707. JSR -156(A6)
  708. MOVEA.L (A7)+,A6
  709. MOVE.L D0,@RESULT
  710. END;
  711. END;
  712. FUNCTION p96PIP_GetTagList(Window : pWindow; Tags : pTagItem) : LONGINT;
  713. BEGIN
  714. ASM
  715. MOVE.L A6,-(A7)
  716. MOVEA.L Window,A0
  717. MOVEA.L Tags,A1
  718. MOVEA.L P96Base,A6
  719. JSR -162(A6)
  720. MOVEA.L (A7)+,A6
  721. MOVE.L D0,@RESULT
  722. END;
  723. END;
  724. FUNCTION p96GetRTGDataTagList(Tags : pTagItem) : LONGINT;
  725. BEGIN
  726. ASM
  727. MOVE.L A6,-(A7)
  728. MOVEA.L Tags,A0
  729. MOVEA.L P96Base,A6
  730. JSR -180(A6)
  731. MOVEA.L (A7)+,A6
  732. MOVE.L D0,@RESULT
  733. END;
  734. END;
  735. FUNCTION p96GetBoardDataTagList(Board : Ulong; Tags : pTagItem) : LONGINT;
  736. BEGIN
  737. ASM
  738. MOVE.L A6,-(A7)
  739. MOVE.L Board,D0
  740. MOVEA.L Tags,A0
  741. MOVEA.L P96Base,A6
  742. JSR -186(A6)
  743. MOVEA.L (A7)+,A6
  744. MOVE.L D0,@RESULT
  745. END;
  746. END;
  747. FUNCTION p96EncodeColor(RGBFormat : RGBFTYPE; Color : Ulong) : Ulong;
  748. BEGIN
  749. ASM
  750. MOVE.L A6,-(A7)
  751. MOVE.L RGBFormat,D0
  752. MOVE.L Color,D1
  753. MOVEA.L P96Base,A6
  754. JSR -192(A6)
  755. MOVEA.L (A7)+,A6
  756. MOVE.L D0,@RESULT
  757. END;
  758. END;
  759. {
  760. Functions and procedures with array of const go here
  761. }
  762. FUNCTION p96BestModeIDTags(const Tags : Array Of Const) : longword;
  763. begin
  764. p96BestModeIDTags := p96BestModeIDTagList(readintags(Tags));
  765. end;
  766. FUNCTION p96RequestModeIDTags(const Tags : Array Of Const) : longword;
  767. begin
  768. p96RequestModeIDTags := p96RequestModeIDTagList(readintags(Tags));
  769. end;
  770. FUNCTION p96AllocModeListTags(const Tags : Array Of Const) : pList;
  771. begin
  772. p96AllocModeListTags := p96AllocModeListTagList(readintags(Tags));
  773. end;
  774. FUNCTION p96OpenScreenTags(const Tags : Array Of Const) : pScreen;
  775. begin
  776. p96OpenScreenTags := p96OpenScreenTagList(readintags(Tags));
  777. end;
  778. FUNCTION p96PIP_OpenTags(const Tags : Array Of Const) : pWindow;
  779. begin
  780. p96PIP_OpenTags := p96PIP_OpenTagList(readintags(Tags));
  781. end;
  782. FUNCTION p96PIP_SetTags(Window : pWindow; const Tags : Array Of Const) : LONGINT;
  783. begin
  784. p96PIP_SetTags := p96PIP_SetTagList(Window , readintags(Tags));
  785. end;
  786. FUNCTION p96PIP_GetTags(Window : pWindow; const Tags : Array Of Const) : LONGINT;
  787. begin
  788. p96PIP_GetTags := p96PIP_GetTagList(Window , readintags(Tags));
  789. end;
  790. FUNCTION p96GetRTGDataTags(const Tags : Array Of Const) : LONGINT;
  791. begin
  792. p96GetRTGDataTags := p96GetRTGDataTagList(readintags(Tags));
  793. end;
  794. FUNCTION p96GetBoardDataTags(Board : longword; const Tags : Array Of Const) : LONGINT;
  795. begin
  796. p96GetBoardDataTags := p96GetBoardDataTagList(Board , readintags(Tags));
  797. end;
  798. const
  799. { Change VERSION and LIBVERSION to proper values }
  800. VERSION : string[2] = '0';
  801. LIBVERSION : longword = 0;
  802. {$ifdef use_init_openlib}
  803. {$Info Compiling initopening of picasso96api.library}
  804. {$Info don't forget to use InitPICASSO96APILibrary in the beginning of your program}
  805. var
  806. picasso96api_exit : Pointer;
  807. procedure Closepicasso96apiLibrary;
  808. begin
  809. ExitProc := picasso96api_exit;
  810. if P96Base <> nil then begin
  811. CloseLibrary(P96Base);
  812. P96Base := nil;
  813. end;
  814. end;
  815. procedure InitPICASSO96APILibrary;
  816. begin
  817. P96Base := nil;
  818. P96Base := OpenLibrary(PICASSO96APINAME,LIBVERSION);
  819. if P96Base <> nil then begin
  820. picasso96api_exit := ExitProc;
  821. ExitProc := @Closepicasso96apiLibrary;
  822. end else begin
  823. MessageBox('FPC Pascal Error',
  824. 'Can''t open picasso96api.library version ' + VERSION + #10 +
  825. 'Deallocating resources and closing down',
  826. 'Oops');
  827. halt(20);
  828. end;
  829. end;
  830. begin
  831. PICASSO96APIIsCompiledHow := 2;
  832. {$endif use_init_openlib}
  833. {$ifdef use_auto_openlib}
  834. {$Info Compiling autoopening of picasso96api.library}
  835. var
  836. picasso96api_exit : Pointer;
  837. procedure Closepicasso96apiLibrary;
  838. begin
  839. ExitProc := picasso96api_exit;
  840. if P96Base <> nil then begin
  841. CloseLibrary(P96Base);
  842. P96Base := nil;
  843. end;
  844. end;
  845. begin
  846. P96Base := nil;
  847. P96Base := OpenLibrary(PICASSO96APINAME,LIBVERSION);
  848. if P96Base <> nil then begin
  849. picasso96api_exit := ExitProc;
  850. ExitProc := @Closepicasso96apiLibrary;
  851. PICASSO96APIIsCompiledHow := 1;
  852. end else begin
  853. MessageBox('FPC Pascal Error',
  854. 'Can''t open picasso96api.library version ' + VERSION + #10 +
  855. 'Deallocating resources and closing down',
  856. 'Oops');
  857. halt(20);
  858. end;
  859. {$endif use_auto_openlib}
  860. {$ifdef dont_use_openlib}
  861. begin
  862. PICASSO96APIIsCompiledHow := 3;
  863. {$Warning No autoopening of picasso96api.library compiled}
  864. {$Warning Make sure you open picasso96api.library yourself}
  865. {$endif dont_use_openlib}
  866. END. (* UNIT PICASSO96API *)