graph.inc 90 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837
  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. { getpixel wants local/relative coordinates }
  547. Color := Not Color;
  548. end
  549. else
  550. Color := CurrentColor;
  551. end;
  552. {$ifndef asmgraph}
  553. offset := Y * 80 + (X shr 3) + VideoOfs;
  554. PortW[$3ce] := $f01;
  555. PortW[$3ce] := Color shl 8;
  556. PortB[$3ce] := 8;
  557. PortW[$3cf] := $80 shr (X and 7) + (Color shl 8);
  558. dummy := Mem[$a000: offset];
  559. Mem[$a000: offset] := dummy;
  560. PortW[$3ce] := $ff08;
  561. PortB[$3ce] := 1;
  562. {$else asmgraph}
  563. asm
  564. {$ifndef fpc}
  565. mov es, [SegA000]
  566. { enable the set / reset function and load the color }
  567. mov dx, 3ceh
  568. mov ax, 0f01h
  569. out dx, ax
  570. { setup set/reset register }
  571. mov ax, [Color]
  572. shl ax, 8
  573. out dx, ax
  574. { setup the bit mask register }
  575. mov al, 8
  576. out dx, al
  577. inc dx
  578. { load the bitmask register }
  579. mov cx, [X]
  580. and cx, 0007h
  581. mov al, 80h
  582. shr al, cl
  583. out dx, ax
  584. { get the x index and divide by 8 for 16-color }
  585. mov ax,[X]
  586. shr ax,3
  587. push ax
  588. { determine the address }
  589. mov ax,80
  590. mov bx,[Y]
  591. mul bx
  592. pop cx
  593. add ax,cx
  594. mov di,ax
  595. { send the data through the display memory through set/reset }
  596. add di,[VideoOfs] { add correct page }
  597. mov bl,es:[di]
  598. mov es:[di],bl
  599. { reset for formal vga operation }
  600. mov dx,3ceh
  601. mov ax,0ff08h
  602. out dx,ax
  603. { restore enable set/reset register }
  604. mov ax,0001h
  605. out dx,ax
  606. {$else fpc}
  607. { enable the set / reset function and load the color }
  608. mov dx, 3ceh
  609. mov ax, 0f01h
  610. out dx, ax
  611. { setup set/reset register }
  612. mov ax, [Color]
  613. shl ax, 8
  614. out dx, ax
  615. { setup the bit mask register }
  616. mov al, 8
  617. out dx, al
  618. inc dx
  619. { load the bitmask register }
  620. mov cx, [X]
  621. and cx, 0007h
  622. mov al, 80h
  623. shr al, cl
  624. out dx, ax
  625. { get the x index and divide by 8 for 16-color }
  626. movzx eax,[X]
  627. shr eax,3
  628. push eax
  629. { determine the address }
  630. mov eax,80
  631. mov bx,[Y]
  632. mul bx
  633. pop ecx
  634. add eax,ecx
  635. mov edi,eax
  636. { send the data through the display memory through set/reset }
  637. add edi,[VideoOfs] { add correct page }
  638. mov bl,fs:[edi+$a0000]
  639. mov fs:[edi+$a0000],bl
  640. { reset for formal vga operation }
  641. mov dx,3ceh
  642. mov ax,0ff08h
  643. out dx,ax
  644. { restore enable set/reset register }
  645. mov ax,0001h
  646. out dx,ax
  647. {$endif fpc}
  648. end;
  649. {$endif asmgraph}
  650. end;
  651. {$ifndef tp}
  652. procedure HLine16(x,x2,y: integer); {$ifndef fpc}far;{$endif fpc}
  653. var
  654. xtmp: integer;
  655. ScrOfs,HLength : word;
  656. LMask,RMask : byte;
  657. Begin
  658. { must we swap the values? }
  659. if x > x2 then
  660. Begin
  661. xtmp := x2;
  662. x2 := x;
  663. x:= xtmp;
  664. end;
  665. { First convert to global coordinates }
  666. X := X + StartXViewPort;
  667. X2 := X2 + StartXViewPort;
  668. Y := Y + StartYViewPort;
  669. if ClipPixels then
  670. Begin
  671. if LineClipped(x,y,x2,y,StartXViewPort,StartYViewPort,
  672. StartXViewPort+ViewWidth, StartYViewPort+ViewHeight) then
  673. exit;
  674. end;
  675. ScrOfs:=y*ScrWidth+x div 8;
  676. HLength:=x2 div 8-x div 8;
  677. LMask:=$ff shr (x and 7);
  678. {$ifopt r+}
  679. {$define rangeOn}
  680. {$r-}
  681. {$endif}
  682. {$ifopt q+}
  683. {$define overflowOn}
  684. {$q-}
  685. {$endif}
  686. RMask:=$ff shl (7-(x2 and 7));
  687. {$ifdef rangeOn}
  688. {$undef rangeOn}
  689. {$r+}
  690. {$endif}
  691. {$ifdef overflowOn}
  692. {$undef overflowOn}
  693. {$q+}
  694. {$endif}
  695. if HLength=0 then
  696. LMask:=LMask and RMask;
  697. port[$3ce]:=0;
  698. If CurrentWriteMode <> NotPut Then
  699. port[$3cf]:= CurrentColor
  700. else port[$3cf]:= not CurrentColor;
  701. port[$3ce]:=1;
  702. port[$3cf]:=$f;
  703. port[$3ce]:=3;
  704. case CurrentWriteMode of
  705. XORPut:
  706. port[$3cf]:=3 shl 3;
  707. ANDPut:
  708. port[$3cf]:=1 shl 3;
  709. ORPut:
  710. port[$3cf]:=2 shl 3;
  711. NormalPut, NotPut:
  712. port[$3cf]:=0
  713. else
  714. port[$3cf]:=0
  715. end;
  716. port[$3ce]:=8;
  717. port[$3cf]:=LMask;
  718. {$ifopt r+}
  719. {$define rangeOn}
  720. {$r-}
  721. {$endif}
  722. {$ifopt q+}
  723. {$define overflowOn}
  724. {$q-}
  725. {$endif}
  726. Mem[$a000:ScrOfs]:=Mem[$a000:ScrOfs]+1;
  727. {$ifdef rangeOn}
  728. {$undef rangeOn}
  729. {$r+}
  730. {$endif}
  731. {$ifdef overflowOn}
  732. {$undef overflowOn}
  733. {$q+}
  734. {$endif}
  735. port[$3ce]:=8;
  736. if HLength>0 then
  737. begin
  738. dec(HLength);
  739. inc(ScrOfs);
  740. if HLength>0 then
  741. begin
  742. port[$3cf]:=$ff;
  743. seg_bytemove(dosmemselector,$a0000+ScrOfs,dosmemselector,$a0000+ScrOfs,HLength);
  744. ScrOfs:=ScrOfs+HLength;
  745. end;
  746. port[$3cf]:=RMask;
  747. {$ifopt r+}
  748. {$define rangeOn}
  749. {$r-}
  750. {$endif}
  751. {$ifopt q+}
  752. {$define overflowOn}
  753. {$q-}
  754. {$endif}
  755. Mem[$a000:ScrOfs]:=Mem[$a000:ScrOfs]+1;
  756. {$ifdef rangeOn}
  757. {$undef rangeOn}
  758. {$r+}
  759. {$endif}
  760. {$ifdef overflowOn}
  761. {$undef overflowOn}
  762. {$q+}
  763. {$endif}
  764. end;
  765. // clean up
  766. port[$3cf]:=0;
  767. port[$3ce]:=8;
  768. port[$3cf]:=$ff;
  769. port[$3ce]:=1;
  770. port[$3cf]:=0;
  771. port[$3ce]:=3;
  772. port[$3cf]:=0;
  773. end;
  774. procedure VLine16(x,y,y2: integer); {$ifndef fpc}far;{$endif fpc}
  775. var
  776. ytmp: integer;
  777. ScrOfs,i : longint;
  778. BitMask : byte;
  779. Begin
  780. { must we swap the values? }
  781. if y > y2 then
  782. Begin
  783. ytmp := y2;
  784. y2 := y;
  785. y:= ytmp;
  786. end;
  787. { First convert to global coordinates }
  788. X := X + StartXViewPort;
  789. Y2 := Y2 + StartYViewPort;
  790. Y := Y + StartYViewPort;
  791. if ClipPixels then
  792. Begin
  793. if LineClipped(x,y,x,y2,StartXViewPort,StartYViewPort,
  794. StartXViewPort+ViewWidth, StartYViewPort+ViewHeight) then
  795. exit;
  796. end;
  797. ScrOfs:=y*ScrWidth+x div 8;
  798. BitMask:=$80 shr (x and 7);
  799. port[$3ce]:=0;
  800. If CurrentWriteMode <> NotPut Then
  801. port[$3cf]:= CurrentColor
  802. else port[$3cf]:= not CurrentColor;
  803. port[$3ce]:=1;
  804. port[$3cf]:=$f;
  805. port[$3ce]:=8;
  806. port[$3cf]:=BitMask;
  807. port[$3ce]:=3;
  808. case CurrentWriteMode of
  809. XORPut:
  810. port[$3cf]:=3 shl 3;
  811. ANDPut:
  812. port[$3cf]:=1 shl 3;
  813. ORPut:
  814. port[$3cf]:=2 shl 3;
  815. NormalPut, NotPut:
  816. port[$3cf]:=0
  817. else
  818. port[$3cf]:=0
  819. end;
  820. for i:=y to y2 do
  821. begin
  822. {$ifopt r+}
  823. {$define rangeOn}
  824. {$r-}
  825. {$endif}
  826. {$ifopt q+}
  827. {$define overflowOn}
  828. {$q-}
  829. {$endif}
  830. Mem[$a000:ScrOfs]:=Mem[$a000:ScrOfs]+1;
  831. {$ifdef rangeOn}
  832. {$undef rangeOn}
  833. {$r+}
  834. {$endif}
  835. {$ifdef overflowOn}
  836. {$undef overflowOn}
  837. {$q+}
  838. {$endif}
  839. ScrOfs:=ScrOfs+ScrWidth;
  840. end;
  841. // clean up
  842. port[$3cf]:=0;
  843. port[$3ce]:=8;
  844. port[$3cf]:=$ff;
  845. port[$3ce]:=1;
  846. port[$3cf]:=0;
  847. port[$3ce]:=3;
  848. port[$3cf]:=0;
  849. End;
  850. {$endif tp}
  851. procedure SetVisual480(page: word); {$ifndef fpc}far;{$endif fpc}
  852. { no page flipping support in 640x480 mode }
  853. begin
  854. VideoOfs := 0;
  855. end;
  856. procedure SetActive480(page: word); {$ifndef fpc}far;{$endif fpc}
  857. { no page flipping support in 640x480 mode }
  858. begin
  859. VideoOfs := 0;
  860. end;
  861. procedure SetVisual200(page: word); {$ifndef fpc}far;{$endif fpc}
  862. { two page support... }
  863. begin
  864. if page > HardwarePages then exit;
  865. asm
  866. mov ax,[page] { only lower byte is supported. }
  867. mov ah,05h
  868. {$ifdef fpc}
  869. push ebp
  870. {$endif fpc}
  871. int 10h
  872. {$ifdef fpc}
  873. pop ebp
  874. {$endif fpc}
  875. { read start address }
  876. mov dx,3d4h
  877. mov al,0ch
  878. out dx,al
  879. inc dx
  880. in al,dx
  881. mov ah,al
  882. dec dx
  883. mov al,0dh
  884. out dx,al
  885. in al,dx
  886. end;
  887. end;
  888. procedure SetActive200(page: word); {$ifndef fpc}far;{$endif fpc}
  889. { two page support... }
  890. begin
  891. case page of
  892. 0 : VideoOfs := 0;
  893. 1 : VideoOfs := 16384;
  894. 2 : VideoOfs := 32768;
  895. else
  896. VideoOfs := 0;
  897. end;
  898. end;
  899. procedure SetVisual350(page: word); {$ifndef fpc}far;{$endif fpc}
  900. { one page support... }
  901. begin
  902. if page > HardwarePages then exit;
  903. asm
  904. mov ax,[page] { only lower byte is supported. }
  905. mov ah,05h
  906. {$ifdef fpc}
  907. push ebp
  908. {$endif fpc}
  909. int 10h
  910. {$ifdef fpc}
  911. pop ebp
  912. {$endif fpc}
  913. end;
  914. end;
  915. procedure SetActive350(page: word); {$ifndef fpc}far;{$endif fpc}
  916. { one page support... }
  917. begin
  918. case page of
  919. 0 : VideoOfs := 0;
  920. 1 : VideoOfs := 32768;
  921. else
  922. VideoOfs := 0;
  923. end;
  924. end;
  925. {************************************************************************}
  926. {* 320x200x256c Routines *}
  927. {************************************************************************}
  928. Procedure Init320; {$ifndef fpc}far;{$endif fpc} assembler;
  929. asm
  930. mov ax,0013h
  931. {$ifdef fpc}
  932. push ebp
  933. {$endif fpc}
  934. int 10h
  935. {$ifdef fpc}
  936. pop ebp
  937. {$endif fpc}
  938. end;
  939. Procedure PutPixel320(X,Y : Integer; Pixel: Word); {$ifndef fpc}far;{$endif fpc}
  940. { x,y -> must be in local coordinates. Clipping if required. }
  941. Begin
  942. X:= X + StartXViewPort;
  943. Y:= Y + StartYViewPort;
  944. { convert to absolute coordinates and then verify clipping...}
  945. if ClipPixels then
  946. Begin
  947. if (X < StartXViewPort) or (X > (StartXViewPort + ViewWidth)) then
  948. exit;
  949. if (Y < StartYViewPort) or (Y > (StartYViewPort + ViewHeight)) then
  950. exit;
  951. end;
  952. {$ifndef asmgraph}
  953. Mem[$a000: y * 320 + x + VideoOfs] := Lo(Pixel);
  954. {$else asmgraph}
  955. asm
  956. {$ifndef fpc}
  957. mov es, [SegA000]
  958. mov ax, [Y]
  959. mov di, [X]
  960. xchg ah, al { The value of Y must be in AH }
  961. add di, ax
  962. shr ax, 2
  963. add di, ax
  964. add di, [VideoOfs] { point to correct page.. }
  965. mov ax, [Pixel]
  966. mov es:[di], al
  967. {$else fpc}
  968. movzx edi, x
  969. movzx ebx, y
  970. add edi, [VideoOfs]
  971. shl ebx, 6
  972. add edi, ebx
  973. mov ax, pixel
  974. mov fs:[edi+ebx*4+$a0000], al
  975. {$endif fpc}
  976. end;
  977. {$endif asmgraph}
  978. end;
  979. Function GetPixel320(X,Y: Integer):word; {$ifndef fpc}far;{$endif fpc}
  980. Begin
  981. X:= X + StartXViewPort;
  982. Y:= Y + StartYViewPort;
  983. {$ifndef asmgraph}
  984. GetPixel320 := Mem[$a000:y * 320 + x + VideoOfs];
  985. {$else asmgraph}
  986. asm
  987. {$ifndef fpc}
  988. mov es, [SegA000]
  989. mov ax, [Y]
  990. mov di, [X]
  991. xchg ah, al { The value of Y must be in AH }
  992. add di, ax
  993. shr ax, 2
  994. add di, ax
  995. xor ax, ax
  996. add di, [VideoOfs] { point to correct gfx page ... }
  997. mov al,es:[di]
  998. mov @Result,ax
  999. {$else fpc}
  1000. movzx edi, x
  1001. movzx ebx, y
  1002. add edi, [VideoOfs]
  1003. shl ebx, 6
  1004. add edi, ebx
  1005. mov al, fs:[edi+ebx*4+$a0000]
  1006. mov @Result, al
  1007. {$endif fpc}
  1008. end;
  1009. {$endif asmgraph}
  1010. end;
  1011. Procedure DirectPutPixel320(X,Y : Integer); {$ifndef fpc}far;{$endif fpc}
  1012. { x,y -> must be in global coordinates. No clipping. }
  1013. {$ifndef asmgraph}
  1014. var offset: word;
  1015. dummy: Byte;
  1016. begin
  1017. dummy := CurrentColor;
  1018. offset := y * 320 + x + VideoOfs;
  1019. case CurrentWriteMode of
  1020. XorPut: dummy := dummy xor Mem[$a000:offset];
  1021. OrPut: dummy := dummy or Mem[$a000:offset];
  1022. AndPut: dummy := dummy and Mem[$a000:offset];
  1023. NotPut: dummy := Not dummy;
  1024. end;
  1025. Mem[$a000:offset] := dummy;
  1026. end;
  1027. {$else asmgraph}
  1028. assembler;
  1029. asm
  1030. {$ifndef fpc}
  1031. mov es, [SegA000]
  1032. mov ax, [Y]
  1033. mov di, [X]
  1034. xchg ah, al { The value of Y must be in AH }
  1035. add di, ax
  1036. shr ax, 2
  1037. add di, ax
  1038. add di, [VideoOfs]
  1039. mov ax, [CurrentColor]
  1040. cmp [CurrentWriteMode],XORPut { check write mode }
  1041. jne @MOVMode
  1042. mov ah,es:[di] { read the byte... }
  1043. xor al,ah { xor it and return value into AL }
  1044. @MovMode:
  1045. mov es:[di], al
  1046. {$else fpc}
  1047. movzx edi, y
  1048. shl edi, 6
  1049. mov ebx, edx
  1050. add edi, [VideoOfs]
  1051. mov ax, [CurrentColor]
  1052. cmp [CurrentWriteMode],XORPut { check write mode }
  1053. jne @MOVMode
  1054. mov bl, fs:[edi+ebx*4+$a0000]
  1055. xor al, bl
  1056. @MovMode:
  1057. mov fs:[edi+ebx*4+$a0000], al
  1058. {$endif fpc}
  1059. end;
  1060. {$endif asmgraph}
  1061. procedure SetVisual320(page: word); {$ifndef fpc}far;{$endif fpc}
  1062. { no page support... }
  1063. begin
  1064. end;
  1065. procedure SetActive320(page: word); {$ifndef fpc}far;{$endif fpc}
  1066. { no page support... }
  1067. begin
  1068. VideoOfs := 0;
  1069. end;
  1070. {************************************************************************}
  1071. {* Mode-X related routines *}
  1072. {************************************************************************}
  1073. const CrtAddress: word = 0;
  1074. procedure InitModeX; {$ifndef fpc}far;{$endif fpc}
  1075. begin
  1076. asm
  1077. {see if we are using color-/monochorme display}
  1078. MOV DX,3CCh {use output register: }
  1079. IN AL,DX
  1080. TEST AL,1 {is it a color display? }
  1081. MOV DX,3D4h
  1082. JNZ @L1 {yes }
  1083. MOV DX,3B4h {no }
  1084. @L1: {DX = 3B4h / 3D4h = CRTAddress-register for monochrome/color}
  1085. MOV CRTAddress,DX
  1086. MOV AX, 0013h
  1087. {$ifdef fpc}
  1088. push ebp
  1089. {$EndIf fpc}
  1090. INT 10h
  1091. {$ifdef fpc}
  1092. pop ebp
  1093. {$EndIf fpc}
  1094. MOV DX,03C4h {select memory-mode-register at sequencer port }
  1095. MOV AL,04
  1096. OUT DX,AL
  1097. INC DX {read in data via the according data register }
  1098. IN AL,DX
  1099. AND AL,0F7h {bit 3 := 0: don't chain the 4 planes}
  1100. OR AL,04 {bit 2 := 1: no odd/even mechanism }
  1101. OUT DX,AL {activate new settings }
  1102. MOV DX,03C4h {s.a.: address sequencer reg. 2 (=map-mask),... }
  1103. MOV AL,02
  1104. OUT DX,AL
  1105. INC DX
  1106. MOV AL,0Fh {...and allow access to all 4 bit maps }
  1107. OUT DX,AL
  1108. {$ifndef fpc}
  1109. MOV AX,[SegA000] {starting with segment A000h, set 8000h logical }
  1110. MOV ES,AX {words = 4*8000h physical words (because of 4 }
  1111. XOR DI,DI {bitplanes) to 0 }
  1112. XOR AX,AX
  1113. MOV CX,8000h
  1114. CLD
  1115. REP STOSW
  1116. {$else fpc}
  1117. push es
  1118. push fs
  1119. mov edi, $a0000
  1120. pop es
  1121. xor eax, eax
  1122. mov ecx, 4000h
  1123. cld
  1124. rep stosd
  1125. pop es
  1126. {$EndIf fpc}
  1127. MOV DX,CRTAddress {address the underline-location-register at }
  1128. MOV AL,14h {the CRT-controller port, read out the according }
  1129. OUT DX,AL {data register: }
  1130. INC DX
  1131. IN AL,DX
  1132. AND AL,0BFh {bit 6:=0: no double word addressing scheme in}
  1133. OUT DX,AL {video RAM }
  1134. DEC DX
  1135. MOV AL,17h {select mode control register }
  1136. OUT DX,AL
  1137. INC DX
  1138. IN AL,DX
  1139. OR AL,40h {bit 6 := 1: memory access scheme=linear bit array }
  1140. OUT DX,AL
  1141. end;
  1142. end;
  1143. Function GetPixelX(X,Y: Integer): word; {$ifndef fpc}far;{$endif fpc}
  1144. {$ifndef asmgraph}
  1145. var offset: word;
  1146. {$endif asmgraph}
  1147. begin
  1148. X:= X + StartXViewPort;
  1149. Y:= Y + StartYViewPort;
  1150. {$ifndef asmgraph}
  1151. offset := y * 80 + x shr 2 + VideoOfs;
  1152. PortW[$3c4] := FirstPlane shl (x and 3);
  1153. GetPixelX := Mem[$a000:offset];
  1154. {$else asmgraph}
  1155. asm
  1156. {$ifndef fpc}
  1157. mov di,[Y] ; (* DI = Y coordinate *)
  1158. (* Multiply by 80 start *)
  1159. mov bx, di
  1160. shl di, 6 ; (* Faster on 286/386/486 machines *)
  1161. shl bx, 4
  1162. add di, bx ; (* Multiply Value by 80 *)
  1163. (* End multiply by 80 *)
  1164. mov cx, [X]
  1165. mov ax, cx
  1166. {DI = Y * LINESIZE, BX = X, coordinates admissible}
  1167. shr ax, 1 ; (* Faster on 286/86 machines *)
  1168. shr ax, 1
  1169. add di, ax ; {DI = Y * LINESIZE + (X SHR 2) }
  1170. add di, [VideoOfs] ; (* Pointing at start of Active page *)
  1171. (* Select plane to use *)
  1172. mov dx, 03c4h
  1173. mov ax, FirstPlane ; (* Map Mask & Plane Select Register *)
  1174. and cl, 03h ; (* Get Plane Bits *)
  1175. shl ah, cl ; (* Get Plane Select Value *)
  1176. out dx, ax
  1177. (* End selection of plane *)
  1178. mov es,[SegA000]
  1179. mov al, ES:[DI]
  1180. xor ah, ah
  1181. mov @Result, ax
  1182. {$else fpc}
  1183. movzx edi,[Y] ; (* DI = Y coordinate *)
  1184. (* Multiply by 80 start *)
  1185. mov ebx, edi
  1186. shl edi, 6 ; (* Faster on 286/386/486 machines *)
  1187. shl ebx, 4
  1188. add edi, ebx ; (* Multiply Value by 80 *)
  1189. (* End multiply by 80 *)
  1190. movzx ecx, [X]
  1191. movzx eax, [Y]
  1192. {DI = Y * LINESIZE, BX = X, coordinates admissible}
  1193. shr eax, 2
  1194. add edi, eax ; {DI = Y * LINESIZE + (X SHR 2) }
  1195. add edi, [VideoOfs] ; (* Pointing at start of Active page *)
  1196. (* Select plane to use *)
  1197. mov dx, 03c4h
  1198. mov ax, FirstPlane ; (* Map Mask & Plane Select Register *)
  1199. and cl, 03h ; (* Get Plane Bits *)
  1200. shl ah, cl ; (* Get Plane Select Value *)
  1201. out dx, ax
  1202. (* End selection of plane *)
  1203. mov ax, fs:[edi+$a0000]
  1204. mov @Result, ax
  1205. {$endif fpc}
  1206. end;
  1207. {$endif asmgraph}
  1208. end;
  1209. procedure SetVisualX(page: word); {$ifndef fpc}far;{$endif fpc}
  1210. { 4 page support... }
  1211. Procedure SetVisibleStart(AOffset: word); Assembler;
  1212. (* Select where the left corner of the screen will be *)
  1213. { By Matt Pritchard }
  1214. asm
  1215. { Wait if we are currently in a Vertical Retrace }
  1216. MOV DX, INPUT_1 { Input Status #1 Register }
  1217. @DP_WAIT0:
  1218. IN AL, DX { Get VGA status }
  1219. AND AL, VERT_RETRACE { In Display mode yet? }
  1220. JNZ @DP_WAIT0 { If Not, wait for it }
  1221. { Set the Start Display Address to the new page }
  1222. MOV DX, CRTC_Index { We Change the VGA Sequencer }
  1223. MOV AL, START_DISP_LO { Display Start Low Register }
  1224. {$ifndef fpc}
  1225. MOV AH, BYTE PTR [AOffset] { Low 8 Bits of Start Addr }
  1226. OUT DX, AX { Set Display Addr Low }
  1227. MOV AL, START_DISP_HI { Display Start High Register }
  1228. MOV AH, BYTE PTR [AOffset+1] { High 8 Bits of Start Addr }
  1229. {$else fpc}
  1230. mov ah, byte [AOffset]
  1231. out dx, ax
  1232. mov AL, START_DISP_HI
  1233. mov ah, byte [AOffset+1]
  1234. {$endif fpc}
  1235. OUT DX, AX { Set Display Addr High }
  1236. { Wait for a Vertical Retrace to smooth out things }
  1237. MOV DX, INPUT_1 { Input Status #1 Register }
  1238. @DP_WAIT1:
  1239. IN AL, DX { Get VGA status }
  1240. AND AL, VERT_RETRACE { Vertical Retrace Start? }
  1241. JZ @DP_WAIT1 { If Not, wait for it }
  1242. { Now Set Display Starting Address }
  1243. end;
  1244. {$ifdef fpc}
  1245. {$undef asmgraph}
  1246. {$endif fpc}
  1247. begin
  1248. Case page of
  1249. 0: SetVisibleStart(0);
  1250. 1: SetVisibleStart(16000);
  1251. 2: SetVisibleStart(32000);
  1252. 3: SetVisibleStart(48000);
  1253. else
  1254. SetVisibleStart(0);
  1255. end;
  1256. end;
  1257. procedure SetActiveX(page: word); {$ifndef fpc}far;{$endif fpc}
  1258. { 4 page support... }
  1259. begin
  1260. case page of
  1261. 0: VideoOfs := 0;
  1262. 1: VideoOfs := 16000;
  1263. 2: VideoOfs := 32000;
  1264. 3: VideoOfs := 48000;
  1265. else
  1266. VideoOfs:=0;
  1267. end;
  1268. end;
  1269. Procedure PutPixelX(X,Y: Integer; color:word); {$ifndef fpc}far;{$endif fpc}
  1270. {$ifndef asmgraph}
  1271. var offset: word;
  1272. dummy: byte;
  1273. {$endif asmgraph}
  1274. begin
  1275. X:= X + StartXViewPort;
  1276. Y:= Y + StartYViewPort;
  1277. { convert to absolute coordinates and then verify clipping...}
  1278. if ClipPixels then
  1279. Begin
  1280. if (X < StartXViewPort) or (X > (StartXViewPort + ViewWidth)) then
  1281. exit;
  1282. if (Y < StartYViewPort) or (Y > (StartYViewPort + ViewHeight)) then
  1283. exit;
  1284. end;
  1285. {$ifndef asmgraph}
  1286. Dummy := color;
  1287. offset := y * 80 + x shr 2 + VideoOfs;
  1288. PortW[$3c4] := FirstPlane shl (x and 3);
  1289. If CurrentWriteMode = XorPut Then
  1290. Dummy := Dummy Xor Mem[$a000:offset];
  1291. Mem[$a000:offset] := Dummy;
  1292. {$else asmgraph}
  1293. asm
  1294. mov di,[Y] ; (* DI = Y coordinate *)
  1295. (* Multiply by 80 start *)
  1296. mov bx, di
  1297. shl di, 6 ; (* Faster on 286/386/486 machines *)
  1298. shl bx, 4
  1299. add di, bx ; (* Multiply Value by 80 *)
  1300. (* End multiply by 80 *)
  1301. mov cx, [X]
  1302. mov ax, cx
  1303. {DI = Y * LINESIZE, BX = X, coordinates admissible}
  1304. shr ax, 2
  1305. add di, ax ; {DI = Y * LINESIZE + (X SHR 2) }
  1306. add di, [VideoOfs] ; (* Pointing at start of Active page *)
  1307. (* Select plane to use *)
  1308. mov dx, 03c4h
  1309. mov ax, FirstPlane ; (* Map Mask & Plane Select Register *)
  1310. and cl, 03h ; (* Get Plane Bits *)
  1311. shl ah, cl ; (* Get Plane Select Value *)
  1312. out dx, ax
  1313. (* End selection of plane *)
  1314. mov es,[SegA000]
  1315. mov ax,[Color] ; { only lower byte is used. }
  1316. cmp [CurrentWriteMode],XORPut { check write mode }
  1317. jne @MOVMode
  1318. mov ah,es:[di] { read the byte... }
  1319. xor al,ah { xor it and return value into AL }
  1320. @MovMode:
  1321. mov es:[di], al
  1322. end;
  1323. {$endif asmgraph}
  1324. end;
  1325. Procedure DirectPutPixelX(X,Y: Integer); {$ifndef fpc}far;{$endif fpc}
  1326. { x,y -> must be in global coordinates. No clipping. }
  1327. {$ifndef asmgraph}
  1328. Var offset: Word;
  1329. dummy: Byte;
  1330. begin
  1331. dummy := CurrentColor;
  1332. offset := y * 80 + x shr 2 + VideoOfs;
  1333. PortW[$3c4] := FirstPlane shl (x and 3);
  1334. If CurrentWriteMode = XorPut Then
  1335. dummy := dummy xor Mem[$a000: offset];
  1336. Mem[$a000: offset] := Dummy;
  1337. end;
  1338. {$else asmgraph}
  1339. Assembler;
  1340. asm
  1341. mov di,[Y] ; (* DI = Y coordinate *)
  1342. (* Multiply by 80 start *)
  1343. mov bx, di
  1344. shl di, 6 ; (* Faster on 286/386/486 machines *)
  1345. shl bx, 4
  1346. add di, bx ; (* Multiply Value by 80 *)
  1347. (* End multiply by 80 *)
  1348. mov cx, [X]
  1349. mov ax, cx
  1350. {DI = Y * LINESIZE, BX = X, coordinates admissible}
  1351. shr ax, 2
  1352. add di, ax ; {DI = Y * LINESIZE + (X SHR 2) }
  1353. add di, [VideoOfs] ; (* Pointing at start of Active page *)
  1354. (* Select plane to use *)
  1355. mov dx, 03c4h
  1356. mov ax, FirstPlane ; (* Map Mask & Plane Select Register *)
  1357. and cl, 03h ; (* Get Plane Bits *)
  1358. shl ah, cl ; (* Get Plane Select Value *)
  1359. out dx, ax
  1360. (* End selection of plane *)
  1361. mov es,[SegA000]
  1362. mov ax,[CurrentColor] ; { only lower byte is used. }
  1363. cmp [CurrentWriteMode],XORPut { check write mode }
  1364. jne @MOVMode
  1365. mov ah,es:[di] { read the byte... }
  1366. xor al,ah { xor it and return value into AL }
  1367. @MovMode:
  1368. mov es:[di], al
  1369. end;
  1370. {$endif asmgraph}
  1371. {************************************************************************}
  1372. {* General routines *}
  1373. {************************************************************************}
  1374. var
  1375. SavePtr : pointer; { pointer to video state }
  1376. StateSize: word; { size in 64 byte blocks for video state }
  1377. VideoMode: byte; { old video mode before graph mode }
  1378. SaveSupported : Boolean; { Save/Restore video state supported? }
  1379. {**************************************************************}
  1380. {* DPMI Routines *}
  1381. {**************************************************************}
  1382. {$IFDEF DPMI}
  1383. RealStateSeg: word; { Real segment of saved video state }
  1384. Procedure SaveStateVGA; {$ifndef fpc}far;{$endif fpc}
  1385. var
  1386. PtrLong: longint;
  1387. regs: TDPMIRegisters;
  1388. begin
  1389. SaveSupported := FALSE;
  1390. SavePtr := nil;
  1391. { Get the video mode }
  1392. asm
  1393. mov ah,0fh
  1394. int 10h
  1395. mov [VideoMode], al
  1396. end;
  1397. { Prepare to save video state...}
  1398. asm
  1399. mov ax, 1C00h { get buffer size to save state }
  1400. mov cx, 00000111b { Save DAC / Data areas / Hardware states }
  1401. {$ifdef fpc}
  1402. push ebp
  1403. {$endif fpc}
  1404. int 10h
  1405. {$ifdef fpc}
  1406. pop ebp
  1407. {$endif fpc}
  1408. mov [StateSize], bx
  1409. cmp al,01ch
  1410. jnz @notok
  1411. mov [SaveSupported],TRUE
  1412. @notok:
  1413. end;
  1414. if SaveSupported then
  1415. begin
  1416. {$ifndef fpc}
  1417. PtrLong:=GlobalDosAlloc(64*StateSize); { values returned in 64-byte blocks }
  1418. {$else fpc}
  1419. PtrLong:=Global_Dos_Alloc(64*StateSize); { values returned in 64-byte blocks }
  1420. {$endif fpc}
  1421. if PtrLong = 0 then
  1422. RunError(203);
  1423. SavePtr := pointer(longint(PtrLong and $0000ffff) shl 16);
  1424. {$ifndef fpc}
  1425. { In FPC mode, we can't do anything with this (no far pointers) }
  1426. { However, we still need to keep it to be able to free the }
  1427. { memory afterwards. Since this data is not accessed in PM code, }
  1428. { there's no need to save it in a seperate buffer (JM) }
  1429. if not assigned(SavePtr) then
  1430. RunError(203);
  1431. {$endif fpc}
  1432. RealStateSeg := word(PtrLong shr 16);
  1433. FillChar(regs, sizeof(regs), #0);
  1434. { call the real mode interrupt ... }
  1435. regs.eax := $1C01; { save the state buffer }
  1436. regs.ecx := $07; { Save DAC / Data areas / Hardware states }
  1437. regs.es := RealStateSeg;
  1438. regs.ebx := 0;
  1439. RealIntr($10,regs);
  1440. FillChar(regs, sizeof(regs), #0);
  1441. { restore state, according to Ralph Brown Interrupt list }
  1442. { some BIOS corrupt the hardware after a save... }
  1443. regs.eax := $1C02; { restore the state buffer }
  1444. regs.ecx := $07; { rest DAC / Data areas / Hardware states }
  1445. regs.es := RealStateSeg;
  1446. regs.ebx := 0;
  1447. RealIntr($10,regs);
  1448. end;
  1449. end;
  1450. procedure RestoreStateVGA; {$ifndef fpc}far;{$endif fpc}
  1451. var
  1452. regs:TDPMIRegisters;
  1453. begin
  1454. { go back to the old video mode...}
  1455. asm
  1456. mov ah,00
  1457. mov al,[VideoMode]
  1458. {$ifdef fpc}
  1459. push ebp
  1460. {$endif fpc}
  1461. int 10h
  1462. {$ifdef fpc}
  1463. pop ebp
  1464. {$endif fpc}
  1465. end;
  1466. { then restore all state information }
  1467. {$ifndef fpc}
  1468. if assigned(SavePtr) and (SaveSupported=TRUE) then
  1469. {$else fpc}
  1470. { No far pointer support, so it's possible that that assigned(SavePtr) }
  1471. { would return false under FPC. Just check if it's different from nil. }
  1472. if (SavePtr <> nil) and (SaveSupported=TRUE) then
  1473. {$endif fpc}
  1474. begin
  1475. FillChar(regs, sizeof(regs), #0);
  1476. { restore state, according to Ralph Brown Interrupt list }
  1477. { some BIOS corrupt the hardware after a save... }
  1478. regs.eax := $1C02; { restore the state buffer }
  1479. regs.ecx := $07; { rest DAC / Data areas / Hardware states }
  1480. regs.es := RealStateSeg;
  1481. regs.ebx := 0;
  1482. RealIntr($10,regs);
  1483. {$ifndef fpc}
  1484. if GlobalDosFree(longint(SavePtr) shr 16)<>0 then
  1485. {$else fpc}
  1486. if Not Global_Dos_Free(longint(SavePtr) shr 16) then
  1487. {$endif fpc}
  1488. RunError(216);
  1489. SavePtr := nil;
  1490. end;
  1491. end;
  1492. {$ELSE}
  1493. {**************************************************************}
  1494. {* Real mode routines *}
  1495. {**************************************************************}
  1496. Procedure SaveStateVGA; far;
  1497. begin
  1498. SavePtr := nil;
  1499. SaveSupported := FALSE;
  1500. { Get the video mode }
  1501. asm
  1502. mov ah,0fh
  1503. int 10h
  1504. mov [VideoMode], al
  1505. end;
  1506. { Prepare to save video state...}
  1507. asm
  1508. mov ax, 1C00h { get buffer size to save state }
  1509. mov cx, 00000111b { Save DAC / Data areas / Hardware states }
  1510. int 10h
  1511. mov [StateSize], bx
  1512. cmp al,01ch
  1513. jnz @notok
  1514. mov [SaveSupported],TRUE
  1515. @notok:
  1516. end;
  1517. if SaveSupported then
  1518. Begin
  1519. GetMem(SavePtr, 64*StateSize); { values returned in 64-byte blocks }
  1520. if not assigned(SavePtr) then
  1521. RunError(203);
  1522. asm
  1523. mov ax, 1C01h { save the state buffer }
  1524. mov cx, 00000111b { Save DAC / Data areas / Hardware states }
  1525. mov es, WORD PTR [SavePtr+2]
  1526. mov bx, WORD PTR [SavePtr]
  1527. int 10h
  1528. end;
  1529. { restore state, according to Ralph Brown Interrupt list }
  1530. { some BIOS corrupt the hardware after a save... }
  1531. asm
  1532. mov ax, 1C02h { save the state buffer }
  1533. mov cx, 00000111b { Save DAC / Data areas / Hardware states }
  1534. mov es, WORD PTR [SavePtr+2]
  1535. mov bx, WORD PTR [SavePtr]
  1536. int 10h
  1537. end;
  1538. end;
  1539. end;
  1540. procedure RestoreStateVGA; far;
  1541. begin
  1542. { go back to the old video mode...}
  1543. asm
  1544. mov ah,00
  1545. mov al,[VideoMode]
  1546. int 10h
  1547. end;
  1548. { then restore all state information }
  1549. if assigned(SavePtr) and (SaveSupported=TRUE) then
  1550. begin
  1551. { restore state, according to Ralph Brown Interrupt list }
  1552. asm
  1553. mov ax, 1C02h { save the state buffer }
  1554. mov cx, 00000111b { Save DAC / Data areas / Hardware states }
  1555. mov es, WORD PTR [SavePtr+2]
  1556. mov bx, WORD PTR [SavePtr]
  1557. int 10h
  1558. end;
  1559. FreeMem(SavePtr, 64*StateSize);
  1560. SavePtr := nil;
  1561. end;
  1562. end;
  1563. {$ENDIF DPMI}
  1564. { VGA is never a direct color mode, so no need to check ... }
  1565. Procedure SetVGARGBPalette(ColorNum, RedValue, GreenValue,
  1566. BlueValue : Integer); {$ifndef fpc}far;{$endif fpc} assembler;
  1567. asm
  1568. { on some hardware - there is a snow like effect }
  1569. { when changing the palette register directly }
  1570. { so we wait for a vertical retrace start period. }
  1571. mov dx, $03da
  1572. @1:
  1573. in al, dx { Get input status register }
  1574. test al, $08 { check if in vertical retrace }
  1575. jnz @1 { yes, complete it }
  1576. { we have to wait for the next }
  1577. { retrace to assure ourselves }
  1578. { that we have time to complete }
  1579. { the DAC operation within }
  1580. { the vertical retrace period }
  1581. @2:
  1582. in al, dx
  1583. test al, $08
  1584. jz @2 { repeat until vertical retrace start }
  1585. mov dx, $03c8 { Set color register address to use }
  1586. mov ax, [ColorNum]
  1587. out dx, al
  1588. inc dx { Point to DAC registers }
  1589. mov ax, [RedValue] { Get RedValue }
  1590. { and ax, $ff } { mask out all upper bits }
  1591. shr al, 2 { convert to LSB RGB format }
  1592. out dx, al
  1593. mov ax, [GreenValue]{ Get RedValue }
  1594. { and ax, $ff } { mask out all upper bits }
  1595. shr al, 2 { convert to LSB RGB format }
  1596. out dx, al
  1597. mov ax, [BlueValue] { Get RedValue }
  1598. { and ax, $ff } { mask out all upper bits }
  1599. shr al, 2 { convert to LSB RGB format }
  1600. out dx, al
  1601. end;
  1602. { VGA is never a direct color mode, so no need to check ... }
  1603. Procedure GetVGARGBPalette(ColorNum: integer; Var
  1604. RedValue, GreenValue, BlueValue : integer); {$ifndef fpc}far;{$endif fpc}
  1605. begin
  1606. Port[$03C7] := ColorNum;
  1607. { we must convert to lsb values... because the vga uses the 6 msb bits }
  1608. { which is not compatible with anything. }
  1609. RedValue := Integer(Port[$3C9] shl 2);
  1610. GreenValue := Integer(Port[$3C9] shl 2);
  1611. BlueValue := Integer(Port[$3C9] shl 2);
  1612. end;
  1613. {************************************************************************}
  1614. {* VESA related routines *}
  1615. {************************************************************************}
  1616. {$I vesa.inc}
  1617. {************************************************************************}
  1618. {* General routines *}
  1619. {************************************************************************}
  1620. procedure CloseGraph;
  1621. Begin
  1622. If not isgraphmode then
  1623. begin
  1624. _graphresult := grnoinitgraph;
  1625. exit
  1626. end;
  1627. {$ifdef logging}
  1628. LogLn('calling RestoreVideoState at '+strf(longint(RestoreVideoState)));
  1629. {$endif logging}
  1630. if not assigned(RestoreVideoState) then
  1631. RunError(216);
  1632. {$ifdef logging}
  1633. LogLn('actual call of RestoreVideoState');
  1634. {$endif logging}
  1635. RestoreVideoState;
  1636. {$IFDEF DPMI}
  1637. { We had copied the buffer of mode information }
  1638. { and allocated it dynamically... now free it }
  1639. { Warning: if GetVESAInfo returned false, this buffer is not allocated!
  1640. (JM)}
  1641. isgraphmode := false;
  1642. If hasVesa then
  1643. Dispose(VESAInfo.ModeList);
  1644. {$ENDIF}
  1645. end;
  1646. function QueryAdapterInfo:PModeInfo;
  1647. { This routine returns the head pointer to the list }
  1648. { of supported graphics modes. }
  1649. { Returns nil if no graphics mode supported. }
  1650. { This list is READ ONLY! }
  1651. var
  1652. EGADetected : Boolean;
  1653. VGADetected : Boolean;
  1654. mode: TModeInfo;
  1655. begin
  1656. QueryAdapterInfo := ModeList;
  1657. { If the mode listing already exists... }
  1658. { simply return it, without changing }
  1659. { anything... }
  1660. if assigned(ModeList) then
  1661. exit;
  1662. EGADetected := FALSE;
  1663. VGADetected := FALSE;
  1664. { check if Hercules adapter supported ... }
  1665. { check if EGA adapter supported... }
  1666. asm
  1667. mov ah,12h
  1668. mov bx,0FF10h
  1669. {$ifdef fpc}
  1670. push ebp
  1671. {$endif fpc}
  1672. int 10h { get EGA information }
  1673. {$ifdef fpc}
  1674. pop ebp
  1675. {$endif fpc}
  1676. cmp bh,0ffh
  1677. jz @noega
  1678. mov [EGADetected],TRUE
  1679. @noega:
  1680. end;
  1681. {$ifdef logging}
  1682. LogLn('EGA detected: '+strf(Longint(EGADetected)));
  1683. {$endif logging}
  1684. { check if VGA adapter supported... }
  1685. if EGADetected then
  1686. begin
  1687. asm
  1688. mov ax,1a00h
  1689. {$ifdef fpc}
  1690. push ebp
  1691. {$endif fpc}
  1692. int 10h { get display combination code...}
  1693. {$ifdef fpc}
  1694. pop ebp
  1695. {$endif fpc}
  1696. cmp al,1ah { check if supported... }
  1697. jne @novga
  1698. { now check if this is the ATI EGA }
  1699. mov ax,1c00h { get state size for save... }
  1700. { ... all important data }
  1701. mov cx,07h
  1702. {$ifdef fpc}
  1703. push ebp
  1704. {$endif fpc}
  1705. int 10h
  1706. {$ifdef fpc}
  1707. pop ebp
  1708. {$endif fpc}
  1709. cmp al,1ch { success? }
  1710. jne @novga
  1711. mov [VGADetected],TRUE
  1712. @novga:
  1713. end;
  1714. end;
  1715. {$ifdef logging}
  1716. LogLn('VGA detected: '+strf(Longint(VGADetected)));
  1717. {$endif logging}
  1718. if VGADetected then
  1719. begin
  1720. SaveVideoState := SaveStateVGA;
  1721. {$ifdef logging}
  1722. LogLn('Setting VGA SaveVideoState to '+strf(longint(SaveVideoState)));
  1723. {$endif logging}
  1724. RestoreVideoState := RestoreStateVGA;
  1725. {$ifdef logging}
  1726. LogLn('Setting VGA RestoreVideoState to '+strf(longint(RestoreVideoState)));
  1727. {$endif logging}
  1728. InitMode(mode);
  1729. { now add all standard VGA modes... }
  1730. mode.DriverNumber:= LowRes;
  1731. mode.HardwarePages:= 0;
  1732. mode.ModeNumber:=0;
  1733. mode.ModeName:='320 x 200 VGA';
  1734. mode.MaxColor := 256;
  1735. mode.PaletteSize := mode.MaxColor;
  1736. mode.DirectColor := FALSE;
  1737. mode.MaxX := 319;
  1738. mode.MaxY := 199;
  1739. {$ifndef 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. {$else fpc}
  1749. mode.DirectPutPixel:=@DirectPutPixel320;
  1750. mode.PutPixel:=@PutPixel320;
  1751. mode.GetPixel:=@GetPixel320;
  1752. mode.SetRGBPalette := @SetVGARGBPalette;
  1753. mode.GetRGBPalette := @GetVGARGBPalette;
  1754. mode.SetVisualPage := @SetVisual320;
  1755. mode.SetActivePage := @SetActive320;
  1756. mode.InitMode := @Init320;
  1757. {$endif fpc}
  1758. mode.XAspect := 10000;
  1759. mode.YAspect := 10000;
  1760. AddMode(mode);
  1761. { now add all standard VGA modes... }
  1762. InitMode(mode);
  1763. mode.DriverNumber:= LowRes;
  1764. mode.ModeNumber:=1;
  1765. mode.HardwarePages := 3; { 0..3 }
  1766. mode.ModeName:='320 x 200 ModeX';
  1767. mode.MaxColor := 256;
  1768. mode.DirectColor := FALSE;
  1769. mode.PaletteSize := mode.MaxColor;
  1770. mode.MaxX := 319;
  1771. mode.MaxY := 199;
  1772. {$ifndef 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. {$else fpc}
  1782. mode.DirectPutPixel:=@DirectPutPixelX;
  1783. mode.PutPixel:=@PutPixelX;
  1784. mode.GetPixel:=@GetPixelX;
  1785. mode.SetRGBPalette := @SetVGARGBPalette;
  1786. mode.GetRGBPalette := @GetVGARGBPalette;
  1787. mode.SetVisualPage := @SetVisualX;
  1788. mode.SetActivePage := @SetActiveX;
  1789. mode.InitMode := @InitModeX;
  1790. {$endif fpc}
  1791. mode.XAspect := 10000;
  1792. mode.YAspect := 10000;
  1793. AddMode(mode);
  1794. InitMode(mode);
  1795. mode.ModeNumber:=VGALo;
  1796. mode.DriverNumber := VGA;
  1797. mode.ModeName:='640 x 200 VGA';
  1798. mode.MaxColor := 16;
  1799. mode.HardwarePages := 2;
  1800. mode.DirectColor := FALSE;
  1801. mode.PaletteSize := mode.MaxColor;
  1802. mode.MaxX := 639;
  1803. mode.MaxY := 199;
  1804. {$ifndef fpc}
  1805. mode.DirectPutPixel:=DirectPutPixel16;
  1806. mode.PutPixel:=PutPixel16;
  1807. mode.GetPixel:=GetPixel16;
  1808. mode.SetRGBPalette := SetVGARGBPalette;
  1809. mode.GetRGBPalette := GetVGARGBPalette;
  1810. mode.SetVisualPage := SetVisual200;
  1811. mode.SetActivePage := SetActive200;
  1812. mode.InitMode := Init640x200x16;
  1813. mode.GetScanLine := GetScanLine16;
  1814. {$else fpc}
  1815. mode.DirectPutPixel:=@DirectPutPixel16;
  1816. mode.PutPixel:=@PutPixel16;
  1817. mode.GetPixel:=@GetPixel16;
  1818. mode.SetRGBPalette := @SetVGARGBPalette;
  1819. mode.GetRGBPalette := @GetVGARGBPalette;
  1820. mode.SetVisualPage := @SetVisual200;
  1821. mode.SetActivePage := @SetActive200;
  1822. mode.InitMode := @Init640x200x16;
  1823. mode.HLine := @HLine16;
  1824. mode.VLine := @VLine16;
  1825. mode.GetScanLine := @GetScanLine16;
  1826. {$endif fpc}
  1827. mode.XAspect := 10000;
  1828. mode.YAspect := 10000;
  1829. AddMode(mode);
  1830. InitMode(mode);
  1831. mode.ModeNumber:=VGAMed;
  1832. mode.DriverNumber := VGA;
  1833. mode.ModeName:='640 x 350 VGA';
  1834. mode.HardwarePages := 1;
  1835. mode.MaxColor := 16;
  1836. mode.DirectColor := FALSE;
  1837. mode.PaletteSize := mode.MaxColor;
  1838. mode.MaxX := 639;
  1839. mode.MaxY := 349;
  1840. {$ifndef fpc}
  1841. mode.DirectPutPixel:=DirectPutPixel16;
  1842. mode.PutPixel:=PutPixel16;
  1843. mode.GetPixel:=GetPixel16;
  1844. mode.InitMode := Init640x350x16;
  1845. mode.SetRGBPalette := SetVGARGBPalette;
  1846. mode.GetRGBPalette := GetVGARGBPalette;
  1847. mode.SetVisualPage := SetVisual350;
  1848. mode.SetActivePage := SetActive350;
  1849. mode.GetScanLine := GetScanLine16;
  1850. {$else fpc}
  1851. mode.DirectPutPixel:=@DirectPutPixel16;
  1852. mode.PutPixel:=@PutPixel16;
  1853. mode.GetPixel:=@GetPixel16;
  1854. mode.InitMode := @Init640x350x16;
  1855. mode.SetRGBPalette := @SetVGARGBPalette;
  1856. mode.GetRGBPalette := @GetVGARGBPalette;
  1857. mode.SetVisualPage := @SetVisual350;
  1858. mode.SetActivePage := @SetActive350;
  1859. mode.HLine := @HLine16;
  1860. mode.VLine := @VLine16;
  1861. mode.GetScanLine := @GetScanLine16;
  1862. {$endif fpc}
  1863. mode.XAspect := 10000;
  1864. mode.YAspect := 10000;
  1865. AddMode(mode);
  1866. InitMode(mode);
  1867. mode.ModeNumber:=VGAHi;
  1868. mode.DriverNumber := VGA;
  1869. mode.HardwarePages := 0;
  1870. mode.ModeName:='640 x 480 VGA';
  1871. mode.MaxColor := 16;
  1872. mode.DirectColor := FALSE;
  1873. mode.PaletteSize := mode.MaxColor;
  1874. mode.MaxX := 639;
  1875. mode.MaxY := 479;
  1876. {$ifndef fpc}
  1877. mode.DirectPutPixel:=DirectPutPixel16;
  1878. mode.PutPixel:=PutPixel16;
  1879. mode.GetPixel:=GetPixel16;
  1880. mode.SetRGBPalette := SetVGARGBPalette;
  1881. mode.GetRGBPalette := GetVGARGBPalette;
  1882. mode.InitMode := Init640x480x16;
  1883. mode.SetVisualPage := SetVisual480;
  1884. mode.SetActivePage := SetActive480;
  1885. mode.GetScanLine := GetScanLine16;
  1886. {$else fpc}
  1887. mode.DirectPutPixel:=@DirectPutPixel16;
  1888. mode.PutPixel:=@PutPixel16;
  1889. mode.GetPixel:=@GetPixel16;
  1890. mode.SetRGBPalette := @SetVGARGBPalette;
  1891. mode.GetRGBPalette := @GetVGARGBPalette;
  1892. mode.InitMode := @Init640x480x16;
  1893. mode.SetVisualPage := @SetVisual480;
  1894. mode.SetActivePage := @SetActive480;
  1895. mode.HLine := @HLine16;
  1896. mode.VLine := @VLine16;
  1897. mode.GetScanLine := @GetScanLine16;
  1898. {$endif fpc}
  1899. mode.XAspect := 10000;
  1900. mode.YAspect := 10000;
  1901. AddMode(mode);
  1902. end;
  1903. { check if VESA adapter supported... }
  1904. {$ifndef noSupportVESA}
  1905. hasVesa := getVesaInfo(VESAInfo);
  1906. {$else noSupportVESA}
  1907. hasVESA := false;
  1908. {$endif noSupportVESA}
  1909. if hasVesa then
  1910. begin
  1911. { We have to set and restore the entire VESA state }
  1912. { otherwise, if we use the VGA BIOS only function }
  1913. { there might be a crash under DPMI, such as in the}
  1914. { ATI Mach64 }
  1915. SaveVideoState := SaveStateVESA;
  1916. {$ifdef logging}
  1917. LogLn('Setting SaveVideoState to '+strf(longint(SaveVideoState)));
  1918. {$endif logging}
  1919. RestoreVideoState := RestoreStateVESA;
  1920. {$ifdef logging}
  1921. LogLn('Setting RestoreVideoState to '+strf(longint(RestoreVideoState)));
  1922. {$endif logging}
  1923. { now check all supported modes...}
  1924. if SearchVESAModes(m320x200x32k) then
  1925. begin
  1926. InitMode(mode);
  1927. mode.ModeNumber:=m320x200x32k;
  1928. mode.DriverNumber := VESA;
  1929. mode.ModeName:='320 x 200 VESA';
  1930. mode.MaxColor := 32768;
  1931. { the ModeInfo is automatically set if the mode is supported }
  1932. { by the call to SearchVESAMode. }
  1933. mode.HardwarePages := ModeInfo.NumberOfPages;
  1934. mode.PaletteSize := mode.MaxColor;
  1935. mode.DirectColor := TRUE;
  1936. mode.MaxX := 319;
  1937. mode.MaxY := 199;
  1938. {$ifndef 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. {$else fpc}
  1948. mode.DirectPutPixel:=@DirectPutPixVESA32k;
  1949. mode.PutPixel:=@PutPixVESA32k;
  1950. mode.GetPixel:=@GetPixVESA32k;
  1951. mode.SetRGBPalette := @SetVESARGBPalette;
  1952. mode.GetRGBPalette := @GetVESARGBPalette;
  1953. mode.InitMode := @Init320x200x32k;
  1954. mode.SetVisualPage := @SetVisualVESA;
  1955. mode.SetActivePage := @SetActiveVESA;
  1956. {$endif fpc}
  1957. mode.XAspect := 10000;
  1958. mode.YAspect := 10000;
  1959. AddMode(mode);
  1960. end;
  1961. if SearchVESAModes(m320x200x64k) then
  1962. begin
  1963. InitMode(mode);
  1964. mode.ModeNumber:=m320x200x64k;
  1965. mode.DriverNumber := VESA;
  1966. mode.ModeName:='320 x 200 VESA';
  1967. mode.MaxColor := 65536;
  1968. { the ModeInfo is automatically set if the mode is supported }
  1969. { by the call to SearchVESAMode. }
  1970. mode.HardwarePages := ModeInfo.NumberOfPages;
  1971. mode.PaletteSize := mode.MaxColor;
  1972. mode.DirectColor := TRUE;
  1973. mode.MaxX := 319;
  1974. mode.MaxY := 199;
  1975. {$ifndef 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. {$else fpc}
  1985. mode.DirectPutPixel:=@DirectPutPixVESA64k;
  1986. mode.PutPixel:=@PutPixVESA64k;
  1987. mode.GetPixel:=@GetPixVESA64k;
  1988. mode.SetRGBPalette := @SetVESARGBPalette;
  1989. mode.GetRGBPalette := @GetVESARGBPalette;
  1990. mode.InitMode := @Init320x200x64k;
  1991. mode.SetVisualPage := @SetVisualVESA;
  1992. mode.SetActivePage := @SetActiveVESA;
  1993. {$endif fpc}
  1994. mode.XAspect := 10000;
  1995. mode.YAspect := 10000;
  1996. AddMode(mode);
  1997. end;
  1998. if SearchVESAModes(m640x400x256) then
  1999. begin
  2000. InitMode(mode);
  2001. mode.ModeNumber:=m640x400x256;
  2002. mode.DriverNumber := VESA;
  2003. mode.ModeName:='640 x 400 VESA';
  2004. mode.MaxColor := 256;
  2005. { the ModeInfo is automatically set if the mode is supported }
  2006. { by the call to SearchVESAMode. }
  2007. mode.HardwarePages := ModeInfo.NumberOfPages;
  2008. mode.PaletteSize := mode.MaxColor;
  2009. mode.DirectColor := FALSE;
  2010. mode.MaxX := 639;
  2011. mode.MaxY := 399;
  2012. {$ifndef fpc}
  2013. mode.DirectPutPixel:=DirectPutPixVESA256;
  2014. mode.PutPixel:=PutPixVESA256;
  2015. mode.GetPixel:=GetPixVESA256;
  2016. mode.SetRGBPalette := SetVESARGBPalette;
  2017. mode.GetRGBPalette := GetVESARGBPalette;
  2018. mode.InitMode := Init640x400x256;
  2019. mode.SetVisualPage := SetVisualVESA;
  2020. mode.SetActivePage := SetActiveVESA;
  2021. mode.hline := HLineVESA256;
  2022. mode.vline := VLineVESA256;
  2023. {$else fpc}
  2024. mode.DirectPutPixel:=@DirectPutPixVESA256;
  2025. mode.PutPixel:=@PutPixVESA256;
  2026. mode.GetPixel:=@GetPixVESA256;
  2027. mode.SetRGBPalette := @SetVESARGBPalette;
  2028. mode.GetRGBPalette := @GetVESARGBPalette;
  2029. mode.InitMode := @Init640x400x256;
  2030. mode.SetVisualPage := @SetVisualVESA;
  2031. mode.SetActivePage := @SetActiveVESA;
  2032. mode.hline := @HLineVESA256;
  2033. mode.vline := @VLineVESA256;
  2034. {$endif fpc}
  2035. mode.XAspect := 10000;
  2036. mode.YAspect := 10000;
  2037. AddMode(mode);
  2038. end;
  2039. if SearchVESAModes(m640x480x256) then
  2040. begin
  2041. InitMode(mode);
  2042. mode.ModeNumber:=m640x480x256;
  2043. mode.DriverNumber := VESA;
  2044. mode.ModeName:='640 x 480 VESA';
  2045. mode.MaxColor := 256;
  2046. { the ModeInfo is automatically set if the mode is supported }
  2047. { by the call to SearchVESAMode. }
  2048. mode.HardwarePages := ModeInfo.NumberOfPages;
  2049. mode.PaletteSize := mode.MaxColor;
  2050. mode.MaxX := 639;
  2051. mode.MaxY := 479;
  2052. {$ifndef fpc}
  2053. mode.DirectPutPixel:=DirectPutPixVESA256;
  2054. mode.PutPixel:=PutPixVESA256;
  2055. mode.GetPixel:=GetPixVESA256;
  2056. mode.SetRGBPalette := SetVESARGBPalette;
  2057. mode.GetRGBPalette := GetVESARGBPalette;
  2058. mode.InitMode := Init640x480x256;
  2059. mode.SetVisualPage := SetVisualVESA;
  2060. mode.SetActivePage := SetActiveVESA;
  2061. mode.hline := HLineVESA256;
  2062. mode.vline := VLineVESA256;
  2063. {$else fpc}
  2064. mode.DirectPutPixel:=@DirectPutPixVESA256;
  2065. mode.PutPixel:=@PutPixVESA256;
  2066. mode.GetPixel:=@GetPixVESA256;
  2067. mode.SetRGBPalette := @SetVESARGBPalette;
  2068. mode.GetRGBPalette := @GetVESARGBPalette;
  2069. mode.InitMode := @Init640x480x256;
  2070. mode.SetVisualPage := @SetVisualVESA;
  2071. mode.SetActivePage := @SetActiveVESA;
  2072. mode.hline := @HLineVESA256;
  2073. mode.hline := @HLineVESA256;
  2074. {$endif fpc}
  2075. mode.XAspect := 10000;
  2076. mode.YAspect := 10000;
  2077. AddMode(mode);
  2078. end;
  2079. if SearchVESAModes(m640x480x32k) then
  2080. begin
  2081. InitMode(mode);
  2082. mode.ModeNumber:=m640x480x32k;
  2083. mode.DriverNumber := VESA;
  2084. mode.ModeName:='640 x 400 VESA';
  2085. mode.MaxColor := 32768;
  2086. { the ModeInfo is automatically set if the mode is supported }
  2087. { by the call to SearchVESAMode. }
  2088. mode.HardwarePages := ModeInfo.NumberOfPages;
  2089. mode.PaletteSize := mode.MaxColor;
  2090. mode.DirectColor := TRUE;
  2091. mode.MaxX := 639;
  2092. mode.MaxY := 399;
  2093. {$ifndef 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. {$else fpc}
  2103. mode.DirectPutPixel:=@DirectPutPixVESA32k;
  2104. mode.PutPixel:=@PutPixVESA32k;
  2105. mode.GetPixel:=@GetPixVESA32k;
  2106. mode.SetRGBPalette := @SetVESARGBPalette;
  2107. mode.GetRGBPalette := @GetVESARGBPalette;
  2108. mode.InitMode := @Init640x480x32k;
  2109. mode.SetVisualPage := @SetVisualVESA;
  2110. mode.SetActivePage := @SetActiveVESA;
  2111. {$endif fpc}
  2112. mode.XAspect := 10000;
  2113. mode.YAspect := 10000;
  2114. AddMode(mode);
  2115. end;
  2116. if SearchVESAModes(m640x480x64k) then
  2117. begin
  2118. InitMode(mode);
  2119. mode.ModeNumber:=m640x480x64k;
  2120. mode.DriverNumber := VESA;
  2121. mode.ModeName:='640 x 480 VESA';
  2122. mode.MaxColor := 65536;
  2123. { the ModeInfo is automatically set if the mode is supported }
  2124. { by the call to SearchVESAMode. }
  2125. mode.HardwarePages := ModeInfo.NumberOfPages;
  2126. mode.PaletteSize := mode.MaxColor;
  2127. mode.DirectColor := TRUE;
  2128. mode.MaxX := 639;
  2129. mode.MaxY := 479;
  2130. {$ifndef 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. {$else fpc}
  2140. mode.DirectPutPixel:=@DirectPutPixVESA64k;
  2141. mode.PutPixel:=@PutPixVESA64k;
  2142. mode.GetPixel:=@GetPixVESA64k;
  2143. mode.SetRGBPalette := @SetVESARGBPalette;
  2144. mode.GetRGBPalette := @GetVESARGBPalette;
  2145. mode.InitMode := @Init640x480x64k;
  2146. mode.SetVisualPage := @SetVisualVESA;
  2147. mode.SetActivePage := @SetActiveVESA;
  2148. {$endif fpc}
  2149. mode.XAspect := 10000;
  2150. mode.YAspect := 10000;
  2151. AddMode(mode);
  2152. end;
  2153. if SearchVESAModes(m800x600x16) then
  2154. begin
  2155. InitMode(mode);
  2156. mode.ModeNumber:=m800x600x16;
  2157. mode.DriverNumber := VESA;
  2158. mode.ModeName:='800 x 600 VESA';
  2159. mode.MaxColor := 16;
  2160. { the ModeInfo is automatically set if the mode is supported }
  2161. { by the call to SearchVESAMode. }
  2162. mode.HardwarePages := ModeInfo.NumberOfPages;
  2163. mode.DirectColor := FALSE;
  2164. mode.PaletteSize := mode.MaxColor;
  2165. mode.MaxX := 799;
  2166. mode.MaxY := 599;
  2167. {$ifndef 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. {$else fpc}
  2177. mode.DirectPutPixel:=@DirectPutPixVESA16;
  2178. mode.SetRGBPalette := @SetVESARGBPalette;
  2179. mode.GetRGBPalette := @GetVESARGBPalette;
  2180. mode.PutPixel:=@PutPixVESA16;
  2181. { mode.GetPixel:=@GetPixVESA16;}
  2182. mode.InitMode := @Init800x600x16;
  2183. mode.SetVisualPage := @SetVisualVESA;
  2184. mode.SetActivePage := @SetActiveVESA;
  2185. {$endif fpc}
  2186. mode.XAspect := 10000;
  2187. mode.YAspect := 10000;
  2188. AddMode(mode);
  2189. end;
  2190. if SearchVESAModes(m800x600x256) then
  2191. begin
  2192. InitMode(mode);
  2193. mode.ModeNumber:=m800x600x256;
  2194. mode.DriverNumber := VESA;
  2195. mode.ModeName:='800 x 600 VESA';
  2196. mode.MaxColor := 256;
  2197. { the ModeInfo is automatically set if the mode is supported }
  2198. { by the call to SearchVESAMode. }
  2199. mode.HardwarePages := ModeInfo.NumberOfPages;
  2200. mode.PaletteSize := mode.MaxColor;
  2201. mode.DirectColor := FALSE;
  2202. mode.MaxX := 799;
  2203. mode.MaxY := 599;
  2204. {$ifndef fpc}
  2205. mode.DirectPutPixel:=DirectPutPixVESA256;
  2206. mode.PutPixel:=PutPixVESA256;
  2207. mode.GetPixel:=GetPixVESA256;
  2208. mode.SetRGBPalette := SetVESARGBPalette;
  2209. mode.GetRGBPalette := GetVESARGBPalette;
  2210. mode.InitMode := Init800x600x256;
  2211. mode.SetVisualPage := SetVisualVESA;
  2212. mode.SetActivePage := SetActiveVESA;
  2213. mode.hline := HLineVESA256;
  2214. mode.vline := VLineVESA256;
  2215. {$else fpc}
  2216. mode.DirectPutPixel:=@DirectPutPixVESA256;
  2217. mode.PutPixel:=@PutPixVESA256;
  2218. mode.GetPixel:=@GetPixVESA256;
  2219. mode.SetRGBPalette := @SetVESARGBPalette;
  2220. mode.GetRGBPalette := @GetVESARGBPalette;
  2221. mode.InitMode := @Init800x600x256;
  2222. mode.SetVisualPage := @SetVisualVESA;
  2223. mode.SetActivePage := @SetActiveVESA;
  2224. mode.hline := @HLineVESA256;
  2225. mode.vline := @VLineVESA256;
  2226. {$endif fpc}
  2227. mode.XAspect := 10000;
  2228. mode.YAspect := 10000;
  2229. AddMode(mode);
  2230. end;
  2231. if SearchVESAModes(m800x600x32k) then
  2232. begin
  2233. InitMode(mode);
  2234. mode.ModeNumber:=m800x600x32k;
  2235. mode.DriverNumber := VESA;
  2236. mode.ModeName:='800 x 600 VESA';
  2237. mode.MaxColor := 32768;
  2238. { the ModeInfo is automatically set if the mode is supported }
  2239. { by the call to SearchVESAMode. }
  2240. mode.HardwarePages := ModeInfo.NumberOfPages;
  2241. mode.PaletteSize := mode.MaxColor;
  2242. mode.DirectColor := TRUE;
  2243. mode.MaxX := 799;
  2244. mode.MaxY := 599;
  2245. {$ifndef 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. {$else fpc}
  2255. mode.DirectPutPixel:=@DirectPutPixVESA32k;
  2256. mode.PutPixel:=@PutPixVESA32k;
  2257. mode.GetPixel:=@GetPixVESA32k;
  2258. mode.SetRGBPalette := @SetVESARGBPalette;
  2259. mode.GetRGBPalette := @GetVESARGBPalette;
  2260. mode.InitMode := @Init800x600x32k;
  2261. mode.SetVisualPage := @SetVisualVESA;
  2262. mode.SetActivePage := @SetActiveVESA;
  2263. {$endif fpc}
  2264. mode.XAspect := 10000;
  2265. mode.YAspect := 10000;
  2266. AddMode(mode);
  2267. end;
  2268. if SearchVESAModes(m800x600x64k) then
  2269. begin
  2270. InitMode(mode);
  2271. mode.ModeNumber:=m800x600x16;
  2272. mode.DriverNumber := VESA;
  2273. mode.ModeName:='800 x 600 VESA';
  2274. mode.MaxColor := 65536;
  2275. { the ModeInfo is automatically set if the mode is supported }
  2276. { by the call to SearchVESAMode. }
  2277. mode.HardwarePages := ModeInfo.NumberOfPages;
  2278. mode.PaletteSize := mode.MaxColor;
  2279. mode.DirectColor := TRUE;
  2280. mode.MaxX := 799;
  2281. mode.MaxY := 599;
  2282. {$ifndef 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. {$else fpc}
  2292. mode.DirectPutPixel:=@DirectPutPixVESA64k;
  2293. mode.PutPixel:=@PutPixVESA64k;
  2294. mode.GetPixel:=@GetPixVESA64k;
  2295. mode.SetRGBPalette := @SetVESARGBPalette;
  2296. mode.GetRGBPalette := @GetVESARGBPalette;
  2297. mode.InitMode := @Init800x600x64k;
  2298. mode.SetVisualPage := @SetVisualVESA;
  2299. mode.SetActivePage := @SetActiveVESA;
  2300. {$endif fpc}
  2301. mode.XAspect := 10000;
  2302. mode.YAspect := 10000;
  2303. AddMode(mode);
  2304. end;
  2305. if SearchVESAModes(m1024x768x16) then
  2306. begin
  2307. InitMode(mode);
  2308. mode.ModeNumber:=m1024x768x16;
  2309. mode.DriverNumber := VESA;
  2310. mode.ModeName:='1024 x 768 VESA';
  2311. mode.MaxColor := 16;
  2312. { the ModeInfo is automatically set if the mode is supported }
  2313. { by the call to SearchVESAMode. }
  2314. mode.HardwarePages := ModeInfo.NumberOfPages;
  2315. mode.PaletteSize := mode.MaxColor;
  2316. mode.DirectColor := FALSE;
  2317. mode.MaxX := 1023;
  2318. mode.MaxY := 767;
  2319. {$ifndef 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. {$else fpc}
  2329. mode.DirectPutPixel:=@DirectPutPixVESA16;
  2330. mode.PutPixel:=@PutPixVESA16;
  2331. mode.SetRGBPalette := @SetVESARGBPalette;
  2332. mode.GetRGBPalette := @GetVESARGBPalette;
  2333. { mode.GetPixel:=@GetPixVESA16;}
  2334. mode.InitMode := @Init1024x768x16;
  2335. mode.SetVisualPage := @SetVisualVESA;
  2336. mode.SetActivePage := @SetActiveVESA;
  2337. {$endif fpc}
  2338. mode.XAspect := 10000;
  2339. mode.YAspect := 10000;
  2340. AddMode(mode);
  2341. end;
  2342. if SearchVESAModes(m1024x768x256) then
  2343. begin
  2344. InitMode(mode);
  2345. mode.ModeNumber:=m1024x768x256;
  2346. mode.DriverNumber := VESA;
  2347. mode.ModeName:='1024 x 768 VESA';
  2348. mode.MaxColor := 256;
  2349. { the ModeInfo is automatically set if the mode is supported }
  2350. { by the call to SearchVESAMode. }
  2351. mode.HardwarePages := ModeInfo.NumberOfPages;
  2352. mode.PaletteSize := mode.MaxColor;
  2353. mode.DirectColor := FALSE;
  2354. mode.MaxX := 1023;
  2355. mode.MaxY := 767;
  2356. {$ifndef fpc}
  2357. mode.DirectPutPixel:=DirectPutPixVESA256;
  2358. mode.PutPixel:=PutPixVESA256;
  2359. mode.GetPixel:=GetPixVESA256;
  2360. mode.SetRGBPalette := SetVESARGBPalette;
  2361. mode.GetRGBPalette := GetVESARGBPalette;
  2362. mode.InitMode := Init1024x768x256;
  2363. mode.SetVisualPage := SetVisualVESA;
  2364. mode.SetActivePage := SetActiveVESA;
  2365. mode.hline := HLineVESA256;
  2366. mode.vline := VLineVESA256;
  2367. {$else fpc}
  2368. mode.DirectPutPixel:=@DirectPutPixVESA256;
  2369. mode.PutPixel:=@PutPixVESA256;
  2370. mode.GetPixel:=@GetPixVESA256;
  2371. mode.SetRGBPalette := @SetVESARGBPalette;
  2372. mode.GetRGBPalette := @GetVESARGBPalette;
  2373. mode.InitMode := @Init1024x768x256;
  2374. mode.SetVisualPage := @SetVisualVESA;
  2375. mode.SetActivePage := @SetActiveVESA;
  2376. mode.vline := @VLineVESA256;
  2377. mode.hline := @HLineVESA256;
  2378. {$endif fpc}
  2379. mode.XAspect := 10000;
  2380. mode.YAspect := 10000;
  2381. AddMode(mode);
  2382. end;
  2383. if SearchVESAModes(m1024x768x32k) then
  2384. begin
  2385. InitMode(mode);
  2386. mode.ModeNumber:=m1024x768x32k;
  2387. mode.DriverNumber := VESA;
  2388. mode.ModeName:='1024 x 768 VESA';
  2389. mode.MaxColor := 32768;
  2390. { the ModeInfo is automatically set if the mode is supported }
  2391. { by the call to SearchVESAMode. }
  2392. mode.HardwarePages := ModeInfo.NumberOfPages;
  2393. mode.PaletteSize := mode.MaxColor;
  2394. mode.DirectColor := TRUE;
  2395. mode.MaxX := 1023;
  2396. mode.MaxY := 767;
  2397. {$ifndef 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. {$else fpc}
  2407. mode.DirectPutPixel:=@DirectPutPixVESA32k;
  2408. mode.PutPixel:=@PutPixVESA32k;
  2409. mode.GetPixel:=@GetPixVESA32k;
  2410. mode.SetRGBPalette := @SetVESARGBPalette;
  2411. mode.GetRGBPalette := @GetVESARGBPalette;
  2412. mode.InitMode := @Init640x480x32k;
  2413. mode.SetVisualPage := @SetVisualVESA;
  2414. mode.SetActivePage := @SetActiveVESA;
  2415. {$endif fpc}
  2416. mode.XAspect := 10000;
  2417. mode.YAspect := 10000;
  2418. AddMode(mode);
  2419. end;
  2420. if SearchVESAModes(m1024x768x64k) then
  2421. begin
  2422. InitMode(mode);
  2423. mode.ModeNumber:=m1024x768x64k;
  2424. mode.DriverNumber := VESA;
  2425. mode.ModeName:='1024 x 768 VESA';
  2426. mode.MaxColor := 65536;
  2427. mode.DirectColor := TRUE;
  2428. { the ModeInfo is automatically set if the mode is supported }
  2429. { by the call to SearchVESAMode. }
  2430. mode.HardwarePages := ModeInfo.NumberOfPages;
  2431. mode.PaletteSize := mode.MaxColor;
  2432. mode.MaxX := 1023;
  2433. mode.MaxY := 767;
  2434. {$ifndef 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. {$else fpc}
  2444. mode.DirectPutPixel:=@DirectPutPixVESA64k;
  2445. mode.PutPixel:=@PutPixVESA64k;
  2446. mode.GetPixel:=@GetPixVESA64k;
  2447. mode.SetRGBPalette := @SetVESARGBPalette;
  2448. mode.GetRGBPalette := @GetVESARGBPalette;
  2449. mode.InitMode := @Init1024x768x64k;
  2450. mode.SetVisualPage := @SetVisualVESA;
  2451. mode.SetActivePage := @SetActiveVESA;
  2452. {$endif fpc}
  2453. mode.XAspect := 10000;
  2454. mode.YAspect := 10000;
  2455. AddMode(mode);
  2456. end;
  2457. if SearchVESAModes(m1280x1024x16) then
  2458. begin
  2459. InitMode(mode);
  2460. mode.ModeNumber:=m1280x1024x16;
  2461. mode.DriverNumber := VESA;
  2462. mode.ModeName:='1280 x 1024 VESA';
  2463. mode.MaxColor := 16;
  2464. { the ModeInfo is automatically set if the mode is supported }
  2465. { by the call to SearchVESAMode. }
  2466. mode.HardwarePages := ModeInfo.NumberOfPages;
  2467. mode.DirectColor := FALSE;
  2468. mode.PaletteSize := mode.MaxColor;
  2469. mode.MaxX := 1279;
  2470. mode.MaxY := 1023;
  2471. {$ifndef 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. {$else fpc}
  2481. mode.DirectPutPixel:=@DirectPutPixVESA16;
  2482. mode.SetRGBPalette := @SetVESARGBPalette;
  2483. mode.GetRGBPalette := @GetVESARGBPalette;
  2484. mode.PutPixel:=@PutPixVESA16;
  2485. { mode.GetPixel:=@GetPixVESA16;}
  2486. mode.InitMode := @Init1280x1024x16;
  2487. mode.SetVisualPage := @SetVisualVESA;
  2488. mode.SetActivePage := @SetActiveVESA;
  2489. {$endif fpc}
  2490. mode.XAspect := 10000;
  2491. mode.YAspect := 10000;
  2492. AddMode(mode);
  2493. end;
  2494. if SearchVESAModes(m1280x1024x256) then
  2495. begin
  2496. InitMode(mode);
  2497. mode.ModeNumber:=m1280x1024x256;
  2498. mode.DriverNumber := VESA;
  2499. mode.ModeName:='1280 x 1024 VESA';
  2500. mode.MaxColor := 256;
  2501. { the ModeInfo is automatically set if the mode is supported }
  2502. { by the call to SearchVESAMode. }
  2503. mode.HardwarePages := ModeInfo.NumberOfPages;
  2504. mode.DirectColor := FALSE;
  2505. mode.PaletteSize := mode.MaxColor;
  2506. mode.MaxX := 1279;
  2507. mode.MaxY := 1023;
  2508. {$ifndef fpc}
  2509. mode.DirectPutPixel:=DirectPutPixVESA256;
  2510. mode.PutPixel:=PutPixVESA256;
  2511. mode.GetPixel:=GetPixVESA256;
  2512. mode.InitMode := Init1280x1024x256;
  2513. mode.SetRGBPalette := SetVESARGBPalette;
  2514. mode.GetRGBPalette := GetVESARGBPalette;
  2515. mode.SetVisualPage := SetVisualVESA;
  2516. mode.SetActivePage := SetActiveVESA;
  2517. mode.hline := HLineVESA256;
  2518. mode.vline := VLineVESA256;
  2519. {$else fpc}
  2520. mode.DirectPutPixel:=@DirectPutPixVESA256;
  2521. mode.PutPixel:=@PutPixVESA256;
  2522. mode.GetPixel:=@GetPixVESA256;
  2523. mode.InitMode := @Init1280x1024x256;
  2524. mode.SetRGBPalette := @SetVESARGBPalette;
  2525. mode.GetRGBPalette := @GetVESARGBPalette;
  2526. mode.SetVisualPage := @SetVisualVESA;
  2527. mode.SetActivePage := @SetActiveVESA;
  2528. mode.vline := @VLineVESA256;
  2529. mode.hline := @HLineVESA256;
  2530. {$endif fpc}
  2531. mode.XAspect := 10000;
  2532. mode.YAspect := 10000;
  2533. AddMode(mode);
  2534. end;
  2535. if SearchVESAModes(m1280x1024x32k) then
  2536. begin
  2537. InitMode(mode);
  2538. mode.ModeNumber:=m1280x1024x32k;
  2539. mode.DriverNumber := VESA;
  2540. mode.ModeName:='1280 x 1024 VESA';
  2541. mode.MaxColor := 32768;
  2542. { the ModeInfo is automatically set if the mode is supported }
  2543. { by the call to SearchVESAMode. }
  2544. mode.HardwarePages := ModeInfo.NumberOfPages;
  2545. mode.DirectColor := TRUE;
  2546. mode.PaletteSize := mode.MaxColor;
  2547. mode.MaxX := 1279;
  2548. mode.MaxY := 1023;
  2549. {$ifndef 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. {$else fpc}
  2559. mode.DirectPutPixel:=@DirectPutPixVESA32k;
  2560. mode.PutPixel:=@PutPixVESA32k;
  2561. mode.GetPixel:=@GetPixVESA32k;
  2562. mode.InitMode := @Init1280x1024x32k;
  2563. mode.SetRGBPalette := @SetVESARGBPalette;
  2564. mode.GetRGBPalette := @GetVESARGBPalette;
  2565. mode.SetVisualPage := @SetVisualVESA;
  2566. mode.SetActivePage := @SetActiveVESA;
  2567. {$endif fpc}
  2568. mode.XAspect := 10000;
  2569. mode.YAspect := 10000;
  2570. AddMode(mode);
  2571. end;
  2572. if SearchVESAModes(m1280x1024x64k) then
  2573. begin
  2574. InitMode(mode);
  2575. mode.ModeNumber:=m1280x1024x64k;
  2576. mode.DriverNumber := VESA;
  2577. mode.ModeName:='1280 x 1024 VESA';
  2578. mode.MaxColor := 65536;
  2579. { the ModeInfo is automatically set if the mode is supported }
  2580. { by the call to SearchVESAMode. }
  2581. mode.HardwarePages := ModeInfo.NumberOfPages;
  2582. mode.DirectColor := TRUE;
  2583. mode.PaletteSize := mode.MaxColor;
  2584. mode.MaxX := 1279;
  2585. mode.MaxY := 1023;
  2586. {$ifndef 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. {$else fpc}
  2596. mode.DirectPutPixel:=@DirectPutPixVESA64k;
  2597. mode.PutPixel:=@PutPixVESA64k;
  2598. mode.GetPixel:=@GetPixVESA64k;
  2599. mode.InitMode := @Init1280x1024x64k;
  2600. mode.SetRGBPalette := @SetVESARGBPalette;
  2601. mode.GetRGBPalette := @GetVESARGBPalette;
  2602. mode.SetVisualPage := @SetVisualVESA;
  2603. mode.SetActivePage := @SetActiveVESA;
  2604. {$endif fpc}
  2605. mode.XAspect := 10000;
  2606. mode.YAspect := 10000;
  2607. AddMode(mode);
  2608. end;
  2609. end;
  2610. end;
  2611. {
  2612. $Log$
  2613. Revision 1.18 1999-09-24 14:22:38 jonas
  2614. + getscanline16
  2615. Revision 1.17 1999/09/24 11:31:38 jonas
  2616. * fixed another typo :(
  2617. Revision 1.16 1999/09/23 14:00:41 jonas
  2618. * -dlogging no longer required to fuction correctly
  2619. * some typo's fixed
  2620. Revision 1.15 1999/09/22 13:13:34 jonas
  2621. * renamed text.inc -> gtext.inc to avoid conflict with system unit
  2622. * fixed textwidth
  2623. * isgraphmode now gets properly updated, so mode restoring works
  2624. again
  2625. Revision 1.14 1999/09/18 22:21:09 jonas
  2626. + hlinevesa256 and vlinevesa256
  2627. + support for not/xor/or/andput in vesamodes with 32k/64k colors
  2628. * lots of changes to avoid warnings under FPC
  2629. Revision 1.13 1999/09/18 16:03:36 jonas
  2630. * graph.pp: removed pieslice and sector from ToDo list
  2631. * closegraph: exits now immidiately if isgraphmode = false (caused
  2632. RTE 204 with VESA enabled if you set exitproc to call closegraph
  2633. and also called closegraph explicitely before exit, like bgidemo)
  2634. Revision 1.12 1999/09/15 13:37:50 jonas
  2635. * small change to internalellipsedef to be TP compatible
  2636. * fixed directputpixel for vga 320*200*256
  2637. Revision 1.11 1999/09/12 17:28:59 jonas
  2638. * several changes to internalellipse to make it faster
  2639. and to make sure it updates the ArcCall correctly
  2640. (not yet done for width = 3)
  2641. * Arc mostly works now, only sometimes an endless loop, don't know
  2642. why
  2643. Revision 1.10 1999/09/11 19:43:01 jonas
  2644. * FloodFill: did not take into account current viewport settings
  2645. * GetScanLine: only get line inside viewport, data outside of it
  2646. is not used anyway
  2647. * InternalEllipseDefault: fix for when xradius or yradius = 0 and
  2648. increase xradius and yradius always by one (TP does this too)
  2649. * fixed conlict in vesa.inc from last update
  2650. * some conditionals to avoid range check and overflow errors in
  2651. places where it doesn't matter
  2652. Revision 1.9 1999/08/01 14:50:51 jonas
  2653. * fixed hline16 and vline16 for notput (also TP supports copy, and, or, xor and
  2654. notput for lines!!)
  2655. * fixed directputpixel16 to support all the different put types
  2656. Revision 1.8 1999/07/18 15:07:19 jonas
  2657. + xor-, and and- orput support for VESA256 modes
  2658. * compile with -dlogging if you want some info to be logged to grlog.txt
  2659. Revision 1.7 1999/07/14 18:18:02 florian
  2660. * cosmetic changes
  2661. Revision 1.6 1999/07/14 18:16:23 florian
  2662. * HLine16 and VLine16 implemented
  2663. Revision 1.5 1999/07/14 14:32:12 florian
  2664. * small VGA detection problem solved
  2665. Revision 1.4 1999/07/12 13:27:08 jonas
  2666. + added Log and Id tags
  2667. * added first FPC support, only VGA works to some extend for now
  2668. * use -dasmgraph to use assembler routines, otherwise Pascal
  2669. equivalents are used
  2670. * use -dsupportVESA to support VESA (crashes under FPC for now)
  2671. * only dispose vesainfo at closegrph if a vesa card was detected
  2672. * changed int32 to longint (int32 is not declared under FPC)
  2673. * changed the declaration of almost every procedure in graph.inc to
  2674. "far;" because otherwise you can't assign them to procvars under TP
  2675. real mode (but unexplainable "data segnment too large" errors prevent
  2676. it from working under real mode anyway)
  2677. }