libgpu.pas 66 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184
  1. // (C) Copyright 1993-1995 Sony Corporation,Tokyo,Japan. All Rights Reserved
  2. // libgpu.h: Graphic Primitive Structures Database
  3. {
  4. *
  5. * Primitive list:
  6. *
  7. * Name |Size*1|Shade |Vertex |Texture| Function
  8. * ---------+------+-------+-------+-------+------------------------
  9. * POLY_F3 | 5 |Flat | 3 |OFF | Flat Triangle
  10. * POLY_FT3 | 8 |Flat | 3 |ON | Flat Textured Triangle
  11. * POLY_G3 | 7 |Gouraud| 3 |OFF | Gouraud Triangle
  12. * POLY_GT3 |10 |Gouraud| 3 |ON | Gouraud Textured Triangle
  13. * POLY_F4 | 6 |Flat | 4 |OFF | Flat Quadrangle
  14. * POLY_FT4 |10 |Flat | 4 |ON | Flat Textured Quadrangle
  15. * POLY_G4 | 9 |Gouraud| 4 |OFF | Gouraud Quadrangle
  16. * POLY_GT4 |13 |Gouraud| 4 |ON | Gouraud Textured Quadrangle
  17. * ---------+------+-------+-------+-------+------------------------
  18. * LINE_F2 | 4 |Flat | 2 | - | unconnected Flat Line
  19. * LINE_G2 | 5 |Gouraud| 2 | - | unconnected Gouraud Line
  20. * LINE_F3 | 6 |Flat | 3 | - | 3-connected Flat Line
  21. * LINE_G3 | 8 |Gouraud| 3 | - | 3-connected Gouraud Line
  22. * LINE_F4 | 7 |Flat | 4 | - | 4-connected Flat Line
  23. * LINE_G4 |10 |Gouraud| 4 | - | 4-connected Gouraud Line
  24. * ---------+------+-------+-------+-------+------------------------
  25. * SPRT | 5 |Flat | 1 |ON | free size Sprite
  26. * SPRT_16 | 4 |Flat | 1 |ON | 16x16 Sprite
  27. * SPRT_8 | 4 |Flat | 1 |ON | 8x8 Sprite
  28. * ---------+------+-------+-------+-------+------------------------
  29. * TILE | 4 |Flat | 1 |OFF | free size Sprite
  30. * TILE_16 | 3 |Flat | 1 |OFF | 16x16 Sprite
  31. * TILE_8 | 3 |Flat | 1 |OFF | 8x8 Sprite
  32. * TILE_1 | 3 |Flat | 1 |OFF | 1x1 Sprite
  33. * ---------+------+-------+-------+-------+------------------------
  34. * DR_TWIN | 3 | - | - | - | Texture Window
  35. * DR_AREA | 3 | - | - | - | Drawing Area
  36. * DR_OFFSET| 3 | - | - | - | Drawing Offset
  37. * DR_MODE | 3 | - | - | - | Drawing Mode
  38. * DR_ENV |16 | - | - | - | Drawing Environment
  39. * DR_MOVE | 6 | - | - | - | MoveImage
  40. * DR_LOAD |17 | - | - | - | LoadImage
  41. * DR_TPAGE | 2 | - | - | - | Drawing TPage
  42. * DR_STP | 3 | - | - | - | Drawing STP
  43. *
  44. * *1: in long-word
  45. *
  46. * Texture Attributes:
  47. * abr: ambient rate
  48. * abr 0 1 2 3
  49. * -------------------------------------
  50. * Front 0.5 1.0 0.5 -1.0
  51. * Back 0.5 1.0 1.0 1.0
  52. *
  53. * tp: texture mode
  54. * tp 0 1 2
  55. * -----------------------------
  56. * depth 4bit 8bit 16bit
  57. * color CLUT CLUT DIRECT
  58. }
  59. unit libgpu;
  60. interface
  61. uses libgte;
  62. function GPU_printf(fmt: pchar): longint; varargs; stdcall; external; // printf() object
  63. // Time-out Cycle
  64. const
  65. WAIT_TIME = $800000;
  66. // General
  67. procedure limitRange(var x: longint; l, h: longint); inline;
  68. // Rectangle:
  69. type
  70. RECT = packed record
  71. x, y : smallint; // offset point on VRAM
  72. w, h : smallint; // width and height
  73. end;
  74. PRECT = ^RECT;
  75. RECT32 = packed record
  76. x, y : longint; // offset point on VRAM
  77. w, h : longint; // width and height
  78. end;
  79. // Environment
  80. DR_ENV = packed record // Packed Drawing Environment
  81. tag : dword;
  82. code : array [0..14] of dword;
  83. end;
  84. PDR_ENV = ^DR_ENV;
  85. DRAWENV = packed record
  86. clip : RECT; // clip area
  87. ofs : array [0..1] of smallint; // drawing offset
  88. tw : RECT; // texture window
  89. tpage : word; // texture page
  90. dtd : byte; // dither flag (0:off, 1:on)
  91. dfe : byte; // flag to draw on display area (0:off 1:on)
  92. isbg : byte; // enable to auto-clear
  93. r0, g0, b0 : byte; // initital background color
  94. _dr_env : DR_ENV; // reserved
  95. end;
  96. PDRAWENV = ^DRAWENV;
  97. DISPENV = packed record
  98. disp : RECT; // display area
  99. screen : RECT; // display start point
  100. isinter : byte; // interlace 0: off 1: on
  101. isrgb24 : byte; // RGB24 bit mode
  102. pad0, pad1 : byte; // reserved
  103. end;
  104. PDISPENV = ^DISPENV;
  105. // Polygon Primitive Definitions
  106. P_TAG = bitpacked record
  107. addr: 0..16777215; // 24-bit address (24 bits can represent numbers from 0 to 16777215)
  108. len: 0..255; // 8-bit length (8 bits can represent numbers from 0 to 255)
  109. r0, g0, b0, code: Byte;
  110. end;
  111. P_CODE = packed record
  112. r0, g0, b0, code : byte;
  113. end;
  114. POLY_F3 = packed record // Flat Triangle
  115. tag : dword;
  116. r0, g0, b0, code : byte;
  117. x0, y0 : smallint;
  118. x1, y1 : smallint;
  119. x2, y2 : smallint;
  120. end;
  121. PPOLY_F3 = ^POLY_F3;
  122. POLY_F4 = packed record // Flat Quadrangle
  123. tag : dword;
  124. r0, g0, b0, code : byte;
  125. x0, y0 : smallint;
  126. x1, y1 : smallint;
  127. x2, y2 : smallint;
  128. x3, y3 : smallint;
  129. end;
  130. PPOLY_F4 = ^POLY_F4;
  131. POLY_FT3 = packed record // Flat Textured Triangle
  132. tag : dword;
  133. r0, g0, b0, code : byte;
  134. x0, y0 : smallint;
  135. u0, v0 : byte;
  136. clut : word;
  137. x1, y1 : smallint;
  138. u1, v1 : byte;
  139. tpage : word;
  140. x2, y2 : smallint;
  141. u2, v2 : byte;
  142. pad1 : word;
  143. end;
  144. PPOLY_FT3 = ^POLY_FT3;
  145. POLY_FT4 = packed record // Flat Textured Quadrangle
  146. tag : dword;
  147. r0, g0, b0, code : byte;
  148. x0, y0 : smallint;
  149. u0, v0 : byte;
  150. clut : word;
  151. x1, y1 : smallint;
  152. u1, v1 : byte;
  153. tpage : word;
  154. x2, y2 : smallint;
  155. u2, v2 : byte;
  156. pad1 : word;
  157. x3, y3 : smallint;
  158. u3, v3 : byte;
  159. pad2 : word;
  160. end;
  161. PPOLY_FT4 = ^POLY_FT4;
  162. POLY_G3 = packed record // Gouraud Triangle
  163. tag : dword;
  164. r0, g0, b0, code : byte;
  165. x0, y0 : smallint;
  166. r1, g1, b1, pad1 : byte;
  167. x1, y1 : smallint;
  168. r2, g2, b2, pad2 : byte;
  169. x2, y2 : smallint;
  170. end;
  171. PPOLY_G3 = ^POLY_G3;
  172. POLY_G4 = packed record // Gouraud Quadrangle
  173. tag : dword;
  174. r0, g0, b0, code : byte;
  175. x0, y0 : smallint;
  176. r1, g1, b1, pad1 : byte;
  177. x1, y1 : smallint;
  178. r2, g2, b2, pad2 : byte;
  179. x2, y2 : smallint;
  180. r3, g3, b3, pad3 : byte;
  181. x3, y3 : smallint;
  182. end;
  183. PPOLY_G4 = ^POLY_G4;
  184. POLY_GT3 = packed record // Gouraud Textured Triangle
  185. tag : dword;
  186. r0, g0, b0, code : byte;
  187. x0, y0 : smallint;
  188. u0, v0 : byte;
  189. clut : word;
  190. r1, g1, b1, p1 : byte;
  191. x1, y1 : smallint;
  192. u1, v1 : byte;
  193. tpage : word;
  194. r2, g2, b2, p2 : byte;
  195. x2, y2 : smallint;
  196. u2, v2 : byte;
  197. pad2 : word;
  198. end;
  199. PPOLY_GT3 = ^POLY_GT3;
  200. POLY_GT4 = packed record // Gouraud Textured Quadrangle
  201. tag : dword;
  202. r0, g0, b0, code : byte;
  203. x0, y0 : smallint;
  204. u0, v0 : byte;
  205. clut : word;
  206. r1, g1, b1, p1 : byte;
  207. x1, y1 : smallint;
  208. u1, v1 : byte;
  209. tpage : word;
  210. r2, g2, b2, p2 : byte;
  211. x2, y2 : smallint;
  212. u2, v2 : byte;
  213. pad2 : word;
  214. r3, g3, b3, p3 : byte;
  215. x3, y3 : smallint;
  216. u3, v3 : byte;
  217. pad3 : word;
  218. end;
  219. PPOLY_GT4 = ^POLY_GT4;
  220. // Line Primitive Definitions
  221. LINE_F2 = packed record // Unconnected Flat Line
  222. tag : dword;
  223. r0, g0, b0, code : byte;
  224. x0, y0 : smallint;
  225. x1, y1 : smallint;
  226. end;
  227. PLINE_F2 = ^LINE_F2;
  228. LINE_G2 = packed record // Unconnected Gouraud Line
  229. tag : dword;
  230. r0, g0, b0, code : byte;
  231. x0, y0 : smallint;
  232. r1, g1, b1, p1 : byte;
  233. x1, y1 : smallint;
  234. end;
  235. PLINE_G2 = ^LINE_G2;
  236. LINE_F3 = packed record // 2 connected Flat Line
  237. tag : dword;
  238. r0, g0, b0, code : byte;
  239. x0, y0 : smallint;
  240. x1, y1 : smallint;
  241. x2, y2 : smallint;
  242. pad : dword;
  243. end;
  244. PLINE_F3 = ^LINE_F3;
  245. LINE_G3 = packed record // 2 connected Gouraud Line
  246. tag : dword;
  247. r0, g0, b0, code : byte;
  248. x0, y0 : smallint;
  249. r1, g1, b1, p1 : byte;
  250. x1, y1 : smallint;
  251. r2, g2, b2, p2 : byte;
  252. x2, y2 : smallint;
  253. pad : dword;
  254. end;
  255. PLINE_G3 = ^LINE_G3;
  256. LINE_F4 = packed record // 3 connected Flat Line Quadrangle
  257. tag : dword;
  258. r0, g0, b0, code : byte;
  259. x0, y0 : smallint;
  260. x1, y1 : smallint;
  261. x2, y2 : smallint;
  262. x3, y3 : smallint;
  263. pad : dword;
  264. end;
  265. PLINE_F4 = ^LINE_F4;
  266. LINE_G4 = packed record // 3 connected Gouraud Line
  267. tag : dword;
  268. r0, g0, b0, code : byte;
  269. x0, y0 : smallint;
  270. r1, g1, b1, p1 : byte;
  271. x1, y1 : smallint;
  272. r2, g2, b2, p2 : byte;
  273. x2, y2 : smallint;
  274. r3, g3, b3, p3 : byte;
  275. x3, y3 : smallint;
  276. pad : dword;
  277. end;
  278. PLINE_G4 = ^LINE_G4;
  279. // Sprite Primitive Definitions
  280. SPRT = packed record // free size Sprite
  281. tag : dword;
  282. r0, g0, b0, code : byte;
  283. x0, y0 : smallint;
  284. u0, v0 : byte;
  285. clut : word;
  286. w, h : smallint;
  287. end;
  288. PSPRT = ^SPRT;
  289. SPRT_16 = packed record // 16x16 Sprite
  290. tag : dword;
  291. r0, g0, b0, code : byte;
  292. x0, y0 : smallint;
  293. u0, v0 : byte;
  294. clut : word;
  295. end;
  296. PSPRT_16 = ^SPRT_16;
  297. SPRT_8 = packed record // 8x8 Sprite
  298. tag : dword;
  299. r0, g0, b0, code : byte;
  300. x0, y0 : smallint;
  301. u0, v0 : byte;
  302. clut : word;
  303. end;
  304. PSPRT_8 = ^SPRT_8;
  305. // Tile Primitive Definitions
  306. TILE = packed record // free size Tile
  307. tag : dword;
  308. r0, g0, b0, code : byte;
  309. x0, y0 : smallint;
  310. w, h : smallint;
  311. end;
  312. PTILE = ^TILE;
  313. TILE_16 = packed record // 16x16 Tile
  314. tag : dword;
  315. r0, g0, b0, code : byte;
  316. x0, y0 : smallint;
  317. end;
  318. PTILE_16 = ^TILE_16;
  319. TILE_8 = packed record // 8x8 Tile
  320. tag : dword;
  321. r0, g0, b0, code : byte;
  322. x0, y0 : smallint;
  323. end;
  324. PTILE_8 = ^TILE_8;
  325. TILE_1 = packed record // 1x1 Tile
  326. tag : dword;
  327. r0, g0, b0, code : byte;
  328. x0, y0 : smallint;
  329. end;
  330. PTILE_1 = TILE_1;
  331. // Special Primitive Definitions
  332. DR_MODE = packed record // Drawing Mode
  333. tag : dword;
  334. code : array [0..1] of dword;
  335. end;
  336. PDR_MODE = ^DR_MODE;
  337. DR_TWIN = packed record // Texture Window
  338. tag : dword;
  339. code : array [0..1] of dword;
  340. end;
  341. PDR_TWIN =^DR_TWIN;
  342. DR_AREA = packed record // Drawing Area
  343. tag : dword;
  344. code : array [0..1] of dword;
  345. end;
  346. PDR_AREA = ^DR_AREA;
  347. DR_OFFSET = packed record // Drawing Offset
  348. tag : dword;
  349. code : array [0..1] of dword;
  350. end;
  351. PDR_OFFSET = ^DR_OFFSET;
  352. DR_MOVE = packed record // MoveImage
  353. tag : dword;
  354. code : array [0..4] of dword;
  355. end;
  356. PDR_MOVE = ^DR_MOVE;
  357. DR_LOAD = packed record // LoadImage
  358. tag : dword;
  359. code : array [0..2] of dword;
  360. p : array [0..12] of dword;
  361. end;
  362. PDR_LOAD = ^DR_LOAD;
  363. DR_TPAGE = packed record // Drawing TPage
  364. tag : dword;
  365. code : array [0..0] of dword;
  366. end;
  367. PDR_TPAGE = DR_TPAGE;
  368. DR_STP = packed record // Drawing STP
  369. tag : dword;
  370. code : array [0..1] of dword;
  371. end;
  372. PDR_STP = DR_STP;
  373. // Font Stream Parameters
  374. const
  375. FNT_MAX_ID = 8; // max number of stream ID
  376. FNT_MAX_SPRT = 1024; // max number of sprites in all streams
  377. // Multi-purpose Sony-TMD primitive
  378. type
  379. TMD_PRIM = packed record
  380. id : dword;
  381. r0, g0, b0, p0 : byte; // Color of vertex 0
  382. r1, g1, b1, p1 : byte; // Color of vertex 1
  383. r2, g2, b2, p2 : byte; // Color of vertex 2
  384. r3, g3, b3, p3 : byte; // Color of vertex 3
  385. tpage, clut : word; // texture page ID, clut ID
  386. u0, v0, u1, v1 : byte; // texture corner point
  387. u2, v2, u3, v3 : byte;
  388. // independent vertex model
  389. x0, x1, x2, x3 : SVECTOR; // 3D corner point
  390. n0, n1, n2, n3 : SVECTOR; // 3D corner normal vector
  391. // Common vertex model
  392. v_ofs : PSVECTOR; // offset to vertex database
  393. n_ofs : PSVECTOR; // offset to normal database
  394. vert0, vert1 : word; // index of vertex
  395. vert2, vert3 : word;
  396. norm0, norm1 : word; // index of normal
  397. norm2, norm3 : word;
  398. end;
  399. PTMD_PRIM = ^TMD_PRIM;
  400. // Multi-purpose TIM image
  401. TIM_IMAGE = packed record
  402. mode : dword; // pixel mode
  403. crect : PRECT; // CLUT rectangle on frame buffer
  404. caddr : pdword; // CLUT address on main memory
  405. prect : PRECT; // texture image rectangle on frame buffer
  406. paddr : pdword; // texture image address on main memory
  407. end;
  408. PTIM_IMAGE = ^TIM_IMAGE;
  409. function FntPrint(Args: pchar): longint; varargs; stdcall; external;
  410. function KanjiFntPrint(Args: pchar): longint; varargs; stdcall; external;
  411. function FntPrint: longint; stdcall; external;
  412. function KanjiFntPrint: longint; stdcall; external;
  413. function GetDispEnv(env: PDISPENV): PDISPENV; stdcall; external;
  414. function PutDispEnv(env: PDISPENV): PDISPENV; stdcall; external;
  415. function SetDefDispEnv(env: PDISPENV; x, y, w, h: longint): PDISPENV; stdcall; external;
  416. function GetDrawEnv(env: PDRAWENV): PDRAWENV; stdcall; external;
  417. function PutDrawEnv(env: PDRAWENV): PDRAWENV; stdcall; external;
  418. function SetDefDrawEnv(env: PDRAWENV; x, y, w, h: longint): PDRAWENV; stdcall; external;
  419. function ReadTIM(timimg: PTIM_IMAGE): PTIM_IMAGE; stdcall; external;
  420. function ReadTMD(tmdprim: PTMD_PRIM): PTMD_PRIM; stdcall; external;
  421. function CheckPrim(s: pchar; p: pdword): longint; stdcall; external;
  422. function ClearImage(rect: PRECT; r, g, b: byte): longint; stdcall; external;
  423. function ClearImage2(rect: PRECT; r, g, b: byte): longint; stdcall; external;
  424. function DrawSync(mode: longint): longint; stdcall; external;
  425. function FntOpen(x, y, w, h: longint; isbg, n: longint): longint; stdcall; external;
  426. function GetGraphDebug: longint; stdcall; external;
  427. function GetTimSize(sjis: pbyte): longint; stdcall; external;
  428. function IsEndPrim(p: pointer): longint; stdcall; external;
  429. function KanjiFntOpen(x, y, w, h: longint; dx, dy, cx, cy: longint; isbg, n: longint): longint; stdcall; external;
  430. procedure KanjiFntClose; stdcall; external;
  431. function Krom2Tim(sjis: pbyte; taddr:pdword; dx, dy, cdx, cdy: longint; fg, bg: dword): longint; stdcall; external;
  432. function LoadImage(rect: PRECT; p: pointer): longint; stdcall; external;
  433. function MargePrim(p0, p1: pointer): longint; stdcall; external;
  434. function MoveImage(rect: PRECT; x, y: longint): longint; stdcall; external;
  435. function OpenTIM(addr: pointer): longint; stdcall; external;
  436. function OpenTMD(tmd: pdword; obj_no: longint): longint; stdcall; external;
  437. function ResetGraph(mode: longint): longint; stdcall; external;
  438. function SetGraphDebug(level: longint): longint; stdcall; external;
  439. function StoreImage(rect: PRECT; p: pointer): longint; stdcall; external;
  440. function ClearOTag(ot: pointer; n: longint): pdword; stdcall; external;
  441. function ClearOTagR(ot: pointer; n: longint): pdword; stdcall; external;
  442. function FntFlush(id: longint): pdword; stdcall; external;
  443. function KanjiFntFlush(id: longint): pdword; stdcall; external;
  444. function DrawSyncCallback(func: pointer): longint; stdcall; external;
  445. function GetClut(x, y: longint): word; stdcall; external;
  446. function GetTPage(tp, abr: longint; x, y: longint): word; stdcall; external;
  447. function LoadClut(clut: pointer; x, y: longint): word; stdcall; external;
  448. function LoadClut2(clut: pointer; x, y: longint): word; stdcall; external;
  449. function LoadTPage(pix: pointer; tp, abr: longint; x, y, w, h: longint): word; stdcall; external;
  450. function NextPrim(p: pointer): pointer; stdcall; external;
  451. procedure AddPrim(ot: pointer; p: pointer); stdcall; external;
  452. procedure AddPrims(ot: pointer; p0, p1: pointer); stdcall; external;
  453. procedure CatPrim(p0, p1: pointer); stdcall; external;
  454. procedure DrawOTag(p: pointer); stdcall; external;
  455. procedure DrawOTagIO(p: pointer); stdcall; external;
  456. procedure DrawOTagEnv(p: pointer; env: PDRAWENV); stdcall; external;
  457. procedure DrawPrim(p: pointer); stdcall; external;
  458. procedure DumpClut(clut: word); stdcall; external;
  459. procedure DumpDispEnv(env: PDISPENV); stdcall; external;
  460. procedure DumpDrawEnv(env: PDRAWENV); stdcall; external;
  461. procedure DumpOTag(p: pointer); stdcall; external;
  462. procedure DumpTPage(tpage: word); stdcall; external;
  463. procedure FntLoad(tx, ty: longint); stdcall; external;
  464. procedure SetDispMask(mask: longint); stdcall; external;
  465. procedure SetDrawArea(p: PDR_AREA; r: PRECT); stdcall; external;
  466. procedure SetDrawEnv(dr_env: PDR_ENV; env: PDRAWENV); stdcall; external;
  467. procedure SetDrawLoad(p: PDR_LOAD; rect: PRECT); stdcall; external;
  468. procedure SetDrawMode(p: PDR_MODE; dfe, dtd: longint; tpage: longint; tw: PRECT); stdcall; external;
  469. procedure SetDrawTPage(p: PDR_TPAGE; dfe, dtd: longint; tpage: longint); stdcall; external;
  470. procedure SetDrawMove(p: PDR_MOVE; r: PRECT; x, y: longint); stdcall; external;
  471. procedure SetDrawOffset(p: PDR_OFFSET; ofs: pword); stdcall; external;
  472. procedure SetDrawStp(p: PDR_STP; pbw: longint); stdcall; external;
  473. procedure SetDumpFnt(id: longint); stdcall; external;
  474. procedure SetLineF2(p: PLINE_F2); stdcall; external;
  475. procedure SetLineF3(p: PLINE_F3); stdcall; external;
  476. procedure SetLineF4(p: PLINE_F4); stdcall; external;
  477. procedure SetLineG2(p: PLINE_G2); stdcall; external;
  478. procedure SetLineG3(p: PLINE_G3); stdcall; external;
  479. procedure SetLineG4(p: PLINE_G4); stdcall; external;
  480. procedure SetPolyF3(p: PPOLY_F3); stdcall; external;
  481. procedure SetPolyF4(p: PPOLY_F4); stdcall; external;
  482. procedure SetPolyFT3(p: PPOLY_FT3); stdcall; external;
  483. procedure SetPolyFT4(p: PPOLY_FT4); stdcall; external;
  484. procedure SetPolyG3(p: PPOLY_G3); stdcall; external;
  485. procedure SetPolyG4(p: PPOLY_G4); stdcall; external;
  486. procedure SetPolyGT3(p: PPOLY_GT3); stdcall; external;
  487. procedure SetPolyGT4(p: PPOLY_GT4); stdcall; external;
  488. procedure SetSemiTrans(p: pointer; abe: longint); stdcall; external;
  489. procedure SetShadeTex(p: pointer; tge: longint); stdcall; external;
  490. procedure SetSprt(p: PSPRT); stdcall; external;
  491. procedure SetSprt16(p: PSPRT_16); stdcall; external;
  492. procedure SetSprt8(p: PSPRT_8); stdcall; external;
  493. procedure SetTexWindow(p: PDR_TWIN; tw: PRECT); stdcall; external;
  494. procedure SetTile(p: PTILE); stdcall; external;
  495. procedure SetTile1(p: PTILE_1); stdcall; external;
  496. procedure SetTile16(p: PTILE_16); stdcall; external;
  497. procedure SetTile8(p: PTILE_8); stdcall; external;
  498. procedure TermPrim(p: pointer); stdcall; external;
  499. function BreakDraw: pdword; stdcall; external;
  500. procedure ContinueDraw(insaddr: pdword; contaddr: pdword); stdcall; external;
  501. function IsIdleGPU(max_count: longint): longint; stdcall; external;
  502. function GetODE: longint; stdcall; external;
  503. function LoadImage2(_rect: PRECT; p: pointer): longint; stdcall; external;
  504. function StoreImage2(_rect: PRECT; p: pointer): longint; stdcall; external;
  505. function MoveImage2(_rect: PRECT; x, y: longint): longint; stdcall; external;
  506. function DrawOTag2(p: pointer): longint; stdcall; external;
  507. procedure GetDrawMode(p: PDR_MODE); stdcall; external;
  508. procedure GetTexWindow(p: PDR_TWIN); stdcall; external;
  509. procedure GetDrawArea(p: PDR_AREA); stdcall; external;
  510. procedure GetDrawOffset(p: PDR_OFFSET); stdcall; external;
  511. procedure GetDrawEnv2(p: PDR_ENV); stdcall; external;
  512. // Set/Add Vector/Rectangle Attributes
  513. procedure setVector(var v: VECTOR; const x, y, z: longint);
  514. procedure setVector(var v: SVECTOR; const x, y, z: smallint);
  515. procedure setVector(var v: DVECTOR; const x, y, z: smallint);
  516. {
  517. #define applyVector(v, _x, _y, _z, op) \
  518. (v)->vx op _x, (v)->vy op _y, (v)->vz op _z
  519. }
  520. procedure copyVector(var v0: VECTOR; const v1: VECTOR);
  521. procedure copyVector(var v0: SVECTOR; const v1: SVECTOR);
  522. procedure copyVector(var v0: DVECTOR; const v1: DVECTOR);
  523. procedure addVector(var v0: VECTOR; const v1: VECTOR);
  524. procedure addVector(var v0: SVECTOR; const v1: SVECTOR);
  525. procedure addVector(var v0: DVECTOR; const v1: DVECTOR);
  526. procedure dumpVector(str: pchar; const v: VECTOR);
  527. procedure dumpVector(str: pchar; const v: SVECTOR);
  528. procedure dumpVector(str: pchar; const v: DVECTOR);
  529. procedure dumpMatrix(const x: MATRIX);
  530. procedure setRECT(var r: RECT; const x, y, w, h: longint);
  531. // Set Primitive Attributes
  532. procedure setTPage(var p: DRAWENV; tp, abr, x, y: longint);
  533. procedure setTPage(var p: POLY_FT3; tp, abr, x, y: longint);
  534. procedure setTPage(var p: POLY_FT4; tp, abr, x, y: longint);
  535. procedure setTPage(var p: POLY_GT3; tp, abr, x, y: longint);
  536. procedure setTPage(var p: POLY_GT4; tp, abr, x, y: longint);
  537. procedure setTPage(var p: TMD_PRIM; tp, abr, x, y: longint);
  538. procedure setClut(var p: POLY_FT3; x, y: longint);
  539. procedure setClut(var p: POLY_FT4; x, y: longint);
  540. procedure setClut(var p: POLY_GT3; x, y: longint);
  541. procedure setClut(var p: POLY_GT4; x, y: longint);
  542. procedure setClut(var p: SPRT; x, y: longint);
  543. procedure setClut(var p: SPRT_16; x, y: longint);
  544. procedure setClut(var p: SPRT_8; x, y: longint);
  545. procedure setClut(var p: TMD_PRIM; x, y: longint);
  546. (*
  547. #define setClut(p,x,y) \
  548. ((p)->clut = getClut(x,y))
  549. *)
  550. // Set Primitive Colors
  551. procedure setRGB0(var p: POLY_F3; const r, g, b: byte);
  552. procedure setRGB0(var p: POLY_F4; const r, g, b: byte);
  553. procedure setRGB0(var p: POLY_FT3; const r, g, b: byte);
  554. procedure setRGB0(var p: POLY_FT4; const r, g, b: byte);
  555. procedure setRGB0(var p: POLY_G3; const r, g, b: byte);
  556. procedure setRGB0(var p: POLY_G4; const r, g, b: byte);
  557. procedure setRGB0(var p: POLY_GT3; const r, g, b: byte);
  558. procedure setRGB0(var p: POLY_GT4; const r, g, b: byte);
  559. procedure setRGB0(var c: DRAWENV; r, g, b: byte);
  560. procedure setRGB1(var p: POLY_G3; const r, g, b: byte);
  561. procedure setRGB1(var p: POLY_G4; const r, g, b: byte);
  562. procedure setRGB1(var p: POLY_GT3; const r, g, b: byte);
  563. procedure setRGB1(var p: POLY_GT4; const r, g, b: byte);
  564. procedure setRGB2(var p: POLY_G3; const r, g, b: byte);
  565. procedure setRGB2(var p: POLY_G4; const r, g, b: byte);
  566. procedure setRGB2(var p: POLY_GT3; const r, g, b: byte);
  567. procedure setRGB2(var p: POLY_GT4; const r, g, b: byte);
  568. procedure setRGB3(var p: POLY_G4; const r, g, b: byte);
  569. procedure setRGB3(var p: POLY_GT4; const r, g, b: byte);
  570. // Set Primitive Screen Points
  571. procedure setXY0(var p: POLY_F3; const x, y: smallint);
  572. procedure setXY0(var p: POLY_F4; const x, y: smallint);
  573. procedure setXY0(var p: POLY_FT3; const x, y: smallint);
  574. procedure setXY0(var p: POLY_FT4; const x, y: smallint);
  575. procedure setXY0(var p: POLY_G3; const x, y: smallint);
  576. procedure setXY0(var p: POLY_G4; const x, y: smallint);
  577. procedure setXY0(var p: POLY_GT3; const x, y: smallint);
  578. procedure setXY0(var p: POLY_GT4; const x, y: smallint);
  579. procedure setXY0(var p: LINE_F2; const x, y: smallint);
  580. procedure setXY0(var p: LINE_G2; const x, y: smallint);
  581. procedure setXY0(var p: LINE_F3; const x, y: smallint);
  582. procedure setXY0(var p: LINE_G3; const x, y: smallint);
  583. procedure setXY0(var p: LINE_F4; const x, y: smallint);
  584. procedure setXY0(var p: LINE_G4; const x, y: smallint);
  585. procedure setXY0(var p: SPRT; const x, y: smallint);
  586. procedure setXY0(var p: SPRT_16; const x, y: smallint);
  587. procedure setXY0(var p: SPRT_8; const x, y: smallint);
  588. procedure setXY0(var p: TILE; const x, y: smallint);
  589. procedure setXY0(var p: TILE_16; const x, y: smallint);
  590. procedure setXY0(var p: TILE_8; const x, y: smallint);
  591. procedure setXY0(var p: TILE_1; const x, y: smallint);
  592. procedure setXY2(var p: POLY_F3; const x0, y0, x1, y1: smallint);
  593. procedure setXY2(var p: POLY_F4; const x0, y0, x1, y1: smallint);
  594. procedure setXY2(var p: POLY_FT3; const x0, y0, x1, y1: smallint);
  595. procedure setXY2(var p: POLY_FT4; const x0, y0, x1, y1: smallint);
  596. procedure setXY2(var p: POLY_G3; const x0, y0, x1, y1: smallint);
  597. procedure setXY2(var p: POLY_G4; const x0, y0, x1, y1: smallint);
  598. procedure setXY2(var p: POLY_GT3; const x0, y0, x1, y1: smallint);
  599. procedure setXY2(var p: POLY_GT4; const x0, y0, x1, y1: smallint);
  600. procedure setXY2(var p: LINE_F2; const x0, y0, x1, y1: smallint);
  601. procedure setXY2(var p: LINE_G2; const x0, y0, x1, y1: smallint);
  602. procedure setXY2(var p: LINE_F3; const x0, y0, x1, y1: smallint);
  603. procedure setXY2(var p: LINE_G3; const x0, y0, x1, y1: smallint);
  604. procedure setXY2(var p: LINE_F4; const x0, y0, x1, y1: smallint);
  605. procedure setXY2(var p: LINE_G4; const x0, y0, x1, y1: smallint);
  606. procedure setXY3(var p: POLY_F3; const x0, y0, x1, y1, x2, y2: smallint);
  607. procedure setXY3(var p: POLY_F4; const x0, y0, x1, y1, x2, y2: smallint);
  608. procedure setXY3(var p: POLY_FT3; const x0, y0, x1, y1, x2, y2: smallint);
  609. procedure setXY3(var p: POLY_FT4; const x0, y0, x1, y1, x2, y2: smallint);
  610. procedure setXY3(var p: POLY_G3; const x0, y0, x1, y1, x2, y2: smallint);
  611. procedure setXY3(var p: POLY_G4; const x0, y0, x1, y1, x2, y2: smallint);
  612. procedure setXY3(var p: POLY_GT3; const x0, y0, x1, y1, x2, y2: smallint);
  613. procedure setXY3(var p: POLY_GT4; const x0, y0, x1, y1, x2, y2: smallint);
  614. procedure setXY3(var p: LINE_F3; const x0, y0, x1, y1, x2, y2: smallint);
  615. procedure setXY3(var p: LINE_G3; const x0, y0, x1, y1, x2, y2: smallint);
  616. procedure setXY3(var p: LINE_F4; const x0, y0, x1, y1, x2, y2: smallint);
  617. procedure setXY3(var p: LINE_G4; const x0, y0, x1, y1, x2, y2: smallint);
  618. procedure setXY4(var p: POLY_F4; const x0, y0, x1, y1, x2, y2, x3, y3: smallint);
  619. procedure setXY4(var p: POLY_FT4; const x0, y0, x1, y1, x2, y2, x3, y3: smallint);
  620. procedure setXY4(var p: POLY_G4; const x0, y0, x1, y1, x2, y2, x3, y3: smallint);
  621. procedure setXY4(var p: POLY_GT4; const x0, y0, x1, y1, x2, y2, x3, y3: smallint);
  622. procedure setXYWH(var p: POLY_F4; x0, y0, w, h: smallint);
  623. procedure setXYWH(var p: POLY_FT4; x0, y0, w, h: smallint);
  624. procedure setXYWH(var p: POLY_G4; x0, y0, w, h: smallint);
  625. procedure setXYWH(var p: POLY_GT4; x0, y0, w, h: smallint);
  626. procedure setXYWH(var p: LINE_F4; x0, y0, w, h: smallint);
  627. procedure setXYWH(var p: LINE_G4; x0, y0, w, h: smallint);
  628. // Set Primitive Width/Height
  629. procedure setWH(var p: RECT; w, h: smallint);
  630. procedure setWH(var p: RECT32; w, h: longint);
  631. procedure setWH(var p: SPRT; w, h: smallint);
  632. procedure setWH(var p: TILE; w, h: smallint);
  633. // Set Primitive Texture Points
  634. procedure setUV0(var p: POLY_FT3; u0, v0: smallint);
  635. procedure setUV0(var p: POLY_FT4; u0, v0: smallint);
  636. procedure setUV0(var p: POLY_GT3; u0, v0: smallint);
  637. procedure setUV0(var p: POLY_GT4; u0, v0: smallint);
  638. procedure setUV0(var p: SPRT; u0, v0: byte);
  639. procedure setUV0(var p: SPRT_16; u0, v0: byte);
  640. procedure setUV0(var p: SPRT_8; u0, v0: byte);
  641. procedure setUV0(var p: TMD_PRIM; u0, v0: byte);
  642. procedure setUV3(var p: POLY_FT3; u0, v0, u1, v1, u2, v2: smallint);
  643. procedure setUV3(var p: POLY_FT4; u0, v0, u1, v1, u2, v2: smallint);
  644. procedure setUV3(var p: POLY_GT3; u0, v0, u1, v1, u2, v2: smallint);
  645. procedure setUV3(var p: POLY_GT4; u0, v0, u1, v1, u2, v2: smallint);
  646. procedure setUV3(var p: TMD_PRIM; u0, v0, u1, v1, u2, v2: byte);
  647. procedure setUV4(var p: POLY_FT4; u0, v0, u1, v1, u2, v2, u3, v3: smallint);
  648. procedure setUV4(var p: POLY_GT4; u0, v0, u1, v1, u2, v2, u3, v3: smallint);
  649. procedure setUV4(var p: TMD_PRIM; u0, v0, u1, v1, u2, v2, u3, v3: byte);
  650. procedure setUVWH(var p: POLY_FT4; u0, v0, w, h: smallint);
  651. procedure setUVWH(var p: POLY_GT4; u0, v0, w, h: smallint);
  652. procedure setUVWH(var p: TMD_PRIM; u0, v0, w, h: smallint);
  653. // Dump Primivie Parameters
  654. procedure dumpRECT(r: RECT);
  655. procedure dumpWH(p: RECT);
  656. procedure dumpWH(p: RECT32);
  657. procedure dumpWH(p: SPRT);
  658. procedure dumpWH(p: TILE);
  659. procedure dumpXY0(p: POLY_F3);
  660. procedure dumpXY0(p: POLY_F4);
  661. procedure dumpXY0(p: POLY_FT3);
  662. procedure dumpXY0(p: POLY_FT4);
  663. procedure dumpXY0(p: POLY_G3);
  664. procedure dumpXY0(p: POLY_G4);
  665. procedure dumpXY0(p: POLY_GT3);
  666. procedure dumpXY0(p: POLY_GT4);
  667. procedure dumpXY0(p: LINE_F2);
  668. procedure dumpXY0(p: LINE_G2);
  669. procedure dumpXY0(p: LINE_F3);
  670. procedure dumpXY0(p: LINE_G3);
  671. procedure dumpXY0(p: LINE_F4);
  672. procedure dumpXY0(p: LINE_G4);
  673. procedure dumpXY0(p: SPRT);
  674. procedure dumpXY0(p: SPRT_16);
  675. procedure dumpXY0(p: SPRT_8);
  676. procedure dumpXY0(p: TILE);
  677. procedure dumpXY0(p: TILE_16);
  678. procedure dumpXY0(p: TILE_8);
  679. procedure dumpXY0(p: TILE_1);
  680. procedure dumpUV0(p: POLY_FT3);
  681. procedure dumpUV0(p: POLY_FT4);
  682. procedure dumpUV0(p: POLY_GT3);
  683. procedure dumpUV0(p: POLY_GT4);
  684. procedure dumpUV0(p: SPRT);
  685. procedure dumpUV0(p: SPRT_16);
  686. procedure dumpUV0(p: SPRT_8);
  687. procedure dumpUV0(p: TMD_PRIM);
  688. procedure dumpXY2(p: POLY_F3);
  689. procedure dumpXY2(p: POLY_F4);
  690. procedure dumpXY2(p: POLY_FT3);
  691. procedure dumpXY2(p: POLY_FT4);
  692. procedure dumpXY2(p: POLY_G3);
  693. procedure dumpXY2(p: POLY_G4);
  694. procedure dumpXY2(p: POLY_GT3);
  695. procedure dumpXY2(p: POLY_GT4);
  696. procedure dumpXY2(p: LINE_F2);
  697. procedure dumpXY2(p: LINE_G2);
  698. procedure dumpXY2(p: LINE_F3);
  699. procedure dumpXY2(p: LINE_G3);
  700. procedure dumpXY2(p: LINE_F4);
  701. procedure dumpXY2(p: LINE_G4);
  702. procedure dumpXY3(p: POLY_F3);
  703. procedure dumpXY3(p: POLY_F4);
  704. procedure dumpXY3(p: POLY_FT3);
  705. procedure dumpXY3(p: POLY_FT4);
  706. procedure dumpXY3(p: POLY_G3);
  707. procedure dumpXY3(p: POLY_G4);
  708. procedure dumpXY3(p: POLY_GT3);
  709. procedure dumpXY3(p: POLY_GT4);
  710. procedure dumpXY3(p: LINE_F3);
  711. procedure dumpXY3(p: LINE_G3);
  712. procedure dumpXY3(p: LINE_F4);
  713. procedure dumpXY3(p: LINE_G4);
  714. procedure dumpUV3(p: POLY_FT3);
  715. procedure dumpUV3(p: POLY_FT4);
  716. procedure dumpUV3(p: POLY_GT3);
  717. procedure dumpUV3(p: POLY_GT4);
  718. procedure dumpUV3(p: TMD_PRIM);
  719. procedure dumpXY4(p: POLY_F4);
  720. procedure dumpXY4(p: POLY_FT4);
  721. procedure dumpXY4(p: POLY_G4);
  722. procedure dumpXY4(p: POLY_GT4);
  723. procedure dumpUV4(p: POLY_FT4);
  724. procedure dumpUV4(p: POLY_GT4);
  725. procedure dumpUV4(p: TMD_PRIM);
  726. procedure dumpRGB0(p: POLY_F3);
  727. procedure dumpRGB0(p: POLY_F4);
  728. procedure dumpRGB0(p: POLY_FT3);
  729. procedure dumpRGB0(p: POLY_FT4);
  730. procedure dumpRGB0(p: POLY_G3);
  731. procedure dumpRGB0(p: POLY_G4);
  732. procedure dumpRGB0(p: POLY_GT3);
  733. procedure dumpRGB0(p: POLY_GT4);
  734. procedure dumpRGB0(p: DRAWENV);
  735. procedure dumpRGB1(p:POLY_G3);
  736. procedure dumpRGB1(p:POLY_G4);
  737. procedure dumpRGB1(p:POLY_GT3);
  738. procedure dumpRGB1(p:POLY_GT4);
  739. procedure dumpRGB2(p: POLY_G3);
  740. procedure dumpRGB2(p: POLY_G4);
  741. procedure dumpRGB2(p: POLY_GT3);
  742. procedure dumpRGB2(p: POLY_GT4);
  743. procedure dumpRGB3(p: POLY_G4);
  744. procedure dumpRGB3(p: POLY_GT4);
  745. // Primitive Handling Macros
  746. procedure setlen(var p: P_TAG; const len: byte);
  747. procedure setlen(var p: POLY_F3; const len: byte);
  748. procedure setlen(var p: POLY_FT3; const len: byte);
  749. procedure setlen(var p: POLY_G3; const len: byte);
  750. procedure setlen(var p: POLY_GT3; const len: byte);
  751. procedure setlen(var p: POLY_F4; const len: byte);
  752. procedure setlen(var p: POLY_FT4; const len: byte);
  753. procedure setlen(var p: POLY_G4; const len: byte);
  754. procedure setlen(var p: POLY_GT4; const len: byte);
  755. procedure setlen(var p: SPRT_8; const len: byte);
  756. procedure setlen(var p: SPRT_16; const len: byte);
  757. procedure setlen(var p: SPRT; const len: byte);
  758. procedure setlen(var p: TILE_1; const len: byte);
  759. procedure setlen(var p: TILE_8; const len: byte);
  760. procedure setlen(var p: TILE_16; const len: byte);
  761. procedure setlen(var p: TILE; const len: byte);
  762. procedure setlen(var p: LINE_F2; const len: byte);
  763. procedure setlen(var p: LINE_G2; const len: byte);
  764. procedure setlen(var p: LINE_F3; const len: byte);
  765. procedure setlen(var p: LINE_G3; const len: byte);
  766. procedure setlen(var p: LINE_F4; const len: byte);
  767. procedure setlen(var p: LINE_G4; const len: byte);
  768. procedure setaddr(var p: P_TAG; const addr: dword);
  769. procedure setcode(var p: P_TAG; const code: byte);
  770. procedure setcode(var p: POLY_F3; const code: byte);
  771. procedure setcode(var p: POLY_FT3; const code: byte);
  772. procedure setcode(var p: POLY_G3; const code: byte);
  773. procedure setcode(var p: POLY_GT3; const code: byte);
  774. procedure setcode(var p: POLY_F4; const code: byte);
  775. procedure setcode(var p: POLY_FT4; const code: byte);
  776. procedure setcode(var p: POLY_G4; const code: byte);
  777. procedure setcode(var p: POLY_GT4; const code: byte);
  778. procedure setcode(var p: SPRT_8; const code: byte);
  779. procedure setcode(var p: SPRT_16; const code: byte);
  780. procedure setcode(var p: SPRT; const code: byte);
  781. procedure setcode(var p: TILE_1; const code: byte);
  782. procedure setcode(var p: TILE_8; const code: byte);
  783. procedure setcode(var p: TILE_16; const code: byte);
  784. procedure setcode(var p: TILE; const code: byte);
  785. procedure setcode(var p: LINE_F2; const code: byte);
  786. procedure setcode(var p: LINE_G2; const code: byte);
  787. procedure setcode(var p: LINE_F3; const code: byte);
  788. procedure setcode(var p: LINE_G3; const code: byte);
  789. procedure setcode(var p: LINE_F4; const code: byte);
  790. procedure setcode(var p: LINE_G4; const code: byte);
  791. function getlen(p: P_TAG): byte;
  792. function getcode(p: P_TAG): byte;
  793. function getaddr(p: P_TAG): dword;
  794. {
  795. #define nextPrim(p) (void *)((((P_TAG *)(p))->addr)|0x80000000)
  796. #define isendprim(p) ((((P_TAG *)(p))->addr)==0xffffff)
  797. #define addPrim(ot, p) setaddr(p, getaddr(ot)), setaddr(ot, p)
  798. #define addPrims(ot, p0, p1) setaddr(p1, getaddr(ot)),setaddr(ot, p0)
  799. #define catPrim(p0, p1) setaddr(p0, p1)
  800. #define termPrim(p) setaddr(p, 0xffffffff)
  801. #define setSemiTrans(p, abe) \
  802. ((abe)?setcode(p, getcode(p)|0x02):setcode(p, getcode(p)&~0x02))
  803. #define setShadeTex(p, tge) \
  804. ((tge)?setcode(p, getcode(p)|0x01):setcode(p, getcode(p)&~0x01))
  805. }
  806. {
  807. function getTPage(tp, abr, x, y: longint): longint;
  808. ((((tp)&0x3)<<7)|(((abr)&0x3)<<5)|(((y)&0x100)>>4)|(((x)&0x3ff)>>6)| \
  809. (((y)&0x200)<<2))
  810. function getClut(x, y): longint;
  811. (((y)<<6)|(((x)>>4)&0x3f))
  812. }
  813. procedure dumpTPage(tpage: longint);
  814. procedure dumpClut(clut: longint);
  815. {
  816. #define _get_mode(dfe, dtd, tpage) \
  817. ((0xe1000000)|((dtd)?0x0200:0)| \
  818. ((dfe)?0x0400:0)|((tpage)&0x9ff))
  819. #define setDrawTPage(p, dfe, dtd, tpage) \
  820. setlen(p, 1), \
  821. ((u_long *)(p))[1] = _get_mode(dfe, dtd, tpage)
  822. #define _get_tw(tw) \
  823. (tw ? ((0xe2000000)|((((tw)->y&0xff)>>3)<<15)| \
  824. ((((tw)->x&0xff)>>3)<<10)|(((~((tw)->h-1)&0xff)>>3)<<5)| \
  825. (((~((tw)->w-1)&0xff)>>3))) : 0)
  826. #define setTexWindow(p, tw) \
  827. setlen(p, 2), \
  828. ((u_long *)(p))[1] = _get_tw(tw), \
  829. ((u_long *)(p))[2] = 0
  830. }
  831. {
  832. #define _get_len(rect) \
  833. (((rect)->w*(rect)->h+1)/2+4)
  834. #define setDrawLoad(pt, rect) \
  835. (_get_len(rect) <= 16) ? ( \
  836. (setlen(pt, _get_len(rect))), \
  837. ((pt)->code[0] = 0xa0000000), \
  838. ((pt)->code[1] = *((u_long *)&(rect)->x)), \
  839. ((pt)->code[2] = *((u_long *)&(rect)->w)), \
  840. ((pt)->p[_get_len(rect)-4] = 0x01000000) \
  841. ) : ( \
  842. (setlen(pt,0)) \
  843. )
  844. #define setDrawStp(p, pbw) \
  845. setlen(p, 2), \
  846. ((u_long *)p)[1] = 0xe6000000|(pbw?0x01:0), \
  847. ((u_long *)p)[2] = 0
  848. #define setDrawMode(p, dfe, dtd, tpage, tw) \
  849. setlen(p, 2), \
  850. ((u_long *)p)[1] = _get_mode(dfe, dtd, tpage), \
  851. ((u_long *)p)[2] = _get_tw((RECT *)tw)
  852. }
  853. // Primitive Lentgh Code
  854. //--------------------------------------------------------------------
  855. //
  856. procedure setPolyF3(var p: POLY_F3);
  857. procedure setPolyFT3(var p: POLY_FT3);
  858. procedure setPolyG3(var p: POLY_G3);
  859. procedure setPolyGT3(var p: POLY_GT3);
  860. procedure setPolyF4(var p: POLY_F4);
  861. procedure setPolyFT4(var p: POLY_FT4);
  862. procedure setPolyG4(var p: POLY_G4);
  863. procedure setPolyGT4(var p: POLY_GT4);
  864. procedure setSprt8(var p: SPRT_8);
  865. procedure setSprt16(var p: SPRT_16);
  866. procedure setSprt(var p: SPRT);
  867. //procedure setTile1(var p: TILE_1);
  868. procedure setTile8(var p: TILE_8);
  869. procedure setTile16(var p: TILE_16);
  870. procedure setTile(var p: TILE);
  871. procedure setLineF2(var p: LINE_F2);
  872. procedure setLineG2(var p: LINE_G2);
  873. procedure setLineF3(var p: LINE_F3);
  874. procedure setLineG3(var p: LINE_G3);
  875. procedure setLineF4(var p: LINE_F4);
  876. procedure setLineG4(var p: LINE_G4);
  877. implementation
  878. procedure limitRange(var x: longint; l, h: longint); inline;
  879. begin
  880. if x < l then x := l else if x > h then x := h;
  881. end;
  882. procedure setVector(var v: VECTOR; const x, y, z: longint);
  883. begin
  884. v.vx:= x;
  885. v.vy:= y;
  886. v.vz:= z;
  887. end;
  888. procedure setVector(var v: SVECTOR; const x, y, z: smallint);
  889. begin
  890. v.vx:= x;
  891. v.vy:= y;
  892. v.vz:= z;
  893. end;
  894. procedure setVector(var v: DVECTOR; const x, y, z: smallint);
  895. begin
  896. v.vx:= x;
  897. v.vy:= y;
  898. end;
  899. procedure copyVector(var v0: VECTOR; const v1: VECTOR);
  900. begin
  901. v0:= v1;
  902. end;
  903. procedure copyVector(var v0: SVECTOR; const v1: SVECTOR);
  904. begin
  905. v0:= v1;
  906. end;
  907. procedure copyVector(var v0: DVECTOR; const v1: DVECTOR);
  908. begin
  909. v0:= v1;
  910. end;
  911. procedure addVector(var v0: VECTOR; const v1: VECTOR);
  912. begin
  913. v0.vx:= v0.vx + v1.vx;
  914. v0.vy:= v0.vy + v1.vy;
  915. v0.vz:= v0.vz + v1.vz;
  916. end;
  917. procedure addVector(var v0: SVECTOR; const v1: SVECTOR);
  918. begin
  919. v0.vx:= v0.vx + v1.vx;
  920. v0.vy:= v0.vy + v1.vy;
  921. v0.vz:= v0.vz + v1.vz;
  922. end;
  923. procedure addVector(var v0: DVECTOR; const v1: DVECTOR);
  924. begin
  925. v0.vx:= v0.vx + v1.vx;
  926. v0.vy:= v0.vy + v1.vy;
  927. end;
  928. procedure setRECT(var r: RECT; const x, y, w, h: longint);
  929. begin
  930. r.x:= x;
  931. r.y:= y;
  932. r.w:= w;
  933. r.h:= h;
  934. end;
  935. procedure dumpMatrix(const x: MATRIX);
  936. begin
  937. GPU_printf('\t%5d,%5d,%5d\n', x.m[0,0], x.m[0,1], x.m[0,2]);
  938. GPU_printf('\t%5d,%5d,%5d\n', x.m[1,0], x.m[1,1], x.m[1,2]);
  939. GPU_printf('\t%5d,%5d,%5d\n', x.m[2,0], x.m[2,1], x.m[2,2]);
  940. end;
  941. procedure dumpVector(str: pchar; const v: VECTOR);
  942. begin
  943. GPU_printf('%s=(%d,%d,%d)\n', str, v.vx, v.vy, v.vz)
  944. end;
  945. procedure dumpVector(str: pchar; const v: SVECTOR);
  946. begin
  947. GPU_printf('%s=(%d,%d,%d)\n', str, v.vx, v.vy, v.vz)
  948. end;
  949. procedure dumpVector(str: pchar; const v: DVECTOR);
  950. begin
  951. GPU_printf('%s=(%d,%d)\n', str, v.vx, v.vy)
  952. end;
  953. procedure setRGB0(var p: POLY_F3; const r, g, b: byte);
  954. begin
  955. p.r0:= r;
  956. p.g0:= g;
  957. p.b0:= b;
  958. end;
  959. procedure setRGB0(var p: POLY_F4; const r, g, b: byte);
  960. begin
  961. p.r0:= r;
  962. p.g0:= g;
  963. p.b0:= b;
  964. end;
  965. procedure setRGB0(var p: POLY_FT3; const r, g, b: byte);
  966. begin
  967. p.r0:= r;
  968. p.g0:= g;
  969. p.b0:= b;
  970. end;
  971. procedure setRGB0(var p: POLY_FT4; const r, g, b: byte);
  972. begin
  973. p.r0:= r;
  974. p.g0:= g;
  975. p.b0:= b;
  976. end;
  977. procedure setRGB0(var p: POLY_G3; const r, g, b: byte);
  978. begin
  979. p.r0:= r;
  980. p.g0:= g;
  981. p.b0:= b;
  982. end;
  983. procedure setRGB0(var p: POLY_G4; const r, g, b: byte);
  984. begin
  985. p.r0:= r;
  986. p.g0:= g;
  987. p.b0:= b;
  988. end;
  989. procedure setRGB0(var p: POLY_GT3; const r, g, b: byte);
  990. begin
  991. p.r0:= r;
  992. p.g0:= g;
  993. p.b0:= b;
  994. end;
  995. procedure setRGB0(var p: POLY_GT4; const r, g, b: byte);
  996. begin
  997. p.r0:= r;
  998. p.g0:= g;
  999. p.b0:= b;
  1000. end;
  1001. procedure setRGB0(var c: DRAWENV; r, g, b: byte);
  1002. begin
  1003. c.r0:=r;
  1004. c.g0:=g;
  1005. c.b0:=b;
  1006. end;
  1007. procedure setRGB1(var p: POLY_G3; const r, g, b: byte);
  1008. begin
  1009. p.r1:= r;
  1010. p.g1:= g;
  1011. p.b1:= b;
  1012. end;
  1013. procedure setRGB1(var p: POLY_G4; const r, g, b: byte);
  1014. begin
  1015. p.r1:= r;
  1016. p.g1:= g;
  1017. p.b1:= b;
  1018. end;
  1019. procedure setRGB1(var p: POLY_GT3; const r, g, b: byte);
  1020. begin
  1021. p.r1:= r;
  1022. p.g1:= g;
  1023. p.b1:= b;
  1024. end;
  1025. procedure setRGB1(var p: POLY_GT4; const r, g, b: byte);
  1026. begin
  1027. p.r1:= r;
  1028. p.g1:= g;
  1029. p.b1:= b;
  1030. end;
  1031. procedure setRGB2(var p: POLY_G3; const r, g, b: byte);
  1032. begin
  1033. p.r2:= r;
  1034. p.g2:= g;
  1035. p.b2:= b;
  1036. end;
  1037. procedure setRGB2(var p: POLY_G4; const r, g, b: byte);
  1038. begin
  1039. p.r2:= r;
  1040. p.g2:= g;
  1041. p.b2:= b;
  1042. end;
  1043. procedure setRGB2(var p: POLY_GT3; const r, g, b: byte);
  1044. begin
  1045. p.r2:= r;
  1046. p.g2:= g;
  1047. p.b2:= b;
  1048. end;
  1049. procedure setRGB2(var p: POLY_GT4; const r, g, b: byte);
  1050. begin
  1051. p.r2:= r;
  1052. p.g2:= g;
  1053. p.b2:= b;
  1054. end;
  1055. procedure setRGB3(var p: POLY_G4; const r, g, b: byte);
  1056. begin
  1057. p.r3:= r;
  1058. p.g3:= g;
  1059. p.b3:= b;
  1060. end;
  1061. procedure setRGB3(var p: POLY_GT4; const r, g, b: byte);
  1062. begin
  1063. p.r3:= r;
  1064. p.g3:= g;
  1065. p.b3:= b;
  1066. end;
  1067. procedure setXY0(var p: POLY_F3; const x, y: smallint);
  1068. begin
  1069. p.x0:= x;
  1070. p.y0:= y;
  1071. end;
  1072. procedure setXY0(var p: POLY_F4; const x, y: smallint);
  1073. begin
  1074. p.x0:= x;
  1075. p.y0:= y;
  1076. end;
  1077. procedure setXY0(var p: POLY_FT3; const x, y: smallint);
  1078. begin
  1079. p.x0:= x;
  1080. p.y0:= y;
  1081. end;
  1082. procedure setXY0(var p: POLY_FT4; const x, y: smallint);
  1083. begin
  1084. p.x0:= x;
  1085. p.y0:= y;
  1086. end;
  1087. procedure setXY0(var p: POLY_G3; const x, y: smallint);
  1088. begin
  1089. p.x0:= x;
  1090. p.y0:= y;
  1091. end;
  1092. procedure setXY0(var p: POLY_G4; const x, y: smallint);
  1093. begin
  1094. p.x0:= x;
  1095. p.y0:= y;
  1096. end;
  1097. procedure setXY0(var p: POLY_GT3; const x, y: smallint);
  1098. begin
  1099. p.x0:= x;
  1100. p.y0:= y;
  1101. end;
  1102. procedure setXY0(var p: POLY_GT4; const x, y: smallint);
  1103. begin
  1104. p.x0:= x;
  1105. p.y0:= y;
  1106. end;
  1107. procedure setXY0(var p: LINE_F2; const x, y: smallint);
  1108. begin
  1109. p.x0:= x;
  1110. p.y0:= y;
  1111. end;
  1112. procedure setXY0(var p: LINE_G2; const x, y: smallint);
  1113. begin
  1114. p.x0:= x;
  1115. p.y0:= y;
  1116. end;
  1117. procedure setXY0(var p: LINE_F3; const x, y: smallint);
  1118. begin
  1119. p.x0:= x;
  1120. p.y0:= y;
  1121. end;
  1122. procedure setXY0(var p: LINE_G3; const x, y: smallint);
  1123. begin
  1124. p.x0:= x;
  1125. p.y0:= y;
  1126. end;
  1127. procedure setXY0(var p: LINE_F4; const x, y: smallint);
  1128. begin
  1129. p.x0:= x;
  1130. p.y0:= y;
  1131. end;
  1132. procedure setXY0(var p: LINE_G4; const x, y: smallint);
  1133. begin
  1134. p.x0:= x;
  1135. p.y0:= y;
  1136. end;
  1137. procedure setXY0(var p: SPRT; const x, y: smallint);
  1138. begin
  1139. p.x0:= x;
  1140. p.y0:= y;
  1141. end;
  1142. procedure setXY0(var p: SPRT_16; const x, y: smallint);
  1143. begin
  1144. p.x0:= x;
  1145. p.y0:= y;
  1146. end;
  1147. procedure setXY0(var p: SPRT_8; const x, y: smallint);
  1148. begin
  1149. p.x0:= x;
  1150. p.y0:= y;
  1151. end;
  1152. procedure setXY0(var p: TILE; const x, y: smallint);
  1153. begin
  1154. p.x0:= x;
  1155. p.y0:= y;
  1156. end;
  1157. procedure setXY0(var p: TILE_16; const x, y: smallint);
  1158. begin
  1159. p.x0:= x;
  1160. p.y0:= y;
  1161. end;
  1162. procedure setXY0(var p: TILE_8; const x, y: smallint);
  1163. begin
  1164. p.x0:= x;
  1165. p.y0:= y;
  1166. end;
  1167. procedure setXY0(var p: TILE_1; const x, y: smallint);
  1168. begin
  1169. p.x0:= x;
  1170. p.y0:= y;
  1171. end;
  1172. procedure setXY2(var p: POLY_F3; const x0, y0, x1, y1: smallint);
  1173. begin
  1174. p.x1:= x0;
  1175. p.y1:= y0;
  1176. p.x2:= x1;
  1177. p.y2:= y1;
  1178. end;
  1179. procedure setXY2(var p: POLY_F4; const x0, y0, x1, y1: smallint);
  1180. begin
  1181. p.x0:= x0;
  1182. p.y0:= y0;
  1183. p.x1:= x1;
  1184. p.y1:= y1;
  1185. end;
  1186. procedure setXY2(var p: POLY_FT3; const x0, y0, x1, y1: smallint);
  1187. begin
  1188. p.x0:= x0;
  1189. p.y0:= y0;
  1190. p.x1:= x1;
  1191. p.y1:= y1;
  1192. end;
  1193. procedure setXY2(var p: POLY_FT4; const x0, y0, x1, y1: smallint);
  1194. begin
  1195. p.x0:= x0;
  1196. p.y0:= y0;
  1197. p.x1:= x1;
  1198. p.y1:= y1;
  1199. end;
  1200. procedure setXY2(var p: POLY_G3; const x0, y0, x1, y1: smallint);
  1201. begin
  1202. p.x0:= x0;
  1203. p.y0:= y0;
  1204. p.x1:= x1;
  1205. p.y1:= y1;
  1206. end;
  1207. procedure setXY2(var p: POLY_G4; const x0, y0, x1, y1: smallint);
  1208. begin
  1209. p.x0:= x0;
  1210. p.y0:= y0;
  1211. p.x1:= x1;
  1212. p.y1:= y1;
  1213. end;
  1214. procedure setXY2(var p: POLY_GT3; const x0, y0, x1, y1: smallint);
  1215. begin
  1216. p.x0:= x0;
  1217. p.y0:= y0;
  1218. p.x1:= x1;
  1219. p.y1:= y1;
  1220. end;
  1221. procedure setXY2(var p: POLY_GT4; const x0, y0, x1, y1: smallint);
  1222. begin
  1223. p.x0:= x0;
  1224. p.y0:= y0;
  1225. p.x1:= x1;
  1226. p.y1:= y1;
  1227. end;
  1228. procedure setXY2(var p: LINE_F2; const x0, y0, x1, y1: smallint);
  1229. begin
  1230. p.x0:= x0;
  1231. p.y0:= y0;
  1232. p.x1:= x1;
  1233. p.y1:= y1;
  1234. end;
  1235. procedure setXY2(var p: LINE_G2; const x0, y0, x1, y1: smallint);
  1236. begin
  1237. p.x0:= x0;
  1238. p.y0:= y0;
  1239. p.x1:= x1;
  1240. p.y1:= y1;
  1241. end;
  1242. procedure setXY2(var p: LINE_F3; const x0, y0, x1, y1: smallint);
  1243. begin
  1244. p.x0:= x0;
  1245. p.y0:= y0;
  1246. p.x1:= x1;
  1247. p.y1:= y1;
  1248. end;
  1249. procedure setXY2(var p: LINE_G3; const x0, y0, x1, y1: smallint);
  1250. begin
  1251. p.x0:= x0;
  1252. p.y0:= y0;
  1253. p.x1:= x1;
  1254. p.y1:= y1;
  1255. end;
  1256. procedure setXY2(var p: LINE_F4; const x0, y0, x1, y1: smallint);
  1257. begin
  1258. p.x0:= x0;
  1259. p.y0:= y0;
  1260. p.x1:= x1;
  1261. p.y1:= y1;
  1262. end;
  1263. procedure setXY2(var p: LINE_G4; const x0, y0, x1, y1: smallint);
  1264. begin
  1265. p.x0:= x0;
  1266. p.y0:= y0;
  1267. p.x1:= x1;
  1268. p.y1:= y1;
  1269. end;
  1270. procedure setXY3(var p: LINE_F3; const x0, y0, x1, y1, x2, y2: smallint);
  1271. begin
  1272. p.x0:= x0;
  1273. p.y0:= y0;
  1274. p.x1:= x1;
  1275. p.y1:= y1;
  1276. p.x2:= x2;
  1277. p.y2:= y2;
  1278. end;
  1279. procedure setXY3(var p: LINE_G3; const x0, y0, x1, y1, x2, y2: smallint);
  1280. begin
  1281. p.x0:= x0;
  1282. p.y0:= y0;
  1283. p.x1:= x1;
  1284. p.y1:= y1;
  1285. p.x2:= x2;
  1286. p.y2:= y2;
  1287. end;
  1288. procedure setXY3(var p: LINE_F4; const x0, y0, x1, y1, x2, y2: smallint);
  1289. begin
  1290. p.x0:= x0;
  1291. p.y0:= y0;
  1292. p.x1:= x1;
  1293. p.y1:= y1;
  1294. p.x2:= x2;
  1295. p.y2:= y2;
  1296. end;
  1297. procedure setXY3(var p: LINE_G4; const x0, y0, x1, y1, x2, y2: smallint);
  1298. begin
  1299. p.x0:= x0;
  1300. p.y0:= y0;
  1301. p.x1:= x1;
  1302. p.y1:= y1;
  1303. p.x2:= x2;
  1304. p.y2:= y2;
  1305. end;
  1306. procedure setXY3(var p: POLY_F3; const x0, y0, x1, y1, x2, y2: smallint);
  1307. begin
  1308. p.x0:= x0;
  1309. p.y0:= y0;
  1310. p.x1:= x1;
  1311. p.y1:= y1;
  1312. p.x2:= x2;
  1313. p.y2:= y2;
  1314. end;
  1315. procedure setXY3(var p: POLY_F4; const x0, y0, x1, y1, x2, y2: smallint);
  1316. begin
  1317. p.x0:= x0;
  1318. p.y0:= y0;
  1319. p.x1:= x1;
  1320. p.y1:= y1;
  1321. p.x2:= x2;
  1322. p.y2:= y2;
  1323. end;
  1324. procedure setXY3(var p: POLY_FT3; const x0, y0, x1, y1, x2, y2: smallint);
  1325. begin
  1326. p.x0:= x0;
  1327. p.y0:= y0;
  1328. p.x1:= x1;
  1329. p.y1:= y1;
  1330. p.x2:= x2;
  1331. p.y2:= y2;
  1332. end;
  1333. procedure setXY3(var p: POLY_FT4; const x0, y0, x1, y1, x2, y2: smallint);
  1334. begin
  1335. p.x0:= x0;
  1336. p.y0:= y0;
  1337. p.x1:= x1;
  1338. p.y1:= y1;
  1339. p.x2:= x2;
  1340. p.y2:= y2;
  1341. end;
  1342. procedure setXY3(var p: POLY_G3; const x0, y0, x1, y1, x2, y2: smallint);
  1343. begin
  1344. p.x0:= x0;
  1345. p.y0:= y0;
  1346. p.x1:= x1;
  1347. p.y1:= y1;
  1348. p.x2:= x2;
  1349. p.y2:= y2;
  1350. end;
  1351. procedure setXY3(var p: POLY_G4; const x0, y0, x1, y1, x2, y2: smallint);
  1352. begin
  1353. p.x0:= x0;
  1354. p.y0:= y0;
  1355. p.x1:= x1;
  1356. p.y1:= y1;
  1357. p.x2:= x2;
  1358. p.y2:= y2;
  1359. end;
  1360. procedure setXY3(var p: POLY_GT3; const x0, y0, x1, y1, x2, y2: smallint);
  1361. begin
  1362. p.x0:= x0;
  1363. p.y0:= y0;
  1364. p.x1:= x1;
  1365. p.y1:= y1;
  1366. p.x2:= x2;
  1367. p.y2:= y2;
  1368. end;
  1369. procedure setXY3(var p: POLY_GT4; const x0, y0, x1, y1, x2, y2: smallint);
  1370. begin
  1371. p.x0:= x0;
  1372. p.y0:= y0;
  1373. p.x1:= x1;
  1374. p.y1:= y1;
  1375. p.x2:= x2;
  1376. p.y2:= y2;
  1377. end;
  1378. procedure setXY4(var p: POLY_F4; const x0, y0, x1, y1, x2, y2, x3, y3: smallint);
  1379. begin
  1380. p.x0:= x0;
  1381. p.y0:= y0;
  1382. p.x1:= x1;
  1383. p.y1:= y1;
  1384. p.x2:= x2;
  1385. p.y2:= y2;
  1386. p.x3:= x3;
  1387. p.y3:= y3;
  1388. end;
  1389. procedure setXY4(var p: POLY_FT4; const x0, y0, x1, y1, x2, y2, x3, y3: smallint);
  1390. begin
  1391. p.x0:= x0;
  1392. p.y0:= y0;
  1393. p.x1:= x1;
  1394. p.y1:= y1;
  1395. p.x2:= x2;
  1396. p.y2:= y2;
  1397. p.x3:= x3;
  1398. p.y3:= y3;
  1399. end;
  1400. procedure setXY4(var p: POLY_G4; const x0, y0, x1, y1, x2, y2, x3, y3: smallint);
  1401. begin
  1402. p.x0:= x0;
  1403. p.y0:= y0;
  1404. p.x1:= x1;
  1405. p.y1:= y1;
  1406. p.x2:= x2;
  1407. p.y2:= y2;
  1408. p.x3:= x3;
  1409. p.y3:= y3;
  1410. end;
  1411. procedure setXY4(var p: POLY_GT4; const x0, y0, x1, y1, x2, y2, x3, y3: smallint);
  1412. begin
  1413. p.x0:= x0;
  1414. p.y0:= y0;
  1415. p.x1:= x1;
  1416. p.y1:= y1;
  1417. p.x2:= x2;
  1418. p.y2:= y2;
  1419. p.x3:= x3;
  1420. p.y3:= y3;
  1421. end;
  1422. procedure setXYWH(var p: POLY_F4; x0, y0, w, h: smallint);
  1423. begin
  1424. p.x0:= x0;
  1425. p.y0:= y0;
  1426. p.x1:= x0 + w;
  1427. p.y1:= y0;
  1428. p.x2:= x0;
  1429. p.y2:= y0 + h;
  1430. p.x3:= x0 + w;
  1431. p.y3:= y0 + h;
  1432. end;
  1433. procedure setXYWH(var p: POLY_FT4; x0, y0, w, h: smallint);
  1434. begin
  1435. p.x0:= x0;
  1436. p.y0:= y0;
  1437. p.x1:= x0 + w;
  1438. p.y1:= y0;
  1439. p.x2:= x0;
  1440. p.y2:= y0 + h;
  1441. p.x3:= x0 + w;
  1442. p.y3:= y0 + h;
  1443. end;
  1444. procedure setXYWH(var p: POLY_G4; x0, y0, w, h: smallint);
  1445. begin
  1446. p.x0:= x0;
  1447. p.y0:= y0;
  1448. p.x1:= x0 + w;
  1449. p.y1:= y0;
  1450. p.x2:= x0;
  1451. p.y2:= y0 + h;
  1452. p.x3:= x0 + w;
  1453. p.y3:= y0 + h;
  1454. end;
  1455. procedure setXYWH(var p: POLY_GT4; x0, y0, w, h: smallint);
  1456. begin
  1457. p.x0:= x0;
  1458. p.y0:= y0;
  1459. p.x1:= x0 + w;
  1460. p.y1:= y0;
  1461. p.x2:= x0;
  1462. p.y2:= y0 + h;
  1463. p.x3:= x0 + w;
  1464. p.y3:= y0 + h;
  1465. end;
  1466. procedure setXYWH(var p: LINE_F4; x0, y0, w, h: smallint);
  1467. begin
  1468. p.x0:= x0;
  1469. p.y0:= y0;
  1470. p.x1:= x0 + w;
  1471. p.y1:= y0;
  1472. p.x2:= x0;
  1473. p.y2:= y0 + h;
  1474. p.x3:= x0 + w;
  1475. p.y3:= y0 + h;
  1476. end;
  1477. procedure setXYWH(var p: LINE_G4; x0, y0, w, h: smallint);
  1478. begin
  1479. p.x0:= x0;
  1480. p.y0:= y0;
  1481. p.x1:= x0 + w;
  1482. p.y1:= y0;
  1483. p.x2:= x0;
  1484. p.y2:= y0 + h;
  1485. p.x3:= x0 + w;
  1486. p.y3:= y0 + h;
  1487. end;
  1488. procedure setWH(var p: RECT; w, h: smallint);
  1489. begin
  1490. p.w:= w;
  1491. p.h:= h;
  1492. end;
  1493. procedure setWH(var p: RECT32; w, h: longint);
  1494. begin
  1495. p.w:= w;
  1496. p.h:= h;
  1497. end;
  1498. procedure setWH(var p: SPRT; w, h: smallint);
  1499. begin
  1500. p.w:= w;
  1501. p.h:= h;
  1502. end;
  1503. procedure setWH(var p: TILE; w, h: smallint);
  1504. begin
  1505. p.w:= w;
  1506. p.h:= h;
  1507. end;
  1508. procedure setUV0(var p: POLY_FT3; u0, v0: smallint);
  1509. begin
  1510. p.u0:= u0;
  1511. p.v0:= v0;
  1512. end;
  1513. procedure setUV0(var p: POLY_FT4; u0, v0: smallint);
  1514. begin
  1515. p.u0:= u0;
  1516. p.v0:= v0;
  1517. end;
  1518. procedure setUV0(var p: POLY_GT3; u0, v0: smallint);
  1519. begin
  1520. p.u0:= u0;
  1521. p.v0:= v0;
  1522. end;
  1523. procedure setUV0(var p: POLY_GT4; u0, v0: smallint);
  1524. begin
  1525. p.u0:= u0;
  1526. p.v0:= v0;
  1527. end;
  1528. procedure setUV0(var p: SPRT; u0, v0: byte);
  1529. begin
  1530. p.u0:= u0;
  1531. p.v0:= v0;
  1532. end;
  1533. procedure setUV0(var p: SPRT_16; u0, v0: byte);
  1534. begin
  1535. p.u0:= u0;
  1536. p.v0:= v0;
  1537. end;
  1538. procedure setUV0(var p: SPRT_8; u0, v0: byte);
  1539. begin
  1540. p.u0:= u0;
  1541. p.v0:= v0;
  1542. end;
  1543. procedure setUV0(var p: TMD_PRIM; u0, v0: byte);
  1544. begin
  1545. p.u0:= u0;
  1546. p.v0:= v0;
  1547. end;
  1548. procedure setUV3(var p: POLY_FT3; u0, v0, u1, v1, u2, v2: smallint);
  1549. begin
  1550. p.u0:= u0;
  1551. p.v0:= v0;
  1552. p.u1:= u1;
  1553. p.v1:= v1;
  1554. p.u2:= u2;
  1555. p.v2:= v2;
  1556. end;
  1557. procedure setUV3(var p: POLY_FT4; u0, v0, u1, v1, u2, v2: smallint);
  1558. begin
  1559. p.u0:= u0;
  1560. p.v0:= v0;
  1561. p.u1:= u1;
  1562. p.v1:= v1;
  1563. p.u2:= u2;
  1564. p.v2:= v2;
  1565. end;
  1566. procedure setUV3(var p: POLY_GT3; u0, v0, u1, v1, u2, v2: smallint);
  1567. begin
  1568. p.u0:= u0;
  1569. p.v0:= v0;
  1570. p.u1:= u1;
  1571. p.v1:= v1;
  1572. p.u2:= u2;
  1573. p.v2:= v2;
  1574. end;
  1575. procedure setUV3(var p: POLY_GT4; u0, v0, u1, v1, u2, v2: smallint);
  1576. begin
  1577. p.u0:= u0;
  1578. p.v0:= v0;
  1579. p.u1:= u1;
  1580. p.v1:= v1;
  1581. p.u2:= u2;
  1582. p.v2:= v2;
  1583. end;
  1584. procedure setUV3(var p: TMD_PRIM; u0, v0, u1, v1, u2, v2: byte);
  1585. begin
  1586. p.u0:= u0;
  1587. p.v0:= v0;
  1588. p.u1:= u1;
  1589. p.v1:= v1;
  1590. p.u2:= u2;
  1591. p.v2:= v2;
  1592. end;
  1593. procedure setUV4(var p: POLY_FT4; u0, v0, u1, v1, u2, v2, u3, v3: smallint);
  1594. begin
  1595. p.u0:= u0;
  1596. p.v0:= v0;
  1597. p.u1:= u1;
  1598. p.v1:= v1;
  1599. p.u2:= u2;
  1600. p.v2:= v2;
  1601. p.u3:= u3;
  1602. p.v3:= v3;
  1603. end;
  1604. procedure setUV4(var p: POLY_GT4; u0, v0, u1, v1, u2, v2, u3, v3: smallint);
  1605. begin
  1606. p.u0:= u0;
  1607. p.v0:= v0;
  1608. p.u1:= u1;
  1609. p.v1:= v1;
  1610. p.u2:= u2;
  1611. p.v2:= v2;
  1612. p.u3:= u3;
  1613. p.v3:= v3;
  1614. end;
  1615. procedure setUV4(var p: TMD_PRIM; u0, v0, u1, v1, u2, v2, u3, v3: byte);
  1616. begin
  1617. p.u0:= u0;
  1618. p.v0:= v0;
  1619. p.u1:= u1;
  1620. p.v1:= v1;
  1621. p.u2:= u2;
  1622. p.v2:= v2;
  1623. p.u3:= u3;
  1624. p.v3:= v3;
  1625. end;
  1626. procedure setUVWH(var p: POLY_FT4; u0, v0, w, h: smallint);
  1627. begin
  1628. p.u0:= u0;
  1629. p.v0:= v0;
  1630. p.u1:= u0 + w;
  1631. p.v1:= v0;
  1632. p.u2:= u0;
  1633. p.v2:= v0 + h;
  1634. p.u3:= u0 + w;
  1635. p.v3:= v0 + h;
  1636. end;
  1637. procedure setUVWH(var p: POLY_GT4; u0, v0, w, h: smallint);
  1638. begin
  1639. p.u0:= u0;
  1640. p.v0:= v0;
  1641. p.u1:= u0 + w;
  1642. p.v1:= v0;
  1643. p.u2:= u0;
  1644. p.v2:= v0 + h;
  1645. p.u3:= u0 + w;
  1646. p.v3:= v0 + h;
  1647. end;
  1648. procedure setUVWH(var p: TMD_PRIM; u0, v0, w, h: smallint);
  1649. begin
  1650. p.u0:= u0;
  1651. p.v0:= v0;
  1652. p.u1:= u0 + w;
  1653. p.v1:= v0;
  1654. p.u2:= u0;
  1655. p.v2:= v0 + h;
  1656. p.u3:= u0 + w;
  1657. p.v3:= v0 + h;
  1658. end;
  1659. procedure dumpWH(p: RECT);
  1660. begin
  1661. GPU_printf('(%d,%d)\n', p.w, p.h);
  1662. end;
  1663. procedure dumpWH(p: RECT32);begin
  1664. GPU_printf('(%d,%d)\n', p.w, p.h);
  1665. end;
  1666. procedure dumpWH(p: SPRT);begin
  1667. GPU_printf('(%d,%d)\n', p.w, p.h);
  1668. end;
  1669. procedure dumpWH(p: TILE);begin
  1670. GPU_printf('(%d,%d)\n', p.w, p.h);
  1671. end;
  1672. procedure dumpXY0(p: POLY_F3);
  1673. begin
  1674. GPU_printf('(%d,%d)\n', p.x0, p.y0);
  1675. end;
  1676. procedure dumpXY0(p: POLY_F4);
  1677. begin
  1678. GPU_printf('(%d,%d)\n', p.x0, p.y0);
  1679. end;
  1680. procedure dumpXY0(p: POLY_FT3);
  1681. begin
  1682. GPU_printf('(%d,%d)\n', p.x0, p.y0);
  1683. end;
  1684. procedure dumpXY0(p: POLY_FT4);
  1685. begin
  1686. GPU_printf('(%d,%d)\n', p.x0, p.y0);
  1687. end;
  1688. procedure dumpXY0(p: POLY_G3);
  1689. begin
  1690. GPU_printf('(%d,%d)\n', p.x0, p.y0);
  1691. end;
  1692. procedure dumpXY0(p: POLY_G4);
  1693. begin
  1694. GPU_printf('(%d,%d)\n', p.x0, p.y0);
  1695. end;
  1696. procedure dumpXY0(p: POLY_GT3);
  1697. begin
  1698. GPU_printf('(%d,%d)\n', p.x0, p.y0);
  1699. end;
  1700. procedure dumpXY0(p: POLY_GT4);
  1701. begin
  1702. GPU_printf('(%d,%d)\n', p.x0, p.y0);
  1703. end;
  1704. procedure dumpXY0(p: LINE_F2);
  1705. begin
  1706. GPU_printf('(%d,%d)\n', p.x0, p.y0);
  1707. end;
  1708. procedure dumpXY0(p: LINE_G2);
  1709. begin
  1710. GPU_printf('(%d,%d)\n', p.x0, p.y0);
  1711. end;
  1712. procedure dumpXY0(p: LINE_F3);
  1713. begin
  1714. GPU_printf('(%d,%d)\n', p.x0, p.y0);
  1715. end;
  1716. procedure dumpXY0(p: LINE_G3);
  1717. begin
  1718. GPU_printf('(%d,%d)\n', p.x0, p.y0);
  1719. end;
  1720. procedure dumpXY0(p: LINE_F4);
  1721. begin
  1722. GPU_printf('(%d,%d)\n', p.x0, p.y0);
  1723. end;
  1724. procedure dumpXY0(p: LINE_G4);
  1725. begin
  1726. GPU_printf('(%d,%d)\n', p.x0, p.y0);
  1727. end;
  1728. procedure dumpXY0(p: SPRT);
  1729. begin
  1730. GPU_printf('(%d,%d)\n', p.x0, p.y0);
  1731. end;
  1732. procedure dumpXY0(p: SPRT_16);
  1733. begin
  1734. GPU_printf('(%d,%d)\n', p.x0, p.y0);
  1735. end;
  1736. procedure dumpXY0(p: SPRT_8);
  1737. begin
  1738. GPU_printf('(%d,%d)\n', p.x0, p.y0);
  1739. end;
  1740. procedure dumpXY0(p: TILE);
  1741. begin
  1742. GPU_printf('(%d,%d)\n', p.x0, p.y0);
  1743. end;
  1744. procedure dumpXY0(p: TILE_16);
  1745. begin
  1746. GPU_printf('(%d,%d)\n', p.x0, p.y0);
  1747. end;
  1748. procedure dumpXY0(p: TILE_8);
  1749. begin
  1750. GPU_printf('(%d,%d)\n', p.x0, p.y0);
  1751. end;
  1752. procedure dumpXY0(p: TILE_1);
  1753. begin
  1754. GPU_printf('(%d,%d)\n', p.x0, p.y0);
  1755. end;
  1756. procedure dumpUV0(p: POLY_FT3);
  1757. begin
  1758. GPU_printf('(%d,%d)\n', p.u0, p.v0);
  1759. end;
  1760. procedure dumpUV0(p: POLY_FT4);
  1761. begin
  1762. GPU_printf('(%d,%d)\n', p.u0, p.v0);
  1763. end;
  1764. procedure dumpUV0(p: POLY_GT3);
  1765. begin
  1766. GPU_printf('(%d,%d)\n', p.u0, p.v0);
  1767. end;
  1768. procedure dumpUV0(p: POLY_GT4);
  1769. begin
  1770. GPU_printf('(%d,%d)\n', p.u0, p.v0);
  1771. end;
  1772. procedure dumpUV0(p: SPRT);
  1773. begin
  1774. GPU_printf('(%d,%d)\n', p.u0, p.v0);
  1775. end;
  1776. procedure dumpUV0(p: SPRT_16);
  1777. begin
  1778. GPU_printf('(%d,%d)\n', p.u0, p.v0);
  1779. end;
  1780. procedure dumpUV0(p: SPRT_8);
  1781. begin
  1782. GPU_printf('(%d,%d)\n', p.u0, p.v0);
  1783. end;
  1784. procedure dumpUV0(p: TMD_PRIM);
  1785. begin
  1786. GPU_printf('(%d,%d)\n', p.u0, p.v0);
  1787. end;
  1788. procedure dumpXY2(p: POLY_F3);
  1789. begin
  1790. GPU_printf('(%d,%d)-(%d,%d)\n', p.x0, p.y0, p.x1, p.y1);
  1791. end;
  1792. procedure dumpXY2(p: POLY_F4);
  1793. begin
  1794. GPU_printf('(%d,%d)-(%d,%d)\n', p.x0, p.y0, p.x1, p.y1);
  1795. end;
  1796. procedure dumpXY2(p: POLY_FT3);
  1797. begin
  1798. GPU_printf('(%d,%d)-(%d,%d)\n', p.x0, p.y0, p.x1, p.y1);
  1799. end;
  1800. procedure dumpXY2(p: POLY_FT4);
  1801. begin
  1802. GPU_printf('(%d,%d)-(%d,%d)\n', p.x0, p.y0, p.x1, p.y1);
  1803. end;
  1804. procedure dumpXY2(p: POLY_G3);
  1805. begin
  1806. GPU_printf('(%d,%d)-(%d,%d)\n', p.x0, p.y0, p.x1, p.y1);
  1807. end;
  1808. procedure dumpXY2(p: POLY_G4);
  1809. begin
  1810. GPU_printf('(%d,%d)-(%d,%d)\n', p.x0, p.y0, p.x1, p.y1);
  1811. end;
  1812. procedure dumpXY2(p: POLY_GT3);
  1813. begin
  1814. GPU_printf('(%d,%d)-(%d,%d)\n', p.x0, p.y0, p.x1, p.y1);
  1815. end;
  1816. procedure dumpXY2(p: POLY_GT4);
  1817. begin
  1818. GPU_printf('(%d,%d)-(%d,%d)\n', p.x0, p.y0, p.x1, p.y1);
  1819. end;
  1820. procedure dumpXY2(p: LINE_F2);
  1821. begin
  1822. GPU_printf('(%d,%d)-(%d,%d)\n', p.x0, p.y0, p.x1, p.y1);
  1823. end;
  1824. procedure dumpXY2(p: LINE_G2);
  1825. begin
  1826. GPU_printf('(%d,%d)-(%d,%d)\n', p.x0, p.y0, p.x1, p.y1);
  1827. end;
  1828. procedure dumpXY2(p: LINE_F3);
  1829. begin
  1830. GPU_printf('(%d,%d)-(%d,%d)\n', p.x0, p.y0, p.x1, p.y1);
  1831. end;
  1832. procedure dumpXY2(p: LINE_G3);
  1833. begin
  1834. GPU_printf('(%d,%d)-(%d,%d)\n', p.x0, p.y0, p.x1, p.y1);
  1835. end;
  1836. procedure dumpXY2(p: LINE_F4);
  1837. begin
  1838. GPU_printf('(%d,%d)-(%d,%d)\n', p.x0, p.y0, p.x1, p.y1);
  1839. end;
  1840. procedure dumpXY2(p: LINE_G4);
  1841. begin
  1842. GPU_printf('(%d,%d)-(%d,%d)\n', p.x0, p.y0, p.x1, p.y1);
  1843. end;
  1844. procedure dumpXY3(p: POLY_F3);
  1845. begin
  1846. GPU_printf('(%d,%d)-(%d,%d)-(%d,%d)\n', p.x0, p.y0, p.x1, p.y1, p.x2, p.y2);
  1847. end;
  1848. procedure dumpXY3(p: POLY_F4);
  1849. begin
  1850. GPU_printf('(%d,%d)-(%d,%d)-(%d,%d)\n', p.x0, p.y0, p.x1, p.y1, p.x2, p.y2);
  1851. end;
  1852. procedure dumpXY3(p: POLY_FT3);
  1853. begin
  1854. GPU_printf('(%d,%d)-(%d,%d)-(%d,%d)\n', p.x0, p.y0, p.x1, p.y1, p.x2, p.y2);
  1855. end;
  1856. procedure dumpXY3(p: POLY_FT4);
  1857. begin
  1858. GPU_printf('(%d,%d)-(%d,%d)-(%d,%d)\n', p.x0, p.y0, p.x1, p.y1, p.x2, p.y2);
  1859. end;
  1860. procedure dumpXY3(p: POLY_G3);
  1861. begin
  1862. GPU_printf('(%d,%d)-(%d,%d)-(%d,%d)\n', p.x0, p.y0, p.x1, p.y1, p.x2, p.y2);
  1863. end;
  1864. procedure dumpXY3(p: POLY_G4);
  1865. begin
  1866. GPU_printf('(%d,%d)-(%d,%d)-(%d,%d)\n', p.x0, p.y0, p.x1, p.y1, p.x2, p.y2);
  1867. end;
  1868. procedure dumpXY3(p: POLY_GT3);
  1869. begin
  1870. GPU_printf('(%d,%d)-(%d,%d)-(%d,%d)\n', p.x0, p.y0, p.x1, p.y1, p.x2, p.y2);
  1871. end;
  1872. procedure dumpXY3(p: POLY_GT4);
  1873. begin
  1874. GPU_printf('(%d,%d)-(%d,%d)-(%d,%d)\n', p.x0, p.y0, p.x1, p.y1, p.x2, p.y2);
  1875. end;
  1876. procedure dumpXY3(p: LINE_F3);
  1877. begin
  1878. GPU_printf('(%d,%d)-(%d,%d)-(%d,%d)\n', p.x0, p.y0, p.x1, p.y1, p.x2, p.y2);
  1879. end;
  1880. procedure dumpXY3(p: LINE_G3);
  1881. begin
  1882. GPU_printf('(%d,%d)-(%d,%d)-(%d,%d)\n', p.x0, p.y0, p.x1, p.y1, p.x2, p.y2);
  1883. end;
  1884. procedure dumpXY3(p: LINE_F4);
  1885. begin
  1886. GPU_printf('(%d,%d)-(%d,%d)-(%d,%d)\n', p.x0, p.y0, p.x1, p.y1, p.x2, p.y2);
  1887. end;
  1888. procedure dumpXY3(p: LINE_G4);
  1889. begin
  1890. GPU_printf('(%d,%d)-(%d,%d)-(%d,%d)\n', p.x0, p.y0, p.x1, p.y1, p.x2, p.y2);
  1891. end;
  1892. procedure dumpUV3(p: POLY_FT3);
  1893. begin
  1894. GPU_printf('(%d,%d)-(%d,%d)-(%d,%d)\n', p.u0, p.v0, p.u1, p.v1, p.u2, p.v2);
  1895. end;
  1896. procedure dumpUV3(p: POLY_FT4);
  1897. begin
  1898. GPU_printf('(%d,%d)-(%d,%d)-(%d,%d)\n', p.u0, p.v0, p.u1, p.v1, p.u2, p.v2);
  1899. end;
  1900. procedure dumpUV3(p: POLY_GT3);
  1901. begin
  1902. GPU_printf('(%d,%d)-(%d,%d)-(%d,%d)\n', p.u0, p.v0, p.u1, p.v1, p.u2, p.v2);
  1903. end;
  1904. procedure dumpUV3(p: POLY_GT4);
  1905. begin
  1906. GPU_printf('(%d,%d)-(%d,%d)-(%d,%d)\n', p.u0, p.v0, p.u1, p.v1, p.u2, p.v2);
  1907. end;
  1908. procedure dumpUV3(p: TMD_PRIM);
  1909. begin
  1910. GPU_printf('(%d,%d)-(%d,%d)-(%d,%d)\n', p.u0, p.v0, p.u1, p.v1, p.u2, p.v2);
  1911. end;
  1912. procedure dumpXY4(p: POLY_F4);
  1913. begin
  1914. GPU_printf('(%d,%d)-(%d,%d)-(%d,%d)-(%d,%d)\n', p.x0, p.y0, p.x1, p.y1, p.x2, p.y2, p.x3, p.y3);
  1915. end;
  1916. procedure dumpXY4(p: POLY_FT4);
  1917. begin
  1918. GPU_printf('(%d,%d)-(%d,%d)-(%d,%d)-(%d,%d)\n', p.x0, p.y0, p.x1, p.y1, p.x2, p.y2, p.x3, p.y3);
  1919. end;
  1920. procedure dumpXY4(p: POLY_G4);
  1921. begin
  1922. GPU_printf('(%d,%d)-(%d,%d)-(%d,%d)-(%d,%d)\n', p.x0, p.y0, p.x1, p.y1, p.x2, p.y2, p.x3, p.y3);
  1923. end;
  1924. procedure dumpXY4(p: POLY_GT4);
  1925. begin
  1926. GPU_printf('(%d,%d)-(%d,%d)-(%d,%d)-(%d,%d)\n', p.x0, p.y0, p.x1, p.y1, p.x2, p.y2, p.x3, p.y3);
  1927. end;
  1928. procedure dumpUV4(p: POLY_FT4);
  1929. begin
  1930. GPU_printf('(%d,%d)-(%d,%d)-(%d,%d)-(%d,%d)\n', p.u0, p.v0, p.u1, p.v1, p.u2, p.v2, p.u3, p.v3);
  1931. end;
  1932. procedure dumpUV4(p: POLY_GT4);
  1933. begin
  1934. GPU_printf('(%d,%d)-(%d,%d)-(%d,%d)-(%d,%d)\n', p.u0, p.v0, p.u1, p.v1, p.u2, p.v2, p.u3, p.v3);
  1935. end;
  1936. procedure dumpUV4(p: TMD_PRIM);
  1937. begin
  1938. GPU_printf('(%d,%d)-(%d,%d)-(%d,%d)-(%d,%d)\n', p.u0, p.v0, p.u1, p.v1, p.u2, p.v2, p.u3, p.v3);
  1939. end;
  1940. procedure dumpRGB0(p: POLY_F3);
  1941. begin
  1942. GPU_printf('(%3d,%3d,%3d)\n', p.r0, p.g0, p.b0);
  1943. end;
  1944. procedure dumpRGB0(p: POLY_F4);
  1945. begin
  1946. GPU_printf('(%3d,%3d,%3d)\n', p.r0, p.g0, p.b0);
  1947. end;
  1948. procedure dumpRGB0(p: POLY_FT3);
  1949. begin
  1950. GPU_printf('(%3d,%3d,%3d)\n', p.r0, p.g0, p.b0);
  1951. end;
  1952. procedure dumpRGB0(p: POLY_FT4);
  1953. begin
  1954. GPU_printf('(%3d,%3d,%3d)\n', p.r0, p.g0, p.b0);
  1955. end;
  1956. procedure dumpRGB0(p: POLY_G3);
  1957. begin
  1958. GPU_printf('(%3d,%3d,%3d)\n', p.r0, p.g0, p.b0);
  1959. end;
  1960. procedure dumpRGB0(p: POLY_G4);
  1961. begin
  1962. GPU_printf('(%3d,%3d,%3d)\n', p.r0, p.g0, p.b0);
  1963. end;
  1964. procedure dumpRGB0(p: POLY_GT3);
  1965. begin
  1966. GPU_printf('(%3d,%3d,%3d)\n', p.r0, p.g0, p.b0);
  1967. end;
  1968. procedure dumpRGB0(p: POLY_GT4);
  1969. begin
  1970. GPU_printf('(%3d,%3d,%3d)\n', p.r0, p.g0, p.b0);
  1971. end;
  1972. procedure dumpRGB0(p: DRAWENV);
  1973. begin
  1974. GPU_printf('(%3d,%3d,%3d)\n', p.r0, p.g0, p.b0);
  1975. end;
  1976. procedure dumpRGB1(p:POLY_G3);
  1977. begin
  1978. GPU_printf('(%3d,%3d,%3d)\n', p.r1, p.g1, p.b1);
  1979. end;
  1980. procedure dumpRGB1(p:POLY_G4);
  1981. begin
  1982. GPU_printf('(%3d,%3d,%3d)\n', p.r1, p.g1, p.b1);
  1983. end;
  1984. procedure dumpRGB1(p:POLY_GT3);
  1985. begin
  1986. GPU_printf('(%3d,%3d,%3d)\n', p.r1, p.g1, p.b1);
  1987. end;
  1988. procedure dumpRGB1(p:POLY_GT4);
  1989. begin
  1990. GPU_printf('(%3d,%3d,%3d)\n', p.r1, p.g1, p.b1);
  1991. end;
  1992. procedure dumpRGB2(p: POLY_G3);
  1993. begin
  1994. GPU_printf('(%3d,%3d,%3d)\n', p.r2, p.g2, p.b2);
  1995. end;
  1996. procedure dumpRGB2(p: POLY_G4);
  1997. begin
  1998. GPU_printf('(%3d,%3d,%3d)\n', p.r2, p.g2, p.b2);
  1999. end;
  2000. procedure dumpRGB2(p: POLY_GT3);
  2001. begin
  2002. GPU_printf('(%3d,%3d,%3d)\n', p.r2, p.g2, p.b2);
  2003. end;
  2004. procedure dumpRGB2(p: POLY_GT4);
  2005. begin
  2006. GPU_printf('(%3d,%3d,%3d)\n', p.r2, p.g2, p.b2);
  2007. end;
  2008. procedure dumpRGB3(p: POLY_G4);
  2009. begin
  2010. GPU_printf('(%3d,%3d,%3d)\n', p.r3, p.g3, p.b3);
  2011. end;
  2012. procedure dumpRGB3(p: POLY_GT4);
  2013. begin
  2014. GPU_printf('(%3d,%3d,%3d)\n', p.r3, p.g3, p.b3);
  2015. end;
  2016. procedure setTPage(var p: DRAWENV; tp, abr, x, y: longint);
  2017. begin
  2018. p.tpage:= GetTPage(tp, abr, x, y);
  2019. end;
  2020. procedure setTPage(var p: POLY_FT3; tp, abr, x, y: longint);
  2021. begin
  2022. p.tpage:= GetTPage(tp, abr, x, y);
  2023. end;
  2024. procedure setTPage(var p: POLY_FT4; tp, abr, x, y: longint);
  2025. begin
  2026. p.tpage:= GetTPage(tp, abr, x, y);
  2027. end;
  2028. procedure setTPage(var p: POLY_GT3; tp, abr, x, y: longint);
  2029. begin
  2030. p.tpage:= GetTPage(tp, abr, x, y);
  2031. end;
  2032. procedure setTPage(var p: POLY_GT4; tp, abr, x, y: longint);
  2033. begin
  2034. p.tpage:= GetTPage(tp, abr, x, y);
  2035. end;
  2036. procedure setTPage(var p: TMD_PRIM; tp, abr, x, y: longint);
  2037. begin
  2038. p.tpage:= GetTPage(tp, abr, x, y);
  2039. end;
  2040. procedure setClut(var p: POLY_FT3; x, y: longint);
  2041. begin
  2042. p.clut:= getClut(x, y);
  2043. end;
  2044. procedure setClut(var p: POLY_FT4; x, y: longint);
  2045. begin
  2046. p.clut:= getClut(x, y);
  2047. end;
  2048. procedure setClut(var p: POLY_GT3; x, y: longint);
  2049. begin
  2050. p.clut:= getClut(x, y);
  2051. end;
  2052. procedure setClut(var p: POLY_GT4; x, y: longint);
  2053. begin
  2054. p.clut:= getClut(x, y);
  2055. end;
  2056. procedure setClut(var p: SPRT; x, y: longint);
  2057. begin
  2058. p.clut:= getClut(x, y);
  2059. end;
  2060. procedure setClut(var p: SPRT_16; x, y: longint);
  2061. begin
  2062. p.clut:= getClut(x, y);
  2063. end;
  2064. procedure setClut(var p: SPRT_8; x, y: longint);
  2065. begin
  2066. p.clut:= getClut(x, y);
  2067. end;
  2068. procedure setClut(var p: TMD_PRIM; x, y: longint);
  2069. begin
  2070. p.clut:= getClut(x, y);
  2071. end;
  2072. procedure dumpRECT(r: RECT);
  2073. begin
  2074. GPU_printf('(%d,%d)-(%d,%d)\n', r.x, r.y, r.w, r.h);
  2075. end;
  2076. procedure setlen(var p: P_TAG; const len: byte);
  2077. begin
  2078. p.len:= len;
  2079. end;
  2080. procedure setlen(var p: POLY_F3; const len: byte);
  2081. var x : ^P_TAG;
  2082. begin
  2083. x:= @p;
  2084. x^.len:= len;
  2085. end;
  2086. procedure setlen(var p: POLY_FT3; const len: byte);
  2087. var x : ^P_TAG;
  2088. begin
  2089. x:= @p;
  2090. x^.len:= len;
  2091. end;
  2092. procedure setlen(var p: POLY_G3; const len: byte);
  2093. var x : ^P_TAG;
  2094. begin
  2095. x:= @p;
  2096. x^.len:= len;
  2097. end;
  2098. procedure setlen(var p: POLY_GT3; const len: byte);
  2099. var x : ^P_TAG;
  2100. begin
  2101. x:= @p;
  2102. x^.len:= len;
  2103. end;
  2104. procedure setlen(var p: POLY_F4; const len: byte);
  2105. var x : ^P_TAG;
  2106. begin
  2107. x:= @p;
  2108. x^.len:= len;
  2109. end;
  2110. procedure setlen(var p: POLY_FT4; const len: byte);
  2111. var x : ^P_TAG;
  2112. begin
  2113. x:= @p;
  2114. x^.len:= len;
  2115. end;
  2116. procedure setlen(var p: POLY_G4; const len: byte);
  2117. var x : ^P_TAG;
  2118. begin
  2119. x:= @p;
  2120. x^.len:= len;
  2121. end;
  2122. procedure setlen(var p: POLY_GT4; const len: byte);
  2123. var x : ^P_TAG;
  2124. begin
  2125. x:= @p;
  2126. x^.len:= len;
  2127. end;
  2128. procedure setlen(var p: SPRT_8; const len: byte);
  2129. var x : ^P_TAG;
  2130. begin
  2131. x:= @p;
  2132. x^.len:= len;
  2133. end;
  2134. procedure setlen(var p: SPRT_16; const len: byte);
  2135. var x : ^P_TAG;
  2136. begin
  2137. x:= @p;
  2138. x^.len:= len;
  2139. end;
  2140. procedure setlen(var p: SPRT; const len: byte);
  2141. var x : ^P_TAG;
  2142. begin
  2143. x:= @p;
  2144. x^.len:= len;
  2145. end;
  2146. procedure setlen(var p: TILE_1; const len: byte);
  2147. var x : ^P_TAG;
  2148. begin
  2149. x:= @p;
  2150. x^.len:= len;
  2151. end;
  2152. procedure setlen(var p: TILE_8; const len: byte);
  2153. var x : ^P_TAG;
  2154. begin
  2155. x:= @p;
  2156. x^.len:= len;
  2157. end;
  2158. procedure setlen(var p: TILE_16; const len: byte);
  2159. var x : ^P_TAG;
  2160. begin
  2161. x:= @p;
  2162. x^.len:= len;
  2163. end;
  2164. procedure setlen(var p: TILE; const len: byte);
  2165. var x : ^P_TAG;
  2166. begin
  2167. x:= @p;
  2168. x^.len:= len;
  2169. end;
  2170. procedure setlen(var p: LINE_F2; const len: byte);
  2171. var x : ^P_TAG;
  2172. begin
  2173. x:= @p;
  2174. x^.len:= len;
  2175. end;
  2176. procedure setlen(var p: LINE_G2; const len: byte);
  2177. var x : ^P_TAG;
  2178. begin
  2179. x:= @p;
  2180. x^.len:= len;
  2181. end;
  2182. procedure setlen(var p: LINE_F3; const len: byte);
  2183. var x : ^P_TAG;
  2184. begin
  2185. x:= @p;
  2186. x^.len:= len;
  2187. end;
  2188. procedure setlen(var p: LINE_G3; const len: byte);
  2189. var x : ^P_TAG;
  2190. begin
  2191. x:= @p;
  2192. x^.len:= len;
  2193. end;
  2194. procedure setlen(var p: LINE_F4; const len: byte);
  2195. var x : ^P_TAG;
  2196. begin
  2197. x:= @p;
  2198. x^.len:= len;
  2199. end;
  2200. procedure setlen(var p: LINE_G4; const len: byte);
  2201. var x : ^P_TAG;
  2202. begin
  2203. x:= @p;
  2204. x^.len:= len;
  2205. end;
  2206. procedure setaddr(var p: P_TAG; const addr: dword);
  2207. begin
  2208. p.addr:= addr;
  2209. end;
  2210. procedure setcode(var p: P_TAG; const code: byte);
  2211. begin
  2212. p.code:= code;
  2213. end;
  2214. procedure setcode(var p: POLY_F3; const code: byte);
  2215. var x : ^P_TAG;
  2216. begin
  2217. x:= @p;
  2218. x^.code:= code;
  2219. end;
  2220. procedure setcode(var p: POLY_FT3; const code: byte);
  2221. var x : ^P_TAG;
  2222. begin
  2223. x:= @p;
  2224. x^.code:= code;
  2225. end;
  2226. procedure setcode(var p: POLY_G3; const code: byte);
  2227. var x : ^P_TAG;
  2228. begin
  2229. x:= @p;
  2230. x^.code:= code;
  2231. end;
  2232. procedure setcode(var p: POLY_GT3; const code: byte);
  2233. var x : ^P_TAG;
  2234. begin
  2235. x:= @p;
  2236. x^.code:= code;
  2237. end;
  2238. procedure setcode(var p: POLY_F4; const code: byte);
  2239. var x : ^P_TAG;
  2240. begin
  2241. x:= @p;
  2242. x^.code:= code;
  2243. end;
  2244. procedure setcode(var p: POLY_FT4; const code: byte);
  2245. var x : ^P_TAG;
  2246. begin
  2247. x:= @p;
  2248. x^.code:= code;
  2249. end;
  2250. procedure setcode(var p: POLY_G4; const code: byte);
  2251. var x : ^P_TAG;
  2252. begin
  2253. x:= @p;
  2254. x^.code:= code;
  2255. end;
  2256. procedure setcode(var p: POLY_GT4; const code: byte);
  2257. var x : ^P_TAG;
  2258. begin
  2259. x:= @p;
  2260. x^.code:= code;
  2261. end;
  2262. procedure setcode(var p: SPRT_8; const code: byte);
  2263. var x : ^P_TAG;
  2264. begin
  2265. x:= @p;
  2266. x^.code:= code;
  2267. end;
  2268. procedure setcode(var p: SPRT_16; const code: byte);
  2269. var x : ^P_TAG;
  2270. begin
  2271. x:= @p;
  2272. x^.code:= code;
  2273. end;
  2274. procedure setcode(var p: SPRT; const code: byte);
  2275. var x : ^P_TAG;
  2276. begin
  2277. x:= @p;
  2278. x^.code:= code;
  2279. end;
  2280. procedure setcode(var p: TILE_1; const code: byte);
  2281. var x : ^P_TAG;
  2282. begin
  2283. x:= @p;
  2284. x^.code:= code;
  2285. end;
  2286. procedure setcode(var p: TILE_8; const code: byte);
  2287. var x : ^P_TAG;
  2288. begin
  2289. x:= @p;
  2290. x^.code:= code;
  2291. end;
  2292. procedure setcode(var p: TILE_16; const code: byte);
  2293. var x : ^P_TAG;
  2294. begin
  2295. x:= @p;
  2296. x^.code:= code;
  2297. end;
  2298. procedure setcode(var p: TILE; const code: byte);
  2299. var x : ^P_TAG;
  2300. begin
  2301. x:= @p;
  2302. x^.code:= code;
  2303. end;
  2304. procedure setcode(var p: LINE_F2; const code: byte);
  2305. var x : ^P_TAG;
  2306. begin
  2307. x:= @p;
  2308. x^.code:= code;
  2309. end;
  2310. procedure setcode(var p: LINE_G2; const code: byte);
  2311. var x : ^P_TAG;
  2312. begin
  2313. x:= @p;
  2314. x^.code:= code;
  2315. end;
  2316. procedure setcode(var p: LINE_F3; const code: byte);
  2317. var x : ^P_TAG;
  2318. begin
  2319. x:= @p;
  2320. x^.code:= code;
  2321. end;
  2322. procedure setcode(var p: LINE_G3; const code: byte);
  2323. var x : ^P_TAG;
  2324. begin
  2325. x:= @p;
  2326. x^.code:= code;
  2327. end;
  2328. procedure setcode(var p: LINE_F4; const code: byte);
  2329. var x : ^P_TAG;
  2330. begin
  2331. x:= @p;
  2332. x^.code:= code;
  2333. end;
  2334. procedure setcode(var p: LINE_G4; const code: byte);
  2335. var x : ^P_TAG;
  2336. begin
  2337. x:= @p;
  2338. x^.code:= code;
  2339. end;
  2340. function getlen(p: P_TAG): byte;
  2341. begin
  2342. getlen:= p.len;
  2343. end;
  2344. function getcode(p: P_TAG): byte;
  2345. begin
  2346. getcode:= p.code;
  2347. end;
  2348. function getaddr(p: P_TAG): dword;
  2349. begin
  2350. getaddr:= p.addr;
  2351. end;
  2352. // Primitive Lentgh Code
  2353. //--------------------------------------------------------------------
  2354. //
  2355. procedure setPolyF3(var p: POLY_F3);
  2356. begin
  2357. setlen(p, 4);
  2358. setcode(p, $20);
  2359. end;
  2360. procedure setPolyFT3(var p: POLY_FT3);
  2361. begin
  2362. setlen(p, 7);
  2363. setcode(p, $24);
  2364. end;
  2365. procedure setPolyG3(var p: POLY_G3);
  2366. begin
  2367. setlen(p, 6);
  2368. setcode(p, $30);
  2369. end;
  2370. procedure setPolyGT3(var p: POLY_GT3);
  2371. begin
  2372. setlen(p, 9);
  2373. setcode(p, $34);
  2374. end;
  2375. procedure setPolyF4(var p: POLY_F4);
  2376. begin
  2377. setlen(p, 5);
  2378. setcode(p, $28);
  2379. end;
  2380. procedure setPolyFT4(var p: POLY_FT4);
  2381. begin
  2382. setlen(p, 9);
  2383. setcode(p, $2c);
  2384. end;
  2385. procedure setPolyG4(var p: POLY_G4);
  2386. begin
  2387. setlen(p, 8);
  2388. setcode(p, $38);
  2389. end;
  2390. procedure setPolyGT4(var p: POLY_GT4);
  2391. begin
  2392. setlen(p, 12);
  2393. setcode(p, $3c);
  2394. end;
  2395. procedure setSprt8(var p: SPRT_8);
  2396. begin
  2397. setlen(p, 3);
  2398. setcode(p, $74);
  2399. end;
  2400. procedure setSprt16(var p: SPRT_16);
  2401. begin
  2402. setlen(p, 3);
  2403. setcode(p, $7c);
  2404. end;
  2405. procedure setSprt(var p: SPRT);
  2406. begin
  2407. setlen(p, 4);
  2408. setcode(p, $64);
  2409. end;
  2410. {
  2411. procedure setTile1(var p: TILE_1);
  2412. begin
  2413. setlen(p, 2);
  2414. setcode(p, $68);
  2415. end;
  2416. }
  2417. procedure setTile8(var p: TILE_8);
  2418. begin
  2419. setlen(p, 2);
  2420. setcode(p, $70);
  2421. end;
  2422. procedure setTile16(var p: TILE_16);
  2423. begin
  2424. setlen(p, 2);
  2425. setcode(p, $78);
  2426. end;
  2427. procedure setTile(var p: TILE);
  2428. begin
  2429. setlen(p, 3);
  2430. setcode(p, $60);
  2431. end;
  2432. procedure setLineF2(var p: LINE_F2);
  2433. begin
  2434. setlen(p, 3);
  2435. setcode(p, $40);
  2436. end;
  2437. procedure setLineG2(var p: LINE_G2);
  2438. begin
  2439. setlen(p, 4);
  2440. setcode(p, $50);
  2441. end;
  2442. procedure setLineF3(var p: LINE_F3);
  2443. begin
  2444. setlen(p, 5);
  2445. setcode(p, $48);
  2446. p.pad:= $55555555;
  2447. end;
  2448. procedure setLineG3(var p: LINE_G3);
  2449. begin
  2450. setlen(p, 7);
  2451. setcode(p, $58);
  2452. p.pad:= $55555555;
  2453. p.p2:= 0;
  2454. end;
  2455. procedure setLineF4(var p: LINE_F4);
  2456. begin
  2457. setlen(p, 6);
  2458. setcode(p, $4c);
  2459. p.pad:= $55555555;
  2460. end;
  2461. procedure setLineG4(var p: LINE_G4);
  2462. begin
  2463. setlen(p, 9);
  2464. setcode(p, $5c);
  2465. p.pad:= $55555555;
  2466. p.p2:= 0;
  2467. p.p3:= 0;
  2468. end;
  2469. {
  2470. function getTPage(tp, abr, x, y: longint): longint;
  2471. begin
  2472. result:= ((((tp) and $3) shl 7) or (((abr) and $3) shl 5) or (((y) and $100) shr 4) or (((x) and $3ff) shr 6) or (((y) and $200) shl 2));
  2473. end;
  2474. function getClut(x, y): longint;
  2475. begin
  2476. result:= (((y) shl 6) or (((x) shr 4) and $3f));
  2477. end;
  2478. }
  2479. procedure dumpTPage(tpage: longint);
  2480. begin
  2481. GPU_printf('tpage: (%d,%d,%d,%d)\n', ((tpage) shr 7) and $003, ((tpage) shr 5) and $003, ((tpage) shl 6) and $7c0, (((tpage) shl 4) and $100)+(((tpage)shr 2) and $200));
  2482. end;
  2483. procedure dumpClut(clut: longint);
  2484. begin
  2485. GPU_printf('clut: (%d,%d)\n', (clut and $3f) shl 4, (clut shr 6));
  2486. end;
  2487. end.