graph.inc 89 KB

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