graph.inc 91 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839
  1. {
  2. $Id$
  3. }
  4. { How this works: }
  5. { QueryAdapter - Va chercher tout les modes videos et drivers }
  6. { disponibles sur cette carte, et les mets dans une linked list }
  7. { en ordre de driver number, et a l'interieur de cela, dans un }
  8. { ordre croissant de mode number. }
  9. { DetectGraph - Verifie si la liste chainee de drivers existe, sinon }
  10. { apelle QueryAdapter }
  11. { InitGraph - Appelle DetectGraph, et verifie que le mode demande existe}
  12. { bel et bien et est disponible sur ce PC }
  13. {$ifndef fpc}
  14. {$ifndef noasmgraph}
  15. {$define asmgraph}
  16. {$endif noasmgraph}
  17. {$i dpmi.inc}
  18. {$else fpc}
  19. {$asmmode intel}
  20. {$endif fpc}
  21. CONST
  22. { VESA Specific video modes. }
  23. m320x200x32k = $10D;
  24. m320x200x64k = $10E;
  25. m640x400x256 = $100;
  26. m640x480x256 = $101;
  27. m640x480x32k = $110;
  28. m640x480x64k = $111;
  29. m800x600x16 = $102;
  30. m800x600x256 = $103;
  31. m800x600x32k = $113;
  32. m800x600x64k = $114;
  33. m1024x768x16 = $104;
  34. m1024x768x256 = $105;
  35. m1024x768x32k = $116;
  36. m1024x768x64k = $117;
  37. m1280x1024x16 = $106;
  38. m1280x1024x256 = $107;
  39. m1280x1024x32k = $119;
  40. m1280x1024x64k = $11A;
  41. { How to access real mode memory }
  42. { using 32-bit DPMI memory }
  43. { 1. Allocate a descriptor }
  44. { 2. Set segment limit }
  45. { 3. Set base linear address }
  46. const
  47. InternalDriverName = 'DOSGX';
  48. {$ifdef fpc}
  49. {$ifdef asmgraph}
  50. VideoOfs : DWord = 0; { Segment to draw to }
  51. {$else asmgraph}
  52. VideoOfs : word = 0; { Segment to draw to }
  53. {$endif asmgraph}
  54. {$else fpc}
  55. VideoOfs : word = 0; { Segment to draw to }
  56. {$endif fpc}
  57. FirstPlane = $0102; (* 02 = Index to Color plane Select, *)
  58. (* 01 = Enable color plane 1 *)
  59. { ; ===== VGA Register Values ===== }
  60. SCREEN_WIDTH = 80 ; { MODE-X 320 SCREEN WIDTH }
  61. { CHANGE THE VALUE IF OTHER MODES }
  62. { OTHER THEN 320 ARE USED. }
  63. ATTRIB_Ctrl = $03C0 ; { VGA Attribute Controller }
  64. GC_Index = $03CE ; { VGA Graphics Controller }
  65. SC_Index = $03C4 ; { VGA Sequencer Controller }
  66. SC_Data = $03C5 ; { VGA Sequencer Data Port }
  67. CRTC_Index = $03D4 ; { VGA CRT Controller }
  68. CRTC_Data = $03D5 ; { VGA CRT Controller Data }
  69. MISC_OUTPUT = $03C2 ; { VGA Misc Register }
  70. INPUT_1 = $03DA ; { Input Status #1 Register }
  71. DAC_WRITE_ADDR = $03C8 ; { VGA DAC Write Addr Register }
  72. DAC_READ_ADDR = $03C7 ; { VGA DAC Read Addr Register }
  73. PEL_DATA_REG = $03C9 ; { VGA DAC/PEL data Register R/W }
  74. PIXEL_PAN_REG = $033 ; { Attrib Index: Pixel Pan Reg }
  75. MAP_MASK = $002 ; { S= $Index: Write Map Mask reg }
  76. READ_MAP = $004 ; { GC Index: Read Map Register }
  77. START_DISP_HI = $00C ; { CRTC Index: Display Start Hi }
  78. START_DISP_LO = $00D ; { CRTC Index: Display Start Lo }
  79. MAP_MASK_PLANE1 = $00102 ; { Map Register + Plane 1 }
  80. MAP_MASK_PLANE2 = $01102 ; { Map Register + Plane 1 }
  81. ALL_PLANES_ON = $00F02 ; { Map Register + All Bit Planes }
  82. CHAIN4_OFF = $00604 ; { Chain 4 mode Off }
  83. ASYNC_RESET = $00100 ; { (A)synchronous Reset }
  84. SEQU_RESTART = $00300 ; { Sequencer Restart }
  85. LATCHES_ON = $00008 ; { Bit Mask + Data from Latches }
  86. LATCHES_OFF = $0FF08 ; { Bit Mask + Data from CPU }
  87. VERT_RETRACE = $08 ; { INPUT_1: Vertical Retrace Bit }
  88. PLANE_BITS = $03 ; { Bits 0-1 of Xpos = Plane # }
  89. ALL_PLANES = $0F ; { All Bit Planes Selected }
  90. CHAR_BITS = $0F ; { Bits 0-3 of Character Data }
  91. GET_CHAR_PTR = $01130 ; { VGA BIOS Func: Get Char Set }
  92. ROM_8x8_Lo = $03 ; { ROM 8x8 Char Set Lo Pointer }
  93. ROM_8x8_Hi = $04 ; { ROM 8x8 Char Set Hi Pointer }
  94. { Constants Specific for these routines }
  95. NUM_MODES = $8 ; { # of Mode X Variations }
  96. var
  97. ScrWidth : word absolute $40:$4a;
  98. {$ifndef tp}
  99. procedure seg_bytemove(sseg : word;source : longint;dseg : word;dest : longint;count : longint);
  100. begin
  101. asm
  102. push es
  103. push ds
  104. cld
  105. mov ecx,count
  106. mov esi,source
  107. mov edi,dest
  108. mov ax,dseg
  109. mov es,ax
  110. mov ax,sseg
  111. mov ds,ax
  112. rep movsb
  113. pop ds
  114. pop es
  115. end ['ESI','EDI','ECX','EAX']
  116. end;
  117. {$endif tp}
  118. {************************************************************************}
  119. {* 4-bit planar VGA mode routines *}
  120. {************************************************************************}
  121. Procedure Init640x200x16; {$ifndef fpc}far;{$endif fpc} assembler;
  122. { must also clear the screen...}
  123. asm
  124. mov ax,000Eh
  125. {$ifdef fpc}
  126. push ebp
  127. {$endif fpc}
  128. int 10h
  129. {$ifdef fpc}
  130. pop ebp
  131. {$endif fpc}
  132. end;
  133. Procedure Init640x350x16; {$ifndef fpc}far;{$endif fpc} assembler;
  134. { must also clear the screen...}
  135. asm
  136. mov ax,0010h
  137. {$ifdef fpc}
  138. push ebp
  139. {$endif fpc}
  140. int 10h
  141. {$ifdef fpc}
  142. pop ebp
  143. {$endif fpc}
  144. end;
  145. procedure Init640x480x16; {$ifndef fpc}far;{$endif fpc} assembler;
  146. { must also clear the screen...}
  147. asm
  148. mov ax,0012h
  149. {$ifdef fpc}
  150. push ebp
  151. {$endif fpc}
  152. int 10h
  153. {$ifdef fpc}
  154. pop ebp
  155. {$endif fpc}
  156. end;
  157. Procedure PutPixel16(X,Y : Integer; Pixel: Word); {$ifndef fpc}far;{$endif fpc}
  158. {$ifndef asmgraph}
  159. var offset: word;
  160. dummy: byte;
  161. {$endif asmgraph}
  162. Begin
  163. X:= X + StartXViewPort;
  164. Y:= Y + StartYViewPort;
  165. { convert to absolute coordinates and then verify clipping...}
  166. if ClipPixels then
  167. Begin
  168. if (X < StartXViewPort) or (X > (StartXViewPort + ViewWidth)) then
  169. exit;
  170. if (Y < StartYViewPort) or (Y > (StartYViewPort + ViewHeight)) then
  171. exit;
  172. end;
  173. {$ifndef asmgraph}
  174. offset := y * 80 + (x shr 3) + VideoOfs;
  175. PortW[$3ce] := $f01;
  176. PortW[$3ce] := Pixel shl 8;
  177. PortB[$3ce] := 8;
  178. PortW[$3cf] := $80 shr (x and $7) + (Pixel shl 8);
  179. dummy := Mem[$a000: offset];
  180. Mem[$a000: offset] := dummy;
  181. PortW[$3ce] := $ff08;
  182. PortB[$3ce] := 1;
  183. {$else asmgraph}
  184. asm
  185. {$ifndef fpc}
  186. mov es, [SegA000]
  187. {$endif fpc}
  188. { enable the set / reset function and load the color }
  189. mov dx, 3ceh
  190. mov ax, 0f01h
  191. out dx, ax
  192. { setup set/reset register }
  193. mov ax, [Pixel]
  194. shl ax, 8
  195. out dx, ax
  196. { setup the bit mask register }
  197. mov al, 8
  198. out dx, al
  199. inc dx
  200. { load the bitmask register }
  201. mov cx, [X]
  202. and cx, 0007h
  203. mov al, 80h
  204. shr al, cl
  205. out dx, ax
  206. {$ifndef fpc}
  207. { get the x index and divide by 8 for 16-color }
  208. mov ax,[X]
  209. shr ax,3
  210. push ax
  211. { determine the address }
  212. mov ax,80
  213. mov bx,[Y]
  214. mul bx
  215. pop cx
  216. add ax,cx
  217. mov di,ax
  218. add di, [VideoOfs]
  219. { send the data through the display memory through set/reset }
  220. mov bl,es:[di]
  221. mov es:[di],bl
  222. { reset for formal vga operation }
  223. mov dx,3ceh
  224. mov ax,0ff08h
  225. out dx,ax
  226. { restore enable set/reset register }
  227. mov ax,0001h
  228. out dx,ax
  229. {$else fpc}
  230. { get the x index and divide by 8 for 16-color }
  231. movzx eax,[X]
  232. shr eax,3
  233. push eax
  234. { determine the address }
  235. mov eax,80
  236. mov bx,[Y]
  237. mul bx
  238. pop ecx
  239. add eax,ecx
  240. mov edi,eax
  241. add edi, [VideoOfs]
  242. { send the data through the display memory through set/reset }
  243. mov bl,fs:[edi+$a0000]
  244. mov fs:[edi+$a0000],bl
  245. { reset for formal vga operation }
  246. mov dx,3ceh
  247. mov ax,0ff08h
  248. out dx,ax
  249. { restore enable set/reset register }
  250. mov ax,0001h
  251. out dx,ax
  252. {$endif fpc}
  253. end;
  254. {$endif asmgraph}
  255. end;
  256. Function GetPixel16(X,Y: Integer):word; {$ifndef fpc}far;{$endif fpc}
  257. {$ifndef asmgraph}
  258. Var dummy, offset: Word;
  259. shift: byte;
  260. {$endif asmgraph}
  261. Begin
  262. X:= X + StartXViewPort;
  263. Y:= Y + StartYViewPort;
  264. {$ifndef asmgraph}
  265. offset := Y * 80 + (x shr 3) + VideoOfs;
  266. PortB[$3ce] := 4;
  267. shift := 7 - (X and 7);
  268. PortB[$3cf] := 0;
  269. dummy := (Mem[$a000:offset] shr shift) and 1;
  270. PortB[$3cf] := 1;
  271. dummy := dummy or (((Mem[$a000:offset] shr shift) and 1) shl 1);
  272. PortB[$3cf] := 2;
  273. dummy := dummy or (((Mem[$a000:offset] shr shift) and 1) shl 2);
  274. PortB[$3cf] := 3;
  275. dummy := dummy or (((Mem[$a000:offset] shr shift) and 1) shl 3);
  276. GetPixel16 := dummy;
  277. {$else asmgraph}
  278. asm
  279. {$ifndef fpc}
  280. mov ax, [X] { Get X address }
  281. push ax
  282. shr ax, 3
  283. push ax
  284. mov ax,80
  285. mov bx,[Y]
  286. mul bx
  287. pop cx
  288. add ax,cx
  289. mov si,ax { SI = correct offset into video segment }
  290. mov es,[SegA000]
  291. add si,[VideoOfs] { Point to correct page offset... }
  292. mov dx,03ceh
  293. mov ax,4
  294. out dx,al
  295. inc dx
  296. pop ax
  297. and ax,0007h
  298. mov cl,07
  299. sub cl,al
  300. mov bl,cl
  301. { read plane 0 }
  302. mov al,0 { Select plane to read }
  303. out dx,al
  304. mov al,es:[si] { read display memory }
  305. shr al,cl
  306. and al,01h
  307. mov ah,al { save bit in AH }
  308. { read plane 1 }
  309. mov al,1 { Select plane to read }
  310. out dx,al
  311. mov al,es:[si]
  312. shr al,cl
  313. and al,01h
  314. shl al,1
  315. or ah,al { save bit in AH }
  316. { read plane 2 }
  317. mov al,2 { Select plane to read }
  318. out dx,al
  319. mov al,es:[si]
  320. shr al,cl
  321. and al,01h
  322. shl al,2
  323. or ah,al { save bit in AH }
  324. { read plane 3 }
  325. mov al,3 { Select plane to read }
  326. out dx,al
  327. mov al,es:[si]
  328. shr al,cl
  329. and al,01h
  330. shl al,3
  331. or ah,al { save bit in AH }
  332. mov al,ah { 16-bit pixel in AX }
  333. xor ah,ah
  334. mov @Result, ax
  335. {$else fpc}
  336. movzx eax, [X] { Get X address }
  337. push eax
  338. shr eax, 3
  339. push eax
  340. mov eax,80
  341. mov bx,[Y]
  342. mul bx
  343. pop ecx
  344. add eax,ecx
  345. mov esi,eax { SI = correct offset into video segment }
  346. add esi,[VideoOfs] { Point to correct page offset... }
  347. mov dx,03ceh
  348. mov ax,4
  349. out dx,al
  350. inc dx
  351. pop eax
  352. and eax,0007h
  353. mov cl,07
  354. sub cl,al
  355. mov bl,cl
  356. { read plane 0 }
  357. mov al,0 { Select plane to read }
  358. out dx,al
  359. mov al,fs:[esi+$a0000] { read display memory }
  360. shr al,cl
  361. and al,01h
  362. mov ah,al { save bit in AH }
  363. { read plane 1 }
  364. mov al,1 { Select plane to read }
  365. out dx,al
  366. mov al,fs:[esi+$a0000]
  367. shr al,cl
  368. and al,01h
  369. shl al,1
  370. or ah,al { save bit in AH }
  371. { read plane 2 }
  372. mov al,2 { Select plane to read }
  373. out dx,al
  374. mov al,fs:[esi+$a0000]
  375. shr al,cl
  376. and al,01h
  377. shl al,2
  378. or ah,al { save bit in AH }
  379. { read plane 3 }
  380. mov al,3 { Select plane to read }
  381. out dx,al
  382. mov al,fs:[esi+$a0000]
  383. shr al,cl
  384. and al,01h
  385. shl al,3
  386. or ah,al { save bit in AH }
  387. mov al,ah { 16-bit pixel in AX }
  388. xor ah,ah
  389. mov @Result, ax
  390. {$endif fpc}
  391. end;
  392. {$endif asmgraph}
  393. end;
  394. Procedure GetScanLine16(y: integer; var data);
  395. var dummylong: longint;
  396. Offset, count, count2, amount, index: word;
  397. shift, plane: byte;
  398. Begin
  399. {$ifdef logging}
  400. LogLn('GetScanLine16 start, length to get: '+strf(ViewWidth+1)+' at y = '+strf(y));
  401. {$Endif logging}
  402. PortB[$3ce] := 4;
  403. offset := (Y + StartYViewPort) * 80 + (StartXViewPort shr 3) + VideoOfs;
  404. {$ifdef logging}
  405. LogLn('Offset: '+HexStr(offset,4)+' - ' + strf(offset));
  406. {$Endif logging}
  407. { first get enough pixels so offset is 32bit aligned }
  408. amount := 0;
  409. index := 0;
  410. If ((StartXViewPort and 31) <> 0) Or
  411. (ViewWidth < 32) Then
  412. Begin
  413. If (ViewWidth >= 32+32-(StartXViewPort and 31)) Then
  414. amount := 32-(StartXViewPort and 31)
  415. Else amount := ViewWidth + 1;
  416. {$ifdef logging}
  417. LogLn('amount to align to 32bits or to get all: ' + strf(amount));
  418. {$Endif logging}
  419. For count := 0 to amount-1 do
  420. WordArray(Data)[Count] := getpixel16(Count,y);
  421. index := count+1;
  422. Inc(Offset,(amount+7) shr 3);
  423. {$ifdef logging}
  424. LogLn('offset now: '+HexStr(offset,4)+' - ' + strf(offset));
  425. LogLn('index now: '+strf(index));
  426. {$Endif logging}
  427. End;
  428. amount := ViewWidth + 1 - amount;
  429. {$ifdef logging}
  430. LogLn('amount left: ' + strf(amount));
  431. {$Endif logging}
  432. If amount = 0 Then Exit;
  433. { first get everything from plane 3 (4th plane) }
  434. PortB[$3cf] := 3;
  435. Count := 0;
  436. For Count := 1 to (amount shr 5) Do
  437. Begin
  438. dummylong := MemL[$a000:offset+(Count-1)*4];
  439. dummylong :=
  440. ((dummylong and $ff) shl 24) or
  441. ((dummylong and $ff00) shl 8) or
  442. ((dummylong and $ff0000) shr 8) or
  443. ((dummylong and $ff000000) shr 24);
  444. For Count2 := 31 downto 0 Do
  445. Begin
  446. WordArray(Data)[index+Count2] := DummyLong and 1;
  447. DummyLong := DummyLong shr 1;
  448. End;
  449. Inc(Index, 32);
  450. End;
  451. { Now get the data from the 3 other planes }
  452. plane := 3;
  453. Repeat
  454. Dec(Index,Count*32);
  455. Dec(plane);
  456. PortB[$3cf] := plane;
  457. Count := 0;
  458. For Count := 1 to (amount shr 5) Do
  459. Begin
  460. dummylong := MemL[$a000:offset+(Count-1)*4];
  461. dummylong :=
  462. ((dummylong and $ff) shl 24) or
  463. ((dummylong and $ff00) shl 8) or
  464. ((dummylong and $ff0000) shr 8) or
  465. ((dummylong and $ff000000) shr 24);
  466. For Count2 := 31 downto 0 Do
  467. Begin
  468. WordArray(Data)[index+Count2] :=
  469. (WordArray(Data)[index+Count2] shl 1) + (DummyLong and 1);
  470. DummyLong := DummyLong shr 1;
  471. End;
  472. Inc(Index, 32);
  473. End;
  474. Until plane = 0;
  475. amount := amount and 31;
  476. Dec(index);
  477. {$ifdef Logging}
  478. LogLn('Last array index written to: '+strf(index));
  479. LogLn('amount left: '+strf(amount)+' starting at x = '+strf(index+1));
  480. {$Endif logging}
  481. For Count := 1 to amount Do
  482. WordArray(Data)[index+Count] := getpixel16(index+Count,y);
  483. {$ifdef logging}
  484. LogLn('First 32 bytes gotten with getscanline16: ');
  485. If ViewWidth + 1 >= 32 Then
  486. Count2 := 32
  487. Else Count2 := ViewWidth;
  488. For Count := 0 to Count2-1 Do
  489. Log(strf(WordArray(Data)[Count])+' ');
  490. LogLn('');
  491. If ViewWidth + 1 >= 32 Then
  492. Begin
  493. LogLn('Last 32 bytes gotten with getscanline16: ');
  494. For Count := 31 downto 0 Do
  495. Log(strf(WordArray(Data)[ViewWidth-Count])+' ');
  496. End;
  497. LogLn('');
  498. GetScanLineDefault(y,Data);
  499. LogLn('First 32 bytes gotten with getscanlinedef: ');
  500. If ViewWidth + 1 >= 32 Then
  501. Count2 := 32
  502. Else Count2 := ViewWidth;
  503. For Count := 0 to Count2-1 Do
  504. Log(strf(WordArray(Data)[Count])+' ');
  505. LogLn('');
  506. If ViewWidth + 1 >= 32 Then
  507. Begin
  508. LogLn('Last 32 bytes gotten with getscanlinedef: ');
  509. For Count := 31 downto 0 Do
  510. Log(strf(WordArray(Data)[ViewWidth-Count])+' ');
  511. End;
  512. LogLn('');
  513. LogLn('GetScanLine16 end');
  514. {$Endif logging}
  515. End;
  516. Procedure DirectPutPixel16(X,Y : Integer); {$ifndef fpc}far;{$endif fpc}
  517. { x,y -> must be in global coordinates. No clipping. }
  518. var
  519. color: word;
  520. {$ifndef asmgraph}
  521. offset: word;
  522. dummy: byte;
  523. {$endif asmgraph}
  524. begin
  525. case CurrentWriteMode of
  526. XORPut:
  527. begin
  528. { getpixel wants local/relative coordinates }
  529. Color := GetPixel(x-StartXViewPort,y-StartYViewPort);
  530. Color := CurrentColor Xor Color;
  531. end;
  532. OrPut:
  533. begin
  534. { getpixel wants local/relative coordinates }
  535. Color := GetPixel(x-StartXViewPort,y-StartYViewPort);
  536. Color := CurrentColor Or Color;
  537. end;
  538. AndPut:
  539. begin
  540. { getpixel wants local/relative coordinates }
  541. Color := GetPixel(x-StartXViewPort,y-StartYViewPort);
  542. Color := CurrentColor And Color;
  543. end;
  544. NotPut:
  545. begin
  546. Color := Not Color;
  547. end
  548. else
  549. Color := CurrentColor;
  550. end;
  551. {$ifndef asmgraph}
  552. offset := Y * 80 + (X shr 3) + VideoOfs;
  553. PortW[$3ce] := $f01;
  554. PortW[$3ce] := Color shl 8;
  555. PortB[$3ce] := 8;
  556. PortW[$3cf] := $80 shr (X and 7) + (Color shl 8);
  557. dummy := Mem[$a000: offset];
  558. Mem[$a000: offset] := dummy;
  559. PortW[$3ce] := $ff08;
  560. PortB[$3ce] := 1;
  561. {$else asmgraph}
  562. asm
  563. {$ifndef fpc}
  564. mov es, [SegA000]
  565. { enable the set / reset function and load the color }
  566. mov dx, 3ceh
  567. mov ax, 0f01h
  568. out dx, ax
  569. { setup set/reset register }
  570. mov ax, [Color]
  571. shl ax, 8
  572. out dx, ax
  573. { setup the bit mask register }
  574. mov al, 8
  575. out dx, al
  576. inc dx
  577. { load the bitmask register }
  578. mov cx, [X]
  579. and cx, 0007h
  580. mov al, 80h
  581. shr al, cl
  582. out dx, ax
  583. { get the x index and divide by 8 for 16-color }
  584. mov ax,[X]
  585. shr ax,3
  586. push ax
  587. { determine the address }
  588. mov ax,80
  589. mov bx,[Y]
  590. mul bx
  591. pop cx
  592. add ax,cx
  593. mov di,ax
  594. { send the data through the display memory through set/reset }
  595. add di,[VideoOfs] { add correct page }
  596. mov bl,es:[di]
  597. mov es:[di],bl
  598. { reset for formal vga operation }
  599. mov dx,3ceh
  600. mov ax,0ff08h
  601. out dx,ax
  602. { restore enable set/reset register }
  603. mov ax,0001h
  604. out dx,ax
  605. {$else fpc}
  606. { enable the set / reset function and load the color }
  607. mov dx, 3ceh
  608. mov ax, 0f01h
  609. out dx, ax
  610. { setup set/reset register }
  611. mov ax, [Color]
  612. shl ax, 8
  613. out dx, ax
  614. { setup the bit mask register }
  615. mov al, 8
  616. out dx, al
  617. inc dx
  618. { load the bitmask register }
  619. mov cx, [X]
  620. and cx, 0007h
  621. mov al, 80h
  622. shr al, cl
  623. out dx, ax
  624. { get the x index and divide by 8 for 16-color }
  625. movzx eax,[X]
  626. shr eax,3
  627. push eax
  628. { determine the address }
  629. mov eax,80
  630. mov bx,[Y]
  631. mul bx
  632. pop ecx
  633. add eax,ecx
  634. mov edi,eax
  635. { send the data through the display memory through set/reset }
  636. add edi,[VideoOfs] { add correct page }
  637. mov bl,fs:[edi+$a0000]
  638. mov fs:[edi+$a0000],bl
  639. { reset for formal vga operation }
  640. mov dx,3ceh
  641. mov ax,0ff08h
  642. out dx,ax
  643. { restore enable set/reset register }
  644. mov ax,0001h
  645. out dx,ax
  646. {$endif fpc}
  647. end;
  648. {$endif asmgraph}
  649. end;
  650. {$ifndef tp}
  651. procedure HLine16(x,x2,y: integer); {$ifndef fpc}far;{$endif fpc}
  652. var
  653. xtmp: integer;
  654. ScrOfs,HLength : word;
  655. LMask,RMask : byte;
  656. Begin
  657. { must we swap the values? }
  658. if x > x2 then
  659. Begin
  660. xtmp := x2;
  661. x2 := x;
  662. x:= xtmp;
  663. end;
  664. { First convert to global coordinates }
  665. X := X + StartXViewPort;
  666. X2 := X2 + StartXViewPort;
  667. Y := Y + StartYViewPort;
  668. if ClipPixels then
  669. Begin
  670. if LineClipped(x,y,x2,y,StartXViewPort,StartYViewPort,
  671. StartXViewPort+ViewWidth, StartYViewPort+ViewHeight) then
  672. exit;
  673. end;
  674. ScrOfs:=y*ScrWidth+x div 8;
  675. HLength:=x2 div 8-x div 8;
  676. LMask:=$ff shr (x and 7);
  677. {$ifopt r+}
  678. {$define rangeOn}
  679. {$r-}
  680. {$endif}
  681. {$ifopt q+}
  682. {$define overflowOn}
  683. {$q-}
  684. {$endif}
  685. RMask:=$ff shl (7-(x2 and 7));
  686. {$ifdef rangeOn}
  687. {$undef rangeOn}
  688. {$r+}
  689. {$endif}
  690. {$ifdef overflowOn}
  691. {$undef overflowOn}
  692. {$q+}
  693. {$endif}
  694. if HLength=0 then
  695. LMask:=LMask and RMask;
  696. port[$3ce]:=0;
  697. If CurrentWriteMode <> NotPut Then
  698. port[$3cf]:= CurrentColor
  699. else port[$3cf]:= not CurrentColor;
  700. port[$3ce]:=1;
  701. port[$3cf]:=$f;
  702. port[$3ce]:=3;
  703. case CurrentWriteMode of
  704. XORPut:
  705. port[$3cf]:=3 shl 3;
  706. ANDPut:
  707. port[$3cf]:=1 shl 3;
  708. ORPut:
  709. port[$3cf]:=2 shl 3;
  710. NormalPut, NotPut:
  711. port[$3cf]:=0
  712. else
  713. port[$3cf]:=0
  714. end;
  715. port[$3ce]:=8;
  716. port[$3cf]:=LMask;
  717. {$ifopt r+}
  718. {$define rangeOn}
  719. {$r-}
  720. {$endif}
  721. {$ifopt q+}
  722. {$define overflowOn}
  723. {$q-}
  724. {$endif}
  725. Mem[$a000:ScrOfs]:=Mem[$a000:ScrOfs]+1;
  726. {$ifdef rangeOn}
  727. {$undef rangeOn}
  728. {$r+}
  729. {$endif}
  730. {$ifdef overflowOn}
  731. {$undef overflowOn}
  732. {$q+}
  733. {$endif}
  734. port[$3ce]:=8;
  735. if HLength>0 then
  736. begin
  737. dec(HLength);
  738. inc(ScrOfs);
  739. if HLength>0 then
  740. begin
  741. port[$3cf]:=$ff;
  742. seg_bytemove(dosmemselector,$a0000+ScrOfs,dosmemselector,$a0000+ScrOfs,HLength);
  743. ScrOfs:=ScrOfs+HLength;
  744. end;
  745. port[$3cf]:=RMask;
  746. {$ifopt r+}
  747. {$define rangeOn}
  748. {$r-}
  749. {$endif}
  750. {$ifopt q+}
  751. {$define overflowOn}
  752. {$q-}
  753. {$endif}
  754. Mem[$a000:ScrOfs]:=Mem[$a000:ScrOfs]+1;
  755. {$ifdef rangeOn}
  756. {$undef rangeOn}
  757. {$r+}
  758. {$endif}
  759. {$ifdef overflowOn}
  760. {$undef overflowOn}
  761. {$q+}
  762. {$endif}
  763. end;
  764. // clean up
  765. port[$3cf]:=0;
  766. port[$3ce]:=8;
  767. port[$3cf]:=$ff;
  768. port[$3ce]:=1;
  769. port[$3cf]:=0;
  770. port[$3ce]:=3;
  771. port[$3cf]:=0;
  772. end;
  773. procedure VLine16(x,y,y2: integer); {$ifndef fpc}far;{$endif fpc}
  774. var
  775. ytmp: integer;
  776. ScrOfs,i : longint;
  777. BitMask : byte;
  778. Begin
  779. { must we swap the values? }
  780. if y > y2 then
  781. Begin
  782. ytmp := y2;
  783. y2 := y;
  784. y:= ytmp;
  785. end;
  786. { First convert to global coordinates }
  787. X := X + StartXViewPort;
  788. Y2 := Y2 + StartYViewPort;
  789. Y := Y + StartYViewPort;
  790. if ClipPixels then
  791. Begin
  792. if LineClipped(x,y,x,y2,StartXViewPort,StartYViewPort,
  793. StartXViewPort+ViewWidth, StartYViewPort+ViewHeight) then
  794. exit;
  795. end;
  796. ScrOfs:=y*ScrWidth+x div 8;
  797. BitMask:=$80 shr (x and 7);
  798. port[$3ce]:=0;
  799. If CurrentWriteMode <> NotPut Then
  800. port[$3cf]:= CurrentColor
  801. else port[$3cf]:= not CurrentColor;
  802. port[$3ce]:=1;
  803. port[$3cf]:=$f;
  804. port[$3ce]:=8;
  805. port[$3cf]:=BitMask;
  806. port[$3ce]:=3;
  807. case CurrentWriteMode of
  808. XORPut:
  809. port[$3cf]:=3 shl 3;
  810. ANDPut:
  811. port[$3cf]:=1 shl 3;
  812. ORPut:
  813. port[$3cf]:=2 shl 3;
  814. NormalPut, NotPut:
  815. port[$3cf]:=0
  816. else
  817. port[$3cf]:=0
  818. end;
  819. for i:=y to y2 do
  820. begin
  821. {$ifopt r+}
  822. {$define rangeOn}
  823. {$r-}
  824. {$endif}
  825. {$ifopt q+}
  826. {$define overflowOn}
  827. {$q-}
  828. {$endif}
  829. Mem[$a000:ScrOfs]:=Mem[$a000:ScrOfs]+1;
  830. {$ifdef rangeOn}
  831. {$undef rangeOn}
  832. {$r+}
  833. {$endif}
  834. {$ifdef overflowOn}
  835. {$undef overflowOn}
  836. {$q+}
  837. {$endif}
  838. ScrOfs:=ScrOfs+ScrWidth;
  839. end;
  840. // clean up
  841. port[$3cf]:=0;
  842. port[$3ce]:=8;
  843. port[$3cf]:=$ff;
  844. port[$3ce]:=1;
  845. port[$3cf]:=0;
  846. port[$3ce]:=3;
  847. port[$3cf]:=0;
  848. End;
  849. {$endif tp}
  850. procedure SetVisual480(page: word); {$ifndef fpc}far;{$endif fpc}
  851. { no page flipping support in 640x480 mode }
  852. begin
  853. VideoOfs := 0;
  854. end;
  855. procedure SetActive480(page: word); {$ifndef fpc}far;{$endif fpc}
  856. { no page flipping support in 640x480 mode }
  857. begin
  858. VideoOfs := 0;
  859. end;
  860. procedure SetVisual200(page: word); {$ifndef fpc}far;{$endif fpc}
  861. { two page support... }
  862. begin
  863. if page > HardwarePages then exit;
  864. asm
  865. mov ax,[page] { only lower byte is supported. }
  866. mov ah,05h
  867. {$ifdef fpc}
  868. push ebp
  869. {$endif fpc}
  870. int 10h
  871. {$ifdef fpc}
  872. pop ebp
  873. {$endif fpc}
  874. { read start address }
  875. mov dx,3d4h
  876. mov al,0ch
  877. out dx,al
  878. inc dx
  879. in al,dx
  880. mov ah,al
  881. dec dx
  882. mov al,0dh
  883. out dx,al
  884. in al,dx
  885. end;
  886. end;
  887. procedure SetActive200(page: word); {$ifndef fpc}far;{$endif fpc}
  888. { two page support... }
  889. begin
  890. case page of
  891. 0 : VideoOfs := 0;
  892. 1 : VideoOfs := 16384;
  893. 2 : VideoOfs := 32768;
  894. else
  895. VideoOfs := 0;
  896. end;
  897. end;
  898. procedure SetVisual350(page: word); {$ifndef fpc}far;{$endif fpc}
  899. { one page support... }
  900. begin
  901. if page > HardwarePages then exit;
  902. asm
  903. mov ax,[page] { only lower byte is supported. }
  904. mov ah,05h
  905. {$ifdef fpc}
  906. push ebp
  907. {$endif fpc}
  908. int 10h
  909. {$ifdef fpc}
  910. pop ebp
  911. {$endif fpc}
  912. end;
  913. end;
  914. procedure SetActive350(page: word); {$ifndef fpc}far;{$endif fpc}
  915. { one page support... }
  916. begin
  917. case page of
  918. 0 : VideoOfs := 0;
  919. 1 : VideoOfs := 32768;
  920. else
  921. VideoOfs := 0;
  922. end;
  923. end;
  924. {************************************************************************}
  925. {* 320x200x256c Routines *}
  926. {************************************************************************}
  927. Procedure Init320; {$ifndef fpc}far;{$endif fpc} assembler;
  928. asm
  929. mov ax,0013h
  930. {$ifdef fpc}
  931. push ebp
  932. {$endif fpc}
  933. int 10h
  934. {$ifdef fpc}
  935. pop ebp
  936. {$endif fpc}
  937. end;
  938. Procedure PutPixel320(X,Y : Integer; Pixel: Word); {$ifndef fpc}far;{$endif fpc}
  939. { x,y -> must be in local coordinates. Clipping if required. }
  940. Begin
  941. X:= X + StartXViewPort;
  942. Y:= Y + StartYViewPort;
  943. { convert to absolute coordinates and then verify clipping...}
  944. if ClipPixels then
  945. Begin
  946. if (X < StartXViewPort) or (X > (StartXViewPort + ViewWidth)) then
  947. exit;
  948. if (Y < StartYViewPort) or (Y > (StartYViewPort + ViewHeight)) then
  949. exit;
  950. end;
  951. {$ifndef asmgraph}
  952. Mem[$a000: y * 320 + x + VideoOfs] := Lo(Pixel);
  953. {$else asmgraph}
  954. asm
  955. {$ifndef fpc}
  956. mov es, [SegA000]
  957. mov ax, [Y]
  958. mov di, [X]
  959. xchg ah, al { The value of Y must be in AH }
  960. add di, ax
  961. shr ax, 2
  962. add di, ax
  963. add di, [VideoOfs] { point to correct page.. }
  964. mov ax, [Pixel]
  965. mov es:[di], al
  966. {$else fpc}
  967. movzx edi, x
  968. movzx ebx, y
  969. add edi, [VideoOfs]
  970. shl ebx, 6
  971. add edi, ebx
  972. mov ax, pixel
  973. mov fs:[edi+ebx*4+$a0000], al
  974. {$endif fpc}
  975. end;
  976. {$endif asmgraph}
  977. end;
  978. Function GetPixel320(X,Y: Integer):word; {$ifndef fpc}far;{$endif fpc}
  979. Begin
  980. X:= X + StartXViewPort;
  981. Y:= Y + StartYViewPort;
  982. {$ifndef asmgraph}
  983. GetPixel320 := Mem[$a000:y * 320 + x + VideoOfs];
  984. {$else asmgraph}
  985. asm
  986. {$ifndef fpc}
  987. mov es, [SegA000]
  988. mov ax, [Y]
  989. mov di, [X]
  990. xchg ah, al { The value of Y must be in AH }
  991. add di, ax
  992. shr ax, 2
  993. add di, ax
  994. xor ax, ax
  995. add di, [VideoOfs] { point to correct gfx page ... }
  996. mov al,es:[di]
  997. mov @Result,ax
  998. {$else fpc}
  999. movzx edi, x
  1000. movzx ebx, y
  1001. add edi, [VideoOfs]
  1002. shl ebx, 6
  1003. add edi, ebx
  1004. mov al, fs:[edi+ebx*4+$a0000]
  1005. mov @Result, al
  1006. {$endif fpc}
  1007. end;
  1008. {$endif asmgraph}
  1009. end;
  1010. Procedure DirectPutPixel320(X,Y : Integer); {$ifndef fpc}far;{$endif fpc}
  1011. { x,y -> must be in global coordinates. No clipping. }
  1012. {$ifndef asmgraph}
  1013. var offset: word;
  1014. dummy: Byte;
  1015. begin
  1016. dummy := CurrentColor;
  1017. offset := y * 320 + x + VideoOfs;
  1018. case CurrentWriteMode of
  1019. XorPut: dummy := dummy xor Mem[$a000:offset];
  1020. OrPut: dummy := dummy or Mem[$a000:offset];
  1021. AndPut: dummy := dummy and Mem[$a000:offset];
  1022. NotPut: dummy := Not dummy;
  1023. end;
  1024. Mem[$a000:offset] := dummy;
  1025. end;
  1026. {$else asmgraph}
  1027. assembler;
  1028. asm
  1029. {$ifndef fpc}
  1030. mov es, [SegA000]
  1031. mov ax, [Y]
  1032. mov di, [X]
  1033. xchg ah, al { The value of Y must be in AH }
  1034. add di, ax
  1035. shr ax, 2
  1036. add di, ax
  1037. add di, [VideoOfs]
  1038. mov ax, [CurrentColor]
  1039. cmp [CurrentWriteMode],XORPut { check write mode }
  1040. jne @MOVMode
  1041. mov ah,es:[di] { read the byte... }
  1042. xor al,ah { xor it and return value into AL }
  1043. @MovMode:
  1044. mov es:[di], al
  1045. {$else fpc}
  1046. movzx edi, y
  1047. shl edi, 6
  1048. mov ebx, edx
  1049. add edi, [VideoOfs]
  1050. mov ax, [CurrentColor]
  1051. cmp [CurrentWriteMode],XORPut { check write mode }
  1052. jne @MOVMode
  1053. mov bl, fs:[edi+ebx*4+$a0000]
  1054. xor al, bl
  1055. @MovMode:
  1056. mov fs:[edi+ebx*4+$a0000], al
  1057. {$endif fpc}
  1058. end;
  1059. {$endif asmgraph}
  1060. procedure SetVisual320(page: word); {$ifndef fpc}far;{$endif fpc}
  1061. { no page support... }
  1062. begin
  1063. end;
  1064. procedure SetActive320(page: word); {$ifndef fpc}far;{$endif fpc}
  1065. { no page support... }
  1066. begin
  1067. VideoOfs := 0;
  1068. end;
  1069. {************************************************************************}
  1070. {* Mode-X related routines *}
  1071. {************************************************************************}
  1072. const CrtAddress: word = 0;
  1073. procedure InitModeX; {$ifndef fpc}far;{$endif fpc}
  1074. begin
  1075. asm
  1076. {see if we are using color-/monochorme display}
  1077. MOV DX,3CCh {use output register: }
  1078. IN AL,DX
  1079. TEST AL,1 {is it a color display? }
  1080. MOV DX,3D4h
  1081. JNZ @L1 {yes }
  1082. MOV DX,3B4h {no }
  1083. @L1: {DX = 3B4h / 3D4h = CRTAddress-register for monochrome/color}
  1084. MOV CRTAddress,DX
  1085. MOV AX, 0013h
  1086. {$ifdef fpc}
  1087. push ebp
  1088. {$EndIf fpc}
  1089. INT 10h
  1090. {$ifdef fpc}
  1091. pop ebp
  1092. {$EndIf fpc}
  1093. MOV DX,03C4h {select memory-mode-register at sequencer port }
  1094. MOV AL,04
  1095. OUT DX,AL
  1096. INC DX {read in data via the according data register }
  1097. IN AL,DX
  1098. AND AL,0F7h {bit 3 := 0: don't chain the 4 planes}
  1099. OR AL,04 {bit 2 := 1: no odd/even mechanism }
  1100. OUT DX,AL {activate new settings }
  1101. MOV DX,03C4h {s.a.: address sequencer reg. 2 (=map-mask),... }
  1102. MOV AL,02
  1103. OUT DX,AL
  1104. INC DX
  1105. MOV AL,0Fh {...and allow access to all 4 bit maps }
  1106. OUT DX,AL
  1107. {$ifndef fpc}
  1108. MOV AX,[SegA000] {starting with segment A000h, set 8000h logical }
  1109. MOV ES,AX {words = 4*8000h physical words (because of 4 }
  1110. XOR DI,DI {bitplanes) to 0 }
  1111. XOR AX,AX
  1112. MOV CX,8000h
  1113. CLD
  1114. REP STOSW
  1115. {$else fpc}
  1116. push es
  1117. push fs
  1118. mov edi, $a0000
  1119. pop es
  1120. xor eax, eax
  1121. mov ecx, 4000h
  1122. cld
  1123. rep stosd
  1124. pop es
  1125. {$EndIf fpc}
  1126. MOV DX,CRTAddress {address the underline-location-register at }
  1127. MOV AL,14h {the CRT-controller port, read out the according }
  1128. OUT DX,AL {data register: }
  1129. INC DX
  1130. IN AL,DX
  1131. AND AL,0BFh {bit 6:=0: no double word addressing scheme in}
  1132. OUT DX,AL {video RAM }
  1133. DEC DX
  1134. MOV AL,17h {select mode control register }
  1135. OUT DX,AL
  1136. INC DX
  1137. IN AL,DX
  1138. OR AL,40h {bit 6 := 1: memory access scheme=linear bit array }
  1139. OUT DX,AL
  1140. end;
  1141. end;
  1142. Function GetPixelX(X,Y: Integer): word; {$ifndef fpc}far;{$endif fpc}
  1143. {$ifndef asmgraph}
  1144. var offset: word;
  1145. {$endif asmgraph}
  1146. begin
  1147. X:= X + StartXViewPort;
  1148. Y:= Y + StartYViewPort;
  1149. {$ifndef asmgraph}
  1150. offset := y * 80 + x shr 2 + VideoOfs;
  1151. PortW[$3c4] := FirstPlane shl (x and 3);
  1152. GetPixelX := Mem[$a000:offset];
  1153. {$else asmgraph}
  1154. asm
  1155. {$ifndef fpc}
  1156. mov di,[Y] ; (* DI = Y coordinate *)
  1157. (* Multiply by 80 start *)
  1158. mov bx, di
  1159. shl di, 6 ; (* Faster on 286/386/486 machines *)
  1160. shl bx, 4
  1161. add di, bx ; (* Multiply Value by 80 *)
  1162. (* End multiply by 80 *)
  1163. mov cx, [X]
  1164. mov ax, cx
  1165. {DI = Y * LINESIZE, BX = X, coordinates admissible}
  1166. shr ax, 1 ; (* Faster on 286/86 machines *)
  1167. shr ax, 1
  1168. add di, ax ; {DI = Y * LINESIZE + (X SHR 2) }
  1169. add di, [VideoOfs] ; (* Pointing at start of Active page *)
  1170. (* Select plane to use *)
  1171. mov dx, 03c4h
  1172. mov ax, FirstPlane ; (* Map Mask & Plane Select Register *)
  1173. and cl, 03h ; (* Get Plane Bits *)
  1174. shl ah, cl ; (* Get Plane Select Value *)
  1175. out dx, ax
  1176. (* End selection of plane *)
  1177. mov es,[SegA000]
  1178. mov al, ES:[DI]
  1179. xor ah, ah
  1180. mov @Result, ax
  1181. {$else fpc}
  1182. movzx edi,[Y] ; (* DI = Y coordinate *)
  1183. (* Multiply by 80 start *)
  1184. mov ebx, edi
  1185. shl edi, 6 ; (* Faster on 286/386/486 machines *)
  1186. shl ebx, 4
  1187. add edi, ebx ; (* Multiply Value by 80 *)
  1188. (* End multiply by 80 *)
  1189. movzx ecx, [X]
  1190. movzx eax, [Y]
  1191. {DI = Y * LINESIZE, BX = X, coordinates admissible}
  1192. shr eax, 2
  1193. add edi, eax ; {DI = Y * LINESIZE + (X SHR 2) }
  1194. add edi, [VideoOfs] ; (* Pointing at start of Active page *)
  1195. (* Select plane to use *)
  1196. mov dx, 03c4h
  1197. mov ax, FirstPlane ; (* Map Mask & Plane Select Register *)
  1198. and cl, 03h ; (* Get Plane Bits *)
  1199. shl ah, cl ; (* Get Plane Select Value *)
  1200. out dx, ax
  1201. (* End selection of plane *)
  1202. mov ax, fs:[edi+$a0000]
  1203. mov @Result, ax
  1204. {$endif fpc}
  1205. end;
  1206. {$endif asmgraph}
  1207. end;
  1208. procedure SetVisualX(page: word); {$ifndef fpc}far;{$endif fpc}
  1209. { 4 page support... }
  1210. Procedure SetVisibleStart(AOffset: word); Assembler;
  1211. (* Select where the left corner of the screen will be *)
  1212. { By Matt Pritchard }
  1213. asm
  1214. { Wait if we are currently in a Vertical Retrace }
  1215. MOV DX, INPUT_1 { Input Status #1 Register }
  1216. @DP_WAIT0:
  1217. IN AL, DX { Get VGA status }
  1218. AND AL, VERT_RETRACE { In Display mode yet? }
  1219. JNZ @DP_WAIT0 { If Not, wait for it }
  1220. { Set the Start Display Address to the new page }
  1221. MOV DX, CRTC_Index { We Change the VGA Sequencer }
  1222. MOV AL, START_DISP_LO { Display Start Low Register }
  1223. {$ifndef fpc}
  1224. MOV AH, BYTE PTR [AOffset] { Low 8 Bits of Start Addr }
  1225. OUT DX, AX { Set Display Addr Low }
  1226. MOV AL, START_DISP_HI { Display Start High Register }
  1227. MOV AH, BYTE PTR [AOffset+1] { High 8 Bits of Start Addr }
  1228. {$else fpc}
  1229. mov ah, byte [AOffset]
  1230. out dx, ax
  1231. mov AL, START_DISP_HI
  1232. mov ah, byte [AOffset+1]
  1233. {$endif fpc}
  1234. OUT DX, AX { Set Display Addr High }
  1235. { Wait for a Vertical Retrace to smooth out things }
  1236. MOV DX, INPUT_1 { Input Status #1 Register }
  1237. @DP_WAIT1:
  1238. IN AL, DX { Get VGA status }
  1239. AND AL, VERT_RETRACE { Vertical Retrace Start? }
  1240. JZ @DP_WAIT1 { If Not, wait for it }
  1241. { Now Set Display Starting Address }
  1242. end;
  1243. {$ifdef fpc}
  1244. {$undef asmgraph}
  1245. {$endif fpc}
  1246. begin
  1247. Case page of
  1248. 0: SetVisibleStart(0);
  1249. 1: SetVisibleStart(16000);
  1250. 2: SetVisibleStart(32000);
  1251. 3: SetVisibleStart(48000);
  1252. else
  1253. SetVisibleStart(0);
  1254. end;
  1255. end;
  1256. procedure SetActiveX(page: word); {$ifndef fpc}far;{$endif fpc}
  1257. { 4 page support... }
  1258. begin
  1259. case page of
  1260. 0: VideoOfs := 0;
  1261. 1: VideoOfs := 16000;
  1262. 2: VideoOfs := 32000;
  1263. 3: VideoOfs := 48000;
  1264. else
  1265. VideoOfs:=0;
  1266. end;
  1267. end;
  1268. Procedure PutPixelX(X,Y: Integer; color:word); {$ifndef fpc}far;{$endif fpc}
  1269. {$ifndef asmgraph}
  1270. var offset: word;
  1271. dummy: byte;
  1272. {$endif asmgraph}
  1273. begin
  1274. X:= X + StartXViewPort;
  1275. Y:= Y + StartYViewPort;
  1276. { convert to absolute coordinates and then verify clipping...}
  1277. if ClipPixels then
  1278. Begin
  1279. if (X < StartXViewPort) or (X > (StartXViewPort + ViewWidth)) then
  1280. exit;
  1281. if (Y < StartYViewPort) or (Y > (StartYViewPort + ViewHeight)) then
  1282. exit;
  1283. end;
  1284. {$ifndef asmgraph}
  1285. Dummy := color;
  1286. offset := y * 80 + x shr 2 + VideoOfs;
  1287. PortW[$3c4] := FirstPlane shl (x and 3);
  1288. If CurrentWriteMode = XorPut Then
  1289. Dummy := Dummy Xor Mem[$a000:offset];
  1290. Mem[$a000:offset] := Dummy;
  1291. {$else asmgraph}
  1292. asm
  1293. mov di,[Y] ; (* DI = Y coordinate *)
  1294. (* Multiply by 80 start *)
  1295. mov bx, di
  1296. shl di, 6 ; (* Faster on 286/386/486 machines *)
  1297. shl bx, 4
  1298. add di, bx ; (* Multiply Value by 80 *)
  1299. (* End multiply by 80 *)
  1300. mov cx, [X]
  1301. mov ax, cx
  1302. {DI = Y * LINESIZE, BX = X, coordinates admissible}
  1303. shr ax, 2
  1304. add di, ax ; {DI = Y * LINESIZE + (X SHR 2) }
  1305. add di, [VideoOfs] ; (* Pointing at start of Active page *)
  1306. (* Select plane to use *)
  1307. mov dx, 03c4h
  1308. mov ax, FirstPlane ; (* Map Mask & Plane Select Register *)
  1309. and cl, 03h ; (* Get Plane Bits *)
  1310. shl ah, cl ; (* Get Plane Select Value *)
  1311. out dx, ax
  1312. (* End selection of plane *)
  1313. mov es,[SegA000]
  1314. mov ax,[Color] ; { only lower byte is used. }
  1315. cmp [CurrentWriteMode],XORPut { check write mode }
  1316. jne @MOVMode
  1317. mov ah,es:[di] { read the byte... }
  1318. xor al,ah { xor it and return value into AL }
  1319. @MovMode:
  1320. mov es:[di], al
  1321. end;
  1322. {$endif asmgraph}
  1323. end;
  1324. Procedure DirectPutPixelX(X,Y: Integer); {$ifndef fpc}far;{$endif fpc}
  1325. { x,y -> must be in global coordinates. No clipping. }
  1326. {$ifndef asmgraph}
  1327. Var offset: Word;
  1328. dummy: Byte;
  1329. begin
  1330. dummy := CurrentColor;
  1331. offset := y * 80 + x shr 2 + VideoOfs;
  1332. PortW[$3c4] := FirstPlane shl (x and 3);
  1333. If CurrentWriteMode = XorPut Then
  1334. dummy := dummy xor Mem[$a000: offset];
  1335. Mem[$a000: offset] := Dummy;
  1336. end;
  1337. {$else asmgraph}
  1338. Assembler;
  1339. asm
  1340. mov di,[Y] ; (* DI = Y coordinate *)
  1341. (* Multiply by 80 start *)
  1342. mov bx, di
  1343. shl di, 6 ; (* Faster on 286/386/486 machines *)
  1344. shl bx, 4
  1345. add di, bx ; (* Multiply Value by 80 *)
  1346. (* End multiply by 80 *)
  1347. mov cx, [X]
  1348. mov ax, cx
  1349. {DI = Y * LINESIZE, BX = X, coordinates admissible}
  1350. shr ax, 2
  1351. add di, ax ; {DI = Y * LINESIZE + (X SHR 2) }
  1352. add di, [VideoOfs] ; (* Pointing at start of Active page *)
  1353. (* Select plane to use *)
  1354. mov dx, 03c4h
  1355. mov ax, FirstPlane ; (* Map Mask & Plane Select Register *)
  1356. and cl, 03h ; (* Get Plane Bits *)
  1357. shl ah, cl ; (* Get Plane Select Value *)
  1358. out dx, ax
  1359. (* End selection of plane *)
  1360. mov es,[SegA000]
  1361. mov ax,[CurrentColor] ; { only lower byte is used. }
  1362. cmp [CurrentWriteMode],XORPut { check write mode }
  1363. jne @MOVMode
  1364. mov ah,es:[di] { read the byte... }
  1365. xor al,ah { xor it and return value into AL }
  1366. @MovMode:
  1367. mov es:[di], al
  1368. end;
  1369. {$endif asmgraph}
  1370. {************************************************************************}
  1371. {* General routines *}
  1372. {************************************************************************}
  1373. var
  1374. SavePtr : pointer; { pointer to video state }
  1375. StateSize: word; { size in 64 byte blocks for video state }
  1376. VideoMode: byte; { old video mode before graph mode }
  1377. SaveSupported : Boolean; { Save/Restore video state supported? }
  1378. {**************************************************************}
  1379. {* DPMI Routines *}
  1380. {**************************************************************}
  1381. {$IFDEF DPMI}
  1382. RealStateSeg: word; { Real segment of saved video state }
  1383. Procedure SaveStateVGA; {$ifndef fpc}far;{$endif fpc}
  1384. var
  1385. PtrLong: longint;
  1386. regs: TDPMIRegisters;
  1387. begin
  1388. SaveSupported := FALSE;
  1389. SavePtr := nil;
  1390. { Get the video mode }
  1391. asm
  1392. mov ah,0fh
  1393. int 10h
  1394. mov [VideoMode], al
  1395. end;
  1396. { Prepare to save video state...}
  1397. asm
  1398. mov ax, 1C00h { get buffer size to save state }
  1399. mov cx, 00000111b { Save DAC / Data areas / Hardware states }
  1400. {$ifdef fpc}
  1401. push ebp
  1402. {$endif fpc}
  1403. int 10h
  1404. {$ifdef fpc}
  1405. pop ebp
  1406. {$endif fpc}
  1407. mov [StateSize], bx
  1408. cmp al,01ch
  1409. jnz @notok
  1410. mov [SaveSupported],TRUE
  1411. @notok:
  1412. end;
  1413. if SaveSupported then
  1414. begin
  1415. {$ifndef fpc}
  1416. PtrLong:=GlobalDosAlloc(64*StateSize); { values returned in 64-byte blocks }
  1417. {$else fpc}
  1418. PtrLong:=Global_Dos_Alloc(64*StateSize); { values returned in 64-byte blocks }
  1419. {$endif fpc}
  1420. if PtrLong = 0 then
  1421. RunError(203);
  1422. SavePtr := pointer(longint(PtrLong and $0000ffff) shl 16);
  1423. {$ifndef fpc}
  1424. { In FPC mode, we can't do anything with this (no far pointers) }
  1425. { However, we still need to keep it to be able to free the }
  1426. { memory afterwards. Since this data is not accessed in PM code, }
  1427. { there's no need to save it in a seperate buffer (JM) }
  1428. if not assigned(SavePtr) then
  1429. RunError(203);
  1430. {$endif fpc}
  1431. RealStateSeg := word(PtrLong shr 16);
  1432. FillChar(regs, sizeof(regs), #0);
  1433. { call the real mode interrupt ... }
  1434. regs.eax := $1C01; { save the state buffer }
  1435. regs.ecx := $07; { Save DAC / Data areas / Hardware states }
  1436. regs.es := RealStateSeg;
  1437. regs.ebx := 0;
  1438. RealIntr($10,regs);
  1439. FillChar(regs, sizeof(regs), #0);
  1440. { restore state, according to Ralph Brown Interrupt list }
  1441. { some BIOS corrupt the hardware after a save... }
  1442. regs.eax := $1C02; { restore the state buffer }
  1443. regs.ecx := $07; { rest DAC / Data areas / Hardware states }
  1444. regs.es := RealStateSeg;
  1445. regs.ebx := 0;
  1446. RealIntr($10,regs);
  1447. end;
  1448. end;
  1449. procedure RestoreStateVGA; {$ifndef fpc}far;{$endif fpc}
  1450. var
  1451. regs:TDPMIRegisters;
  1452. begin
  1453. { go back to the old video mode...}
  1454. asm
  1455. mov ah,00
  1456. mov al,[VideoMode]
  1457. {$ifdef fpc}
  1458. push ebp
  1459. {$endif fpc}
  1460. int 10h
  1461. {$ifdef fpc}
  1462. pop ebp
  1463. {$endif fpc}
  1464. end;
  1465. { then restore all state information }
  1466. {$ifndef fpc}
  1467. if assigned(SavePtr) and (SaveSupported=TRUE) then
  1468. {$else fpc}
  1469. { No far pointer support, so it's possible that that assigned(SavePtr) }
  1470. { would return false under FPC. Just check if it's different from nil. }
  1471. if (SavePtr <> nil) and (SaveSupported=TRUE) then
  1472. {$endif fpc}
  1473. begin
  1474. FillChar(regs, sizeof(regs), #0);
  1475. { restore state, according to Ralph Brown Interrupt list }
  1476. { some BIOS corrupt the hardware after a save... }
  1477. regs.eax := $1C02; { restore the state buffer }
  1478. regs.ecx := $07; { rest DAC / Data areas / Hardware states }
  1479. regs.es := RealStateSeg;
  1480. regs.ebx := 0;
  1481. RealIntr($10,regs);
  1482. {$ifndef fpc}
  1483. if GlobalDosFree(longint(SavePtr) shr 16)<>0 then
  1484. {$else fpc}
  1485. if Not Global_Dos_Free(longint(SavePtr) shr 16) then
  1486. {$endif fpc}
  1487. RunError(216);
  1488. SavePtr := nil;
  1489. end;
  1490. end;
  1491. {$ELSE}
  1492. {**************************************************************}
  1493. {* Real mode routines *}
  1494. {**************************************************************}
  1495. Procedure SaveStateVGA; far;
  1496. begin
  1497. SavePtr := nil;
  1498. SaveSupported := FALSE;
  1499. { Get the video mode }
  1500. asm
  1501. mov ah,0fh
  1502. int 10h
  1503. mov [VideoMode], al
  1504. end;
  1505. { Prepare to save video state...}
  1506. asm
  1507. mov ax, 1C00h { get buffer size to save state }
  1508. mov cx, 00000111b { Save DAC / Data areas / Hardware states }
  1509. int 10h
  1510. mov [StateSize], bx
  1511. cmp al,01ch
  1512. jnz @notok
  1513. mov [SaveSupported],TRUE
  1514. @notok:
  1515. end;
  1516. if SaveSupported then
  1517. Begin
  1518. GetMem(SavePtr, 64*StateSize); { values returned in 64-byte blocks }
  1519. if not assigned(SavePtr) then
  1520. RunError(203);
  1521. asm
  1522. mov ax, 1C01h { save the state buffer }
  1523. mov cx, 00000111b { Save DAC / Data areas / Hardware states }
  1524. mov es, WORD PTR [SavePtr+2]
  1525. mov bx, WORD PTR [SavePtr]
  1526. int 10h
  1527. end;
  1528. { restore state, according to Ralph Brown Interrupt list }
  1529. { some BIOS corrupt the hardware after a save... }
  1530. asm
  1531. mov ax, 1C02h { save the state buffer }
  1532. mov cx, 00000111b { Save DAC / Data areas / Hardware states }
  1533. mov es, WORD PTR [SavePtr+2]
  1534. mov bx, WORD PTR [SavePtr]
  1535. int 10h
  1536. end;
  1537. end;
  1538. end;
  1539. procedure RestoreStateVGA; far;
  1540. begin
  1541. { go back to the old video mode...}
  1542. asm
  1543. mov ah,00
  1544. mov al,[VideoMode]
  1545. int 10h
  1546. end;
  1547. { then restore all state information }
  1548. if assigned(SavePtr) and (SaveSupported=TRUE) then
  1549. begin
  1550. { restore state, according to Ralph Brown Interrupt list }
  1551. asm
  1552. mov ax, 1C02h { save the state buffer }
  1553. mov cx, 00000111b { Save DAC / Data areas / Hardware states }
  1554. mov es, WORD PTR [SavePtr+2]
  1555. mov bx, WORD PTR [SavePtr]
  1556. int 10h
  1557. end;
  1558. FreeMem(SavePtr, 64*StateSize);
  1559. SavePtr := nil;
  1560. end;
  1561. end;
  1562. {$ENDIF DPMI}
  1563. { VGA is never a direct color mode, so no need to check ... }
  1564. Procedure SetVGARGBPalette(ColorNum, RedValue, GreenValue,
  1565. BlueValue : Integer); {$ifndef fpc}far;{$endif fpc} assembler;
  1566. asm
  1567. { on some hardware - there is a snow like effect }
  1568. { when changing the palette register directly }
  1569. { so we wait for a vertical retrace start period. }
  1570. mov dx, $03da
  1571. @1:
  1572. in al, dx { Get input status register }
  1573. test al, $08 { check if in vertical retrace }
  1574. jnz @1 { yes, complete it }
  1575. { we have to wait for the next }
  1576. { retrace to assure ourselves }
  1577. { that we have time to complete }
  1578. { the DAC operation within }
  1579. { the vertical retrace period }
  1580. @2:
  1581. in al, dx
  1582. test al, $08
  1583. jz @2 { repeat until vertical retrace start }
  1584. mov dx, $03c8 { Set color register address to use }
  1585. mov ax, [ColorNum]
  1586. out dx, al
  1587. inc dx { Point to DAC registers }
  1588. mov ax, [RedValue] { Get RedValue }
  1589. { and ax, $ff } { mask out all upper bits }
  1590. shr al, 2 { convert to LSB RGB format }
  1591. out dx, al
  1592. mov ax, [GreenValue]{ Get RedValue }
  1593. { and ax, $ff } { mask out all upper bits }
  1594. shr al, 2 { convert to LSB RGB format }
  1595. out dx, al
  1596. mov ax, [BlueValue] { Get RedValue }
  1597. { and ax, $ff } { mask out all upper bits }
  1598. shr al, 2 { convert to LSB RGB format }
  1599. out dx, al
  1600. end;
  1601. { VGA is never a direct color mode, so no need to check ... }
  1602. Procedure GetVGARGBPalette(ColorNum: integer; Var
  1603. RedValue, GreenValue, BlueValue : integer); {$ifndef fpc}far;{$endif fpc}
  1604. begin
  1605. Port[$03C7] := ColorNum;
  1606. { we must convert to lsb values... because the vga uses the 6 msb bits }
  1607. { which is not compatible with anything. }
  1608. RedValue := Integer(Port[$3C9] shl 2);
  1609. GreenValue := Integer(Port[$3C9] shl 2);
  1610. BlueValue := Integer(Port[$3C9] shl 2);
  1611. end;
  1612. {************************************************************************}
  1613. {* VESA related routines *}
  1614. {************************************************************************}
  1615. {$I vesa.inc}
  1616. {************************************************************************}
  1617. {* General routines *}
  1618. {************************************************************************}
  1619. procedure CloseGraph;
  1620. Begin
  1621. If not isgraphmode then
  1622. begin
  1623. _graphresult := grnoinitgraph;
  1624. exit
  1625. end;
  1626. {$ifdef logging}
  1627. LogLn('calling RestoreVideoState at '+strf(longint(RestoreVideoState)));
  1628. {$endif logging}
  1629. if not assigned(RestoreVideoState) then
  1630. RunError(216);
  1631. {$ifdef logging}
  1632. LogLn('actual call of RestoreVideoState');
  1633. {$endif logging}
  1634. RestoreVideoState;
  1635. isgraphmode := false;
  1636. end;
  1637. function QueryAdapterInfo:PModeInfo;
  1638. { This routine returns the head pointer to the list }
  1639. { of supported graphics modes. }
  1640. { Returns nil if no graphics mode supported. }
  1641. { This list is READ ONLY! }
  1642. var
  1643. EGADetected : Boolean;
  1644. VGADetected : Boolean;
  1645. mode: TModeInfo;
  1646. begin
  1647. QueryAdapterInfo := ModeList;
  1648. { If the mode listing already exists... }
  1649. { simply return it, without changing }
  1650. { anything... }
  1651. if assigned(ModeList) then
  1652. exit;
  1653. EGADetected := FALSE;
  1654. VGADetected := FALSE;
  1655. { check if Hercules adapter supported ... }
  1656. { check if EGA adapter supported... }
  1657. asm
  1658. mov ah,12h
  1659. mov bx,0FF10h
  1660. {$ifdef fpc}
  1661. push ebp
  1662. {$endif fpc}
  1663. int 10h { get EGA information }
  1664. {$ifdef fpc}
  1665. pop ebp
  1666. {$endif fpc}
  1667. cmp bh,0ffh
  1668. jz @noega
  1669. mov [EGADetected],TRUE
  1670. @noega:
  1671. end;
  1672. {$ifdef logging}
  1673. LogLn('EGA detected: '+strf(Longint(EGADetected)));
  1674. {$endif logging}
  1675. { check if VGA adapter supported... }
  1676. if EGADetected then
  1677. begin
  1678. asm
  1679. mov ax,1a00h
  1680. {$ifdef fpc}
  1681. push ebp
  1682. {$endif fpc}
  1683. int 10h { get display combination code...}
  1684. {$ifdef fpc}
  1685. pop ebp
  1686. {$endif fpc}
  1687. cmp al,1ah { check if supported... }
  1688. jne @novga
  1689. { now check if this is the ATI EGA }
  1690. mov ax,1c00h { get state size for save... }
  1691. { ... all important data }
  1692. mov cx,07h
  1693. {$ifdef fpc}
  1694. push ebp
  1695. {$endif fpc}
  1696. int 10h
  1697. {$ifdef fpc}
  1698. pop ebp
  1699. {$endif fpc}
  1700. cmp al,1ch { success? }
  1701. jne @novga
  1702. mov [VGADetected],TRUE
  1703. @novga:
  1704. end;
  1705. end;
  1706. {$ifdef logging}
  1707. LogLn('VGA detected: '+strf(Longint(VGADetected)));
  1708. {$endif logging}
  1709. if VGADetected then
  1710. begin
  1711. SaveVideoState := SaveStateVGA;
  1712. {$ifdef logging}
  1713. LogLn('Setting VGA SaveVideoState to '+strf(longint(SaveVideoState)));
  1714. {$endif logging}
  1715. RestoreVideoState := RestoreStateVGA;
  1716. {$ifdef logging}
  1717. LogLn('Setting VGA RestoreVideoState to '+strf(longint(RestoreVideoState)));
  1718. {$endif logging}
  1719. InitMode(mode);
  1720. { now add all standard VGA modes... }
  1721. mode.DriverNumber:= LowRes;
  1722. mode.HardwarePages:= 0;
  1723. mode.ModeNumber:=0;
  1724. mode.ModeName:='320 x 200 VGA';
  1725. mode.MaxColor := 256;
  1726. mode.PaletteSize := mode.MaxColor;
  1727. mode.DirectColor := FALSE;
  1728. mode.MaxX := 319;
  1729. mode.MaxY := 199;
  1730. {$ifndef fpc}
  1731. mode.DirectPutPixel:=DirectPutPixel320;
  1732. mode.PutPixel:=PutPixel320;
  1733. mode.GetPixel:=GetPixel320;
  1734. mode.SetRGBPalette := SetVGARGBPalette;
  1735. mode.GetRGBPalette := GetVGARGBPalette;
  1736. mode.SetVisualPage := SetVisual320;
  1737. mode.SetActivePage := SetActive320;
  1738. mode.InitMode := Init320;
  1739. {$else fpc}
  1740. mode.DirectPutPixel:=@DirectPutPixel320;
  1741. mode.PutPixel:=@PutPixel320;
  1742. mode.GetPixel:=@GetPixel320;
  1743. mode.SetRGBPalette := @SetVGARGBPalette;
  1744. mode.GetRGBPalette := @GetVGARGBPalette;
  1745. mode.SetVisualPage := @SetVisual320;
  1746. mode.SetActivePage := @SetActive320;
  1747. mode.InitMode := @Init320;
  1748. {$endif fpc}
  1749. mode.XAspect := 10000;
  1750. mode.YAspect := 10000;
  1751. AddMode(mode);
  1752. { now add all standard VGA modes... }
  1753. InitMode(mode);
  1754. mode.DriverNumber:= LowRes;
  1755. mode.ModeNumber:=1;
  1756. mode.HardwarePages := 3; { 0..3 }
  1757. mode.ModeName:='320 x 200 ModeX';
  1758. mode.MaxColor := 256;
  1759. mode.DirectColor := FALSE;
  1760. mode.PaletteSize := mode.MaxColor;
  1761. mode.MaxX := 319;
  1762. mode.MaxY := 199;
  1763. {$ifndef fpc}
  1764. mode.DirectPutPixel:=DirectPutPixelX;
  1765. mode.PutPixel:=PutPixelX;
  1766. mode.GetPixel:=GetPixelX;
  1767. mode.SetRGBPalette := SetVGARGBPalette;
  1768. mode.GetRGBPalette := GetVGARGBPalette;
  1769. mode.SetVisualPage := SetVisualX;
  1770. mode.SetActivePage := SetActiveX;
  1771. mode.InitMode := InitModeX;
  1772. {$else fpc}
  1773. mode.DirectPutPixel:=@DirectPutPixelX;
  1774. mode.PutPixel:=@PutPixelX;
  1775. mode.GetPixel:=@GetPixelX;
  1776. mode.SetRGBPalette := @SetVGARGBPalette;
  1777. mode.GetRGBPalette := @GetVGARGBPalette;
  1778. mode.SetVisualPage := @SetVisualX;
  1779. mode.SetActivePage := @SetActiveX;
  1780. mode.InitMode := @InitModeX;
  1781. {$endif fpc}
  1782. mode.XAspect := 10000;
  1783. mode.YAspect := 10000;
  1784. AddMode(mode);
  1785. InitMode(mode);
  1786. mode.ModeNumber:=VGALo;
  1787. mode.DriverNumber := VGA;
  1788. mode.ModeName:='640 x 200 VGA';
  1789. mode.MaxColor := 16;
  1790. mode.HardwarePages := 2;
  1791. mode.DirectColor := FALSE;
  1792. mode.PaletteSize := mode.MaxColor;
  1793. mode.MaxX := 639;
  1794. mode.MaxY := 199;
  1795. {$ifndef fpc}
  1796. mode.DirectPutPixel:=DirectPutPixel16;
  1797. mode.PutPixel:=PutPixel16;
  1798. mode.GetPixel:=GetPixel16;
  1799. mode.SetRGBPalette := SetVGARGBPalette;
  1800. mode.GetRGBPalette := GetVGARGBPalette;
  1801. mode.SetVisualPage := SetVisual200;
  1802. mode.SetActivePage := SetActive200;
  1803. mode.InitMode := Init640x200x16;
  1804. mode.GetScanLine := GetScanLine16;
  1805. {$else fpc}
  1806. mode.DirectPutPixel:=@DirectPutPixel16;
  1807. mode.PutPixel:=@PutPixel16;
  1808. mode.GetPixel:=@GetPixel16;
  1809. mode.SetRGBPalette := @SetVGARGBPalette;
  1810. mode.GetRGBPalette := @GetVGARGBPalette;
  1811. mode.SetVisualPage := @SetVisual200;
  1812. mode.SetActivePage := @SetActive200;
  1813. mode.InitMode := @Init640x200x16;
  1814. mode.HLine := @HLine16;
  1815. mode.VLine := @VLine16;
  1816. mode.GetScanLine := @GetScanLine16;
  1817. {$endif fpc}
  1818. mode.XAspect := 10000;
  1819. mode.YAspect := 10000;
  1820. AddMode(mode);
  1821. InitMode(mode);
  1822. mode.ModeNumber:=VGAMed;
  1823. mode.DriverNumber := VGA;
  1824. mode.ModeName:='640 x 350 VGA';
  1825. mode.HardwarePages := 1;
  1826. mode.MaxColor := 16;
  1827. mode.DirectColor := FALSE;
  1828. mode.PaletteSize := mode.MaxColor;
  1829. mode.MaxX := 639;
  1830. mode.MaxY := 349;
  1831. {$ifndef fpc}
  1832. mode.DirectPutPixel:=DirectPutPixel16;
  1833. mode.PutPixel:=PutPixel16;
  1834. mode.GetPixel:=GetPixel16;
  1835. mode.InitMode := Init640x350x16;
  1836. mode.SetRGBPalette := SetVGARGBPalette;
  1837. mode.GetRGBPalette := GetVGARGBPalette;
  1838. mode.SetVisualPage := SetVisual350;
  1839. mode.SetActivePage := SetActive350;
  1840. mode.GetScanLine := GetScanLine16;
  1841. {$else fpc}
  1842. mode.DirectPutPixel:=@DirectPutPixel16;
  1843. mode.PutPixel:=@PutPixel16;
  1844. mode.GetPixel:=@GetPixel16;
  1845. mode.InitMode := @Init640x350x16;
  1846. mode.SetRGBPalette := @SetVGARGBPalette;
  1847. mode.GetRGBPalette := @GetVGARGBPalette;
  1848. mode.SetVisualPage := @SetVisual350;
  1849. mode.SetActivePage := @SetActive350;
  1850. mode.HLine := @HLine16;
  1851. mode.VLine := @VLine16;
  1852. mode.GetScanLine := @GetScanLine16;
  1853. {$endif fpc}
  1854. mode.XAspect := 10000;
  1855. mode.YAspect := 10000;
  1856. AddMode(mode);
  1857. InitMode(mode);
  1858. mode.ModeNumber:=VGAHi;
  1859. mode.DriverNumber := VGA;
  1860. mode.HardwarePages := 0;
  1861. mode.ModeName:='640 x 480 VGA';
  1862. mode.MaxColor := 16;
  1863. mode.DirectColor := FALSE;
  1864. mode.PaletteSize := mode.MaxColor;
  1865. mode.MaxX := 639;
  1866. mode.MaxY := 479;
  1867. {$ifndef fpc}
  1868. mode.DirectPutPixel:=DirectPutPixel16;
  1869. mode.PutPixel:=PutPixel16;
  1870. mode.GetPixel:=GetPixel16;
  1871. mode.SetRGBPalette := SetVGARGBPalette;
  1872. mode.GetRGBPalette := GetVGARGBPalette;
  1873. mode.InitMode := Init640x480x16;
  1874. mode.SetVisualPage := SetVisual480;
  1875. mode.SetActivePage := SetActive480;
  1876. mode.GetScanLine := GetScanLine16;
  1877. {$else fpc}
  1878. mode.DirectPutPixel:=@DirectPutPixel16;
  1879. mode.PutPixel:=@PutPixel16;
  1880. mode.GetPixel:=@GetPixel16;
  1881. mode.SetRGBPalette := @SetVGARGBPalette;
  1882. mode.GetRGBPalette := @GetVGARGBPalette;
  1883. mode.InitMode := @Init640x480x16;
  1884. mode.SetVisualPage := @SetVisual480;
  1885. mode.SetActivePage := @SetActive480;
  1886. mode.HLine := @HLine16;
  1887. mode.VLine := @VLine16;
  1888. mode.GetScanLine := @GetScanLine16;
  1889. {$endif fpc}
  1890. mode.XAspect := 10000;
  1891. mode.YAspect := 10000;
  1892. AddMode(mode);
  1893. end;
  1894. { check if VESA adapter supported... }
  1895. {$ifndef noSupportVESA}
  1896. hasVesa := getVesaInfo(VESAInfo);
  1897. {$else noSupportVESA}
  1898. hasVESA := false;
  1899. {$endif noSupportVESA}
  1900. if hasVesa then
  1901. begin
  1902. { We have to set and restore the entire VESA state }
  1903. { otherwise, if we use the VGA BIOS only function }
  1904. { there might be a crash under DPMI, such as in the}
  1905. { ATI Mach64 }
  1906. SaveVideoState := SaveStateVESA;
  1907. {$ifdef logging}
  1908. LogLn('Setting SaveVideoState to '+strf(longint(SaveVideoState)));
  1909. {$endif logging}
  1910. RestoreVideoState := RestoreStateVESA;
  1911. {$ifdef logging}
  1912. LogLn('Setting RestoreVideoState to '+strf(longint(RestoreVideoState)));
  1913. {$endif logging}
  1914. { now check all supported modes...}
  1915. if SearchVESAModes(m320x200x32k) then
  1916. begin
  1917. InitMode(mode);
  1918. mode.ModeNumber:=m320x200x32k;
  1919. mode.DriverNumber := VESA;
  1920. mode.ModeName:='320 x 200 VESA';
  1921. mode.MaxColor := 32768;
  1922. { the ModeInfo is automatically set if the mode is supported }
  1923. { by the call to SearchVESAMode. }
  1924. mode.HardwarePages := ModeInfo.NumberOfPages;
  1925. mode.PaletteSize := mode.MaxColor;
  1926. mode.DirectColor := TRUE;
  1927. mode.MaxX := 319;
  1928. mode.MaxY := 199;
  1929. {$ifndef fpc}
  1930. mode.DirectPutPixel:=DirectPutPixVESA32k;
  1931. mode.PutPixel:=PutPixVESA32k;
  1932. mode.GetPixel:=GetPixVESA32k;
  1933. mode.SetRGBPalette := SetVESARGBPalette;
  1934. mode.GetRGBPalette := GetVESARGBPalette;
  1935. mode.InitMode := Init320x200x32k;
  1936. mode.SetVisualPage := SetVisualVESA;
  1937. mode.SetActivePage := SetActiveVESA;
  1938. {$else fpc}
  1939. mode.DirectPutPixel:=@DirectPutPixVESA32k;
  1940. mode.PutPixel:=@PutPixVESA32k;
  1941. mode.GetPixel:=@GetPixVESA32k;
  1942. mode.SetRGBPalette := @SetVESARGBPalette;
  1943. mode.GetRGBPalette := @GetVESARGBPalette;
  1944. mode.InitMode := @Init320x200x32k;
  1945. mode.SetVisualPage := @SetVisualVESA;
  1946. mode.SetActivePage := @SetActiveVESA;
  1947. {$endif fpc}
  1948. mode.XAspect := 10000;
  1949. mode.YAspect := 10000;
  1950. AddMode(mode);
  1951. end;
  1952. if SearchVESAModes(m320x200x64k) then
  1953. begin
  1954. InitMode(mode);
  1955. mode.ModeNumber:=m320x200x64k;
  1956. mode.DriverNumber := VESA;
  1957. mode.ModeName:='320 x 200 VESA';
  1958. mode.MaxColor := 65536;
  1959. { the ModeInfo is automatically set if the mode is supported }
  1960. { by the call to SearchVESAMode. }
  1961. mode.HardwarePages := ModeInfo.NumberOfPages;
  1962. mode.PaletteSize := mode.MaxColor;
  1963. mode.DirectColor := TRUE;
  1964. mode.MaxX := 319;
  1965. mode.MaxY := 199;
  1966. {$ifndef fpc}
  1967. mode.DirectPutPixel:=DirectPutPixVESA64k;
  1968. mode.PutPixel:=PutPixVESA64k;
  1969. mode.GetPixel:=GetPixVESA64k;
  1970. mode.SetRGBPalette := SetVESARGBPalette;
  1971. mode.GetRGBPalette := GetVESARGBPalette;
  1972. mode.InitMode := Init320x200x64k;
  1973. mode.SetVisualPage := SetVisualVESA;
  1974. mode.SetActivePage := SetActiveVESA;
  1975. {$else fpc}
  1976. mode.DirectPutPixel:=@DirectPutPixVESA64k;
  1977. mode.PutPixel:=@PutPixVESA64k;
  1978. mode.GetPixel:=@GetPixVESA64k;
  1979. mode.SetRGBPalette := @SetVESARGBPalette;
  1980. mode.GetRGBPalette := @GetVESARGBPalette;
  1981. mode.InitMode := @Init320x200x64k;
  1982. mode.SetVisualPage := @SetVisualVESA;
  1983. mode.SetActivePage := @SetActiveVESA;
  1984. {$endif fpc}
  1985. mode.XAspect := 10000;
  1986. mode.YAspect := 10000;
  1987. AddMode(mode);
  1988. end;
  1989. if SearchVESAModes(m640x400x256) then
  1990. begin
  1991. InitMode(mode);
  1992. mode.ModeNumber:=m640x400x256;
  1993. mode.DriverNumber := VESA;
  1994. mode.ModeName:='640 x 400 VESA';
  1995. mode.MaxColor := 256;
  1996. { the ModeInfo is automatically set if the mode is supported }
  1997. { by the call to SearchVESAMode. }
  1998. mode.HardwarePages := ModeInfo.NumberOfPages;
  1999. mode.PaletteSize := mode.MaxColor;
  2000. mode.DirectColor := FALSE;
  2001. mode.MaxX := 639;
  2002. mode.MaxY := 399;
  2003. {$ifndef fpc}
  2004. mode.DirectPutPixel:=DirectPutPixVESA256;
  2005. mode.PutPixel:=PutPixVESA256;
  2006. mode.GetPixel:=GetPixVESA256;
  2007. mode.SetRGBPalette := SetVESARGBPalette;
  2008. mode.GetRGBPalette := GetVESARGBPalette;
  2009. mode.InitMode := Init640x400x256;
  2010. mode.SetVisualPage := SetVisualVESA;
  2011. mode.SetActivePage := SetActiveVESA;
  2012. mode.hline := HLineVESA256;
  2013. mode.vline := VLineVESA256;
  2014. {$else fpc}
  2015. mode.DirectPutPixel:=@DirectPutPixVESA256;
  2016. mode.PutPixel:=@PutPixVESA256;
  2017. mode.GetPixel:=@GetPixVESA256;
  2018. mode.SetRGBPalette := @SetVESARGBPalette;
  2019. mode.GetRGBPalette := @GetVESARGBPalette;
  2020. mode.InitMode := @Init640x400x256;
  2021. mode.SetVisualPage := @SetVisualVESA;
  2022. mode.SetActivePage := @SetActiveVESA;
  2023. mode.hline := @HLineVESA256;
  2024. mode.vline := @VLineVESA256;
  2025. {$endif fpc}
  2026. mode.XAspect := 10000;
  2027. mode.YAspect := 10000;
  2028. AddMode(mode);
  2029. end;
  2030. if SearchVESAModes(m640x480x256) then
  2031. begin
  2032. InitMode(mode);
  2033. mode.ModeNumber:=m640x480x256;
  2034. mode.DriverNumber := VESA;
  2035. mode.ModeName:='640 x 480 VESA';
  2036. mode.MaxColor := 256;
  2037. { the ModeInfo is automatically set if the mode is supported }
  2038. { by the call to SearchVESAMode. }
  2039. mode.HardwarePages := ModeInfo.NumberOfPages;
  2040. mode.PaletteSize := mode.MaxColor;
  2041. mode.MaxX := 639;
  2042. mode.MaxY := 479;
  2043. {$ifndef fpc}
  2044. mode.DirectPutPixel:=DirectPutPixVESA256;
  2045. mode.PutPixel:=PutPixVESA256;
  2046. mode.GetPixel:=GetPixVESA256;
  2047. mode.SetRGBPalette := SetVESARGBPalette;
  2048. mode.GetRGBPalette := GetVESARGBPalette;
  2049. mode.InitMode := Init640x480x256;
  2050. mode.SetVisualPage := SetVisualVESA;
  2051. mode.SetActivePage := SetActiveVESA;
  2052. mode.hline := HLineVESA256;
  2053. mode.vline := VLineVESA256;
  2054. {$else fpc}
  2055. mode.DirectPutPixel:=@DirectPutPixVESA256;
  2056. mode.PutPixel:=@PutPixVESA256;
  2057. mode.GetPixel:=@GetPixVESA256;
  2058. mode.SetRGBPalette := @SetVESARGBPalette;
  2059. mode.GetRGBPalette := @GetVESARGBPalette;
  2060. mode.InitMode := @Init640x480x256;
  2061. mode.SetVisualPage := @SetVisualVESA;
  2062. mode.SetActivePage := @SetActiveVESA;
  2063. mode.hline := @HLineVESA256;
  2064. mode.hline := @HLineVESA256;
  2065. {$endif fpc}
  2066. mode.XAspect := 10000;
  2067. mode.YAspect := 10000;
  2068. AddMode(mode);
  2069. end;
  2070. if SearchVESAModes(m640x480x32k) then
  2071. begin
  2072. InitMode(mode);
  2073. mode.ModeNumber:=m640x480x32k;
  2074. mode.DriverNumber := VESA;
  2075. mode.ModeName:='640 x 400 VESA';
  2076. mode.MaxColor := 32768;
  2077. { the ModeInfo is automatically set if the mode is supported }
  2078. { by the call to SearchVESAMode. }
  2079. mode.HardwarePages := ModeInfo.NumberOfPages;
  2080. mode.PaletteSize := mode.MaxColor;
  2081. mode.DirectColor := TRUE;
  2082. mode.MaxX := 639;
  2083. mode.MaxY := 399;
  2084. {$ifndef fpc}
  2085. mode.DirectPutPixel:=DirectPutPixVESA32k;
  2086. mode.PutPixel:=PutPixVESA32k;
  2087. mode.GetPixel:=GetPixVESA32k;
  2088. mode.SetRGBPalette := SetVESARGBPalette;
  2089. mode.GetRGBPalette := GetVESARGBPalette;
  2090. mode.InitMode := Init640x480x32k;
  2091. mode.SetVisualPage := SetVisualVESA;
  2092. mode.SetActivePage := SetActiveVESA;
  2093. {$else fpc}
  2094. mode.DirectPutPixel:=@DirectPutPixVESA32k;
  2095. mode.PutPixel:=@PutPixVESA32k;
  2096. mode.GetPixel:=@GetPixVESA32k;
  2097. mode.SetRGBPalette := @SetVESARGBPalette;
  2098. mode.GetRGBPalette := @GetVESARGBPalette;
  2099. mode.InitMode := @Init640x480x32k;
  2100. mode.SetVisualPage := @SetVisualVESA;
  2101. mode.SetActivePage := @SetActiveVESA;
  2102. {$endif fpc}
  2103. mode.XAspect := 10000;
  2104. mode.YAspect := 10000;
  2105. AddMode(mode);
  2106. end;
  2107. if SearchVESAModes(m640x480x64k) then
  2108. begin
  2109. InitMode(mode);
  2110. mode.ModeNumber:=m640x480x64k;
  2111. mode.DriverNumber := VESA;
  2112. mode.ModeName:='640 x 480 VESA';
  2113. mode.MaxColor := 65536;
  2114. { the ModeInfo is automatically set if the mode is supported }
  2115. { by the call to SearchVESAMode. }
  2116. mode.HardwarePages := ModeInfo.NumberOfPages;
  2117. mode.PaletteSize := mode.MaxColor;
  2118. mode.DirectColor := TRUE;
  2119. mode.MaxX := 639;
  2120. mode.MaxY := 479;
  2121. {$ifndef fpc}
  2122. mode.DirectPutPixel:=DirectPutPixVESA64k;
  2123. mode.PutPixel:=PutPixVESA64k;
  2124. mode.GetPixel:=GetPixVESA64k;
  2125. mode.SetRGBPalette := SetVESARGBPalette;
  2126. mode.GetRGBPalette := GetVESARGBPalette;
  2127. mode.InitMode := Init640x480x64k;
  2128. mode.SetVisualPage := SetVisualVESA;
  2129. mode.SetActivePage := SetActiveVESA;
  2130. {$else fpc}
  2131. mode.DirectPutPixel:=@DirectPutPixVESA64k;
  2132. mode.PutPixel:=@PutPixVESA64k;
  2133. mode.GetPixel:=@GetPixVESA64k;
  2134. mode.SetRGBPalette := @SetVESARGBPalette;
  2135. mode.GetRGBPalette := @GetVESARGBPalette;
  2136. mode.InitMode := @Init640x480x64k;
  2137. mode.SetVisualPage := @SetVisualVESA;
  2138. mode.SetActivePage := @SetActiveVESA;
  2139. {$endif fpc}
  2140. mode.XAspect := 10000;
  2141. mode.YAspect := 10000;
  2142. AddMode(mode);
  2143. end;
  2144. if SearchVESAModes(m800x600x16) then
  2145. begin
  2146. InitMode(mode);
  2147. mode.ModeNumber:=m800x600x16;
  2148. mode.DriverNumber := VESA;
  2149. mode.ModeName:='800 x 600 VESA';
  2150. mode.MaxColor := 16;
  2151. { the ModeInfo is automatically set if the mode is supported }
  2152. { by the call to SearchVESAMode. }
  2153. mode.HardwarePages := ModeInfo.NumberOfPages;
  2154. mode.DirectColor := FALSE;
  2155. mode.PaletteSize := mode.MaxColor;
  2156. mode.MaxX := 799;
  2157. mode.MaxY := 599;
  2158. {$ifndef fpc}
  2159. mode.DirectPutPixel:=DirectPutPixVESA16;
  2160. mode.SetRGBPalette := SetVESARGBPalette;
  2161. mode.GetRGBPalette := GetVESARGBPalette;
  2162. mode.PutPixel:=PutPixVESA16;
  2163. { mode.GetPixel:=GetPixVESA16;}
  2164. mode.InitMode := Init800x600x16;
  2165. mode.SetVisualPage := SetVisualVESA;
  2166. mode.SetActivePage := SetActiveVESA;
  2167. {$else fpc}
  2168. mode.DirectPutPixel:=@DirectPutPixVESA16;
  2169. mode.SetRGBPalette := @SetVESARGBPalette;
  2170. mode.GetRGBPalette := @GetVESARGBPalette;
  2171. mode.PutPixel:=@PutPixVESA16;
  2172. { mode.GetPixel:=@GetPixVESA16;}
  2173. mode.InitMode := @Init800x600x16;
  2174. mode.SetVisualPage := @SetVisualVESA;
  2175. mode.SetActivePage := @SetActiveVESA;
  2176. {$endif fpc}
  2177. mode.XAspect := 10000;
  2178. mode.YAspect := 10000;
  2179. AddMode(mode);
  2180. end;
  2181. if SearchVESAModes(m800x600x256) then
  2182. begin
  2183. InitMode(mode);
  2184. mode.ModeNumber:=m800x600x256;
  2185. mode.DriverNumber := VESA;
  2186. mode.ModeName:='800 x 600 VESA';
  2187. mode.MaxColor := 256;
  2188. { the ModeInfo is automatically set if the mode is supported }
  2189. { by the call to SearchVESAMode. }
  2190. mode.HardwarePages := ModeInfo.NumberOfPages;
  2191. mode.PaletteSize := mode.MaxColor;
  2192. mode.DirectColor := FALSE;
  2193. mode.MaxX := 799;
  2194. mode.MaxY := 599;
  2195. {$ifndef fpc}
  2196. mode.DirectPutPixel:=DirectPutPixVESA256;
  2197. mode.PutPixel:=PutPixVESA256;
  2198. mode.GetPixel:=GetPixVESA256;
  2199. mode.SetRGBPalette := SetVESARGBPalette;
  2200. mode.GetRGBPalette := GetVESARGBPalette;
  2201. mode.InitMode := Init800x600x256;
  2202. mode.SetVisualPage := SetVisualVESA;
  2203. mode.SetActivePage := SetActiveVESA;
  2204. mode.hline := HLineVESA256;
  2205. mode.vline := VLineVESA256;
  2206. {$else fpc}
  2207. mode.DirectPutPixel:=@DirectPutPixVESA256;
  2208. mode.PutPixel:=@PutPixVESA256;
  2209. mode.GetPixel:=@GetPixVESA256;
  2210. mode.SetRGBPalette := @SetVESARGBPalette;
  2211. mode.GetRGBPalette := @GetVESARGBPalette;
  2212. mode.InitMode := @Init800x600x256;
  2213. mode.SetVisualPage := @SetVisualVESA;
  2214. mode.SetActivePage := @SetActiveVESA;
  2215. mode.hline := @HLineVESA256;
  2216. mode.vline := @VLineVESA256;
  2217. {$endif fpc}
  2218. mode.XAspect := 10000;
  2219. mode.YAspect := 10000;
  2220. AddMode(mode);
  2221. end;
  2222. if SearchVESAModes(m800x600x32k) then
  2223. begin
  2224. InitMode(mode);
  2225. mode.ModeNumber:=m800x600x32k;
  2226. mode.DriverNumber := VESA;
  2227. mode.ModeName:='800 x 600 VESA';
  2228. mode.MaxColor := 32768;
  2229. { the ModeInfo is automatically set if the mode is supported }
  2230. { by the call to SearchVESAMode. }
  2231. mode.HardwarePages := ModeInfo.NumberOfPages;
  2232. mode.PaletteSize := mode.MaxColor;
  2233. mode.DirectColor := TRUE;
  2234. mode.MaxX := 799;
  2235. mode.MaxY := 599;
  2236. {$ifndef fpc}
  2237. mode.DirectPutPixel:=DirectPutPixVESA32k;
  2238. mode.PutPixel:=PutPixVESA32k;
  2239. mode.GetPixel:=GetPixVESA32k;
  2240. mode.SetRGBPalette := SetVESARGBPalette;
  2241. mode.GetRGBPalette := GetVESARGBPalette;
  2242. mode.InitMode := Init800x600x32k;
  2243. mode.SetVisualPage := SetVisualVESA;
  2244. mode.SetActivePage := SetActiveVESA;
  2245. {$else fpc}
  2246. mode.DirectPutPixel:=@DirectPutPixVESA32k;
  2247. mode.PutPixel:=@PutPixVESA32k;
  2248. mode.GetPixel:=@GetPixVESA32k;
  2249. mode.SetRGBPalette := @SetVESARGBPalette;
  2250. mode.GetRGBPalette := @GetVESARGBPalette;
  2251. mode.InitMode := @Init800x600x32k;
  2252. mode.SetVisualPage := @SetVisualVESA;
  2253. mode.SetActivePage := @SetActiveVESA;
  2254. {$endif fpc}
  2255. mode.XAspect := 10000;
  2256. mode.YAspect := 10000;
  2257. AddMode(mode);
  2258. end;
  2259. if SearchVESAModes(m800x600x64k) then
  2260. begin
  2261. InitMode(mode);
  2262. mode.ModeNumber:=m800x600x16;
  2263. mode.DriverNumber := VESA;
  2264. mode.ModeName:='800 x 600 VESA';
  2265. mode.MaxColor := 65536;
  2266. { the ModeInfo is automatically set if the mode is supported }
  2267. { by the call to SearchVESAMode. }
  2268. mode.HardwarePages := ModeInfo.NumberOfPages;
  2269. mode.PaletteSize := mode.MaxColor;
  2270. mode.DirectColor := TRUE;
  2271. mode.MaxX := 799;
  2272. mode.MaxY := 599;
  2273. {$ifndef fpc}
  2274. mode.DirectPutPixel:=DirectPutPixVESA64k;
  2275. mode.PutPixel:=PutPixVESA64k;
  2276. mode.GetPixel:=GetPixVESA64k;
  2277. mode.SetRGBPalette := SetVESARGBPalette;
  2278. mode.GetRGBPalette := GetVESARGBPalette;
  2279. mode.InitMode := Init800x600x64k;
  2280. mode.SetVisualPage := SetVisualVESA;
  2281. mode.SetActivePage := SetActiveVESA;
  2282. {$else fpc}
  2283. mode.DirectPutPixel:=@DirectPutPixVESA64k;
  2284. mode.PutPixel:=@PutPixVESA64k;
  2285. mode.GetPixel:=@GetPixVESA64k;
  2286. mode.SetRGBPalette := @SetVESARGBPalette;
  2287. mode.GetRGBPalette := @GetVESARGBPalette;
  2288. mode.InitMode := @Init800x600x64k;
  2289. mode.SetVisualPage := @SetVisualVESA;
  2290. mode.SetActivePage := @SetActiveVESA;
  2291. {$endif fpc}
  2292. mode.XAspect := 10000;
  2293. mode.YAspect := 10000;
  2294. AddMode(mode);
  2295. end;
  2296. if SearchVESAModes(m1024x768x16) then
  2297. begin
  2298. InitMode(mode);
  2299. mode.ModeNumber:=m1024x768x16;
  2300. mode.DriverNumber := VESA;
  2301. mode.ModeName:='1024 x 768 VESA';
  2302. mode.MaxColor := 16;
  2303. { the ModeInfo is automatically set if the mode is supported }
  2304. { by the call to SearchVESAMode. }
  2305. mode.HardwarePages := ModeInfo.NumberOfPages;
  2306. mode.PaletteSize := mode.MaxColor;
  2307. mode.DirectColor := FALSE;
  2308. mode.MaxX := 1023;
  2309. mode.MaxY := 767;
  2310. {$ifndef fpc}
  2311. mode.DirectPutPixel:=DirectPutPixVESA16;
  2312. mode.PutPixel:=PutPixVESA16;
  2313. mode.SetRGBPalette := SetVESARGBPalette;
  2314. mode.GetRGBPalette := GetVESARGBPalette;
  2315. { mode.GetPixel:=GetPixVESA16;}
  2316. mode.InitMode := Init1024x768x16;
  2317. mode.SetVisualPage := SetVisualVESA;
  2318. mode.SetActivePage := SetActiveVESA;
  2319. {$else fpc}
  2320. mode.DirectPutPixel:=@DirectPutPixVESA16;
  2321. mode.PutPixel:=@PutPixVESA16;
  2322. mode.SetRGBPalette := @SetVESARGBPalette;
  2323. mode.GetRGBPalette := @GetVESARGBPalette;
  2324. { mode.GetPixel:=@GetPixVESA16;}
  2325. mode.InitMode := @Init1024x768x16;
  2326. mode.SetVisualPage := @SetVisualVESA;
  2327. mode.SetActivePage := @SetActiveVESA;
  2328. {$endif fpc}
  2329. mode.XAspect := 10000;
  2330. mode.YAspect := 10000;
  2331. AddMode(mode);
  2332. end;
  2333. if SearchVESAModes(m1024x768x256) then
  2334. begin
  2335. InitMode(mode);
  2336. mode.ModeNumber:=m1024x768x256;
  2337. mode.DriverNumber := VESA;
  2338. mode.ModeName:='1024 x 768 VESA';
  2339. mode.MaxColor := 256;
  2340. { the ModeInfo is automatically set if the mode is supported }
  2341. { by the call to SearchVESAMode. }
  2342. mode.HardwarePages := ModeInfo.NumberOfPages;
  2343. mode.PaletteSize := mode.MaxColor;
  2344. mode.DirectColor := FALSE;
  2345. mode.MaxX := 1023;
  2346. mode.MaxY := 767;
  2347. {$ifndef fpc}
  2348. mode.DirectPutPixel:=DirectPutPixVESA256;
  2349. mode.PutPixel:=PutPixVESA256;
  2350. mode.GetPixel:=GetPixVESA256;
  2351. mode.SetRGBPalette := SetVESARGBPalette;
  2352. mode.GetRGBPalette := GetVESARGBPalette;
  2353. mode.InitMode := Init1024x768x256;
  2354. mode.SetVisualPage := SetVisualVESA;
  2355. mode.SetActivePage := SetActiveVESA;
  2356. mode.hline := HLineVESA256;
  2357. mode.vline := VLineVESA256;
  2358. {$else fpc}
  2359. mode.DirectPutPixel:=@DirectPutPixVESA256;
  2360. mode.PutPixel:=@PutPixVESA256;
  2361. mode.GetPixel:=@GetPixVESA256;
  2362. mode.SetRGBPalette := @SetVESARGBPalette;
  2363. mode.GetRGBPalette := @GetVESARGBPalette;
  2364. mode.InitMode := @Init1024x768x256;
  2365. mode.SetVisualPage := @SetVisualVESA;
  2366. mode.SetActivePage := @SetActiveVESA;
  2367. mode.vline := @VLineVESA256;
  2368. mode.hline := @HLineVESA256;
  2369. {$endif fpc}
  2370. mode.XAspect := 10000;
  2371. mode.YAspect := 10000;
  2372. AddMode(mode);
  2373. end;
  2374. if SearchVESAModes(m1024x768x32k) then
  2375. begin
  2376. InitMode(mode);
  2377. mode.ModeNumber:=m1024x768x32k;
  2378. mode.DriverNumber := VESA;
  2379. mode.ModeName:='1024 x 768 VESA';
  2380. mode.MaxColor := 32768;
  2381. { the ModeInfo is automatically set if the mode is supported }
  2382. { by the call to SearchVESAMode. }
  2383. mode.HardwarePages := ModeInfo.NumberOfPages;
  2384. mode.PaletteSize := mode.MaxColor;
  2385. mode.DirectColor := TRUE;
  2386. mode.MaxX := 1023;
  2387. mode.MaxY := 767;
  2388. {$ifndef fpc}
  2389. mode.DirectPutPixel:=DirectPutPixVESA32k;
  2390. mode.PutPixel:=PutPixVESA32k;
  2391. mode.GetPixel:=GetPixVESA32k;
  2392. mode.SetRGBPalette := SetVESARGBPalette;
  2393. mode.GetRGBPalette := GetVESARGBPalette;
  2394. mode.InitMode := Init640x480x32k;
  2395. mode.SetVisualPage := SetVisualVESA;
  2396. mode.SetActivePage := SetActiveVESA;
  2397. {$else fpc}
  2398. mode.DirectPutPixel:=@DirectPutPixVESA32k;
  2399. mode.PutPixel:=@PutPixVESA32k;
  2400. mode.GetPixel:=@GetPixVESA32k;
  2401. mode.SetRGBPalette := @SetVESARGBPalette;
  2402. mode.GetRGBPalette := @GetVESARGBPalette;
  2403. mode.InitMode := @Init640x480x32k;
  2404. mode.SetVisualPage := @SetVisualVESA;
  2405. mode.SetActivePage := @SetActiveVESA;
  2406. {$endif fpc}
  2407. mode.XAspect := 10000;
  2408. mode.YAspect := 10000;
  2409. AddMode(mode);
  2410. end;
  2411. if SearchVESAModes(m1024x768x64k) then
  2412. begin
  2413. InitMode(mode);
  2414. mode.ModeNumber:=m1024x768x64k;
  2415. mode.DriverNumber := VESA;
  2416. mode.ModeName:='1024 x 768 VESA';
  2417. mode.MaxColor := 65536;
  2418. mode.DirectColor := TRUE;
  2419. { the ModeInfo is automatically set if the mode is supported }
  2420. { by the call to SearchVESAMode. }
  2421. mode.HardwarePages := ModeInfo.NumberOfPages;
  2422. mode.PaletteSize := mode.MaxColor;
  2423. mode.MaxX := 1023;
  2424. mode.MaxY := 767;
  2425. {$ifndef fpc}
  2426. mode.DirectPutPixel:=DirectPutPixVESA64k;
  2427. mode.PutPixel:=PutPixVESA64k;
  2428. mode.GetPixel:=GetPixVESA64k;
  2429. mode.SetRGBPalette := SetVESARGBPalette;
  2430. mode.GetRGBPalette := GetVESARGBPalette;
  2431. mode.InitMode := Init1024x768x64k;
  2432. mode.SetVisualPage := SetVisualVESA;
  2433. mode.SetActivePage := SetActiveVESA;
  2434. {$else fpc}
  2435. mode.DirectPutPixel:=@DirectPutPixVESA64k;
  2436. mode.PutPixel:=@PutPixVESA64k;
  2437. mode.GetPixel:=@GetPixVESA64k;
  2438. mode.SetRGBPalette := @SetVESARGBPalette;
  2439. mode.GetRGBPalette := @GetVESARGBPalette;
  2440. mode.InitMode := @Init1024x768x64k;
  2441. mode.SetVisualPage := @SetVisualVESA;
  2442. mode.SetActivePage := @SetActiveVESA;
  2443. {$endif fpc}
  2444. mode.XAspect := 10000;
  2445. mode.YAspect := 10000;
  2446. AddMode(mode);
  2447. end;
  2448. if SearchVESAModes(m1280x1024x16) then
  2449. begin
  2450. InitMode(mode);
  2451. mode.ModeNumber:=m1280x1024x16;
  2452. mode.DriverNumber := VESA;
  2453. mode.ModeName:='1280 x 1024 VESA';
  2454. mode.MaxColor := 16;
  2455. { the ModeInfo is automatically set if the mode is supported }
  2456. { by the call to SearchVESAMode. }
  2457. mode.HardwarePages := ModeInfo.NumberOfPages;
  2458. mode.DirectColor := FALSE;
  2459. mode.PaletteSize := mode.MaxColor;
  2460. mode.MaxX := 1279;
  2461. mode.MaxY := 1023;
  2462. {$ifndef fpc}
  2463. mode.DirectPutPixel:=DirectPutPixVESA16;
  2464. mode.SetRGBPalette := SetVESARGBPalette;
  2465. mode.GetRGBPalette := GetVESARGBPalette;
  2466. mode.PutPixel:=PutPixVESA16;
  2467. { mode.GetPixel:=GetPixVESA16;}
  2468. mode.InitMode := Init1280x1024x16;
  2469. mode.SetVisualPage := SetVisualVESA;
  2470. mode.SetActivePage := SetActiveVESA;
  2471. {$else fpc}
  2472. mode.DirectPutPixel:=@DirectPutPixVESA16;
  2473. mode.SetRGBPalette := @SetVESARGBPalette;
  2474. mode.GetRGBPalette := @GetVESARGBPalette;
  2475. mode.PutPixel:=@PutPixVESA16;
  2476. { mode.GetPixel:=@GetPixVESA16;}
  2477. mode.InitMode := @Init1280x1024x16;
  2478. mode.SetVisualPage := @SetVisualVESA;
  2479. mode.SetActivePage := @SetActiveVESA;
  2480. {$endif fpc}
  2481. mode.XAspect := 10000;
  2482. mode.YAspect := 10000;
  2483. AddMode(mode);
  2484. end;
  2485. if SearchVESAModes(m1280x1024x256) then
  2486. begin
  2487. InitMode(mode);
  2488. mode.ModeNumber:=m1280x1024x256;
  2489. mode.DriverNumber := VESA;
  2490. mode.ModeName:='1280 x 1024 VESA';
  2491. mode.MaxColor := 256;
  2492. { the ModeInfo is automatically set if the mode is supported }
  2493. { by the call to SearchVESAMode. }
  2494. mode.HardwarePages := ModeInfo.NumberOfPages;
  2495. mode.DirectColor := FALSE;
  2496. mode.PaletteSize := mode.MaxColor;
  2497. mode.MaxX := 1279;
  2498. mode.MaxY := 1023;
  2499. {$ifndef fpc}
  2500. mode.DirectPutPixel:=DirectPutPixVESA256;
  2501. mode.PutPixel:=PutPixVESA256;
  2502. mode.GetPixel:=GetPixVESA256;
  2503. mode.InitMode := Init1280x1024x256;
  2504. mode.SetRGBPalette := SetVESARGBPalette;
  2505. mode.GetRGBPalette := GetVESARGBPalette;
  2506. mode.SetVisualPage := SetVisualVESA;
  2507. mode.SetActivePage := SetActiveVESA;
  2508. mode.hline := HLineVESA256;
  2509. mode.vline := VLineVESA256;
  2510. {$else fpc}
  2511. mode.DirectPutPixel:=@DirectPutPixVESA256;
  2512. mode.PutPixel:=@PutPixVESA256;
  2513. mode.GetPixel:=@GetPixVESA256;
  2514. mode.InitMode := @Init1280x1024x256;
  2515. mode.SetRGBPalette := @SetVESARGBPalette;
  2516. mode.GetRGBPalette := @GetVESARGBPalette;
  2517. mode.SetVisualPage := @SetVisualVESA;
  2518. mode.SetActivePage := @SetActiveVESA;
  2519. mode.vline := @VLineVESA256;
  2520. mode.hline := @HLineVESA256;
  2521. {$endif fpc}
  2522. mode.XAspect := 10000;
  2523. mode.YAspect := 10000;
  2524. AddMode(mode);
  2525. end;
  2526. if SearchVESAModes(m1280x1024x32k) then
  2527. begin
  2528. InitMode(mode);
  2529. mode.ModeNumber:=m1280x1024x32k;
  2530. mode.DriverNumber := VESA;
  2531. mode.ModeName:='1280 x 1024 VESA';
  2532. mode.MaxColor := 32768;
  2533. { the ModeInfo is automatically set if the mode is supported }
  2534. { by the call to SearchVESAMode. }
  2535. mode.HardwarePages := ModeInfo.NumberOfPages;
  2536. mode.DirectColor := TRUE;
  2537. mode.PaletteSize := mode.MaxColor;
  2538. mode.MaxX := 1279;
  2539. mode.MaxY := 1023;
  2540. {$ifndef fpc}
  2541. mode.DirectPutPixel:=DirectPutPixVESA32k;
  2542. mode.PutPixel:=PutPixVESA32k;
  2543. mode.GetPixel:=GetPixVESA32k;
  2544. mode.InitMode := Init1280x1024x32k;
  2545. mode.SetRGBPalette := SetVESARGBPalette;
  2546. mode.GetRGBPalette := GetVESARGBPalette;
  2547. mode.SetVisualPage := SetVisualVESA;
  2548. mode.SetActivePage := SetActiveVESA;
  2549. {$else fpc}
  2550. mode.DirectPutPixel:=@DirectPutPixVESA32k;
  2551. mode.PutPixel:=@PutPixVESA32k;
  2552. mode.GetPixel:=@GetPixVESA32k;
  2553. mode.InitMode := @Init1280x1024x32k;
  2554. mode.SetRGBPalette := @SetVESARGBPalette;
  2555. mode.GetRGBPalette := @GetVESARGBPalette;
  2556. mode.SetVisualPage := @SetVisualVESA;
  2557. mode.SetActivePage := @SetActiveVESA;
  2558. {$endif fpc}
  2559. mode.XAspect := 10000;
  2560. mode.YAspect := 10000;
  2561. AddMode(mode);
  2562. end;
  2563. if SearchVESAModes(m1280x1024x64k) then
  2564. begin
  2565. InitMode(mode);
  2566. mode.ModeNumber:=m1280x1024x64k;
  2567. mode.DriverNumber := VESA;
  2568. mode.ModeName:='1280 x 1024 VESA';
  2569. mode.MaxColor := 65536;
  2570. { the ModeInfo is automatically set if the mode is supported }
  2571. { by the call to SearchVESAMode. }
  2572. mode.HardwarePages := ModeInfo.NumberOfPages;
  2573. mode.DirectColor := TRUE;
  2574. mode.PaletteSize := mode.MaxColor;
  2575. mode.MaxX := 1279;
  2576. mode.MaxY := 1023;
  2577. {$ifndef fpc}
  2578. mode.DirectPutPixel:=DirectPutPixVESA64k;
  2579. mode.PutPixel:=PutPixVESA64k;
  2580. mode.GetPixel:=GetPixVESA64k;
  2581. mode.InitMode := Init1280x1024x64k;
  2582. mode.SetRGBPalette := SetVESARGBPalette;
  2583. mode.GetRGBPalette := GetVESARGBPalette;
  2584. mode.SetVisualPage := SetVisualVESA;
  2585. mode.SetActivePage := SetActiveVESA;
  2586. {$else fpc}
  2587. mode.DirectPutPixel:=@DirectPutPixVESA64k;
  2588. mode.PutPixel:=@PutPixVESA64k;
  2589. mode.GetPixel:=@GetPixVESA64k;
  2590. mode.InitMode := @Init1280x1024x64k;
  2591. mode.SetRGBPalette := @SetVESARGBPalette;
  2592. mode.GetRGBPalette := @GetVESARGBPalette;
  2593. mode.SetVisualPage := @SetVisualVESA;
  2594. mode.SetActivePage := @SetActiveVESA;
  2595. {$endif fpc}
  2596. mode.XAspect := 10000;
  2597. mode.YAspect := 10000;
  2598. AddMode(mode);
  2599. end;
  2600. end;
  2601. end;
  2602. {
  2603. $Log$
  2604. Revision 1.19 1999-09-24 22:52:38 jonas
  2605. * optimized patternline a bit (always use hline when possible)
  2606. * isgraphmode stuff cleanup
  2607. * vesainfo.modelist now gets disposed in cleanmode instead of in
  2608. closegraph (required moving of some declarations from vesa.inc to
  2609. new vesah.inc)
  2610. * queryadapter gets no longer called from initgraph (is called from
  2611. initialization of graph unit)
  2612. * bugfix for notput in 32k and 64k vesa modes
  2613. * a div replaced by / in fillpoly
  2614. Revision 1.18 1999/09/24 14:22:38 jonas
  2615. + getscanline16
  2616. Revision 1.17 1999/09/24 11:31:38 jonas
  2617. * fixed another typo :(
  2618. Revision 1.16 1999/09/23 14:00:41 jonas
  2619. * -dlogging no longer required to fuction correctly
  2620. * some typo's fixed
  2621. Revision 1.15 1999/09/22 13:13:34 jonas
  2622. * renamed text.inc -> gtext.inc to avoid conflict with system unit
  2623. * fixed textwidth
  2624. * isgraphmode now gets properly updated, so mode restoring works
  2625. again
  2626. Revision 1.14 1999/09/18 22:21:09 jonas
  2627. + hlinevesa256 and vlinevesa256
  2628. + support for not/xor/or/andput in vesamodes with 32k/64k colors
  2629. * lots of changes to avoid warnings under FPC
  2630. Revision 1.13 1999/09/18 16:03:36 jonas
  2631. * graph.pp: removed pieslice and sector from ToDo list
  2632. * closegraph: exits now immidiately if isgraphmode = false (caused
  2633. RTE 204 with VESA enabled if you set exitproc to call closegraph
  2634. and also called closegraph explicitely before exit, like bgidemo)
  2635. Revision 1.12 1999/09/15 13:37:50 jonas
  2636. * small change to internalellipsedef to be TP compatible
  2637. * fixed directputpixel for vga 320*200*256
  2638. Revision 1.11 1999/09/12 17:28:59 jonas
  2639. * several changes to internalellipse to make it faster
  2640. and to make sure it updates the ArcCall correctly
  2641. (not yet done for width = 3)
  2642. * Arc mostly works now, only sometimes an endless loop, don't know
  2643. why
  2644. Revision 1.10 1999/09/11 19:43:01 jonas
  2645. * FloodFill: did not take into account current viewport settings
  2646. * GetScanLine: only get line inside viewport, data outside of it
  2647. is not used anyway
  2648. * InternalEllipseDefault: fix for when xradius or yradius = 0 and
  2649. increase xradius and yradius always by one (TP does this too)
  2650. * fixed conlict in vesa.inc from last update
  2651. * some conditionals to avoid range check and overflow errors in
  2652. places where it doesn't matter
  2653. Revision 1.9 1999/08/01 14:50:51 jonas
  2654. * fixed hline16 and vline16 for notput (also TP supports copy, and, or, xor and
  2655. notput for lines!!)
  2656. * fixed directputpixel16 to support all the different put types
  2657. Revision 1.8 1999/07/18 15:07:19 jonas
  2658. + xor-, and and- orput support for VESA256 modes
  2659. * compile with -dlogging if you want some info to be logged to grlog.txt
  2660. Revision 1.7 1999/07/14 18:18:02 florian
  2661. * cosmetic changes
  2662. Revision 1.6 1999/07/14 18:16:23 florian
  2663. * HLine16 and VLine16 implemented
  2664. Revision 1.5 1999/07/14 14:32:12 florian
  2665. * small VGA detection problem solved
  2666. Revision 1.4 1999/07/12 13:27:08 jonas
  2667. + added Log and Id tags
  2668. * added first FPC support, only VGA works to some extend for now
  2669. * use -dasmgraph to use assembler routines, otherwise Pascal
  2670. equivalents are used
  2671. * use -dsupportVESA to support VESA (crashes under FPC for now)
  2672. * only dispose vesainfo at closegrph if a vesa card was detected
  2673. * changed int32 to longint (int32 is not declared under FPC)
  2674. * changed the declaration of almost every procedure in graph.inc to
  2675. "far;" because otherwise you can't assign them to procvars under TP
  2676. real mode (but unexplainable "data segnment too large" errors prevent
  2677. it from working under real mode anyway)
  2678. }