| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641 |
- (* Release 3.10 *)
- (*-------------------------------------------------------------------------*
- * *
- * COREGRAP.A - low-level graphics routines *
- * *
- * COPYRIGHT (C) 1989..1992 Clarion Software Corporation. *
- * All Rights Reserved *
- * *
- *--------------------------------------------------------------------------*)
- include "corelib.inc"
- FastIO = 0 (* Set to 0 prevents words being written to adjacent ports *)
- module CoreGraph
- (*****************************************************************************)
- segment _BSS(BSS, 28H)
- public __fstart : org 6
- segment _BSS(BSS, 28H)
- public __g_charout : org FarCodePtrSize
- public __g_strin : org FarCodePtrSize
- segment _DATA(DATA, 28H)
- extrn __gdummy
- (*%F NearCall *)
- public __get : dd __gdummy
- public __put : dd __gdummy
- public __hscan : dd __gdummy
- public __plot : dd __gdummy
- public __point : dd __gdummy
- public __hline : dd __gdummy
- public __line : dd __gdummy
- (*%E *)
- (*%T NearCall *)
- public __get : dw __gdummy
- public __put : dw __gdummy
- public __hscan : dw __gdummy
- public __plot : dw __gdummy
- public __point : dw __gdummy
- public __hline : dw __gdummy
- public __line : dw __gdummy
- (*%E *)
- segment _DATA(DATA, 28H)
- public __EGA_table : db 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15
- (*%T _DLL *)
- public __setvideomode_vector : org FarCodePtrSize
- public __initgraph_vector : org FarCodePtrSize
- (*%E *)
- segment _BSS(BSS, 28H)
- public __lastmode : org 2
- public __depth : org 2
- public __width : org 2
- public __current_video : org VideoConfigSize
- public __origin : org XYcoordSize
- public __clip_tl : org XYcoordSize
- public __clip_br : org XYcoordSize
- public __current_graph : org XYcoordSize
- public __text_tl : org RCcoordSize
- public __current_text : org RCcoordSize
- public __active_page : org 2
- public __visual_page : org 2
- public __page_size : org 2
- public __fgcolor : org 2
- public __mode_changed : org 2
- public __txcolor : org 2
- public __cursor_lock : org 2
- public __scr_attr : org 2
- public __current_mask : org FarDataPtrSize
- public __EGA64K : org 1
- public __cursor_state : org 1
- public __wrap_state : org 1
- public __display_state : org 1
- public __EGAtranslate : org 2
- public __bkcolor : org 4
- segment _DATA(DATA, 28H)
- public __text_br : dw 24, 79
- public __fill_mask : db 0FFH, 0FFH, 0FFH, 0FFH, 0FFH, 0FFH, 0FFH, 0FFH
- public __current_linestyle : dw 0FFFFH
- public __EGAScreen : dd 0A0000000H;
- public __EGAStartPlane : dw 3
- public __EGAPlaneShift : dw 1
- (**************************************************************************)
- section
- (*%F NearCall *)
- segment Graphics_TEXT(CODE,28H)
- (*%E *)
- (*%T NearCall *)
- segment _TEXT(CODE,28H)
- (*%E *)
- public $OutWord :
- out byte dx, al
- inc dx
- xchg ah, al
- out byte dx, al
- dec dx
- xchg ah, al
- ret 0
- (**************************************************************************)
- section
- (*%F NearCall *)
- segment Graphics_TEXT(CODE,28H)
- (*%E *)
- (*%T NearCall *)
- segment _TEXT(CODE,28H)
- (*%E *)
- segment _DATA(DATA, 28H)
- select _DATA
- extrn __page_size
- extrn __active_page
- (*%F NearCall *)
- select Graphics_TEXT
- (*%E *)
- (*%T NearCall *)
- select _TEXT
- (*%E *)
- public __pixeladdrEGA :
- BytesPerRow= -2
- mov cl, bl
- push dx
- mul word [bp][BytesPerRow]
- pop dx
- (*%T _XTD *)
- db 0C1H,0FBH,003H (*I shr bx, 3 *)
- (*%E *)
- (*%F _XTD *)
- shr bx, 1
- shr bx, 1
- shr bx, 1
- (*%E *)
- add bx, ax
- mov ax, [__active_page]
- mov dx, [__page_size]
- mul dx
- (*%T _XTD *)
- db 0C1H,0E0H,004H (*I shl ax, 4 *)
- add bx, ax
- extrn __A000h
- mov ax, __A000h
- (*%E *)
- (*%F _XTD *)
- add ax, 0A000H
- (*%E *)
- mov es, ax
- and cl, 7
- xor cl, 7
- mov ah, 1
- ret 0
- (**************************************************************************)
- section
- (*%F NearCall *)
- segment Graphics_TEXT(CODE,28H)
- (*%E *)
- (*%T NearCall *)
- segment _TEXT(CODE,28H)
- (*%E *)
- segment _DATA(DATA, 28H)
- select _DATA
- extrn __page_size
- extrn __active_page
- extrn __width
- (*%F NearCall *)
- select Graphics_TEXT
- (*%E *)
- (*%T NearCall *)
- select _TEXT
- (*%E *)
- public __pixeladdrEGA2 :
- mov cl, bl
- push dx
- mul word [__width]
- (*%T _XTD *)
- db 0C1H,0FBH,003H (*I shr bx, 3 *)
- (*%E *)
- (*%F _XTD *)
- shr bx, 1
- shr bx, 1
- shr bx, 1
- (*%E *)
- add bx, ax
- mov ax, [__active_page]
- mov dx, [__page_size]
- mul dx
- (*%T _XTD *)
- db 0C1H,0E0H,004H (*I shl ax, 4 *)
- add bx, ax
- extrn __A000h
- mov ax, __A000h
- (*%E *)
- (*%F _XTD *)
- add ax, 0A000H
- (*%E *)
- mov es, ax
- and cl, 7
- xor cl, 7
- mov ah, 1
- pop dx
- ret 0
- (**************************************************************************)
- section
- (*%F NearCall *)
- segment Graphics_TEXT(CODE,28H)
- (*%E *)
- (*%T NearCall *)
- segment _TEXT(CODE,28H)
- (*%E *)
- segment _DATA(DATA, 28H)
- select _DATA
- extrn __active_page
- extrn __page_size
- (*%F NearCall *)
- select Graphics_TEXT
- (*%E *)
- (*%T NearCall *)
- select _TEXT
- (*%E *)
- public __pixeladdrHerc :
- mov cl, bl
- shr ax, 1
- rcr bx, 1
- shr ax, 1
- rcr bx, 1
- shr bx, 1
- mov ah, 90
- mul ah
- add bx, ax
- mov ax, [__active_page]
- mov dx, [__page_size]
- mul dx
- (*%T _XTD *)
- db 0C1H,0E0H,004H (*I shl ax, 4 *)
- add bx, ax
- extrn __B000h
- mov ax, __B000h
- (*%E *)
- (*%F _XTD *)
- add ax, 0B000H (* NB New Fix *)
- (*%E *)
- mov es, ax
- and cl, 7
- xor cl, 7
- mov ah, 1
- ret 0
- (**************************************************************************)
- section
- (*%F NearCall *)
- segment Graphics_TEXT(CODE,28H)
- (*%E *)
- (*%T NearCall *)
- segment _TEXT(CODE,28H)
- (*%E *)
- segment _DATA(DATA, 28H)
- (*%F NearCall *)
- select Graphics_TEXT
- (*%E *)
- (*%T NearCall *)
- select _TEXT
- (*%E *)
- calcAddress:
- shr ax, 1
- add bh, al
- sub al, al
- add bx, ax
- shr ax, 1
- shr ax, 1
- add bx, ax
- shr bx, 1
- shr bx, 1
- (*%T _XTD *)
- extrn __B800h
- mov ax, __B800h
- (*%E *)
- (*%F _XTD *)
- mov ax, 0B800H
- (*%E*)
- mov es, ax
- ret 0
- public __pixeladdr320x200 :
- mov cl, bl
- xchg ah, al
- call calcAddress
- mov ah, 3
- and cl, ah
- xor cl, ah
- shl cl, 1
- ret 0
- public __pixeladdr640x200 :
- mov cl, bl
- xchg ah, al
- shr bx, 1
- call calcAddress
- and cl, 7
- xor cl, 7
- mov ah, 1
- ret 0
- (**************************************************************************)
- section
- (*%F NearCall *)
- segment Graphics_TEXT(CODE,28H)
- (*%E *)
- (*%T NearCall *)
- segment _TEXT(CODE,28H)
- (*%E *)
- segment _DATA(DATA, 28H)
- select _DATA
- extrn __clip_tl
- extrn __clip_br
- (*%F NearCall *)
- select Graphics_TEXT
- (*%E *)
- (*%T NearCall *)
- select _TEXT
- (*%E *)
- public __hclip : (* ax = x1, bx = y1, cx = x2 *)
- cmp bx, [__clip_tl][graph_ycoord]
- jl hclipError
- cmp bx, [__clip_br][graph_ycoord]
- jg hclipError
- cmp ax, cx
- jle noSwap
- xchg ax, cx
- noSwap:
- mov di, [__clip_tl][graph_xcoord]
- mov si, [__clip_br][graph_xcoord]
- cmp cx, di
- jl hclipError
- cmp ax, si
- jg hclipError
- cmp ax, di
- jge leftOK
- mov ax, di
- leftOK:
- cmp cx, si
- jle rightOK
- mov cx, si
- rightOK:
- clc
- ret 0 (* ax = x1, bx = y1, cx = x2, cy clear *)
- hclipError:
- stc
- ret 0
- (**************************************************************************)
- section
- (*%F NearCall *)
- segment Graphics_TEXT(CODE,28H)
- (*%E *)
- (*%T NearCall *)
- segment _TEXT(CODE,28H)
- (*%E *)
- segment _DATA(DATA, 28H)
- xLtl = 1
- yLtl = 2
- xGbr = 4
- yGbr = 8
- extrn F$SgnDiv
- extrn N$SgnDiv
- select _DATA
- extrn __clip_tl
- extrn __clip_br
- (*%F NearCall *)
- select Graphics_TEXT
- (*%E *)
- (*%T NearCall *)
- select _TEXT
- (*%E *)
- public __lclip : (* ax = x1, bx = y1, cx = x2, dx = y2 *)
- push bp
- sub si, si (* set outcodes *)
- mov di, si
- mov bp, [__clip_tl][graph_xcoord]
- cmp ax, bp
- jge l1
- or di, xLtl
- l1:
- cmp cx, bp
- jge l2
- or si, xLtl
- l2:
- mov bp, [__clip_br][graph_xcoord]
- cmp ax, bp
- jle l3
- or di, xGbr
- l3:
- cmp cx, bp
- jle l4
- or si, xGbr
- l4:
- mov bp, [__clip_tl][graph_ycoord]
- cmp bx, bp
- jge l5
- or di, yLtl
- l5:
- cmp dx, bp
- jge l6
- or si, yLtl
- l6:
- mov bp, [__clip_br][graph_ycoord]
- cmp bx, bp
- jle l7
- or di, yGbr
- l7:
- cmp dx, bp
- jle l8
- or si, yGbr
- l8:
- clipLoop:
- or si, si
- jnz $NotZero
- or di, di
- jz near clipDone
- $NotZero:
- test si, di
- jnz near clipNoLine
- or di, di
- jnz noSwap2
- xchg ax, cx
- xchg bx, dx
- xchg di, si
- noSwap2:
- push dx
- test di, xLtl
- jz nC10
- mov bp, [__clip_tl][graph_xcoord]
- mov di, cx
- sub di, ax
- mov si, bp
- sub si, ax
- mov ax, dx
- sub ax, bx
- imul si (* result in ax, dx *)
- push dx
- push ax
- mov ax, di
- cwd
- push dx
- push ax
- (*%F NearCall *)
- call far F$SgnDiv
- (*%E *)
- (*%T NearCall *)
- call N$SgnDiv
- (*%E *)
- add bx, ax
- mov ax, bp
- jmp near nC13
- nC10:
- test di, yLtl
- jz nC11
- mov bp, [__clip_tl][graph_ycoord]
- mov di, dx
- sub di, bx
- mov si, bp
- sub si, bx
- push ax
- sub ax, cx
- neg ax
- imul si (* result in ax, dx *)
- push dx
- push ax
- mov ax, di
- cwd
- push dx
- push ax
- (*%F NearCall *)
- call far F$SgnDiv
- (*%E *)
- (*%T NearCall *)
- call N$SgnDiv
- (*%E *)
- pop dx
- add ax, dx
- mov bx, bp
- jmp nC13
- nC11:
- test di, xGbr
- jz nC12
- mov bp, [__clip_br][graph_xcoord]
- mov di, cx
- sub di, ax
- mov si, bp
- sub si, ax
- mov ax, dx
- sub ax, bx
- imul si (* result in ax, dx *)
- push dx
- push ax
- mov ax, di
- cwd
- push dx
- push ax
- (*%F NearCall *)
- call far F$SgnDiv
- (*%E *)
- (*%T NearCall *)
- call N$SgnDiv
- (*%E *)
- add bx, ax
- mov ax, bp
- jmp nC13
- nC12:
- test di, yGbr
- jz nC13
- mov bp, [__clip_br][graph_ycoord]
- mov di, dx
- sub di, bx
- mov si, bp
- sub si, bx
- push ax
- sub ax, cx
- neg ax
- imul si (* result in ax, dx *)
- push dx
- push ax
- mov ax, di
- cwd
- push dx
- push ax
- (*%F NearCall *)
- call far F$SgnDiv
- (*%E *)
- (*%T NearCall *)
- call N$SgnDiv
- (*%E *)
- pop dx
- add ax, dx
- mov bx, bp
- nC13:
- pop dx
- sub si, si (* set outcodes *)
- sub di, di
- mov bp, [__clip_tl][graph_xcoord]
- cmp ax, bp
- jge l11
- or di, xLtl
- l11:
- cmp cx, bp
- jge l12
- or si, xLtl
- l12:
- mov bp, [__clip_br][graph_xcoord]
- cmp ax, bp
- jle l13
- or di, xGbr
- l13:
- cmp cx, bp
- jle l14
- or si, xGbr
- l14:
- mov bp, [__clip_tl][graph_ycoord]
- cmp bx, bp
- jge l15
- or di, yLtl
- l15:
- cmp dx, bp
- jge l16
- or si, yLtl
- l16:
- mov bp, [__clip_br][graph_ycoord]
- cmp bx, bp
- jle l17
- or di, yGbr
- l17:
- cmp dx, bp
- jle l18
- or si, yGbr
- l18:
- jmp clipLoop
- clipDone:
- cmp ax, cx
- jle noSwap
- xchg bx, dx
- xchg ax, cx
- noSwap:
- pop bp
- clc
- ret 0
- clipNoLine:
- pop bp
- stc
- ret 0
- (**************************************************************************)
- section
- (*%F NearCall *)
- segment Graphics_TEXT(CODE,28H)
- (*%E *)
- (*%T NearCall *)
- segment _TEXT(CODE,28H)
- (*%E *)
- segment _DATA(DATA, 28H)
- extrn __hclip
- extrn __pixeladdr640x200
- select _DATA
- extrn __fgcolor
- select _DATA
- PropPix: db 0, 0FFH
- (*%F NearCall *)
- select Graphics_TEXT
- (*%E *)
- (*%T NearCall *)
- select _TEXT
- (*%E *)
- x1 = -2
- y1 = -4
- x2 = -6
- color = -8
- locals = 8
- public __CGA640HLine :
- push bp
- mov bp, sp
- sub sp, locals
- push di
- push si
- (*%F SameDS *)
- push ds
- mov si, _DATA
- mov ds, si
- (*%E *)
- call __hclip
- jc noDraw
- mov [bp][x1], ax
- mov [bp][y1], bx
- mov [bp][x2], cx
- mov [bp][color], dx
- xchg ax, bx
- call __pixeladdr640x200
- mov di, bx
- mov dh, ah
- not dh
- mov dl, 0FFH
- shl dh, cl
- not dh
- mov cx, [bp][x2]
- and cl, 7
- xor cl, 7
- shl dl, cl
- mov ax, [bp][x2]
- mov bx, [bp][x1]
- mov cl, 3
- shr ax, cl
- shr bx, cl
- mov cx, ax
- sub cx, bx
- mov bx, PropPix
- mov al, [bp][color]
- xlat
- or dh, dh
- js byteAligned
- or cx, cx
- jnz multiByte
- and dl, dh
- jmp singleByte
- multiByte:
- mov ah, al
- and ah, dh
- not dh
- and es:[di], dh
- or es:[di], ah
- inc di
- dec cx
- byteAligned:
- rep ; stosb
- singleByte:
- and al, dl
- not dl
- and es:[di], dl
- or es:[di], al
- noDraw:
- (*%F SameDS *)
- pop ds
- (*%E *)
- pop si
- pop di
- mov sp, bp
- pop bp
- (*%F NearCall *)
- ret far 0
- (*%E *)
- (*%T NearCall *)
- ret 0
- (*%E *)
- (**************************************************************************)
- section
- (*%F NearCall *)
- segment Graphics_TEXT(CODE,28H)
- (*%E *)
- (*%T NearCall *)
- segment _TEXT(CODE,28H)
- (*%E *)
- segment _DATA(DATA, 28H)
- extrn __hclip
- extrn __pixeladdr320x200
- select _DATA
- select _DATA
- PropPix: db 0, 55H, 0AAH, 0FFH
- (*%F NearCall *)
- select Graphics_TEXT
- (*%E *)
- (*%T NearCall *)
- select _TEXT
- (*%E *)
- x1 = -2
- y1 = -4
- x2 = -6
- color = -8
- locals = 8
- public __CGA320HLine :
- push bp
- mov bp, sp
- sub sp, locals
- push di
- push si
- (*%F SameDS *)
- push ds
- mov si, _DATA
- mov ds, si
- (*%E *)
- call __hclip
- jc noDraw
- mov [bp][x1], ax
- mov [bp][y1], bx
- mov [bp][x2], cx
- mov [bp][color], dx
- xchg ax, bx
- call __pixeladdr320x200
- mov di, bx
- mov dh, ah
- not dh
- mov dl, 0FFH
- shl dh, cl
- not dh
- mov cx, [bp][x2]
- and cl, 3
- xor cl, 3
- shl cl, 1
- shl dl, cl
- mov ax, [bp][x2]
- mov bx, [bp][x1]
- mov cl, 2
- shr ax, cl
- shr bx, cl
- mov cx, ax
- sub cx, bx
- mov bx, PropPix
- mov al, [bp][color]
- xlat
- or dh, dh
- js byteAligned
- or cx, cx
- jnz multiByte
- and dl, dh
- jmp singleByte
- multiByte:
- mov ah, al
- and ah, dh
- not dh
- and es:[di], dh
- or es:[di], ah
- inc di
- dec cx
- byteAligned:
- rep ; stosb
- singleByte:
- and al, dl
- not dl
- and es:[di], dl
- or es:[di], al
- noDraw:
- (*%F SameDS *)
- pop ds
- (*%E *)
- pop si
- pop di
- mov sp, bp
- pop bp
- (*%F NearCall *)
- ret far 0
- (*%E *)
- (*%T NearCall *)
- ret 0
- (*%E *)
- (**************************************************************************)
- section
- (*%F NearCall *)
- segment Graphics_TEXT(CODE,28H)
- (*%E *)
- (*%T NearCall *)
- segment _TEXT(CODE,28H)
- (*%E *)
- segment _DATA(DATA, 28H)
- extrn __hclip
- extrn __pixeladdrHerc
- select _DATA
- select _DATA
- PropPix: db 0, 0FFH
- (*%F NearCall *)
- select Graphics_TEXT
- (*%E *)
- (*%T NearCall *)
- select _TEXT
- (*%E *)
- x1 = -2
- y1 = -4
- x2 = -6
- color = -8
- locals = 8
- public __HercHLine :
- push bp
- mov bp, sp
- sub sp, locals
- push di
- push si
- (*%F SameDS *)
- push ds
- mov si, _DATA
- mov ds, si
- (*%E *)
- call __hclip
- jc noDraw
- mov [bp][x1], ax
- mov [bp][y1], bx
- mov [bp][x2], cx
- mov [bp][color], dx
- xchg ax, bx
- call __pixeladdrHerc
- mov di, bx
- mov dh, ah
- not dh
- mov dl, 0FFH
- shl dh, cl
- not dh
- mov cx, [bp][x2]
- and cl, 7
- xor cl, 7
- shl dl, cl
- mov ax, [bp][x2]
- mov bx, [bp][x1]
- mov cl, 3
- shr ax, cl
- shr bx, cl
- mov cx, ax
- sub cx, bx
- mov bx, PropPix
- mov al, [bp][color]
- xlat
- or dh, dh
- js byteAligned
- or cx, cx
- jnz multiByte
- and dl, dh
- jmp singleByte
- multiByte:
- mov ah, al
- and ah, dh
- not dh
- and es:[di], dh
- or es:[di], ah
- inc di
- dec cx
- byteAligned:
- rep ; stosb
- singleByte:
- and al, dl
- not dl
- and es:[di], dl
- or es:[di], al
- noDraw:
- (*%F SameDS *)
- pop ds
- (*%E *)
- pop si
- pop di
- mov sp, bp
- pop bp
- (*%F NearCall *)
- ret far 0
- (*%E *)
- (*%T NearCall *)
- ret 0
- (*%E *)
- (**************************************************************************)
- section
- (*%F NearCall *)
- segment Graphics_TEXT(CODE,28H)
- (*%E *)
- (*%T NearCall *)
- segment _TEXT(CODE,28H)
- (*%E *)
- segment _DATA(DATA, 28H)
- extrn __hclip
- extrn __pixeladdrEGA2
- extrn __EGAxlat
- select _DATA
- extrn __EGAtranslate
- (*%F NearCall *)
- select Graphics_TEXT
- (*%E *)
- (*%T NearCall *)
- select _TEXT
- (*%E *)
- x1 = -2
- y1 = -4
- x2 = -6
- EGAcolor = -8
- locals = 8
- public __EGAHLine :
- push bp
- mov bp, sp
- sub sp, locals
- push di
- push si
- push ds
- (*%F SameDS *)
- mov si, _DATA
- mov ds, si
- (*%E *)
- call __hclip
- jc near noDraw
- mov [bp][x1], ax
- mov [bp][y1], bx
- mov [bp][x2], cx
- mov ax, dx
- cmp byte [__EGAtranslate], 0
- jz notNeeded
- call __EGAxlat
- notNeeded:
- mov [bp][EGAcolor], ax
- mov dx, 3CEH
- mov ax, 5H
- (*%F FastIO *)
- extrn $OutWord
- call $OutWord
- (*%E *)
- (*%T FastIO *)
- out word dx, ax
- (*%E *)
- mov ah, [bp][EGAcolor]
- sub al, al
- (*%F FastIO *)
- call $OutWord
- (*%E *)
- (*%T FastIO *)
- out word dx, ax
- (*%E *)
- mov ax, 0FF01H
- (*%F FastIO *)
- call $OutWord
- (*%E *)
- (*%T FastIO *)
- out word dx, ax
- (*%E *)
- mov al, 3
- mov ah, 0
- (*%F FastIO *)
- call $OutWord
- (*%E *)
- (*%T FastIO *)
- out word dx, ax
- (*%E *)
- mov ax, [bp][y1]
- mov bx, [bp][x1]
- call __pixeladdrEGA2
- mov di, bx
- mov dh, ah
- not dh
- shl dh, cl
- not dh
- mov cx, [bp][x2]
- and cl, 7
- xor cl, 7
- mov dl, 0FFH
- shl dl, cl
- mov ax, [bp][x2]
- mov bx, [bp][x1]
- mov cl, 3
- shr ax, cl
- shr bx, cl
- mov cx, ax
- sub cx, bx
- mov bx, dx
- mov dx, 3CEH
- mov al, 8
- push es
- pop ds
- mov si, di
- or bh, bh
- js byteAligned
- or cx, cx
- jnz multiByte
- and bl, bh
- jmp singleByte
- multiByte:
- mov ah, bh
- (*%F FastIO *)
- call $OutWord
- (*%E *)
- (*%T FastIO *)
- out word dx, ax
- (*%E *)
- movsb
- dec cx
- byteAligned:
- mov ah, 0FFH
- (*%F FastIO *)
- call $OutWord
- (*%E *)
- (*%T FastIO *)
- out word dx, ax
- (*%E *)
- rep ; movsb
- singleByte:
- mov ah, bl
- (*%F FastIO *)
- call $OutWord
- (*%E *)
- (*%T FastIO *)
- out word dx, ax
- (*%E *)
- movsb
- sub ax, ax
- (*%F FastIO *)
- call $OutWord
- (*%E *)
- (*%T FastIO *)
- out word dx, ax
- (*%E *)
- inc ax
- (*%F FastIO *)
- call $OutWord
- (*%E *)
- (*%T FastIO *)
- out word dx, ax
- (*%E *)
- mov al, 3
- (*%F FastIO *)
- call $OutWord
- (*%E *)
- (*%T FastIO *)
- out word dx, ax
- (*%E *)
- mov ax, 0FF08H
- (*%F FastIO *)
- call $OutWord
- (*%E *)
- (*%T FastIO *)
- out word dx, ax
- (*%E *)
- noDraw:
- pop ds
- pop si
- pop di
- mov sp, bp
- pop bp
- (*%F NearCall *)
- ret far 0
- (*%E *)
- (*%T NearCall *)
- ret 0
- (*%E *)
- (****************************************************************************)
- section
- (*%F NearCall *)
- segment Graphics_TEXT(CODE,28H)
- (*%E *)
- (*%T NearCall *)
- segment _TEXT(CODE,28H)
- (*%E *)
- segment _DATA(DATA, 28H)
- extrn __pixeladdrEGA2
- extrn __hclip
- select _DATA
- EGA2x1 : dw 0
- EGA2y1 : dw 0
- EGA2x2 : dw 0
- EGA2color : dw 0
- propPix : db 0, 0FFH
- (*%F NearCall *)
- select Graphics_TEXT
- (*%E *)
- (*%T NearCall *)
- select _TEXT
- (*%E *)
- public __EGA2HLine :
- push bp
- mov bp, sp
- push di
- push si
- (*%F SameDS *)
- push ds
- mov si, _DATA
- mov ds, si
- (*%E *)
- call __hclip
- jc noDraw
- mov [EGA2x1], ax
- mov [EGA2y1], bx
- mov [EGA2x2], cx
- mov [EGA2color], dx
- mov ax, [EGA2y1]
- mov bx, [EGA2x1]
- call __pixeladdrEGA2
- mov di, bx
- mov dh, ah
- not dh
- mov dl, 0FFH
- shl dh, cl
- not dh
- mov cx, [EGA2x2]
- and cl, 7
- xor cl, 7
- shl dl, cl
- mov ax, [EGA2x2]
- mov bx, [EGA2x1]
- mov cl, 3
- shr ax, cl
- shr bx, cl
- mov cx, ax
- sub cx, bx
- mov bx, propPix
- mov al, [EGA2color]
- xlat
- or dh, dh
- js fullByte
- or cx, cx
- jnz multiByte
- and dl, dh
- jmp lastByte
- multiByte:
- mov ah, al
- and ah, dh
- not dh
- and es:[di], dh
- or es:[di], ah
- inc di
- dec cx
- fullByte:
- rep ; stosb
- lastByte:
- and al, dl
- not dl
- and es:[di], dl
- or es:[di], al
- noDraw:
- (*%F SameDS *)
- pop ds
- (*%E *)
- pop si
- pop di
- pop bp
- (*%F NearCall *)
- ret far 0
- (*%E *)
- (*%T NearCall *)
- ret 0
- (*%E *)
- (**************************************************************************)
- section
- (*%F NearCall *)
- segment Graphics_TEXT(CODE,28H)
- (*%E *)
- (*%T NearCall *)
- segment _TEXT(CODE,28H)
- (*%E *)
- segment _DATA(DATA, 28H)
- extrn __hclip
- (*%F NearCall *)
- select Graphics_TEXT
- (*%E *)
- (*%T NearCall *)
- select _TEXT
- (*%E *)
- mask = frame
- public __VGAHLine :
- (*%T _DLLOVL *)
- push bp
- mov bp, sp
- (*%E *)
- push di
- push si
- (*%F SameDS *)
- push ds
- mov si, _DATA
- mov ds, si
- (*%E *)
- call __hclip
- jc noDraw
- mov di, cx
- sub di, ax
- inc di
- push dx
- mov dx, 320
- xchg bx, ax
- mul dx
- add ax, bx
- mov cx, di
- (*%T _XTD *)
- extrn __A000h
- mov bx, __A000h
- (*%E *)
- (*%F _XTD *)
- mov bx, 0A000H
- (*%E *)
- mov es, bx
- mov di, ax
- pop ax
- rep ; stosb
- noDraw:
- (*%F SameDS *)
- pop ds
- (*%E *)
- pop si
- pop di
- (*%T _DLLOVL *)
- pop bp
- (*%E *)
- (*%F NearCall *)
- ret far 0
- (*%E *)
- (*%T NearCall *)
- ret 0
- (*%E *)
- (**************************************************************************)
- section
- (*%F NearCall *)
- segment Graphics_TEXT(CODE,28H)
- (*%E *)
- (*%T NearCall *)
- segment _TEXT(CODE,28H)
- (*%E *)
- segment _DATA(DATA, 28H)
- extrn __lclip
- select _DATA
- extrn __fgcolor
- (*%F NearCall *)
- select Graphics_TEXT
- (*%E *)
- (*%T NearCall *)
- select _TEXT
- (*%E *)
- lstyle = frame
- x1 = -2
- y1 = -4
- x2 = -6
- y2 = -8
- inc1 = -10
- inc2 = -12
- mask = -14
- draw = -16
- locals = 16
- verticalLine:
- mov ax, [bp][y1]
- mov bx, [bp][y2]
- mov cx, bx
- sub cx, ax
- jge Ps
- neg cx
- mov ax, bx
- Ps:
- inc cx
- mov di, [bp][x1]
- mov dx, 320
- mul dx
- add di, ax
- dec si
- mov al, [__fgcolor]
- mov bx, [bp][lstyle]
- cmp bx, -1
- jne vertMask
- vertLoop:
- stosb
- add di, si
- loop vertLoop
- jmp lineExit
- vertMask:
- mov dx, [bp][mask]
- vertMLoop:
- test dx, bx
- jz noStore
- stosb
- cont:
- add di, si
- rol dx, 1
- loop vertMLoop
- jmp lineExit
- noStore:
- inc di
- jmp cont
- VGAhoriz:
- mov ax, [bp][y1]
- mov bx, [bp][x1]
- mov dx, 320
- mul dx
- add ax, bx
- mov di, ax
- inc cx
- mov al, [__fgcolor]
- mov bx, [bp][lstyle]
- mov dx, [bp][mask]
- hLoop:
- test bx, dx
- jz noStore5
- mov es:[di], al
- noStore5:
- inc di
- rol dx, 1
- loop hLoop
- jmp lineExit
- lowLine:
- test dx, [bp][lstyle]
- jz noStore2
- stosb
- cont2:
- rol dx, 1
- or si, si
- jns lPos
- add si, [bp][inc1]
- loop lowLine
- jmp lineExit
- noStore2:
- inc di
- jmp cont2
- lPos:
- add si, [bp][inc2]
- add di, bx
- loop lowLine
- jmp lineExit
- highLine:
- test dx, [bp][lstyle]
- jz noStore3
- stosb
- cont3:
- rol dx, 1
- add di, bx
- or si, si
- jns hPos
- add si, [bp][inc1]
- dec di
- loop highLine
- jmp lineExit
- noStore3:
- inc di
- jmp cont3
- hPos:
- add si, [bp][inc2]
- loop highLine
- lineExit:
- (*%F SameDS *)
- pop ds
- (*%E *)
- pop si
- pop di
- mov sp, bp
- pop bp
- (*%F NearCall *)
- ret far 2
- (*%E *)
- (*%T NearCall *)
- ret 2
- (*%E *)
- public __VGALine : (* ax = x1, bx = y1, cx = x2, dx = y2 *)
- push bp
- mov bp, sp
- sub sp, locals
- push di
- push si
- (*%F SameDS *)
- push ds
- mov si, _DATA
- mov ds, si
- (*%E *)
- call __lclip
- jc lineExit
- mov [bp][x1], ax
- mov [bp][y1], bx
- mov [bp][x2], cx
- mov [bp][y2], dx
- (*%T _XTD *)
- extrn __A000h
- mov ax, __A000h
- (*%E *)
- (*%F _XTD *)
- mov ax, 0A000H
- (*%E *)
- mov es, ax
- mov si, 320
- sub cx, [bp][x1]
- jz verticalLine
- push cx
- mov cx, [bp][x1]
- and cl, 15
- mov bx, 1
- shl bx, cl
- mov [bp][mask], bx
- pop cx
- mov bx, [bp][y2]
- sub bx, [bp][y1]
- jz VGAhoriz
- jns slopePos
- neg bx
- neg si
- slopePos:
- push si
- mov word [bp][draw], lowLine
- cmp bx, cx
- jle useLowSlope
- mov word [bp][draw], highLine
- xchg bx, cx
- useLowSlope:
- shl bx, 1
- mov [bp][inc1], bx
- sub bx, cx
- mov si, bx
- sub bx, cx
- mov [bp][inc2], bx
- mov ax, [bp][y1]
- mov di, [bp][x1]
- mov dx, 320
- mul dx
- add di, ax
- inc cx
- pop bx
- mov al, [__fgcolor]
- mov dx, [bp][mask]
- jmp [bp][draw]
- (**************************************************************************)
- section
- (*%F NearCall *)
- segment Graphics_TEXT(CODE,28H)
- (*%E *)
- (*%T NearCall *)
- segment _TEXT(CODE,28H)
- (*%E *)
- segment _DATA(DATA, 28H)
- (*%F NearCall *)
- select Graphics_TEXT
- (*%E *)
- (*%T NearCall *)
- select _TEXT
- (*%E *)
- public __VGAleftscan :
- (*%T _DLLOVL *)
- push bp
- mov bp, sp
- (*%E *)
- push di
- mov di, ax
- (*%T _XTD *)
- extrn __A000h
- mov ax, __A000h
- (*%E *)
- (*%F _XTD *)
- mov ax, 0A000H
- (*%E *)
- mov es, ax
- mov al, bl
- scanLoop:
- dec di
- dec dx
- cmp al, es:[di]
- je scanDone
- cmp dx, cx
- jge scanLoop
- scanDone:
- mov ax, dx
- inc ax
- pop di
- (*%T _DLLOVL *)
- pop bp
- (*%E *)
- (*%F NearCall *)
- ret far 0
- (*%E *)
- (*%T NearCall *)
- ret 0
- (*%E *)
- (**************************************************************************)
- section
- (*%F NearCall *)
- segment Graphics_TEXT(CODE,28H)
- (*%E *)
- (*%T NearCall *)
- segment _TEXT(CODE,28H)
- (*%E *)
- segment _DATA(DATA, 28H)
- (*%F NearCall *)
- select Graphics_TEXT
- (*%E *)
- (*%T NearCall *)
- select _TEXT
- (*%E *)
- public __VGArightscan :
- (*%T _DLLOVL *)
- push bp
- mov bp, sp
- (*%E *)
- push di
- mov di, ax
- (*%T _XTD *)
- extrn __A000h
- mov ax, __A000h
- (*%E *)
- (*%F _XTD *)
- mov ax, 0A000H
- (*%E *)
- mov es, ax
- mov al, bl
- scanLoop:
- inc di
- inc dx
- cmp al, es:[di]
- je scanDone
- cmp dx, cx
- jle scanLoop
- scanDone:
- mov ax, dx
- dec ax
- pop di
- (*%T _DLLOVL *)
- pop bp
- (*%E *)
- (*%F NearCall *)
- ret far 0
- (*%E *)
- (*%T NearCall *)
- ret 0
- (*%E *)
- (**************************************************************************)
- section
- (*%F NearCall *)
- segment Graphics_TEXT(CODE,28H)
- (*%E *)
- (*%T NearCall *)
- segment _TEXT(CODE,28H)
- (*%E *)
- segment _DATA(DATA, 28H)
- extrn __pixeladdr640x200
- extrn __lclip
- select _DATA
- extrn __fgcolor
- L640x1 : dw 0
- L640y1 : dw 0
- L640x2 : dw 0
- L640y2 : dw 0
- L640inc1 : dw 0
- L640inc2 : dw 0
- L640leafinc : dw 0
- L640draw : dw 0
- L640lstyle : dw 0
- L640buffer : dw 0
- (*%F NearCall *)
- select Graphics_TEXT
- (*%E *)
- (*%T NearCall *)
- select _TEXT
- (*%E *)
- L640verticalLine:
- mov ax, [L640y1]
- mov bx, [L640y2]
- mov cx, bx
- sub cx, ax
- jge L640dyPos
- neg cx
- mov ax, bx
- L640dyPos:
- inc cx
- mov bx, [L640x1]
- push cx
- call __pixeladdr640x200
- mov al, [__fgcolor]
- shl ax, cl
- not ah
- pop cx
- test bx, si
- jz L640int1
- xchg si, di
- L640int1:
- or al, al
- jz L640pixVal0
- L640vertLoop:
- test bp, [L640lstyle]
- jz L640noStore1
- or es:[bx], al
- L640noStore1:
- rol bp, 1
- add bx, si
- xchg si, di
- loop L640vertLoop
- jmp near L640lineExit
- L640pixVal0:
- test bp, [L640lstyle]
- jz L640noStore2
- and es:[bx], ah
- L640noStore2:
- rol bp, 1
- add bx, si
- xchg si, di
- loop L640pixVal0
- jmp near L640lineExit
- L640horizLine:
- mov ax, [L640y1]
- mov bx, [L640x1]
- call __pixeladdr640x200
- mov al, [__fgcolor]
- shl ax, cl
- mov dx, ax
- not dh
- mov cx, [L640x2]
- sub cx, [L640x1]
- inc cx
- mov di, [L640lstyle]
- mov si, -1
- L640horizSlope:
- mov ah, es:[bx]
- L640horizLoop:
- and ah, dh
- test bp, di
- jz L640noStore5
- or ah, dl
- L640noStore5:
- rol bp, 1
- ror dl, 1
- ror dh, 1
- jnc L640maskLeft5
- loop L640horizLoop
- mov es:[bx], ah
- jmp near L640lineExit
- L640maskLeft5:
- mov es:[bx], ah
- inc bx
- dec cx
- or si, si
- js notYet
- mov [si][L640buffer], ah
- notYet:
- cmp si, 1
- jz storeBytes
- inc si
- notEnough:
- jcxz near L640lineExit
- jmp L640horizSlope
- storeBytes:
- mov si, cx
- and si, 7
- push si
- shr cx, 1
- shr cx, 1
- shr cx, 1
- jcxz abort
- sub si, si
- sbLoop:
- mov ah, [si][L640buffer]
- mov es:[bx], ah
- inc si
- inc bx
- and si, 2
- loop sbLoop
- abort:
- pop cx
- jmp notEnough
- L640lowSlope:
- mov ah, es:[bx]
- L640lowLoop:
- and ah, dh
- test bp, [L640lstyle]
- jz L640noStore3
- or ah, dl
- L640noStore3:
- rol bp, 1
- ror dl, 1
- ror dh, 1
- jnc L640maskLeft
- or di, di
- jns L640dPos
- add di, [L640inc1]
- loop L640lowLoop
- mov es:[bx], ah
- jmp L640lineExit
- L640dPos:
- add di, [L640inc2]
- mov es:[bx], ah
- add bx, si
- xchg si, [L640leafinc]
- loop L640lowSlope
- jmp L640lineExit
- L640maskLeft:
- mov es:[bx], ah
- inc bx
- or di, di
- jns L640dPos2
- add di, [L640inc1]
- loop L640lowSlope
- jmp L640lineExit
- L640dPos2:
- add di, [L640inc2]
- add bx, si
- xchg si, [L640leafinc]
- loop L640lowSlope
- jmp L640lineExit
- L640highSlope:
- and es:[bx], dh
- test bp, [L640lstyle]
- jz L640noStore4
- or es:[bx], dl
- L640noStore4:
- rol bp, 1
- add bx, si
- xchg si, [L640leafinc]
- or di, di
- jns L640dPos3
- add di, [L640inc1]
- loop L640highSlope
- jmp L640lineExit
- L640dPos3:
- add di, [L640inc2]
- ror dl ,1
- ror dh, 1
- cmc
- adc bx, 0
- loop L640highSlope
- L640lineExit:
- (*%F SameDS *)
- pop ds
- (*%E *)
- pop si
- pop di
- pop bp
- (*%F NearCall *)
- ret far 2
- (*%E *)
- (*%T NearCall *)
- ret 2
- (*%E *)
- public __CGA640Line :
- push bp
- mov bp, sp
- push di
- push si
- (*%F SameDS *)
- push ds
- mov si, _DATA
- mov ds, si
- (*%E *)
- call __lclip
- jc L640lineExit
- mov [L640x1], ax
- mov [L640y1], bx
- mov [L640x2], cx
- mov [L640y2], dx
- mov cx, [bp][frame]
- mov [L640lstyle], cx
- mov cx, ax
- and cl, 15
- mov bp, 1
- shl bp, cl
- mov si, 2000H
- mov di, 80-2000H
- mov cx, [L640x2]
- sub cx, ax
- jz L640verticalLine
- mov bx, [L640y2]
- sub bx, [L640y1]
- je L640horizLine
- jns L640posInc
- neg bx
- xchg si, di
- neg si
- neg di
- L640posInc:
- mov [L640leafinc], di
- mov word [L640draw], L640lowSlope
- cmp bx, cx
- jle L640useLowSlope
- mov word [L640draw], L640highSlope
- xchg bx, cx
- L640useLowSlope:
- shl bx, 1
- mov [L640inc1], bx
- sub bx, cx
- mov di, bx
- sub bx, cx
- mov [L640inc2], bx
- push cx
- mov bx, [L640x1]
- mov ax, [L640y1]
- call __pixeladdr640x200
- mov al, [__fgcolor]
- shl ax, cl
- mov dx, ax
- not dh
- pop cx
- inc cx
- test bx, 2000H
- jz L640iLeave0
- xchg si, [L640leafinc]
- L640iLeave0:
- jmp [L640draw]
- (**************************************************************************)
- section
- extrn __pixeladdr320x200
- (*%F NearCall *)
- segment Graphics_TEXT(CODE,28H)
- (*%E *)
- (*%T NearCall *)
- segment _TEXT(CODE,28H)
- (*%E *)
- segment _DATA(DATA, 28H)
- extrn __lclip
- select _DATA
- extrn __fgcolor
- L320x1 : dw 0
- L320y1 : dw 0
- L320x2 : dw 0
- L320y2 : dw 0
- L320inc1 : dw 0
- L320inc2 : dw 0
- L320leafinc : dw 0
- L320draw : dw 0
- L320lstyle : dw 0
- L320buffer : dw 0, 0
- (*%F NearCall *)
- select Graphics_TEXT
- (*%E *)
- (*%T NearCall *)
- select _TEXT
- (*%E *)
- L320verticalLine:
- mov ax, [L320y1]
- mov bx, [L320y2]
- mov cx, bx
- sub cx, ax
- jge L320dyPos
- neg cx
- mov ax, bx
- L320dyPos:
- inc cx
- mov bx, [L320x1]
- push cx
- call __pixeladdr320x200
- mov al, [__fgcolor]
- shl ax, cl
- not ah
- pop cx
- test bx, si
- jz L320vertLoop
- xchg si, di
- L320vertLoop:
- and es:[bx], ah
- test bp, [L320lstyle]
- jz L320noStore1
- or es:[bx], al
- L320noStore1:
- rol bp, 1
- add bx, si
- xchg si, di
- loop L320vertLoop
- jmp near L320lineExit
- L320horizLine:
- mov ax, [L320y1]
- mov bx, [L320x1]
- call __pixeladdr320x200
- mov al, [__fgcolor]
- shl ax, cl
- mov dx, ax
- not dh
- mov cx, [L320x2]
- sub cx, [L320x1]
- inc cx
- mov di, [L320lstyle]
- mov si, -1
- L320horizSlope:
- mov ah, es:[bx]
- L320horizLoop:
- and ah, dh
- test bp, di
- jz L320noStore5
- or ah, dl
- L320noStore5:
- rol bp, 1
- ror dl, 1
- ror dl, 1
- ror dh, 1
- ror dh, 1
- jnc L320maskLeft5
- loop L320horizLoop
- mov es:[bx], ah
- jmp near L320lineExit
- L320maskLeft5:
- mov es:[bx], ah
- inc bx
- dec cx
- or si, si
- js notYet
- mov [si][L320buffer], ah
- notYet:
- cmp si, 3
- jz storeBytes
- inc si
- notEnough:
- jcxz near L320lineExit
- jmp L320horizSlope
- storeBytes:
- mov si, cx
- and si, 3
- push si
- shr cx, 1
- shr cx, 1
- jcxz abort
- sub si, si
- sbLoop:
- mov ah, [si][L320buffer]
- mov es:[bx], ah
- inc si
- inc bx
- and si, 3
- loop sbLoop
- abort:
- pop cx
- jmp notEnough
- L320lowSlope:
- mov ah, es:[bx]
- L320lowLoop:
- and ah, dh
- test bp, [L320lstyle]
- jz L320noStore3
- or ah, dl
- L320noStore3:
- rol bp, 1
- ror dl, 1
- ror dl, 1
- ror dh, 1
- ror dh, 1
- jnc L320maskLeft
- or di, di
- jns L320dPos
- add di, [L320inc1]
- loop L320lowLoop
- mov es:[bx], ah
- jmp L320lineExit
- L320dPos:
- add di, [L320inc2]
- mov es:[bx], ah
- add bx, si
- xchg si, [L320leafinc]
- loop L320lowSlope
- jmp L320lineExit
- L320maskLeft:
- mov es:[bx], ah
- inc bx
- or di, di
- jns L320dPos2
- add di, [L320inc1]
- loop L320lowSlope
- jmp L320lineExit
- L320dPos2:
- add di, [L320inc2]
- add bx, si
- xchg si, [L320leafinc]
- loop L320lowSlope
- jmp L320lineExit
- L320highSlope:
- and es:[bx], dh
- test bp, [L320lstyle]
- jz L320noStore4
- or es:[bx], dl
- L320noStore4:
- rol bp, 1
- add bx, si
- xchg si, [L320leafinc]
- or di, di
- jns L320dPos3
- add di, [L320inc1]
- loop L320highSlope
- jmp L320lineExit
- L320dPos3:
- add di, [L320inc2]
- ror dl ,1
- ror dl ,1
- ror dh, 1
- ror dh, 1
- cmc
- adc bx, 0
- loop L320highSlope
- L320lineExit:
- (*%F SameDS *)
- pop ds
- (*%E *)
- pop si
- pop di
- pop bp
- (*%F NearCall *)
- ret far 2
- (*%E *)
- (*%T NearCall *)
- ret 2
- (*%E *)
- public __CGA320Line :
- push bp
- mov bp, sp
- push di
- push si
- (*%F SameDS *)
- push ds
- mov si, _DATA
- mov ds, si
- (*%E *)
- call __lclip
- jc L320lineExit
- mov [L320x1], ax
- mov [L320y1], bx
- mov [L320x2], cx
- mov [L320y2], dx
- mov cx, [bp][frame]
- mov [L320lstyle], cx
- mov cx, ax
- and cl, 15
- mov bp, 1
- shl bp, cl
- mov si, 2000H
- mov di, 80-2000H
- mov cx, [L320x2]
- sub cx, ax
- jz L320verticalLine
- mov bx, [L320y2]
- sub bx, [L320y1]
- je L320horizLine
- jns L320posInc
- neg bx
- xchg si, di
- neg si
- neg di
- L320posInc:
- mov [L320leafinc], di
- mov word [L320draw], L320lowSlope
- cmp bx, cx
- jle L320useLowSlope
- mov word [L320draw], L320highSlope
- xchg bx, cx
- L320useLowSlope:
- shl bx, 1
- mov [L320inc1], bx
- sub bx, cx
- mov di, bx
- sub bx, cx
- mov [L320inc2], bx
- push cx
- mov bx, [L320x1]
- mov ax, [L320y1]
- call __pixeladdr320x200
- mov al, [__fgcolor]
- shl ax, cl
- mov dx, ax
- not dh
- pop cx
- inc cx
- test bx, 2000H
- jz L320iLeave0
- xchg si, [L320leafinc]
- L320iLeave0:
- jmp [L320draw]
- (**************************************************************************)
- section
- (*%F NearCall *)
- segment Graphics_TEXT(CODE,28H)
- (*%E *)
- (*%T NearCall *)
- segment _TEXT(CODE,28H)
- (*%E *)
- segment _DATA(DATA, 28H)
- extrn __pixeladdrHerc
- extrn __lclip
- select _DATA
- extrn __fgcolor
- Hercx1 : dw 0
- Hercy1 : dw 0
- Hercx2 : dw 0
- Hercy2 : dw 0
- Hercinc1 : dw 0
- Hercinc2 : dw 0
- Hercleafinc : dw 0
- Hercdraw : dw 0
- Herclstyle : dw 0
- (*%F NearCall *)
- select Graphics_TEXT
- (*%E *)
- (*%T NearCall *)
- select _TEXT
- (*%E *)
- HERCverticalLine:
- mov ax, [Hercy1]
- mov bx, [Hercy2]
- mov cx, bx
- sub cx, ax
- jge HERCdyPos
- neg cx
- mov ax, bx
- HERCdyPos:
- inc cx
- mov bx, [Hercx1]
- push cx
- call __pixeladdrHerc
- mov al, [__fgcolor]
- shl ax, cl
- not ah
- pop cx
- or al, al
- jz HERCpixVal0
- HERCvertLoop:
- test bp, [Herclstyle]
- jz HERCnoStore1
- or es:[bx], al
- HERCnoStore1:
- rol bp, 1
- add bx, si
- jns iLeave2
- add bx, di
- iLeave2:
- loop HERCvertLoop
- jmp near HERClineExit
- HERCpixVal0:
- test bp, [Herclstyle]
- jz HERCnoStore2
- and es:[bx], ah
- HERCnoStore2:
- rol bp, 1
- add bx, si
- jns iLeave3
- add bx, di
- iLeave3:
- loop HERCpixVal0
- jmp near HERClineExit
- HERClowSlope:
- mov ah, es:[bx]
- HERClowLoop:
- and ah, dh
- test bp, [Herclstyle]
- jz HERCnoStore3
- or ah, dl
- HERCnoStore3:
- rol bp, 1
- ror dl, 1
- ror dh, 1
- jnc HERCmaskLeft
- or di, di
- jns HERCdPos
- add di, [Hercinc1]
- loop HERClowLoop
- mov es:[bx], ah
- jmp HERClineExit
- HERCdPos:
- add di, [Hercinc2]
- mov es:[bx], ah
- add bx, si
- jns HERCnotLastInt
- add bx, [Hercleafinc]
- HERCnotLastInt:
- loop HERClowSlope
- jmp HERClineExit
- HERCmaskLeft:
- mov es:[bx], ah
- inc bx
- or di, di
- jns HERCdPos2
- add di, [Hercinc1]
- loop HERClowSlope
- jmp HERClineExit
- HERCdPos2:
- add di, [Hercinc2]
- add bx, si
- jns HERCnotLastInt2
- add bx, [Hercleafinc]
- HERCnotLastInt2:
- loop HERClowSlope
- jmp HERClineExit
- HERChighSlope:
- and es:[bx], dh
- test bp, [Herclstyle]
- jz HERCnoStore4
- or es:[bx], dl
- HERCnoStore4:
- rol bp, 1
- add bx, si
- jns HERCnotLastInt3
- add bx, [Hercleafinc]
- HERCnotLastInt3:
- or di, di
- jns HERCdPos3
- add di, [Hercinc1]
- loop HERChighSlope
- jmp HERClineExit
- HERCdPos3:
- add di, [Hercinc2]
- ror dl ,1
- ror dh, 1
- cmc
- adc bx, 0
- loop HERChighSlope
- HERClineExit:
- (*%F SameDS *)
- pop ds
- (*%E *)
- pop si
- pop di
- pop bp
- (*%F NearCall *)
- ret far 2
- (*%E *)
- (*%T NearCall *)
- ret 2
- (*%E *)
- public __HercLine :
- push bp
- mov bp, sp
- push di
- push si
- (*%F SameDS *)
- push ds
- mov si, _DATA
- mov ds, si
- (*%E *)
- call __lclip
- jc HERClineExit
- mov [Hercx1], ax
- mov [Hercy1], bx
- mov [Hercx2], cx
- mov [Hercy2], dx
- mov cx, [bp][frame]
- mov [Herclstyle], cx
- mov cx, ax
- and cl, 15
- mov bp, 1
- shl bp, cl
- mov si, 2000H
- mov di, 90-8000H
- mov cx, [Hercx2]
- sub cx, ax
- jz HERCverticalLine
- mov bx, [Hercy2]
- sub bx, [Hercy1]
- jns HERCposInc
- neg bx
- neg si
- neg di
- HERCposInc:
- mov [Hercleafinc], di
- mov word [Hercdraw], HERClowSlope
- cmp bx, cx
- jle HERCuseLowSlope
- mov word [Hercdraw], HERChighSlope
- xchg bx, cx
- HERCuseLowSlope:
- shl bx, 1
- mov [Hercinc1], bx
- sub bx, cx
- mov di, bx
- sub bx, cx
- mov [Hercinc2], bx
- push cx
- mov bx, [Hercx1]
- mov ax, [Hercy1]
- call __pixeladdrHerc
- mov al, [__fgcolor]
- shl ax, cl
- mov dx, ax
- not dh
- pop cx
- inc cx
- jmp [Hercdraw]
- (**************************************************************************)
- section
- (*%F NearCall *)
- segment Graphics_TEXT(CODE,28H)
- (*%E *)
- (*%T NearCall *)
- segment _TEXT(CODE,28H)
- (*%E *)
- segment _DATA(DATA, 28H)
- extrn __pixeladdrEGA2
- extrn __EGAxlat
- extrn __lclip
- select _DATA
- extrn __fgcolor
- extrn __width
- extrn __EGAtranslate
- EGAx1 : dw 0
- EGAy1 : dw 0
- EGAx2 : dw 0
- EGAy2 : dw 0
- EGAinc1 : dw 0
- EGAinc2 : dw 0
- EGAvertinc1 : dw 0
- EGAdraw : dw 0
- EGAcolor : dw 0
- EGAlstyle : dw 0
- EGAmaskbit : dw 0
- (*%F NearCall *)
- select Graphics_TEXT
- (*%E *)
- (*%T NearCall *)
- select _TEXT
- (*%E *)
- out byte dx, ax
- EGAverticalLine:
- mov cx, [EGAx1]
- and cl, 15
- mov bp, 1
- shl bp, cl
- mov ax, [EGAy1]
- mov bx, [EGAy2]
- mov cx, bx
- sub cx, ax
- jge EGAdPos
- neg cx
- mov ax, bx
- EGAdPos:
- inc cx
- mov bx, [EGAx1]
- push cx
- call __pixeladdrEGA2
- shl ah, cl
- mov al, 8
- (*%F FastIO *)
- extrn $OutWord
- call $OutWord
- (*%E *)
- (*%T FastIO *)
- out word dx, ax
- (*%E *)
- pop cx
- mov dx, [EGAlstyle]
- EGAvertLoop:
- test bp, dx
- jz EGAnoStore1
- or byte es:[bx], 0FFH
- EGAnoStore1:
- rol bp, 1
- add bx, si
- loop EGAvertLoop
- jmp near EGAlineExit
- EGAlowSlope:
- mov bp, [EGAinc1]
- EGAlowSlopeL:
- sub ah, ah
- EGAlowLoop:
- or ah, bl
- ror bl, 1
- jc EGAmaskLeft
- or si, si
- jns EGAdPos1
- add si, bp
- loop EGAlowLoop
- (*%F FastIO *)
- call $OutWord
- (*%E *)
- (*%T FastIO *)
- out word dx, ax
- (*%E *)
- or byte es:[di], 0FFH
- jmp near EGAlineExit
- EGAdPos1:
- add si, [EGAinc2]
- (*%F FastIO *)
- extrn $OutWord
- call $OutWord
- (*%E *)
- (*%T FastIO *)
- out word dx, ax
- (*%E *)
- or byte es:[di], 0FFH
- add di, [EGAvertinc1]
- loop EGAlowSlopeL
- jmp near EGAlineExit
- EGAmaskLeft:
- (*%F FastIO *)
- call $OutWord
- (*%E *)
- (*%T FastIO *)
- out word dx, ax
- (*%E *)
- or byte es:[di], 0FFH
- inc di
- or si, si
- jns EGAdPos2
- add si, bp
- loop EGAlowSlopeL
- jmp near EGAlineExit
- EGAdPos2:
- add si, [EGAinc2]
- add di, [EGAvertinc1]
- loop EGAlowSlopeL
- jmp near EGAlineExit
- EGAlowSlopeM:
- sub ah, ah
- EGAlowLoopM:
- push ax
- mov ax, [EGAmaskbit]
- test ax, [EGAlstyle]
- pop ax
- jz EGAnoStore3M
- or ah, bl
- EGAnoStore3M:
- rol word [EGAmaskbit], 1
- ror bl, 1
- jc EGAmaskLeftM
- or si, si
- jns EGAdPos1M
- add si, [EGAinc1]
- loop EGAlowLoopM
- (*%F FastIO *)
- extrn $OutWord
- call $OutWord
- (*%E *)
- (*%T FastIO *)
- out word dx, ax
- (*%E *)
- or byte es:[di], 0FFH
- jmp near EGAlineExit
- EGAdPos1M:
- add si, [EGAinc2]
- (*%F FastIO *)
- call $OutWord
- (*%E *)
- (*%T FastIO *)
- out word dx, ax
- (*%E *)
- or byte es:[di], 0FFH
- add di, [EGAvertinc1]
- loop EGAlowSlopeM
- jmp EGAlineExit
- EGAmaskLeftM:
- (*%F FastIO *)
- extrn $OutWord
- call $OutWord
- (*%E *)
- (*%T FastIO *)
- out word dx, ax
- (*%E *)
- or byte es:[di], 0FFH
- inc di
- or si, si
- jns EGAdPos2M
- add si, [EGAinc1]
- loop EGAlowSlopeM
- jmp EGAlineExit
- EGAdPos2M:
- add si, [EGAinc2]
- add di, [EGAvertinc1]
- loop EGAlowSlopeM
- jmp EGAlineExit
- EGAhighSlope:
- mov bp, [EGAinc1]
- mov bx, [EGAvertinc1]
- EGAhighLoop:
- (*%F FastIO *)
- call $OutWord
- (*%E *)
- (*%T FastIO *)
- out word dx, ax
- (*%E *)
- or byte es:[di], 0FFH
- add di, bx
- or si, si
- jns EGAdPos3
- add si, bp
- loop EGAhighLoop
- jmp EGAlineExit
- EGAdPos3:
- add si, [EGAinc2]
- ror ah, 1
- adc di, 0
- loop EGAhighLoop
- jmp EGAlineExit
- EGAhighSlopeM:
- mov bp, [EGAinc1]
- mov bx, [EGAvertinc1]
- EGAhighLoopM:
- push ax
- mov ax, [EGAmaskbit]
- test ax, [EGAlstyle]
- pop ax
- jz EGAnoStore4M
- (*%F FastIO *)
- call $OutWord
- (*%E *)
- (*%T FastIO *)
- out word dx, ax
- (*%E *)
- or byte es:[di], 0FFH
- EGAnoStore4M:
- rol word [EGAmaskbit], 1
- add di, bx
- or si, si
- jns EGAdPos3M
- add si, bp
- loop EGAhighLoopM
- jmp EGAlineExit
- EGAdPos3M:
- add si, [EGAinc2]
- ror ah, 1
- adc di, 0
- loop EGAhighLoopM
- EGAlineExit:
- mov dx, 3CEH
- sub ax, ax
- (*%F FastIO *)
- call $OutWord
- (*%E *)
- (*%T FastIO *)
- out word dx, ax
- (*%E *)
- inc ax
- (*%F FastIO *)
- call $OutWord
- (*%E *)
- (*%T FastIO *)
- out word dx, ax
- (*%E *)
- mov al, 3
- (*%F FastIO *)
- call $OutWord
- (*%E *)
- (*%T FastIO *)
- out word dx, ax
- (*%E *)
- mov ax, 0FF08H
- (*%F FastIO *)
- call $OutWord
- (*%E *)
- (*%T FastIO *)
- out word dx, ax
- (*%E *)
- noDraw:
- (*%F SameDS *)
- pop ds
- (*%E *)
- pop si
- pop di
- pop bp
- (*%F NearCall *)
- ret far 2
- (*%E *)
- (*%T NearCall *)
- ret 2
- (*%E *)
- public __EGALine :
- push bp
- mov bp, sp
- push di
- push si
- (*%F SameDS *)
- push ds
- mov si, _DATA
- mov ds, si
- (*%E *)
- call __lclip
- jc noDraw
- mov [EGAx1], ax
- mov [EGAy1], bx
- mov [EGAx2], cx
- mov [EGAy2], dx
- mov ax, [bp][frame]
- mov [EGAlstyle], ax
- mov ax, [__fgcolor]
- cmp byte [__EGAtranslate], 0
- jz notNeeded
- call __EGAxlat
- notNeeded:
- mov [EGAcolor], ax
- mov dx, 3CEH
- mov ax, 5H
- (*%F FastIO *)
- extrn $OutWord
- call $OutWord
- (*%E *)
- (*%T FastIO *)
- out word dx, ax
- (*%E *)
- mov ah, [EGAcolor]
- sub al, al
- (*%F FastIO *)
- call $OutWord
- (*%E *)
- (*%T FastIO *)
- out word dx, ax
- (*%E *)
- mov ax, 0FF01H
- (*%F FastIO *)
- call $OutWord
- (*%E *)
- (*%T FastIO *)
- out word dx, ax
- (*%E *)
- mov al, 3
- mov ah, 0
- (*%F FastIO *)
- call $OutWord
- (*%E *)
- (*%T FastIO *)
- out word dx, ax
- (*%E *)
- mov si, [__width]
- mov cx, [EGAx2]
- mov ax, [EGAx1]
- sub cx, ax
- jz EGAverticalLine
- mov bx, [EGAy2]
- sub bx, [EGAy1]
- jns EGAposInc
- neg bx
- neg si
- EGAposInc:
- mov [EGAvertinc1], si
- cmp bx, cx
- jle EGAuseLowSlope
- mov bp, 1
- xchg bx, cx
- jmp EGAgotSlope
- EGAuseLowSlope:
- mov bp, 2
- EGAgotSlope:
- shl bx, 1
- mov [EGAinc1], bx
- sub bx, cx
- mov si, bx
- sub bx, cx
- mov [EGAinc2], bx
- push cx
- mov bx, [EGAx1]
- mov ax, [EGAy1]
- call __pixeladdrEGA2
- mov di, bx
- shl ah, cl
- mov bl, ah
- mov al, 8
- pop cx
- inc cx
- cmp word [EGAlstyle], -1
- jne EGAMaskSet
- cmp bp, 1
- je EGAhighSlope
- jmp EGAlowSlope
- EGAMaskSet:
- mov [EGAdraw], bp
- push cx
- mov cx, [EGAx1]
- and cl, 15
- mov bp, 1
- shl bp, cl
- mov [EGAmaskbit], bp
- pop cx
- cmp byte [EGAdraw], 1
- je EGAhighSlopeM
- jmp EGAlowSlopeM
- (**************************************************************************)
- section
- (*%F NearCall *)
- segment Graphics_TEXT(CODE,28H)
- (*%E *)
- (*%T NearCall *)
- segment _TEXT(CODE,28H)
- (*%E *)
- segment _DATA(DATA, 28H)
- extrn __pixeladdrEGA2
- extrn __lclip
- select _DATA
- extrn __fgcolor
- extrn __width
- EGA2x1 : dw 0
- EGA2y1 : dw 0
- EGA2x2 : dw 0
- EGA2y2 : dw 0
- EGA2inc1 : dw 0
- EGA2inc2 : dw 0
- EGA2draw : dw 0
- EGA2lstyle : dw 0
- propPix : db 0, 0FFH
- (*%F NearCall *)
- select Graphics_TEXT
- (*%E *)
- (*%T NearCall *)
- select _TEXT
- (*%E *)
- rotate:
- push cx
- push ax
- mov cx, 1
- mov si, 8000H
- sub ax, ax
- rotLoop:
- test bx, cx
- jz zeroBit
- or ax, si
- zeroBit:
- shr si, 1
- shl cx, 1
- jc rotDone
- jmp rotLoop
- rotDone:
- mov bx, ax
- pop ax
- pop cx
- ret 0
- EGA2verticalLine:
- mov cx, [EGA2x1]
- and cl, 15
- mov bp, 1
- shl bp, cl
- mov ax, [EGA2y1]
- mov bx, [EGA2y2]
- mov cx, bx
- sub cx, ax
- jge EGA2dPos
- neg cx
- mov ax, bx
- EGA2dPos:
- inc cx
- mov bx, [EGA2x1]
- push cx
- call __pixeladdrEGA2
- mov al, [__fgcolor]
- shl ax, cl
- not ah
- pop cx
- mov dx, [EGA2lstyle]
- or al, al
- jz EGA2vertLoop2
- EGA2vertLoop1:
- test bp, dx
- jz EGA2noStore1
- or es:[bx], al
- EGA2noStore1:
- rol bp, 1
- add bx, si
- loop EGA2vertLoop1
- jmp near EGA2lineExit
- EGA2vertLoop2:
- test bp, dx
- jz EGA2noStore2
- and es:[bx], ah
- EGA2noStore2:
- rol bp, 1
- add bx, si
- loop EGA2vertLoop2
- jmp near EGA2lineExit
- EGA2horiz:
- mov ax, [EGA2y1]
- mov bx, [EGA2x1]
- call __pixeladdrEGA2
- mov di, bx
- mov dh, ah
- not dh
- mov dl, 0FFH
- shl dh, cl
- not dh
- mov cx, [EGA2x2]
- and cl, 7
- xor cl, 7
- shl dl, cl
- mov ax, [EGA2x2]
- mov bx, [EGA2x1]
- mov cl, 3
- shr ax, cl
- shr bx, cl
- mov cx, ax
- sub cx, bx
- mov bx, propPix
- mov al, [__fgcolor]
- xlat
- mov bx, [EGA2lstyle]
- call rotate
- test di, 1
- jz maskSetOK
- xchg bh, bl
- maskSetOK:
- mov bp, ax
- and al, bh
- or dh, dh
- js fullByte
- or cx, cx
- jnz multiByte
- and dl, dh
- jmp lastByte
- multiByte:
- mov ah, al
- and ah, dh
- not dh
- and es:[di], dh
- or es:[di], ah
- inc di
- dec cx
- fullByte:
- mov ax, bp
- xchg bh, bl
- and al, bh
- jcxz lastByte
- stosb
- loop fullByte
- lastByte:
- and al, dl
- not dl
- and es:[di], dl
- or es:[di], al
- jmp near EGA2lineExit
- EGA2lowSlope:
- mov bp, [EGA2inc1]
- EGA2lowSlopeL:
- mov ah, es:[bx]
- EGA2lowLoop:
- and ah, dh
- or ah, dl
- ror dl, 1
- ror dh, 1
- jnc EGA2maskLeft
- or di, di
- jns EGA2dPos1
- add di, bp
- loop EGA2lowLoop
- mov es:[bx], ah
- jmp near EGA2lineExit
- EGA2dPos1:
- add di, [EGA2inc2]
- mov es:[bx], ah
- add bx, si
- loop EGA2lowSlopeL
- jmp near EGA2lineExit
- EGA2maskLeft:
- mov es:[bx], ah
- inc bx
- or di, di
- jns EGA2dPos2
- add di, bp
- loop EGA2lowSlopeL
- jmp near EGA2lineExit
- EGA2dPos2:
- add di, [EGA2inc2]
- add bx, si
- loop EGA2lowSlopeL
- jmp near EGA2lineExit
- EGA2lowSlopeM:
- mov ah, es:[bx]
- EGA2lowLoopM:
- and ah, dh
- test bp, [EGA2lstyle]
- jz EGA2noStore3
- or ah, dl
- EGA2noStore3:
- rol bp, 1
- ror dl, 1
- ror dh, 1
- jnc EGA2maskLeftM
- or di, di
- jns EGA2dPos1M
- add di, [EGA2inc1]
- loop EGA2lowLoopM
- mov es:[bx], ah
- jmp EGA2lineExit
- EGA2dPos1M:
- add di, [EGA2inc2]
- mov es:[bx], ah
- add bx, si
- loop EGA2lowSlopeM
- jmp EGA2lineExit
- EGA2maskLeftM:
- mov es:[bx], ah
- inc bx
- or di, di
- jns EGA2dPos2M
- add di, [EGA2inc1]
- loop EGA2lowSlopeM
- jmp EGA2lineExit
- EGA2dPos2M:
- add di, [EGA2inc2]
- add bx, si
- loop EGA2lowSlopeM
- jmp EGA2lineExit
- EGA2highSlope:
- mov bp, [EGA2inc1]
- EGA2highSlopeL:
- and es:[bx], dh
- or es:[bx], dl
- add bx, si
- or di, di
- jns EGA2dPos3
- add di, bp
- loop EGA2highSlopeL
- jmp EGA2lineExit
- EGA2dPos3:
- add di, [EGA2inc2]
- ror dl, 1
- ror dh, 1
- cmc
- adc bx, 0
- loop EGA2highSlopeL
- jmp EGA2lineExit
- EGA2highSlopeM:
- and es:[bx], dh
- test bp, [EGA2lstyle]
- jz EGA2noStore4
- or es:[bx], dl
- EGA2noStore4:
- rol bp, 1
- add bx, si
- or di, di
- jns EGA2dPos3M
- add di, [EGA2inc1]
- loop EGA2highSlopeM
- jmp EGA2lineExit
- EGA2dPos3M:
- add di, [EGA2inc2]
- ror dl, 1
- ror dh, 1
- cmc
- adc bx, 0
- loop EGA2highSlopeM
- EGA2lineExit:
- (*%F SameDS *)
- pop ds
- (*%E *)
- pop si
- pop di
- pop bp
- (*%F NearCall *)
- ret far 2
- (*%E *)
- (*%T NearCall *)
- ret 2
- (*%E *)
- public __EGA2Line :
- push bp
- mov bp, sp
- push di
- push si
- (*%F SameDS *)
- push ds
- mov si, _DATA
- mov ds, si
- (*%E *)
- call __lclip
- jc EGA2lineExit
- mov [EGA2x1], ax
- mov [EGA2y1], bx
- mov [EGA2x2], cx
- mov [EGA2y2], dx
- mov ax, [bp][frame]
- mov [EGA2lstyle], ax
- mov si, 80
- mov cx, [EGA2x2]
- mov ax, [EGA2x1]
- sub cx, ax
- jz EGA2verticalLine
- mov bx, [EGA2y2]
- sub bx, [EGA2y1]
- je EGA2horiz
- jns EGA2posInc
- neg bx
- neg si
- EGA2posInc:
- cmp bx, cx
- jle EGA2useLowSlope
- mov bp, 1
- xchg bx, cx
- jmp EGA2gotSlope
- EGA2useLowSlope:
- mov bp, 2
- EGA2gotSlope:
- shl bx, 1
- mov [EGA2inc1], bx
- sub bx, cx
- mov di, bx
- sub bx, cx
- mov [EGA2inc2], bx
- push cx
- mov bx, [EGA2x1]
- mov ax, [EGA2y1]
- call __pixeladdrEGA2
- mov al, [__fgcolor]
- shl ax, cl
- mov dx, ax
- not dh
- pop cx
- inc cx
- cmp word [EGA2lstyle], -1
- jne EGA2MaskSet
- cmp bp, 1
- je EGA2highSlope
- jmp EGA2lowSlope
- EGA2MaskSet:
- mov [EGA2draw], bp
- push cx
- mov cx, [EGA2x1]
- and cl, 15
- mov bp, 1
- shl bp, cl
- pop cx
- cmp byte [EGA2draw], 1
- je EGA2highSlopeM
- jmp EGA2lowSlopeM
- (**************************************************************************)
- section
- (*%F NearCall *)
- segment Graphics_TEXT(CODE,28H)
- (*%E *)
- (*%T NearCall *)
- segment _TEXT(CODE,28H)
- (*%E *)
- segment _DATA(DATA, 28H)
- (*%F NearCall *)
- select Graphics_TEXT
- (*%E *)
- (*%T NearCall *)
- select _TEXT
- (*%E *)
- public __VGAPoint :
- (*%T _DLLOVL *)
- push bp
- mov bp, sp
- (*%E *)
- mov cx, ax
- mov ax, 320
- mul bx
- add ax, cx
- mov bx, ax
- (*%T _XTD *)
- extrn __A000h
- mov ax, __A000h
- (*%E *)
- (*%F _XTD *)
- mov ax, 0A000H
- (*%E *)
- mov es, ax
- mov al, es:[bx]
- sub ah, ah
- (*%T _DLLOVL *)
- pop bp
- (*%E *)
- (*%F NearCall *)
- ret far 0
- (*%E *)
- (*%T NearCall *)
- ret 0
- (*%E *)
- (**************************************************************************)
- section
- (*%F NearCall *)
- segment Graphics_TEXT(CODE,28H)
- (*%E *)
- (*%T NearCall *)
- segment _TEXT(CODE,28H)
- (*%E *)
- segment _DATA(DATA, 28H)
- (*%F NearCall *)
- select Graphics_TEXT
- (*%E *)
- (*%T NearCall *)
- select _TEXT
- (*%E *)
- (*
- void VGAGet(unsigned char *buffer, short x1, y1, x2, y2);
- *)
- buffer = frame
- x1 = 4+frame
- y1 = 6+frame
- x2 = 8+frame
- y2 = 10+frame
- len = -2
- incr = -4
- pixAddress= -6
- byteShift = -7
- locals = 7
- public __VGAGet :
- push bp
- mov bp, sp
- sub sp, locals
- push di
- push si
- push ds
- les di, [bp][buffer]
- (*%T _XTD *)
- extrn __A000h
- mov ax, __A000h
- (*%E *)
- (*%F _XTD *)
- mov ax, 0A000H
- (*%E *)
- mov ds, ax
- mov ax, [bp][y1]
- mov dx, 320
- mul dx
- add ax, [bp][x1]
- mov si, ax
- mov ax, [bp][x2] (* cols *)
- sub ax, [bp][x1]
- inc ax
- push ax
- mov cl, 3
- shl ax, cl
- stosw
- mov ax, [bp][y2] (* rows *)
- sub ax, [bp][y1]
- inc ax
- mov cx, ax
- stosw
- mov bx, 320
- pop ax
- getRowLoop:
- push cx
- mov dx, si
- mov cx, ax
- shr cx, 1
- rep ; movsw
- adc cx, cx
- rep ; movsb
- mov si, dx
- add si, bx
- pop cx
- loop getRowLoop
- pop ds
- pop si
- pop di
- mov sp, bp
- pop bp
- (*%F NearCall *)
- ret far 0
- (*%E *)
- (*%T NearCall *)
- ret 0
- (*%E *)
- (**************************************************************************)
- section
- (*%F NearCall *)
- segment Graphics_TEXT(CODE,28H)
- (*%E *)
- (*%T NearCall *)
- segment _TEXT(CODE,28H)
- (*%E *)
- segment _DATA(DATA, 28H)
- (*%F NearCall *)
- select Graphics_TEXT
- (*%E *)
- (*%T NearCall *)
- select _TEXT
- (*%E *)
- x1 = frame
- y1 = 2+frame
- buffer = 4+frame
- action = 8+frame
- len = -2
- incr = -4
- rows = -6
- bitOp = -8
- pixAddress = -10
- locals = 10
- public __VGAPut :
- push bp
- mov bp, sp
- sub sp, locals
- push di
- push si
- push ds
- lds si, [bp][buffer]
- lodsw
- mov [bp][len], ax
- mov cl, 3
- shr ax, cl
- mov [bp][len], ax
- lodsw
- mov [bp][rows], ax
- (*%T _XTD *)
- extrn __A000h
- mov ax, __A000h
- (*%E *)
- (*%F _XTD *)
- mov ax, 0A000H
- (*%E *)
- mov es, ax
- mov ax, [bp][y1]
- mov dx, 320
- mul dx
- add ax, [bp][x1]
- mov di, ax
- mov ax, [bp][action]
- mov cx, [bp][rows]
- mov bx, 320
- or ax, ax
- jz __OR
- dec ax
- or ax, ax
- jz __AND
- dec ax
- or ax, ax
- jz __RESET
- dec ax
- or ax, ax
- jz __SET
- dec ax
- or ax, ax
- jz __XOR
- setExit:
- pop ds
- pop si
- pop di
- mov sp, bp
- pop bp
- (*%F NearCall *)
- ret far 0
- (*%E *)
- (*%T NearCall *)
- ret 0
- (*%E *)
- __OR:
- orRowLoop:
- push cx
- mov dx, di
- mov cx, [bp][len]
- orColLoop:
- lodsb
- or ax, es:[di]
- stosb
- loop orColLoop
- mov di, dx
- add di, bx
- pop cx
- loop orRowLoop
- jmp setExit
- __AND:
- andRowLoop:
- push cx
- mov dx, di
- mov cx, [bp][len]
- andColLoop:
- lodsb
- and es:[di], al
- inc di
- loop andColLoop
- mov di, dx
- add di, bx
- pop cx
- loop andRowLoop
- jmp setExit
- __RESET:
- resetRowLoop:
- push cx
- mov dx, di
- mov cx, [bp][len]
- resetColLoop:
- lodsb
- not al
- stosb
- loop resetColLoop
- mov di, dx
- add di, bx
- pop cx
- loop resetRowLoop
- jmp setExit
- __SET:
- setRowLoop:
- push cx
- mov dx, di
- mov cx, [bp][len]
- rep; movsb
- mov di, dx
- add di, bx
- pop cx
- loop setRowLoop
- jmp setExit
- __XOR:
- xorRowLoop:
- push cx
- mov dx, di
- mov cx, [bp][len]
- xorColLoop:
- lodsb
- xor es:[di], al
- inc di
- loop xorColLoop
- mov di, dx
- add di, bx
- pop cx
- loop xorRowLoop
- jmp setExit
- (**************************************************************************)
- section
- (*%F NearCall *)
- segment Graphics_TEXT(CODE,28H)
- (*%E *)
- (*%T NearCall *)
- segment _TEXT(CODE,28H)
- (*%E *)
- segment _DATA(DATA, 28H)
- extrn __pixeladdrEGA
- select _DATA
- extrn __width
- extrn __EGAPlaneShift
- extrn __EGAStartPlane
- (*%F NearCall *)
- select Graphics_TEXT
- (*%E *)
- (*%T NearCall *)
- select _TEXT
- (*%E *)
- (****Move from selector for a huge selector to the next****)
- (* Input : Selector on stack *)
- (* Output : Selector on stack, all regs preserved *)
- (* Internal routine, always near called *)
- extrn __hugeshift
- public @next_seg:
- push bp
- mov bp,sp
- push ax
- (*%F SameDS *)
- push ds
- mov ax, seg __hugeshift
- mov ds, ax
- (*%E *)
- mov ax,[__hugeshift]
- add [bp][4],ax
- (*%F SameDS *)
- pop ds
- (*%E *)
- pop ax
- pop bp
- ret 0
- (*
- void EGAGet(unsigned char *buffer, short x1, y1, x2, y2);
- *)
- buffer = frame
- x1 = 4+frame
- y1 = 6+frame
- x2 = 8+frame
- y2 = 10+frame
- BytesPerRow = -2
- len = -4
- rows = -6
- EGAPlaneShift = -8
- EGAStartPlane = -10
- locals = 10
- ByteShift = 3
- public __EGAGet :
- push bp
- mov bp, sp
- sub sp, locals
- push di
- push si
- push ds
- (*%F SameDS *)
- mov ax, _DATA
- mov ds, ax
- (*%E *)
- mov ax, [__EGAPlaneShift]
- mov [bp][EGAPlaneShift], ax
- mov ax, [__EGAStartPlane]
- mov [bp][EGAStartPlane], ax
- mov ax, [__width]
- mov [bp][BytesPerRow], ax
- mov ax, [bp][x2]
- sub ax, [bp][x1]
- mov cx, 0FF07H
- and cl, al
- xor cl, 7
- shl ch, cl
- mov cl, ch
- push cx
- mov cl, ByteShift
- shr ax, cl
- inc ax
- push ax
- mov ax, [bp][y2]
- sub ax, [bp][y1]
- inc ax
- push ax
- (* setup addressing *)
- mov ax, [bp][y1]
- mov bx, [bp][x1]
- call __pixeladdrEGA
- xor cl, 7
- mov si, es
- mov ds, si
- mov si, bx
- les di, [bp][buffer]
- (* build header *)
- pop ax
- mov [bp][rows], ax
- stosw
- pop ax
- mov [bp][len], ax
- stosb
- pop ax
- mov ch, al
- stosb
- (* setup controller *)
- mov dx, 3CEH
- mov al, 5
- out byte dx, al
- sub al, al
- inc dx
- out byte dx, al
- dec dx
- mov al, 4H
- out byte dx, al
- mov al, [bp][EGAStartPlane]
- mov ah, [bp][EGAPlaneShift]
- inc dx
- getPlaneLoop:
- out byte dx, al
- push ax
- push [bp][rows]
- push si
- op2:
- mov bx, [bp][len]
- push si
- op3:
- lodsw
- dec si
- rol ax, cl
- stosb
- or di, di
- jnz inSeg
- push es
- call @next_seg
- pop es
- inSeg:
- dec bx
- jnz op3
- and es:[di][-1], ch
- pop si
- add si, [bp][BytesPerRow]
- dec word [bp][rows]
- jnz op2
- pop si
- pop [bp][rows]
- pop ax
- sub al, ah
- jns getPlaneLoop
- pop ds
- pop si
- pop di
- mov sp, bp
- pop bp
- (*%F NearCall *)
- ret far 0
- (*%E *)
- (*%T NearCall *)
- ret 0
- (*%E *)
- (**************************************************************************)
- section
- (*%F NearCall *)
- segment Graphics_TEXT(CODE,28H)
- (*%E *)
- (*%T NearCall *)
- segment _TEXT(CODE,28H)
- (*%E *)
- segment _DATA(DATA, 28H)
- extrn __EGArexlat
- select _DATA
- extrn __width
- extrn __page_size
- extrn __active_page
- extrn __EGAPlaneShift
- extrn __EGAStartPlane
- extrn __EGA64K
- extrn __EGAtranslate
- (*%F NearCall *)
- select Graphics_TEXT
- (*%E *)
- (*%T NearCall *)
- select _TEXT
- (*%E *)
- public __EGAPoint :
- (*%T _DLLOVL *)
- push bp
- mov bp, sp
- (*%E *)
- push si
- (*%F SameDS *)
- push ds
- mov si, _DATA
- mov ds, si
- (*%E *)
- mov cx, ax
- and cx, 7
- mov ch, 80H
- shr ch, cl
- mov cl, ch (* cl = mask *)
- (*%T _XTD *)
- db 0C1H,0F8H,003H (*I shr ax, 3 *)
- (*%E *)
- (*%F _XTD *)
- shr ax, 1
- shr ax, 1
- shr ax, 1
- (*%E *)
- mov si, ax
- mov ax, [__width]
- mul bx
- add si, ax (* offset *)
- mov ax, [__active_page]
- mul word [__page_size]
- (*%T _XTD *)
- db 0C1H,0E0H,004H (*I shl ax, 4 *)
- add si, ax
- extrn __A000h
- mov ax, __A000h
- (*%E *)
- (*%F _XTD *)
- add ax, 0A000H
- (*%E *)
- mov es, ax (* segment *)
- mov dx, 03CEH
- mov ax, 5
- (*%F FastIO *)
- extrn $OutWord
- call $OutWord
- (*%E *)
- (*%T FastIO *)
- out word dx, ax
- (*%E *)
- mov al, 4
- out byte dx, al
- inc dx
- cmp byte [__EGA64K], 0
- je fullEGA
- mov ax, 1
- and ax, si
- add ax, [__EGAStartPlane]
- jmp gotPlane
- fullEGA:
- mov ax, [__EGAStartPlane]
- gotPlane:
- mov bl, [__EGAPlaneShift]
- readLoop:
- out byte dx, al
- mov ch, es:[si]
- and ch, cl
- neg ch
- rcl ah, 1
- sub al, bl
- jns readLoop
- mov al, ah
- sub ah, ah
- (*%F SameDS *)
- pop ds
- (*%E *)
- pop si
- (*%T _DLLOVL *)
- pop bp
- (*%E *)
- (*%F NearCall *)
- ret far 0
- (*%E *)
- (*%T NearCall *)
- ret 0
- (*%E *)
- (**************************************************************************)
- section
- (*%F NearCall *)
- segment Graphics_TEXT(CODE,28H)
- (*%E *)
- (*%T NearCall *)
- segment _TEXT(CODE,28H)
- (*%E *)
- segment _DATA(DATA, 28H)
- select _DATA
- extrn __width
- extrn __page_size
- extrn __active_page
- (*%F NearCall *)
- select Graphics_TEXT
- (*%E *)
- (*%T NearCall *)
- select _TEXT
- (*%E *)
- public __EGA2Point :
- (*%T _DLLOVL *)
- push bp
- mov bp, sp
- (*%E *)
- push si
- (*%F SameDS *)
- push ds
- mov si, _DATA
- mov ds, si
- (*%E *)
- mov cx, ax
- and cl, 7
- xor cl, 7
- (*%T _XTD *)
- db 0C1H,0F8H,003H (*I shr ax, 3 *)
- (*%E *)
- (*%F _XTD *)
- shr ax, 1
- shr ax, 1
- shr ax, 1
- (*%E *)
- mov si, ax
- mov ax, [__width]
- mul bx
- add si, ax (* offset *)
- mov ax, [__active_page]
- mul word [__page_size]
- (*%T _XTD *)
- db 0C1H,0E0H,004H (*I shl ax, 4 *)
- add si, ax
- extrn __A000h
- mov ax, __A000h
- (*%E *)
- (*%F _XTD *)
- add ax, 0A000H
- (*%E *)
- mov es, ax (* segment *)
- mov al, es:[si]
- shr al, cl
- and ax, 1
- (*%F SameDS *)
- pop ds
- (*%E *)
- pop si
- (*%T _DLLOVL *)
- pop bp
- (*%E *)
- (*%F NearCall *)
- ret far 0
- (*%E *)
- (*%T NearCall *)
- ret 0
- (*%E *)
- (**************************************************************************)
- section
- (*%F NearCall *)
- segment Graphics_TEXT(CODE,28H)
- (*%E *)
- (*%T NearCall *)
- segment _TEXT(CODE,28H)
- (*%E *)
- segment _DATA(DATA, 28H)
- select _DATA
- extrn __EGA64K
- EGAtable1 : db 0, 1, 4, 5
- EGAtable2 : db 0, 3, 0CH, 0FH
- (*%F NearCall *)
- select Graphics_TEXT
- (*%E *)
- (*%T NearCall *)
- select _TEXT
- (*%E *)
- public __EGAxlat :
- (*%T _DLLOVL *)
- push bp
- mov bp, sp
- (*%E *)
- (*%F SameDS *)
- push ds
- mov bx, _DATA
- mov ds, bx
- (*%E *)
- cmp byte [__EGA64K], 0
- je XfullEGA
- mov bx, EGAtable2
- jmp gotTable
- XfullEGA:
- mov bx, EGAtable1
- gotTable:
- xlat
- (*%F SameDS *)
- pop ds
- (*%E *)
- (*%T _DLLOVL *)
- pop bp
- (*%E *)
- (*%F NearCall *)
- ret far 0
- (*%E *)
- (*%T NearCall *)
- ret 0
- (*%E *)
- (**************************************************************************)
- section
- (*%F NearCall *)
- segment Graphics_TEXT(CODE,28H)
- (*%E *)
- (*%T NearCall *)
- segment _TEXT(CODE,28H)
- (*%E *)
- segment _DATA(DATA, 28H)
- select _DATA
- extrn __EGA64K
- EGAtable1 : db 0, 1, 0, 2, 0, 3
- EGAtable2 : db 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 4
- (*%F NearCall *)
- select Graphics_TEXT
- (*%E *)
- (*%T NearCall *)
- select _TEXT
- (*%E *)
- public __EGArexlat :
- (*%T _DLLOVL *)
- push bp
- mov bp, sp
- (*%E *)
- (*%F SameDS *)
- push ds
- mov bx, _DATA
- mov ds, bx
- (*%E *)
- cmp byte [__EGA64K], 0
- je XfullEGA
- mov bx, EGAtable2
- jmp gotTable
- XfullEGA:
- mov bx, EGAtable1
- gotTable:
- xlat
- (*%F SameDS *)
- pop ds
- (*%E *)
- (*%T _DLLOVL *)
- pop bp
- (*%E *)
- (*%F NearCall *)
- ret far 0
- (*%E *)
- (*%T NearCall *)
- ret 0
- (*%E *)
- (**************************************************************************)
- section
- (*%F NearCall *)
- segment Graphics_TEXT(CODE,28H)
- (*%E *)
- (*%T NearCall *)
- segment _TEXT(CODE,28H)
- (*%E *)
- segment _DATA(DATA, 28H)
- extrn __EGAxlat
- select _DATA
- extrn __width
- extrn __page_size
- extrn __active_page
- extrn __EGAtranslate
- (*%F NearCall *)
- select Graphics_TEXT
- (*%E *)
- (*%T NearCall *)
- select _TEXT
- (*%E *)
- public __EGAPlot1 : (* doesn't translate pixel value *)
- (*%T _DLLOVL *)
- push bp
- mov bp, sp
- (*%E *)
- push si
- jmp notNeeded
- public __EGAPlot :
- (*%T _DLLOVL *)
- push bp
- mov bp, sp
- (*%E *)
- push si
- (*%F SameDS *)
- push ds
- mov si, _DATA
- mov ds, si
- (*%E *)
- cmp byte [__EGAtranslate], 0
- jz notNeeded
- push ax
- push bx
- mov ax, cx
- call __EGAxlat
- mov cx, ax
- pop bx
- pop ax
- notNeeded:
- push cx
- mov cx, ax
- and cx, 7
- mov ch, 80H
- shr ch, cl
- mov cl, ch (* cl = mask *)
- (*%T _XTD *)
- db 0C1H,0F8H,003H (*I shr ax, 3 *)
- (*%E *)
- (*%F _XTD *)
- shr ax, 1
- shr ax, 1
- shr ax, 1
- (*%E *)
- mov si, ax
- mov ax, [__width]
- mul bx
- add si, ax (* offset *)
- mov ax, [__active_page]
- mul word [__page_size]
- (*%T _XTD *)
- db 0C1H,0E0H,004H (*I shl ax, 4 *)
- add si, ax
- extrn __A000h
- mov ax, __A000h
- (*%E *)
- (*%F _XTD *)
- add ax, 0A000H
- (*%E *)
- mov es, ax (* segment *)
- pop bx (* cx = mask, bx = col *)
- mov dx, 03CEH
- mov ax, 205H
- (*%F FastIO *)
- extrn $OutWord
- call $OutWord
- (*%E *)
- (*%T FastIO *)
- out word dx, ax
- (*%E *)
- mov al, 8
- mov ah, cl
- (*%F FastIO *)
- call $OutWord
- (*%E *)
- (*%T FastIO *)
- out word dx, ax
- (*%E *)
- xchg bl, es:[si]
- mov ah, 0FFH
- (*%F FastIO *)
- call $OutWord
- (*%E *)
- (*%T FastIO *)
- out word dx, ax
- (*%E *)
- mov ax, 5
- (*%F FastIO *)
- call $OutWord
- (*%E *)
- (*%T FastIO *)
- out word dx, ax
- (*%E *)
- (*%F SameDS *)
- pop ds
- (*%E *)
- pop si
- (*%T _DLLOVL *)
- pop bp
- (*%E *)
- (*%F NearCall *)
- ret far 0
- (*%E *)
- (*%T NearCall *)
- ret 0
- (*%E *)
- (**************************************************************************)
- section
- (*%F NearCall *)
- segment Graphics_TEXT(CODE,28H)
- (*%E *)
- (*%T NearCall *)
- segment _TEXT(CODE,28H)
- (*%E *)
- segment _DATA(DATA, 28H)
- extrn __EGAxlat
- select _DATA
- extrn __width
- extrn __page_size
- extrn __active_page
- (*%F NearCall *)
- select Graphics_TEXT
- (*%E *)
- (*%T NearCall *)
- select _TEXT
- (*%E *)
- public __EGA2Plot :
- (*%T _DLLOVL *)
- push bp
- mov bp, sp
- (*%E *)
- push si
- (*%F SameDS *)
- push ds
- mov si, _DATA
- mov ds, si
- (*%E *)
- mov dx, cx
- mov cx, ax
- and cl, 7
- xor cl, 7
- shl dl, cl
- mov cl, dl
- (*%T _XTD *)
- db 0C1H,0F8H,003H (*I shr ax, 3 *)
- (*%E *)
- (*%F _XTD *)
- shr ax, 1
- shr ax, 1
- shr ax, 1
- (*%E *)
- mov si, ax
- mov ax, [__width]
- mul bx
- add si, ax (* offset *)
- mov ax, [__active_page]
- mul word [__page_size]
- (*%T _XTD *)
- db 0C1H,0E0H,004H (*I shl ax, 4 *)
- add si, ax
- extrn __A000h
- mov ax, __A000h
- (*%E *)
- (*%F _XTD *)
- add ax, 0A000H
- (*%E *)
- mov es, ax (* segment *)
- or es:[si], cl
- (*%F SameDS *)
- pop ds
- (*%E *)
- pop si
- (*%T _DLLOVL *)
- pop bp
- (*%E *)
- (*%F NearCall *)
- ret far 0
- (*%E *)
- (*%T NearCall *)
- ret 0
- (*%E *)
- (**************************************************************************)
- section
- (*%F NearCall *)
- segment Graphics_TEXT(CODE,28H)
- (*%E *)
- (*%T NearCall *)
- segment _TEXT(CODE,28H)
- (*%E *)
- segment _DATA(DATA, 28H)
- extrn __pixeladdrEGA
- extrn __resetEGA
- extrn __EGAPlaneShift
- extrn __EGAStartPlane
- select _DATA
- extrn __width
- actionTable : db 10H, 8H, 0H, 0H, 18H
- (*%F NearCall *)
- select Graphics_TEXT
- (*%E *)
- (*%T NearCall *)
- select _TEXT
- (*%E *)
- x1 = frame
- y1 = 2+frame
- buffer = 4+frame
- action = 8+frame
- BytesPerRow = -2
- len = -4
- rows = -6
- rowcount = -8
- startmask = -10
- endmaskL = -12
- endmaskR = -14
- RMWBits = -16
- NotFlag = -18
- EGAPlaneShift = -20
- EGAStartPlane = -22
- locals = 22
- _GPRESET = 2
- ByteShift = 3
- public __EGAPut :
- push bp
- mov bp, sp
- sub sp, locals
- push di
- push si
- push ds
- (*%F SameDS *)
- mov ax, _DATA
- mov ds, ax
- (*%E *)
- mov ax, [__EGAPlaneShift]
- mov [bp][EGAPlaneShift], ax
- mov ax, [__EGAStartPlane]
- mov [bp][EGAStartPlane], ax
- mov ax, [__width]
- mov [bp][BytesPerRow], ax
- mov al, [bp][action]
- cmp al, _GPRESET
- jnz selectMode
- mov byte [bp][RMWBits], 0
- mov byte [bp][NotFlag], 1
- jmp modeSelected
- selectMode:
- mov bx, actionTable
- xlat
- mov [bp][RMWBits], ax
- mov byte [bp][NotFlag], 0
- modeSelected:
- mov ax, [bp][y1] (* setup addressing *)
- mov bx, [bp][x1]
- call __pixeladdrEGA
- inc cl
- and cl, 7
- mov di, bx
- lds si, [bp][buffer]
- (* get header *)
- lodsw
- mov [bp][rows], ax
- lodsb
- sub ah, ah
- mov [bp][len], ax
- lodsb
- mov ch, al
- (* setup controller *)
- mov dx, 3CEH
- mov al, 3
- out byte dx, al
- inc dx
- mov al, [bp][RMWBits]
- out byte dx, al
- dec dx
- mov al, 5H
- out byte dx, al
- inc dx
- mov al, 8
- out byte dx, al
- dec dx
- mov al, 7H
- out byte dx, al
- inc dx
- mov al, 0
- out byte dx, al
- dec dx
- mov dl, 0C4H
- mov al, 2H
- mov ah, 1
- push cx
- mov cl, [bp][EGAStartPlane]
- shl ah, cl
- pop cx
- cmp cx, 0FF00H
- jne op15
- (* byte aligned blocks *)
- mov cx, [bp][len]
- op10:
- (*%F FastIO *)
- extrn $OutWord
- call $OutWord
- (*%E *)
- (*%T FastIO *)
- out word dx, ax
- (*%E *)
- push ax
- push di
- mov bx, [bp][rows]
- mov ah, [bp][NotFlag]
- op11:
- push di
- push cx
- op12:
- lodsb
- or si, si
- jnz inSeg1
- push ds
- extrn @next_seg
- call @next_seg
- pop ds
- inSeg1:
- or ah, ah
- jz EGApStore
- not al
- EGApStore:
- and es:[di], al
- inc di
- loop op12
- pop cx
- pop di
- add di, [bp][BytesPerRow]
- dec bx
- jnz op11
- pop di
- pop ax
- push cx
- mov cl, [bp][EGAPlaneShift]
- shr ah, cl
- pop cx
- jnz op10
- jmp near EGAPutExit
- op15: (* non aligned blocks *)
- push ax
- mov bx, 0FFH
- mov al, ch
- cbw
- cmp word [bp][len], 1
- jne op16
- mov bl, ch
- mov ah, ch
- sub al, al
- op16:
- shl ax, cl
- shl bx, cl
- mov bl, al
- mov al, 8
- mov [bp][endmaskL], ax
- mov ah, bl
- mov [bp][endmaskR], ax
- mov ah, bh
- mov [bp][startmask], ax
- mov bx, [bp][len]
- pop ax
- op17:
- (*%F FastIO *)
- call $OutWord
- (*%E *)
- (*%T FastIO *)
- out word dx, ax
- (*%E *)
- push ax
- push di
- mov dl, 0CEH
- mov ax, [bp][rows]
- mov [bp][rowcount], ax
- op18:
- push di
- push ds
- push si
- push bx
- mov ax, [bp][startmask]
- (*%F FastIO *)
- call $OutWord
- (*%E *)
- (*%T FastIO *)
- out word dx, ax
- (*%E *)
- lodsb
- or si, si
- jnz inSeg2
- push ds
- call @next_seg
- pop ds
- inSeg2:
- mov ah, al
- lodsb
- xchg ah, al
- cmp byte [bp][NotFlag], 0
- je noNot1
- not ax
- noNot1:
- dec si
- test cl, cl
- jnz op19
- dec bx
- jnz op20
- jmp op22
- op19:
- rol ax, cl
- and es:[di], ah
- inc di
- dec bx
- op20:
- push ax
- mov ax, 0FF08H
- (*%F FastIO *)
- call $OutWord
- (*%E *)
- (*%T FastIO *)
- out word dx, ax
- (*%E *)
- pop ax
- dec bx
- jng op22
- op21:
- and es:[di], al
- inc di
- lodsb
- or si, si
- jnz inSeg3
- push ds
- call @next_seg
- pop ds
- inSeg3:
- mov ah, al
- lodsb
- xchg ah, al
- cmp byte [bp][NotFlag], 0
- je noNot2
- not ax
- noNot2:
- dec si
- rol ax, cl
- dec bx
- jnz op21
- op22:
- mov bx, ax
- mov ax, [bp][endmaskL]
- (*%F FastIO *)
- call $OutWord
- (*%E *)
- (*%T FastIO *)
- out word dx, ax
- (*%E *)
- and es:[di], bl
- mov ax, [bp][endmaskR]
- (*%F FastIO *)
- call $OutWord
- (*%E *)
- (*%T FastIO *)
- out word dx, ax
- (*%E *)
- and es:[di][1], bh
- pop bx
- pop si
- pop ds
- add si, bx
- jnc inSeg4
- mov di, ds (*@@@ Ask Nigel *)
- add di, 1000H
- mov ds, di
- inSeg4:
- pop di
- add di, [bp][BytesPerRow]
- dec word [bp][rowcount]
- jnz op18
- pop di
- pop ax
- mov dl, 0C4H
- push cx
- mov cl, [bp][EGAPlaneShift]
- shr ah, cl
- pop cx
- jnz op17
- EGAPutExit:
- (*%F NearCall *)
- call far __resetEGA
- (*%E *)
- (*%T NearCall *)
- call __resetEGA
- (*%E *)
- pop ds
- pop si
- pop di
- mov sp, bp
- pop bp
- (*%F NearCall *)
- ret far 0
- (*%E *)
- (*%T NearCall *)
- ret 0
- (*%E *)
- (**************************************************************************)
- section
- (*%F NearCall *)
- segment Graphics_TEXT(CODE,28H)
- (*%E *)
- (*%T NearCall *)
- segment _TEXT(CODE,28H)
- (*%E *)
- segment _DATA(DATA, 28H)
- (*%F NearCall *)
- select Graphics_TEXT
- (*%E *)
- (*%T NearCall *)
- select _TEXT
- (*%E *)
- public __EGAleftscan :
- left = frame
- border = frame
- push bp
- mov bp, sp
- push di
- push si
- push ds
- std
- mov si, ax (* ptr *)
- mov ds, bx
- mov di, dx (* lim value *)
- mov bp, [bp][left] (* left *)
- mov bx, cx (* bl border *)
- mov cx, 7 (* calculate mask *)
- and cx, bp
- mov ch, 80H
- shr ch, cl
- mov cl, ch (* cl = mask *)
- mov dx, 03CEH (* set read mode *)
- mov al, 5
- out byte dx, al
- mov al, 8
- inc dx
- out byte dx, al
- dec dx
- mov al, 2
- out byte dx, al
- inc dx
- mov al, bl
- out byte dx, al
- dec dx
- mov ax, 0FF08H
- (*%F FastIO *)
- extrn $OutWord
- call $OutWord
- (*%E *)
- (*%T FastIO *)
- out word dx, ax
- (*%E *)
- lodsb
- scanLoop:
- dec bp
- cmp cl, 80H
- je needNewByte
- shl cl, 1
- getPixel:
- test al, cl
- jnz scanDone
- cmp bp, di
- jge scanLoop
- scanDone:
- inc bp
- mov ax, bp
- cld
- pop ds
- pop si
- pop di
- pop bp
- (*%F NearCall *)
- ret far 2
- (*%E *)
- (*%T NearCall *)
- ret 2
- (*%E *)
- needNewByte:
- mov cl, 1H
- newByteLoop:
- lodsb
- or al, al
- jnz getPixel
- sub bp, 8
- cmp bp, di
- jge newByteLoop
- mov bp, di
- dec bp
- jmp scanDone
- (**************************************************************************)
- section
- (*%F NearCall *)
- segment Graphics_TEXT(CODE,28H)
- (*%E *)
- (*%T NearCall *)
- segment _TEXT(CODE,28H)
- (*%E *)
- segment _DATA(DATA, 28H)
- (*%F NearCall *)
- select Graphics_TEXT
- (*%E *)
- (*%T NearCall *)
- select _TEXT
- (*%E *)
- public __EGArightscan :
- right = frame
- border = frame
- push bp
- mov bp, sp
- push di
- push si
- push ds
- mov si, ax (* ptr *)
- mov ds, bx
- mov es, bx
- mov di, dx (* lim value *)
- mov bp, [bp][right] (* right *)
- mov bx, cx (* bl border *)
- mov cx, 7 (* calculate mask *)
- and cx, bp
- mov ch, 80H
- shr ch, cl
- mov cl, ch (* cl = mask *)
- (* read mode set in left scan *)
- lodsb
- EGARsLoop:
- inc bp
- cmp cl, 1H
- je EGAnNewByte
- shr cl, 1
- EGARgPixel:
- test al, cl
- jnz EGARsDone
- cmp bp, di
- jle EGARsLoop
- EGARsDone:
- dec bp
- mov dx, 3CEH
- mov al, 5
- out byte dx, al
- inc dx
- mov al, 0
- out byte dx, al
- mov ax, bp
- pop ds
- pop si
- pop di
- pop bp
- (*%F NearCall *)
- ret far 2
- (*%E *)
- (*%T NearCall *)
- ret 2
- (*%E *)
- EGAnNewByte:
- mov ax, bp
- mov cx, di
- sub cx, bp
- inc cx
- mov bp, cx
- and bp, 7
- shr cx, 1
- shr cx, 1
- shr cx, 1
- jcxz noneLeft
- sub al, al
- xchg si, di
- repe ; scasb
- xchg si, di
- je byteF
- inc cx
- shl cx, 1
- shl cx, 1
- shl cx, 1
- byteF:
- mov ax, di
- sub ax, cx
- sub ax, bp
- mov bp, ax
- inc bp
- cmp bp, di
- ja EGARsDone
- EGAFastDone:
- dec si
- EGAFastDone2:
- lodsb
- mov cl, 80H
- jmp EGARgPixel
- noneLeft:
- mov bp, ax
- jmp EGAFastDone2
- (**************************************************************************)
- section
- (*%F NearCall *)
- segment Graphics_TEXT(CODE,28H)
- (*%E *)
- (*%T NearCall *)
- segment _TEXT(CODE,28H)
- (*%E *)
- segment _DATA(DATA, 28H)
- extrn __pixeladdr320x200
- extrn __pixeladdr640x200
- select _DATA
- extrn __width
- (*%F NearCall *)
- select Graphics_TEXT
- (*%E *)
- (*%T NearCall *)
- select _TEXT
- (*%E *)
- (*
- void CGAGet(unsigned char *buffer, short x1, y1, x2, y2);
- *)
- buffer = frame
- x1 = 4+frame
- y1 = 6+frame
- x2 = 8+frame
- y2 = 10+frame
- len = -2
- incr = -4
- locals = 4
- public __CGA320Get :
- push bp
- mov bp, sp
- sub sp, locals
- push di
- push si
- push ds
- (*%F SameDS *)
- mov si, _DATA
- mov ds, si
- (*%E *)
- mov ax, [bp][x2] (* get block size *)
- sub ax, [bp][x1]
- mov cx, 0FF03H
- and cl, al
- xor cl, 3
- shl cl, 1
- shl ch, cl
- mov cl, ch
- push cx
- mov cl, 2
- shr ax, cl
- inc ax
- push ax
- mov ax, [bp][y2]
- sub ax, [bp][y1]
- inc ax
- push ax
- mov ax, [bp][y1] (* compute video address *)
- mov bx, [bp][x1]
- call __pixeladdr320x200
- xor cl, 6
- jmp common
- (*
- void CGAGet(unsigned char *buffer, short x1, y1, x2, y2);
- *)
- public __CGA640Get :
- push bp
- mov bp, sp
- sub sp, locals
- push di
- push si
- push ds
- (*%F SameDS *)
- mov si, _DATA
- mov ds, si
- (*%E *)
- mov ax, [bp][x2] (* get block size *)
- sub ax, [bp][x1]
- mov cx, 0FF07H
- and cl, al
- xor cl, 7
- shl ch, cl
- mov cl, ch
- push cx
- mov cl, 3
- shr ax, cl
- inc ax
- push ax
- mov ax, [bp][y2]
- sub ax, [bp][y1]
- inc ax
- push ax
- mov ax, [bp][y1] (* compute video address *)
- mov bx, [bp][x1]
- call __pixeladdr640x200
- xor cl, 7
- common:
- push es
- pop ds
- mov si, bx
- mov bx, 2000H
- test si, 2000H
- jz interleave1
- mov bx, 80-2000H
- interleave1:
- mov [bp][incr], bx
- les di, [bp][buffer]
- pop ax (* pixel rows *)
- stosw
- mov dx, ax (* dx = row count *)
- pop ax (* bytes per pixel row *)
- stosb
- mov [bp][len], ax
- pop ax
- stosb (* mask for last byte *)
- mov ch, al
- getLoop1:
- mov bx, [bp][len]
- push si
- getLoop2:
- lodsw
- dec si
- rol ax, cl
- stosb
- dec bx
- jnz getLoop2
- and es:[di][-1], ch
- pop si
- add si, [bp][incr]
- mov ax, 2000H
- xor ax, 80-2000H
- xor [bp][incr], ax
- dec dx
- jnz getLoop1
- pop ds
- pop si
- pop di
- mov sp, bp
- pop bp
- (*%F NearCall *)
- ret far 0
- (*%E *)
- (*%T NearCall *)
- ret 0
- (*%E *)
- (**************************************************************************)
- section
- (*%F NearCall *)
- segment Graphics_TEXT(CODE,28H)
- (*%E *)
- (*%T NearCall *)
- segment _TEXT(CODE,28H)
- (*%E *)
- segment _DATA(DATA, 28H)
- extrn __pixeladdr320x200
- extrn __pixeladdr640x200
- (*%F NearCall *)
- select Graphics_TEXT
- (*%E *)
- (*%T NearCall *)
- select _TEXT
- (*%E *)
- x1 = frame
- y1 = 2+frame
- buffer = 4+frame
- action = 8+frame
- len = -2
- incr = -4
- rows = -6
- bitOp = -8
- pixAddress = -10
- lastMask = -12
- clShift = -13
- locals = 13
- incRow:
- add di, [bp][incr]
- mov ax, 2000H
- xor ax, 80-2000H
- xor [bp][incr], ax
- dec word [bp][rows]
- ret 0
- __setBlock:
- cmp cx, 0FF00H
- jnz L640op15
- mov cx, [bp][len]
- L640op10:
- push cx
- push di
- rep ; movsb
- pop di
- pop cx
- call incRow
- jnz L640op10
- jmp near L640setExit
- L640op15:
- not ch
- mov dx, 0FF00H
- ror dx, cl
- mov bx, [bp][len]
- dec bx
- L640op16:
- push di
- or bx, bx
- jz L640op18
- push bx
- L640op17:
- and es:[di], dx
- lodsb
- sub ah, ah
- ror ax, cl
- or es:[di], ax
- inc di
- dec bx
- jnz L640op17
- pop bx
- L640op18:
- mov al, ch
- mov ah, 0FFH
- ror ax, cl
- and es:[di], ax
- lodsb
- sub ah, ah
- ror ax, cl
- or es:[di], ax
- pop di
- call incRow
- jnz L640op16
- jmp near L640setExit
- __XORBlock:
- mov bx, [bp][len]
- L640op20:
- push di
- push bx
- L640op21:
- lodsb
- sub ah, ah
- ror ax, cl
- xor es:[di], ax
- inc di
- dec bx
- jnz L640op21
- pop bx
- pop di
- call incRow
- jnz L640op20
- jmp near L640setExit
- __ANDBlock:
- not ch
- mov bx, [bp][len]
- dec bx
- L640op30:
- push di
- or bx, bx
- jz L640op32
- push bx
- L640op31:
- lodsb
- mov ah, 0FFH
- ror ax, cl
- and es:[di], ax
- inc di
- dec bx
- jnz L640op31
- pop bx
- L640op32:
- lodsb
- or al, ch
- mov ah, 0FFH
- ror ax, cl
- and es:[di], ax
- pop di
- call incRow
- jnz L640op30
- jmp near L640setExit
- __ORBlock:
- mov bx, [bp][len]
- L640op40:
- push di
- push bx
- L640op41:
- lodsb
- sub ah, ah
- ror ax, cl
- or es:[di], ax
- inc di
- dec bx
- jnz L640op41
- pop bx
- pop di
- call incRow
- jnz L640op40
- jmp near L640setExit
- __reverseBlock:
- cmp cx, 0FF00H
- jnz L640op55
- mov cx, [bp][len]
- L640op50:
- push cx
- push di
- revLoop1:
- lodsb
- not al
- stosb
- loop revLoop1
- pop di
- pop cx
- call incRow
- jnz L640op50
- jmp near L640setExit
- L640op55:
- not ch
- mov dx, 0FF00H
- ror dx, cl
- mov bx, [bp][len]
- dec bx
- L640op56:
- push di
- or bx, bx
- jz L640op58
- push bx
- L640op57:
- and es:[di], dx
- lodsb
- sub ah, ah
- not al
- ror ax, cl
- or es:[di], ax
- inc di
- dec bx
- jnz L640op57
- pop bx
- L640op58:
- mov al, ch
- mov ah, 0FFH
- ror ax, cl
- and es:[di], ax
- not ax
- mov [bp][lastMask], ax
- lodsb
- sub ah, ah
- not al
- ror ax, cl
- and ax, [bp][lastMask]
- or es:[di], ax
- pop di
- call incRow
- jnz L640op56
- jmp near L640setExit
- (*
- void CGA640Put(short x1, y1, unsigned char *buffer, short action);
- *)
- public __CGA320Put :
- push bp
- mov bp, sp
- sub sp, locals
- mov word [bp][pixAddress], __pixeladdr320x200
- mov byte [bp][clShift], 6
- jmp PCGAcommon
- public __CGA640Put :
- push bp
- mov bp, sp
- sub sp, locals
- mov word [bp][pixAddress], __pixeladdr640x200
- mov byte [bp][clShift], 7
- PCGAcommon:
- push di
- push si
- push ds
- (*%F SameDS *)
- mov si, _DATA
- mov ds, si
- (*%E *)
- mov ax, [bp][action]
- or ax, ax
- jnz L640op2
- L640op1:
- mov word [bp][bitOp], __ORBlock
- jmp gotOp
- L640op2:
- dec ax
- jnz L640op3
- mov word [bp][bitOp], __ANDBlock
- jmp gotOp
- L640op3:
- dec ax
- jnz L640op4
- mov word [bp][bitOp], __reverseBlock
- jmp gotOp
- L640op4:
- dec ax
- jnz L640op5
- mov word [bp][bitOp], __setBlock
- jmp gotOp
- L640op5:
- mov word [bp][bitOp], __XORBlock
- gotOp:
- mov ax, [bp][y1]
- mov bx, [bp][x1]
- call [bp][pixAddress]
- xor cl, [bp][clShift]
- mov di, bx
- mov bx, 2000H
- test di, 2000H
- jz L640interleave1
- mov bx, 80-2000H
- L640interleave1:
- mov [bp][incr], bx
- lds si, [bp][buffer]
- lodsw
- mov [bp][rows], ax
- lodsb
- sub ah, ah
- mov [bp][len], ax
- lodsb
- mov ch, al
- jmp [bp][bitOp]
- L640setExit:
- pop ds
- pop si
- pop di
- mov sp, bp
- pop bp
- (*%F NearCall *)
- ret far 0
- (*%E *)
- (*%T NearCall *)
- ret 0
- (*%E *)
- (**************************************************************************)
- section
- (*%F NearCall *)
- segment Graphics_TEXT(CODE,28H)
- (*%E *)
- (*%T NearCall *)
- segment _TEXT(CODE,28H)
- (*%E *)
- segment _DATA(DATA, 28H)
- (*%F NearCall *)
- select Graphics_TEXT
- (*%E *)
- (*%T NearCall *)
- select _TEXT
- (*%E *)
- public __CGA320leftscan :
- (*%T _DLLOVL *)
- push bp
- mov bp, sp
- (*%E *)
- push di
- push si
- push ds
- std
- mov si, ax (* ptr *)
- (*%T _XTD *)
- extrn __B800h
- mov ax, __B800h
- (*%E *)
- (*%F _XTD *)
- mov ax, 0B800H
- (*%E *)
- mov ds, ax
- mov di, dx (* left *)
- mov ax, dx
- mov dx, cx (* limit *)
- mov cl, 6
- shl bl, cl
- mov cx, ax
- and cl, 3
- shl cl, 1
- mov bh, 0C0H
- shr bx, cl
- lodsb
- CGALscanLoop:
- dec di
- rol bl, 1
- rol bl, 1
- rol bh, 1
- rol bh, 1
- jc CGALoad
- CGAloadDone:
- mov ah, al
- and ah, bh
- cmp ah, bl
- je CGALscanDone
- cmp di, dx
- jge CGALscanLoop
- CGALscanDone:
- inc di
- mov ax, di
- cld
- pop ds
- pop si
- pop di
- (*%T _DLLOVL *)
- pop bp
- (*%E *)
- (*%F NearCall *)
- ret far 0
- (*%E *)
- (*%T NearCall *)
- ret 0
- (*%E *)
- CGALoad:
- lodsb
- jmp CGAloadDone
- (**************************************************************************)
- section
- (*%F NearCall *)
- segment Graphics_TEXT(CODE,28H)
- (*%E *)
- (*%T NearCall *)
- segment _TEXT(CODE,28H)
- (*%E *)
- segment _DATA(DATA, 28H)
- (*%F NearCall *)
- select Graphics_TEXT
- (*%E *)
- (*%T NearCall *)
- select _TEXT
- (*%E *)
- public __CGA320rightscan :
- push bp
- mov bp, sp
- push di
- push si
- push ds
- mov si, ax (* ptr *)
- (*%T _XTD *)
- extrn __B800h
- mov ax, __B800h
- (*%E *)
- (*%F _XTD *)
- mov ax, 0B800H
- (*%E *)
- mov ds, ax
- mov es, ax
- mov di, dx (* right *)
- mov ax, dx
- mov dx, cx (* limit *)
- mov cl, 6
- shl bl, cl
- mov cx, ax
- and cl, 3
- shl cl, 1
- mov bh, 0C0H
- shr bx, cl
- mov cx, dx
- sub cx, di
- mov di, -1
- lodsb
- CGARscanLoop:
- ror bl, 1
- ror bl, 1
- ror bh, 1
- ror bh, 1
- jc CGARLoad
- CGARnoInc:
- mov ah, al
- and ah, bh
- cmp ah, bl
- loopne CGARscanLoop
- CGARscanDone:
- jne noInc
- inc cx
- noInc:
- mov ax, dx
- sub ax, cx
- pop ds
- pop si
- pop di
- pop bp
- (*%F NearCall *)
- ret far 0
- (*%E *)
- (*%T NearCall *)
- ret 0
- (*%E *)
- CGARLoad:
- inc di
- jne CGARfastTest
- lodsb
- jmp CGARnoInc
- CGARfastTest:
- mov bp, cx
- and bp, 3
- shr cx, 1
- shr cx, 1
- jcxz CGARnoInc
- mov di, si
- repe ; scasb
- jne foundNewByte
- mov cx, bp
- jcxz noInc
- jmp setupNext
- foundNewByte:
- inc cx
- shl cx, 1
- shl cx, 1
- add cx, bp
- setupNext:
- dec di
- mov si, di
- sub di, di
- lodsb
- jmp CGARnoInc
- (**************************************************************************)
- section
- (*%F NearCall *)
- segment Graphics_TEXT(CODE,28H)
- (*%E *)
- (*%T NearCall *)
- segment _TEXT(CODE,28H)
- (*%E *)
- segment _DATA(DATA, 28H)
- (*%F NearCall *)
- select Graphics_TEXT
- (*%E *)
- (*%T NearCall *)
- select _TEXT
- (*%E *)
- public __CGA640leftscan :
- (*%T _DLLOVL *)
- push bp
- mov bp, sp
- (*%E *)
- push di
- push si
- push ds
- std
- mov si, ax (* ptr *)
- (*%T _XTD *)
- extrn __B800h
- mov ax, __B800h
- (*%E *)
- (*%F _XTD *)
- mov ax, 0B800H
- (*%E *)
- mov ds, ax
- mov di, dx (* left *)
- mov ax, dx
- mov dx, cx (* limit *)
- mov cx, 7
- and ax, cx
- sub cx, ax
- lodsb
- L640LscanLoop:
- dec di
- inc cl
- cmp cl, 8
- jnz L640LnoLoad
- sub cl, cl
- lodsb
- L640LnoLoad:
- mov ah, 1
- shl ah, cl
- and ah, al
- shr ah, cl
- cmp ah, bl
- jz L640LscanDone
- cmp di, dx
- jge L640LscanLoop
- L640LscanDone:
- inc di
- mov ax, di
- cld
- pop ds
- pop si
- pop di
- (*%T _DLLOVL *)
- pop bp
- (*%E *)
- (*%F NearCall *)
- ret far 0
- (*%E *)
- (*%T NearCall *)
- ret 0
- (*%E *)
- (**************************************************************************)
- section
- (*%F NearCall *)
- segment Graphics_TEXT(CODE,28H)
- (*%E *)
- (*%T NearCall *)
- segment _TEXT(CODE,28H)
- (*%E *)
- segment _DATA(DATA, 28H)
- (*%F NearCall *)
- select Graphics_TEXT
- (*%E *)
- (*%T NearCall *)
- select _TEXT
- (*%E *)
- public __CGA640rightscan :
- push bp
- mov bp, sp
- push di
- push si
- push ds
- mov si, ax (* ptr *)
- (*%T _XTD *)
- extrn __B800h
- mov ax, __B800h
- (*%E *)
- (*%F _XTD *)
- mov ax, 0B800H
- (*%E *)
- mov ds, ax
- mov es, ax
- mov di, dx (* right *)
- mov ax, dx
- mov dx, cx (* limit *)
- mov cl, 7
- shl bl, cl
- mov cx, ax
- and cl, 7
- mov bh, 080H
- shr bx, cl
- mov cx, dx
- sub cx, di
- mov di, -1
- lodsb
- CGARscanLoop:
- ror bl, 1
- ror bh, 1
- jc CGARLoad
- CGARnoInc:
- mov ah, al
- and ah, bh
- cmp ah, bl
- loopne CGARscanLoop
- CGARscanDone:
- jne noInc
- inc cx
- noInc:
- mov ax, dx
- sub ax, cx
- pop ds
- pop si
- pop di
- pop bp
- (*%F NearCall *)
- ret far 0
- (*%E *)
- (*%T NearCall *)
- ret 0
- (*%E *)
- CGARLoad:
- inc di
- jne CGARfastTest
- lodsb
- jmp CGARnoInc
- CGARfastTest:
- mov bp, cx
- and bp, 7
- shr cx, 1
- shr cx, 1
- shr cx, 1
- jcxz CGARnoInc
- mov di, si
- repe ; scasb
- jne foundNewByte
- mov cx, bp
- jcxz noInc
- jmp setupNext
- foundNewByte:
- inc cx
- shl cx, 1
- shl cx, 1
- shl cx, 1
- add cx, bp
- setupNext:
- dec di
- mov si, di
- sub di, di
- lodsb
- jmp CGARnoInc
- (**************************************************************************)
- section
- (*%F NearCall *)
- segment Graphics_TEXT(CODE,28H)
- (*%E *)
- (*%T NearCall *)
- segment _TEXT(CODE,28H)
- (*%E *)
- segment _DATA(DATA, 28H)
- extrn __pixeladdrHerc
- (*%F NearCall *)
- select Graphics_TEXT
- (*%E *)
- (*%T NearCall *)
- select _TEXT
- (*%E *)
- (*
- void HercGet(unsigned char *buffer, short x1, y1, x2, y2);
- *)
- buffer = frame
- x1 = 4+frame
- y1 = 6+frame
- x2 = 8+frame
- y2 = 10+frame
- len = -2
- leaf = -4
- locals = 4
- public __HercGet :
- push bp
- mov bp, sp
- sub sp, locals
- push di
- push si
- push ds
- (*%F SameDS *)
- mov si, _DATA
- mov ds, si
- (*%E *)
- mov ax, [bp][x2] (* get block size *)
- sub ax, [bp][x1]
- mov cx, 0FF07H
- and cl, al
- xor cl, 7
- shl ch, cl
- mov cl, ch
- push cx
- mov cl, 3
- shr ax, cl
- inc ax
- push ax
- mov ax, [bp][y2]
- sub ax, [bp][y1]
- inc ax
- push ax
- mov ax, [bp][y1] (* compute video address *)
- mov bx, [bp][x1]
- call __pixeladdrHerc
- xor cl, 7
- push es
- pop ds
- mov si, bx
- cmp si, 2000H
- jb HGinterleave1
- cmp si, 4000H
- jb HGinterleave2
- cmp si, 6000H
- jb HGinterleave3
- HGinterleave4:
- mov bx, 3H
- jmp HGgotInterleave
- HGinterleave3:
- mov bx, 2H
- jmp HGgotInterleave
- HGinterleave2:
- mov bx, 1H
- jmp HGgotInterleave
- HGinterleave1:
- mov bx, 0H
- HGgotInterleave:
- mov [bp][leaf], bx
- les di, [bp][buffer]
- pop ax (* pixel rows *)
- stosw
- mov dx, ax
- pop ax (* bytes per pixel row *)
- stosb
- mov [bp][len], ax
- pop ax
- stosb (* mask for last byte *)
- mov ch, al
- HGgetLoop1:
- mov bx, [bp][len]
- push si
- HGgetLoop2:
- lodsw
- dec si
- rol ax, cl
- stosb
- dec bx
- jnz HGgetLoop2
- pop si
- and es:[di][-1], ch
- mov ax, [bp][leaf]
- cmp ax, 3
- jnz HGnotLast
- sub ax, ax
- mov [bp][leaf], ax
- sub si, 6000H-90
- jmp HGgotRow
- HGnotLast:
- inc ax
- mov [bp][leaf], ax
- add si, 2000H
- HGgotRow:
- dec dx
- jnz HGgetLoop1
- pop ds
- pop si
- pop di
- mov sp, bp
- pop bp
- (*%F NearCall *)
- ret far 0
- (*%E *)
- (*%T NearCall *)
- ret 0
- (*%E *)
- (**************************************************************************)
- section
- (*%F NearCall *)
- segment Graphics_TEXT(CODE,28H)
- (*%E *)
- (*%T NearCall *)
- segment _TEXT(CODE,28H)
- (*%E *)
- segment _DATA(DATA, 28H)
- extrn __pixeladdrHerc
- (*%F NearCall *)
- select Graphics_TEXT
- (*%E *)
- (*%T NearCall *)
- select _TEXT
- (*%E *)
- x1 = frame
- y1 = 2+frame
- buffer = 4+frame
- action = 8+frame
- len = -2
- leaf = -4
- rows = -6
- bitOp = -8
- lastMask = -10
- locals = 10
- incRow:
- mov ax, [bp][leaf]
- cmp ax, 3
- jnz notLast
- sub ax, ax
- mov [bp][leaf], ax
- sub di, 6000H-90
- jmp gotRow
- notLast:
- inc ax
- mov [bp][leaf], ax
- add di, 2000H
- gotRow:
- dec word [bp][rows]
- ret 0
- __setBlock:
- cmp cx, 0FF00H
- jnz op15
- mov cx, [bp][len]
- op10:
- push cx
- push di
- rep ; movsb
- pop di
- pop cx
- call incRow
- jnz op10
- jmp near setExit
- op15:
- not ch
- mov dx, 0FF00H
- ror dx, cl
- mov bx, [bp][len]
- dec bx
- op16:
- push di
- or bx, bx
- jz op18
- push bx
- op17:
- and es:[di], dx
- lodsb
- sub ah, ah
- ror ax, cl
- or es:[di], ax
- inc di
- dec bx
- jnz op17
- pop bx
- op18:
- mov al, ch
- mov ah, 0FFH
- ror ax, cl
- and es:[di], ax
- lodsb
- sub ah, ah
- ror ax, cl
- or es:[di], ax
- pop di
- call incRow
- jnz op16
- jmp near setExit
- __XORBlock:
- mov bx, [bp][len]
- op20:
- push di
- push bx
- op21:
- lodsb
- sub ah, ah
- ror ax, cl
- xor es:[di], ax
- inc di
- dec bx
- jnz op21
- pop bx
- pop di
- call incRow
- jnz op20
- jmp near setExit
- __ANDBlock:
- not ch
- mov bx, [bp][len]
- dec bx
- op30:
- push di
- or bx, bx
- jz op32
- push bx
- op31:
- lodsb
- mov ah, 0FFH
- ror ax, cl
- and es:[di], ax
- inc di
- dec bx
- jnz op31
- pop bx
- op32:
- lodsb
- or al, ch
- mov ah, 0FFH
- ror ax, cl
- and es:[di], ax
- pop di
- call incRow
- jnz op30
- jmp near setExit
- __ORBlock:
- mov bx, [bp][len]
- op40:
- push di
- push bx
- op41:
- lodsb
- sub ah, ah
- ror ax, cl
- or es:[di], ax
- inc di
- dec bx
- jnz op41
- pop bx
- pop di
- call incRow
- jnz op40
- jmp near setExit
- __reverseBlock:
- cmp cx, 0FF00H
- jnz op55
- mov cx, [bp][len]
- op50:
- push cx
- push di
- revLoop1:
- lodsb
- not al
- stosb
- loop revLoop1
- pop di
- pop cx
- call incRow
- jnz op50
- jmp near setExit
- op55:
- not ch
- mov dx, 0FF00H
- ror dx, cl
- mov bx, [bp][len]
- dec bx
- op56:
- push di
- or bx, bx
- jz op58
- push bx
- op57:
- and es:[di], dx
- lodsb
- not al
- sub ah, ah
- ror ax, cl
- or es:[di], ax
- inc di
- dec bx
- jnz op57
- pop bx
- op58:
- mov al, ch
- mov ah, 0FFH
- ror ax, cl
- and es:[di], ax
- not ax
- mov [bp][lastMask], ax
- lodsb
- sub ah, ah
- not al
- ror ax, cl
- and ax, [bp][lastMask]
- or es:[di], ax
- pop di
- call incRow
- jnz op56
- jmp near setExit
- (*
- void HercPut(short x1, y1, unsigned char *buffer, short action);
- *)
- public __HercPut :
- push bp
- mov bp, sp
- sub sp, locals
- push di
- push si
- push ds
- (*%F SameDS *)
- mov si, _DATA
- mov ds, si
- (*%E *)
- mov ax, [bp][action]
- or ax, ax
- jnz op2
- op1:
- mov word [bp][bitOp], __ORBlock
- jmp gotOp
- op2:
- dec ax
- jnz op3
- mov word [bp][bitOp], __ANDBlock
- jmp gotOp
- op3:
- dec ax
- jnz op4
- mov word [bp][bitOp], __reverseBlock
- jmp gotOp
- op4:
- dec ax
- jnz op5
- mov word [bp][bitOp], __setBlock
- jmp gotOp
- op5:
- mov word [bp][bitOp], __XORBlock
- gotOp:
- mov ax, [bp][y1]
- mov bx, [bp][x1]
- call __pixeladdrHerc
- xor cl, 7
- mov di, bx
- cmp di, 2000H
- jb interleave1
- cmp di, 4000H
- jb interleave2
- cmp di, 6000H
- jb interleave3
- interleave4:
- mov bx, 3H
- jmp gotInterleave
- interleave3:
- mov bx, 2H
- jmp gotInterleave
- interleave2:
- mov bx, 1H
- jmp gotInterleave
- interleave1:
- mov bx, 0H
- gotInterleave:
- mov [bp][leaf], bx
- lds si, [bp][buffer]
- lodsw
- mov [bp][rows], ax
- lodsb
- sub ah, ah
- mov [bp][len], ax
- lodsb
- mov ch, al
- mov bx, [bp][len]
- jmp [bp][bitOp]
- setExit:
- pop ds
- pop si
- pop di
- mov sp, bp
- pop bp
- (*%F NearCall *)
- ret far 0
- (*%E *)
- (*%T NearCall *)
- ret 0
- (*%E *)
- (**************************************************************************)
- section
- (*%F NearCall *)
- segment Graphics_TEXT(CODE,28H)
- (*%E *)
- (*%T NearCall *)
- segment _TEXT(CODE,28H)
- (*%E *)
- segment _DATA(DATA, 28H)
- select _DATA
- extrn __active_page
- extrn __page_size
- extrn __bkcolor
- (*%F NearCall *)
- select Graphics_TEXT
- (*%E *)
- (*%T NearCall *)
- select _TEXT
- (*%E *)
- public __clear_Herc :
- (*%T _DLLOVL *)
- push bp
- mov bp, sp
- (*%E *)
- push di
- (*%F SameDS *)
- push ds
- mov ax, _DATA
- mov ds, ax
- (*%E *)
- mov ax, [__active_page]
- mul word [__page_size]
- (*%T _XTD *)
- db 0C1H,0F8H,004H (*I shl ax, 4 *)
- mov di, ax
- extrn __B000h
- mov ax, __B000h
- (*%E *)
- (*%F _XTD *)
- add ax, 0B000H
- sub di, di
- (*%E *)
- mov es, ax
- mov ax, [__bkcolor]
- jz black
- mov ax, 0FFFFH
- black:
- mov cx, 4000H
- rep; stosw
- (*%F SameDS *)
- pop ds
- (*%E *)
- pop di
- (*%T _DLLOVL *)
- pop bp
- (*%E *)
- (*%F NearCall *)
- ret far 0
- (*%E *)
- (*%T NearCall *)
- ret 0
- (*%E *)
- (**************************************************************************)
- section
- (*%F NearCall *)
- segment Graphics_TEXT(CODE,28H)
- (*%E *)
- (*%T NearCall *)
- segment _TEXT(CODE,28H)
- (*%E *)
- segment _DATA(DATA, 28H)
- select _DATA
- extrn __fgcolor
- extrn __bkcolor
- extrn __display_state
- extrn __active_page
- extrn __txcolor
- extrn __current_video
- extrn __HercPut
- extrn __current_text
- __GPSET = 3
- __GPRESET = 2
- __GPAND = 1
- __GPOR = 0
- __GPXOR = 4
- __RHUNDLIN = 8
- mode = 14 (* current video mode *)
- _HERCMONO = 8 (* 720 x 348, BW for HGC *)
- (* Buffer for character shape in putimage format for hercules *)
- __PixRows : dw 12 (* pixel rows per char - 12 vertical **)
- __BytsPerRow : db 1 (* 8 bit wide chars **)
- __FinalMask : db 0FFH (* All bits matter **)
- dw 0 (* Two zero pixel rows **)
- __Character : dw 0,0,0,0 (* 8 pixel rows **)
- __Underline : db 0 (* This byte for underlining **)
- db 0 (* 1 more zero pixel row **)
- (*%F NearCall *)
- select Graphics_TEXT
- (*%E *)
- (*%T NearCall *)
- select _TEXT
- (*%E *)
- public __txt_out :
- chk = frame
- push bp
- mov bp, sp
- (*%F SameDS *)
- push ds
- mov ax, _DATA
- mov ds, ax
- (*%E *)
- mov ah, 9
- mov bh, [__active_page]
- mov al, [bp][chk]
- mov cl, 4
- mov bl, [__bkcolor]
- shl bl, cl
- mov dl, [__txcolor]
- mov dh, dl
- and dl, 0FH
- or bl, dl
- test dh, 10H
- jz outChar
- or bl, 80H
- outChar:
- cmp word ds:[__current_video][mode], _HERCMONO
- jz herc_text
- mov cx, 1
- int 10H
- done:
- (*%F SameDS *)
- pop ds
- (*%E *)
- pop bp
- (*%F NearCall *)
- ret far 0
- (*%E *)
- (*%T NearCall *)
- ret 0
- (*%E *)
- (* Obtain the character shape from the bios table at F000:FA6E**)
- (* al = char to output **)
- herc_text:
- push di
- push si
- (* Copy char shape from bios table into buffer **)
- mov bl, al (* char to output *)
- xor bh, bh
- push ds
- mov ax, ds
- mov es, ax
- (*%F _XTD *)
- mov ax, 0F000H (* bios segment *)
- (*%E *)
- (*%T _XTD *)
- extrn __F000h
- mov ax, __F000h
- (*%E *)
- mov ds, ax
- mov ax, 0FA6EH (* char table starting offset *)
- mov cl, 3
- shl bx, cl (* char code * 8 (8 bytes in table/char) *)
- add ax, bx (* offset of char in table *)
- mov si, ax (* ds:si is char loc in bios **)
- mov di, __Character (* address of dest. down here **)
- lodsw
- stosw
- lodsw
- stosw
- lodsw
- stosw
- lodsw
- stosw
- xor al, al (* Assume no underline *)
- xor dh, dh (* dx is foreground 'colour' *)
- mov cx, dx
- and cl, 07H
- and dl, 08H (* dx is underline bit **)
- jz normal
- not al
- normal:
- stosb
- pop ds
- (* Now call HercPut to load the character shape onto the screen RAM **)
- push cx
- push ds (* buffer *)
- mov cx, __PixRows
- push cx
- mov al, [__current_text] (* convert row to y pixels *)
- xor ah, ah
- shl ax, 1
- shl ax, 1
- mov bx, ax
- shl ax, 1
- add ax, bx (* row * 12 *)
- push ax
- mov al, [__current_text][2] (* convert col to x pixels *)
- xor ah, ah
- mov cl, 3
- shl ax, cl
- push ax
- (*%F NearCall *)
- call far __HercPut
- (*%E *)
- (*%T NearCall *)
- call __HercPut
- (*%E *)
- add sp, 0AH
- pop si
- pop di
- jmp done
- (**************************************************************************)
- section
- (*%F NearCall *)
- segment Graphics_TEXT(CODE,28H)
- (*%E *)
- (*%T NearCall *)
- segment _TEXT(CODE,28H)
- (*%E *)
- segment _DATA(DATA, 28H)
- select _DATA
- extrn __fgcolor
- extrn __bkcolor
- extrn __display_state
- extrn __active_page
- extrn __txcolor
- (*%F NearCall *)
- select Graphics_TEXT
- (*%E *)
- (*%T NearCall *)
- select _TEXT
- (*%E *)
- public __gcur :
- (*%T _DLLOVL *)
- push bp
- mov bp, sp
- (*%E *)
- push ax
- mov ah, 2
- mov bh, dl
- mov dl, cl
- mov dh, bl
- int 10H
- pop bx
- or bl, 80H
- mov ah, 9
- mov al, 219
- outChar:
- mov cx, 1
- int 10H
- (*%T _DLLOVL *)
- pop bp
- (*%E *)
- (*%F NearCall *)
- ret far 0
- (*%E *)
- (*%T NearCall *)
- ret 0
- (*%E *)
- (**************************************************************************)
- section
- (*%F NearCall *)
- segment Graphics_TEXT(CODE,28H)
- (*%E *)
- (*%T NearCall *)
- segment _TEXT(CODE,28H)
- (*%E *)
- segment _DATA(DATA, 28H)
- select _DATA
- extrn __defaultmode
- (*%F NearCall *)
- select Graphics_TEXT
- (*%E *)
- (*%T NearCall *)
- select _TEXT
- (*%E *)
- public __setbiosmode :
- mode = frame
- push bp
- mov bp, sp
- mov ax, [bp][mode]
- mov ah, 0H
- int 10H
- pop bp
- (*%F NearCall *)
- ret far 0
- (*%E *)
- (*%T NearCall *)
- ret 0
- (*%E *)
- (**************************************************************************)
- section
- (*%F NearCall *)
- segment Graphics_TEXT(CODE,28H)
- (*%E *)
- (*%T NearCall *)
- segment _TEXT(CODE,28H)
- (*%E *)
- segment _DATA(DATA, 28H)
- (*%F NearCall *)
- select Graphics_TEXT
- (*%E *)
- (*%T NearCall *)
- select _TEXT
- (*%E *)
- public __getvideomode :
- (*%T _DLLOVL *)
- push bp
- mov bp, sp
- (*%E *)
- mov ah, 0FH
- int 10H
- sub ah, ah
- (*%T _DLLOVL *)
- pop bp
- (*%E *)
- (*%F NearCall *)
- ret far 0
- (*%E *)
- (*%T NearCall *)
- ret 0
- (*%E *)
- (**************************************************************************)
- section
- (*%F NearCall *)
- segment Graphics_TEXT(CODE,28H)
- (*%E *)
- (*%T NearCall *)
- segment _TEXT(CODE,28H)
- (*%E *)
- segment _DATA(DATA, 28H)
- (*%F NearCall *)
- select Graphics_TEXT
- (*%E *)
- (*%T NearCall *)
- select _TEXT
- (*%E *)
- public __change_screen_background :
- (*%T _DLLOVL *)
- push bp
- mov bp, sp
- (*%E *)
- push di
- push si
- push ds
- mov es, bx
- mov ds, bx
- mov di, ax
- mov si, ax
- shl dl, 1
- shl dl, 1
- shl dl, 1
- shl dl, 1
- changeLoop:
- lodsw
- and ah, 0FH
- or ah, dl
- stosw
- loop changeLoop
- pop ds
- pop si
- pop di
- (*%T _DLLOVL *)
- pop bp
- (*%E *)
- (*%F NearCall *)
- ret far 0
- (*%E *)
- (*%T NearCall *)
- ret 0
- (*%E *)
- (****************************************************************************)
- section
- (*%F NearCall *)
- segment Graphics_TEXT(CODE,28H)
- (*%E *)
- (*%T NearCall *)
- segment _TEXT(CODE,28H)
- (*%E *)
- segment _DATA(DATA, 28H)
- extrn __FindPS2
- extrn __FindEGA
- extrn __FindCGA
- extrn __FindMono
- select _DATA
- public __TestSequence: db 0 (* this list of flags and addresses *)
- dw __FindPS2 (* determines the order in which this *)
- (* program looks for the various *) (* subsystems *)
- public __EGAflag : db 0
- dw __FindEGA
- public __CGAflag : db 0
- dw __FindCGA
- public __Monoflag : db 0
- dw __FindMono
- (****************************************************************************)
- section
- (*%F NearCall *)
- segment Graphics_TEXT(CODE,28H)
- (*%E *)
- (*%T NearCall *)
- segment _TEXT(CODE,28H)
- (*%E *)
- segment _DATA(DATA, 28H)
- select _DATA
- (*%F NearCall *)
- select Graphics_TEXT
- (*%E *)
- (*%T NearCall *)
- select _TEXT
- (*%E *)
- (* TYPE
- VIDstruct = RECORD
- VideoSubsystem0 : SHORTCARD
- Display0 : SHORTCARD
- VideoSubsystem1 : SHORTCARD
- Display1 : SHORTCARD
- END
- PROCEDURE VideoID(VAR vs: VIDstruct)
- Subsystem ID values:
- 0 = (none)
- 1 = MDA
- 2 = CGA
- 3 = EGA
- 4 = MCGA
- 5 = VGA
- 80h = HGC
- 81h = HGC+
- 82h = Hercules InColor
- Display types: 0 = (none)
- 1 = MDA-compatible monochrome
- 2 = CGA-compatible color
- 3 = EGA-compatible color
- 4 = PS/2-compatible monochrome
- 5 = PS/2-compatible color
- The values returned in VIDstruct[0].VideoSubsystem and
- VIDstruct[0].Display indicate the currently active subsystem.
- *)
- Video0Type = 0 (* first subsytem type *)
- Display0Type = 1 (* display attached to first subsystem *)
- Video1Type = 2 (* second subsystem type *)
- Display1Type = 3 (* display attached to second subsystem *)
- Device0 = 0
- Device1 = 2
- MDA = 1
- CGA = 2
- EGA = 3
- MCGA = 4
- VGA = 5
- HGC = 80H
- HGCPlus = 81H
- InColor = 82H
- MDADisplay = 1
- CGADisplay = 2
- EGAColorDisplay = 3
- PS2MonoDisplay = 4
- PS2ColorDisplay = 5
- TRUE = 1
- FALSE = 0
- select _DATA
- extrn __Monoflag
- extrn __EGAflag
- extrn __CGAflag
- extrn __TestSequence
- EGADisplays : db CGADisplay (* 0000b, 0001b (EGA switch values) *)
- db EGAColorDisplay (* 0010b, 0011b *)
- db MDADisplay (* 0100b, 0101b *)
- db CGADisplay (* 0110b, 0111b *)
- db EGAColorDisplay (* 1000b, 1001b *)
- db MDADisplay (* 1010b, 1011b *)
- DCCtable : db 0,0 (* translate table for INT 10H func 1AH *)
- db MDA,MDADisplay
- db CGA,CGADisplay
- db 0,0
- db EGA,EGAColorDisplay
- db EGA,MDADisplay
- db 0,0
- db VGA,PS2MonoDisplay
- db VGA,PS2ColorDisplay
- db 0,0
- db MCGA,EGAColorDisplay
- db MCGA,PS2MonoDisplay
- db MCGA,PS2ColorDisplay
- NumberOfTests = 4
- (*%F NearCall *)
- select Graphics_TEXT
- (*%E *)
- (*%T NearCall *)
- select _TEXT
- (*%E *)
- (*
- __FindPS2
- This subroutine uses INT 10H function 1AH to determine the video BIOS
- Display Combination Code (DCC) for each video subsystem present.
- *)
- public __FindPS2 :
- mov ax, 1A00H
- int 10H (* call video BIOS for info *)
- cmp al, 1AH (* exit if function not supported (i.e., *)
- jne L13 (* no MCGA or VGA in system) *)
- (* convert BIOS DCCs into specific subsystems & displays *)
- mov cx, bx
- xor bh, bh (* BX := DCC for active subsystem *)
- or ch, ch
- jz L11 (* jump if only one subsystem present *)
- mov bl, ch (* BX := inactive DCC *)
- add bx, bx
- mov ax, [bx][DCCtable]
- mov es:[di][Device1], ax
- mov bl, cl
- xor bh, bh (* BX := active DCC *)
- L11:
- add bx, bx
- mov ax, [bx][DCCtable]
- mov es:[di][Device0], ax
- (* reset flags for subsystems that have been ruled out *)
- mov byte [__CGAflag], FALSE
- mov byte [__EGAflag], FALSE
- mov byte [__Monoflag], FALSE
- lea bx, [Video0Type][di] (* if the BIOS reported an MDA ... *)
- cmp byte es:[bx], MDA
- je L12
- lea bx, [Video1Type][di] (* if the BIOS reported an MDA ... *)
- cmp byte es:[bx], MDA
- jne L13
- L12:
- mov word es:[bx], 0 (* ..... Hercules can't be ruled out *)
- mov byte [__Monoflag], TRUE
- L13:
- ret 0
- (* Look for an EGA. This is done by making a call to an EGA BIOS function
- which doesn't exist in the default (MDA, CGA) BIOS.
- *)
- public __FindEGA : (* Caller: AH = flags *)
- (* Returns: AH = flags *)
- (* Video0Type and *)
- (* Display0Type updated *)
- mov bl, 10H (* BL := 10H (return EGA info) *)
- mov ah, 12H
- int 10H (* call EGA BIOS for info *)
- (* if EGA BIOS is present *)
- (* BL <> 10H *)
- (* CL = switch setting *)
- cmp bl,10H
- je L22 (* jump if EGA BIOS not present *)
- mov al, cl
- shr al, 1 (* AL := switches/2 *)
- mov bx, EGADisplays
- xlat (* determine display type from switches *)
- mov ah, al (* AH := display type *)
- mov al, EGA (* AL := subsystem type *)
- call FoundDevice
- cmp ah, MDADisplay
- je L21 (* jump if EGA has a monochrome display *)
- mov byte [__CGAflag], FALSE(* no CGA if EGA has color display *)
- jmp L22
- L21:
- mov byte [__Monoflag], FALSE (* EGA has a mono display, so MDA and *)
- (* Hercules are ruled out *)
- L22:
- ret 0
- (* This is done by looking for the CGA's 6845 CRTC at I/O port 3D4H *)
- public __FindCGA : (* Returns: VIDstruct updated *)
- mov dx, 3D4H (* DX := CRTC address port *)
- call __Find6845
- jc L31 (* jump if not present *)
- mov al, CGA
- mov ah, CGADisplay
- call FoundDevice
- L31:
- ret 0
- (*
- __FindMono This is done by looking for the MDA's 6845 CRTC at I/O port 3B4H.
- If a 6845 is found, the subroutine distinguishes between an MDA
- and a Hercules adapter by monitoring bit 7 of the CRT Status byte.
- This bit changes on Hercules adapters but does not change on an MDA.
- The various Hercules adapters are identified by bits 4 through 6 of
- the CRT Status value:
- 000BH = HGC
- 001BH = HGC+
- 101BH = InColor card
- *)
- public __FindMono : (* Returns: VIDstruct updated *)
- xor bx, bx (* Clear RetraceToggle *)
- mov dx, 003BAH (* Set DX := Status Port Address *)
- in al, dx (* Get Status Byte *)
- and al, 080H (* Mask out bits 0..6 *)
- mov ah, al (* Store RdPort in AH *)
- mov cx, 08000H (* Set loop count to 32767 *)
- $$RdPortLoop:
- dec cx
- jcxz $$RdPortDone
- $$RdPortLoop2:
- in al, dx (* Get Status Byte *)
- and al, 080H (* Mask out bits 0..6 *)
- cmp al, ah (* Same as last time? *)
- jz $$RdPortLoop (* If So, try again *)
- in al, dx (* Otherwise, update RdPort *)
- and al, 080H
- mov ah, al
- inc bx (* Increase RetraceToggle *)
- loop $$RdPortLoop2
- $$RdPortDone:
- mov ah, MDADisplay (* Assume MDA *)
- cmp bx, 2 (* Did the Retrace Toggle > twice *)
- ja $$IsHerc (* If so, it's a Herc *)
- mov al, MDA (* If not, it's a plain MDA *)
- jmp $$Exit
- $$IsHerc:
- in al, dx (* Get the Status Byte *)
- and al, 70H (* Mask out bits 0..3 *)
- cmp al, 10H (* Is it a HGC+ ? *)
- jnz $$NotPlus (* If not, keep looking *)
- mov al, HGCPlus (* If so, tell the world *)
- jmp $$Exit
- $$NotPlus:
- cmp al, 50H (* Is it an InColor Card *)
- jnz $$PlainHGC (* If not, keep looking *)
- mov ah, EGAColorDisplay (* InColor is EGA compatible *)
- mov al, InColor (* Shout it loud *)
- jmp $$Exit
- $$PlainHGC:
- mov al, HGC (* It must be a plain HGC *)
- $$Exit:
- call FoundDevice (* update VideoConfig *)
- ret 0 (* Go Home *)
- (*
- __Find6845 This routine detects the presence of the CRTC on an MDA,CGA, or
- HGC. The technique is to write and read register 0FH of the chip (Cursor
- Location low). If the same value is read as written, assume the chip
- is present at the specified port address.
- *)
- __Find6845 :
- (* Caller: DX = port addr *)
- (* Returns: cf set if not present *)
- mov al, 0FH
- out byte dx, al (* select 6845 reg 0FH (Cursor Low) *)
- inc dx
- in al, dx (* AL := current Cursor Low value *)
- mov ah, al (* preserve in AH *)
- mov al, 66H (* AL := arbritrary value *)
- out byte dx, al (* try to write to 6845 *)
- mov cx, 8000H
- L51:
- loop L51 (* wait for 6845 to respond *)
- in al, dx
- xchg ah, al (* AH := returned value *)
- (* AL := original value *)
- out byte dx, al (* restore original value *)
- cmp ah, 66H (* test whether 6845 responded *)
- je L52 (* jump if it did cf is reset *)
- stc (* set carry flag if no 6845 present *)
- ret 0
- L52:
- clc
- ret 0
- __FindHercMode:
- mov ax, 0F00H
- int 10H
- cmp al, 7
- jne noMono
- clc
- ret 0
- noMono:
- stc
- ret 0
- (* __FindActive This subroutine stores the currently active device as Device0.
- The current video mode determines which subsystem is active.
- *)
- __FindActive :
- cmp word es:[di][Device1], 0
- je L63 (* exit if only one subsystem *)
- cmp byte es:[Video0Type][di], 4 (* exit if MCGA or VGA present *)
- jge L63 (* INT 10H function 1AH *)
- cmp byte es:[Video1Type][di], 4 (* already did the work *)
- jge L63
- mov ah, 0FH
- int 10H (* AL := current BIOS video mode *)
- and al, 7
- cmp al, 7 (* jump if monochrome *)
- je L61 (* (mode 7 or 0FH) *)
- cmp byte es:[Display0Type][di], MDADisplay
- L61:
- jne L63 (* exit if Display0 is monochrome *)
- L62:
- mov ax, es:[di][Device0] (* make Device0 currently active *)
- xchg ax, es:[di][Device1]
- mov es:[di][Device0], ax
- L63:
- ret 0
- (*
- FoundDevice This routine updates the list of subsystems
- *)
- FoundDevice :
- (* Caller: AH = display # *)
- (* AL = subsystem # *)
- (* Destroys: BX *)
- lea bx, es:[Video0Type][di]
- cmp byte es:[bx], 0
- je L71 (* jump if 1st subsystem *)
- lea bx, es:[Video1Type][di] (* must be 2nd subsystem *)
- L71:
- mov es:[bx], ax (* update list entry *)
- ret 0
- (*%F NearCall *)
- select Graphics_TEXT
- (*%E *)
- (*%T NearCall *)
- select _TEXT
- (*%E *)
- public __getsystem :
- (* void _getsystem(VIDstruct *vid) *)
- ARGpVID = frame
- push bp
- mov bp,sp
- push si
- push di
- (*%F SameDS *)
- push ds
- mov cx, _DATA
- mov ds, cx
- (*%E *)
- (* initialize the data structure that will contain the results *)
- (*%F NearPtr *)
- les di, [bp][ARGpVID] (* ES:DI -> start of data structure *)
- (*%E *)
- (*%T NearPtr *)
- mov di, ds
- mov es, di
- mov di, [bp][ARGpVID] (* ES:DI -> start of data structure *)
- (*%E *)
- mov word es:[di][Device0], 0 (* zero these variables *)
- mov word es:[di][Device1], 0
- (* look for various subsystems using the subroutines whose addresses are *)
- (* tabulated in TestSequence; each subroutine sets flags in TestSequence *)
- (* to indicate whether subsequent subroutines need to be called *)
- mov byte [__CGAflag], TRUE
- mov byte [__EGAflag], TRUE
- mov byte [__Monoflag], TRUE
- mov byte [__TestSequence], TRUE
- mov cx, NumberOfTests
- mov si, __TestSequence
- L01:
- lodsb (* AL = flag *)
- test al,al
- lodsw (* AX = subroutine address *)
- jz L02 (* skip subroutine if flag is false *)
- push si
- push cx
- call ax (* call subroutine to detect subsystem *)
- pop cx
- pop si
- L02:
- loop L01
- (* determine which subsystem is active *)
- call __FindActive
- (*%F SameDS *)
- pop ds
- (*%E *)
- pop di (* restore caller registers and return *)
- pop si
- pop bp
- (*%F NearCall *)
- ret far 0
- (*%E *)
- (*%T NearCall *)
- ret 0
- (*%E *)
- (****************************************************************************)
- section
- (*%F NearCall *)
- segment Graphics_TEXT(CODE,28H)
- (*%E *)
- (*%T NearCall *)
- segment _TEXT(CODE,28H)
- (*%E *)
- segment _DATA(DATA, 28H)
- (*%F NearCall *)
- select Graphics_TEXT
- (*%E *)
- (*%T NearCall *)
- select _TEXT
- (*%E *)
- public __getmemory :
- (*%T _DLLOVL *)
- push bp
- mov bp, sp
- (*%E *)
- mov ah, 12H
- mov bl, 10H
- int 10H
- mov al, 64
- inc bl
- mov dl, bl
- mul dl
- (*%T _DLLOVL *)
- pop bp
- (*%E *)
- (*%F NearCall *)
- ret far 0
- (*%E *)
- (*%T NearCall *)
- ret 0
- (*%E *)
- (****************************************************************************)
- section
- (*%F NearCall *)
- segment Graphics_TEXT(CODE,28H)
- (*%E *)
- (*%T NearCall *)
- segment _TEXT(CODE,28H)
- (*%E *)
- segment _DATA(DATA, 28H)
- (*%F NearCall *)
- select Graphics_TEXT
- (*%E *)
- (*%T NearCall *)
- select _TEXT
- (*%E *)
- public __clear_blink :
- mov ax, 1003H
- mov bl, 0H
- int 10H
- ret 0
- (******************************************************************************)
- section
- (*%F NearCall *)
- segment Graphics_TEXT(CODE,28H)
- (*%E *)
- (*%T NearCall *)
- segment _TEXT(CODE,28H)
- (*%E *)
- segment _DATA(DATA, 28H)
- (*%F NearCall *)
- select Graphics_TEXT
- (*%E *)
- (*%T NearCall *)
- select _TEXT
- (*%E *)
- public __gr_abs_value :
- (*%T _DLLOVL *)
- push bp
- mov bp, sp
- (*%E *)
- test ah, 80H
- jz absRet
- neg ax
- absRet:
- (*%T _DLLOVL *)
- pop bp
- (*%E *)
- (*%F NearCall *)
- ret far 0
- (*%E *)
- (*%T NearCall *)
- ret 0
- (*%E *)
- (**************************************************************************)
- section
- (*%F NearCall *)
- segment Graphics_TEXT(CODE,28H)
- (*%E *)
- (*%T NearCall *)
- segment _TEXT(CODE,28H)
- (*%E *)
- segment _DATA(DATA, 28H)
- (*%F NearCall *)
- select Graphics_TEXT
- (*%E *)
- (*%T NearCall *)
- select _TEXT
- (*%E *)
- public __gdummy : (* default null procedure for function pointers *)
- (*%F NearCall *)
- ret far 0
- (*%E *)
- (*%T NearCall *)
- ret 0
- (*%E *)
- (**************************************************************************)
- section
- (*%F NearCall *)
- segment Graphics_TEXT(CODE,28H)
- (*%E *)
- (*%T NearCall *)
- segment _TEXT(CODE,28H)
- (*%E *)
- segment _DATA(DATA, 28H)
- (*%F NearCall *)
- select Graphics_TEXT
- (*%E *)
- (*%T NearCall *)
- select _TEXT
- (*%E *)
- (*
- void _setcur(short row, short col, short page);
- *)
- public __setcur :
- (*%T _DLLOVL *)
- push bp
- mov bp, sp
- (*%E *)
- mov dh, al
- mov dl, bl
- mov bh, cl
- mov ah, 2
- int 10H
- (*%T _DLLOVL *)
- pop bp
- (*%E *)
- (*%F NearCall *)
- ret far 0
- (*%E *)
- (*%T NearCall *)
- ret 0
- (*%E *)
- (*************************************************************************)
- numxpixels = 0 (* number of pixels on X axis *)
- numypixels = 2 (* number of pixels on Y axis *)
- numtextcols = 4 (* number of text columns available *)
- numtextrows = 6 (* number of text rows available *)
- numcolors = 8 (* number of actual colors *)
- bitsperpixel = 10 (* number of bits per pixel *)
- numvideopages = 12 (* number of available video pages *)
- mode = 14 (* current video mode *)
- adapter = 16 (* active display adapter *)
- monitor = 18 (* active display monitor *)
- memory = 20 (* adapter video memory in K bytes *)
- _DEFAULTMODE = -1 (* restore screen to original mode *)
- _TEXTBW40 = 0 (* 40 x 25 text, 16 grey *)
- _TEXTC40 = 1 (* 40 x 25 text, 16/8 color *)
- _TEXTBW80 = 2 (* 80 x 25 text, 16 grey *)
- _TEXTC80 = 3 (* 80 x 25 text, 16/8 color *)
- _MRES4COLOR = 4 (* 320 x 200, 4 color *)
- _MRESNOCOLOR = 5 (* 320 x 200, 4 grey *)
- _HRESBW = 6 (* 640 x 200, BW *)
- _TEXTMONO = 7 (* 80 x 25 text, BW *)
- _HERCMONO = 8 (* 720 x 348, BW for HGC *)
- _MRES16COLOR = 13 (* 320 x 200, 16 color *)
- _HRES16COLOR = 14 (* 640 x 200, 16 color *)
- _ERESNOCOLOR = 15 (* 640 x 350, BW *)
- _ERESCOLOR = 16 (* 640 x 350, 4 or 16 color *)
- _VRES2COLOR = 17 (* 640 x 480, BW *)
- _VRES16COLOR = 18 (* 640 x 480, 16 color *)
- _MRES256COLOR = 19 (* 320 x 200, 256 color *)
- extrn __current_video
- extrn __clear_blink
- public __resetEGA :
- mov ax, _DATA
- mov es, ax
- cmp word es:[__current_video][mode], _VRES2COLOR
- jnz notVres
- mov cx, 1
- jmp ccDone
- notVres:
- cmp word es:[__current_video][mode], _ERESNOCOLOR
- jnz notEres
- mov cx, 5
- jmp ccDone
- notEres:
- mov cx, 0FH;
- ccDone:
- mov al, 2
- mov dx, 3CEH
- out byte dx, al
- mov al, 0FH
- inc dx
- out byte dx, al
- mov al, 1
- dec dx
- out byte dx, al
- sub al, al
- inc dx
- out byte dx, al
- mov al, 2
- dec dx
- out byte dx, al
- sub al, al
- inc dx
- out byte dx, al
- mov al, 3
- dec dx
- out byte dx, al
- sub al, al
- inc dx
- out byte dx, al
- mov al, 8
- dec dx
- out byte dx, al
- mov al, 0FFH
- inc dx
- out byte dx, al
- mov al, 7
- dec dx
- out byte dx, al
- mov al, cl
- inc dx
- out byte dx, al
- mov al, 5
- dec dx
- out byte dx, al
- sub al, al
- inc dx
- out byte dx, al
- mov al, 2
- mov dx, 3C4H
- out byte dx, al
- mov al, 0FH
- inc dx
- out byte dx, al
- call __clear_blink
- (*%F NearCall *)
- ret far 0
- (*%E *)
- (*%T NearCall *)
- ret 0
- (*%E *)
- public __setbc :
- mov ah, 0BH
- sub bx, bx
- (*%F NearCall *)
- ret far 0
- (*%E *)
- (*%T NearCall *)
- ret 0
- (*%E *)
- public __setr10 :
- mov ax, 1010H
- mov bx, 10H
- sub cx, cx
- sub dx, dx
- (*%F NearCall *)
- ret far 0
- (*%E *)
- (*%T NearCall *)
- ret 0
- (*%E *)
- (***************************************************************************)
- section
- (*%F NearCall *)
- segment Graphics_TEXT(CODE,28H)
- (*%E *)
- (*%T NearCall *)
- segment _TEXT(CODE,28H)
- (*%E *)
- segment _DATA(DATA, 28H)
- (*%F NearCall *)
- select Graphics_TEXT
- (*%E *)
- (*%T NearCall *)
- select _TEXT
- (*%E *)
- public __gmemcpy :
- (*
- void *_gmemcpy(void *dest, void *source, unsigned num)
- Copies num bytes from source to dest (Does not handle any overlap).
- Returns destination address.
- *)
- num = bxframe
- mov es, bx
- mov bx, sp
- mov bx, ss:[bx][num]
- push di
- push si
- push ds
- mov ds, dx
- mov si, cx
- mov di, ax
- mov cx, bx
- jcxz noMove
- test al, 1
- jz evenAdd (* word align *)
- movsb
- dec cx
- evenAdd:
- shr cx, 1
- rep; movsw (* move words *)
- adc cx, cx
- rep; movsb (* move odd byte *)
- noMove:
- mov dx, es
- pop ds
- pop si
- pop di
- (*%F NearCall *)
- ret far 2
- (*%E *)
- (*%T NearCall *)
- ret 2
- (*%E *)
- (****************************************************************************)
- section
- (*%F NearCall *)
- segment Graphics_TEXT(CODE,28H)
- (*%E *)
- (*%T NearCall *)
- segment _TEXT(CODE,28H)
- (*%E *)
- segment _DATA(DATA, 28H)
- (*%F NearCall *)
- select Graphics_TEXT
- (*%E *)
- (*%T NearCall *)
- select _TEXT
- (*%E *)
- public __gmemset :
- (*
- void *_gmemset(void *s, char c, unsigned num)
- Sets num bytes to c.
- Returns buffer address.
- *)
- push di
- mov es, bx
- mov di, ax
- mov al, cl
- mov cx, dx
- mov dx, di
- jcxz noMove
- mov ah, al
- test di, 1
- jz evenAdd
- stosb (* word align *)
- dec cx
- evenAdd:
- shr cx, 1
- rep ; stosw (* move words *)
- adc cx, cx
- rep ; stosb (* move odd byte *)
- noMove:
- mov ax, dx
- mov dx, es (* return buffer address *)
- pop di
- (*%F NearCall *)
- ret far 0
- (*%E *)
- (*%T NearCall *)
- ret 0
- (*%E *)
- (***************************************************************************)
- section
- (*%F NearCall *)
- segment Graphics_TEXT(CODE,28H)
- (*%E *)
- (*%T NearCall *)
- segment _TEXT(CODE,28H)
- (*%E *)
- segment _DATA(DATA, 28H)
- (*%F NearCall *)
- select Graphics_TEXT
- (*%E *)
- (*%T NearCall *)
- select _TEXT
- (*%E *)
- public __gmemwset :
- (*
- void *memwset(void *s, char c, unsigned num)
- Sets num words to c.
- Returns buffer address.
- *)
- push di
- mov es, bx
- mov di, ax
- mov ax, cx
- mov cx, dx
- mov dx, di
- rep ; stosw
- mov ax, dx
- mov dx, es (* return buffer address *)
- pop di
- (*%F NearCall *)
- ret far 0
- (*%E *)
- (*%T NearCall *)
- ret 0
- (*%E *)
- (****************************************************************************)
- section
- segment _DATA(DATA, 28H)
- segment _TEXT(CODE,28H)
- extrn __setvideomode
- extrn __setvideomode_vector
- extrn __display_state
- extrn __mode_changed
- select _TEXT
- public __restore_mode :
- (*%T _DLLOVL *)
- push bp
- mov bp, sp
- (*%E *)
- (*%F SameDS *)
- push ds
- mov ax, _DATA
- mov ds, ax
- (*%E *)
- cmp byte [__display_state], 0
- jz dontReset
- cmp byte [__mode_changed], 0
- jz dontReset
- mov ax, -1
- (*%F RegParam *)
- push ax
- (*%E *)
- (*%F _DLL *)
- call far __setvideomode
- (*%E *)
- (*%T _DLL *)
- call far [__setvideomode_vector]
- (*%E *)
- (*%F RegParam *)
- pop ax
- (*%E *)
- dontReset:
- (*%F SameDS *)
- pop ds
- (*%E *)
- (*%T _DLLOVL *)
- pop bp
- (*%E *)
- (*%F NearCall *)
- ret far 0
- (*%E *)
- (*%T NearCall *)
- ret 0
- (*%E *)
- (****************************************************************************)
- section
- segment _TEXT(CODE,28H)
- segment _DATA(DATA, 28H)
- segment _INIT(INIT_CODE,28H)
- extrn __initgraph
- extrn __initgraph_vector
- extrn __exitgraph
- extrn __restore_mode
- (*%T _DLLOVL *)
- select _DATA
- RestAdr: dd __restore_mode
- (*%E *)
- select _TEXT
- do_initgraph : (* defined later on ! *)
- select _INIT
- (*%F NearCall *)
- initgraph : dw MAGIC_NUM
- db PR4
- dd do_initgraph
- (*%E *)
- (*%T NearCall *)
- initgraph : dw MAGIC_NUM
- db PR4
- dw do_initgraph
- (*%E *)
- select _DATA
- public __defaultmode : dw initgraph, 0
- select _TEXT
- (*%T _DLLOVL *)
- push bp
- mov bp, sp
- (*%E *)
- push ds
- mov ax, _DATA
- mov ds, ax
- (*%F _DLL *)
- call far __initgraph
- (*%E *)
- (*%T _DLL *)
- cmp word [__initgraph_vector], 0
- jz noInit
- call far [__initgraph_vector]
- (*%E *)
- (*%F _DLLOVL *)
- mov word [__exitgraph], __restore_mode
- (*%F NearCall *)
- mov word [__exitgraph][2], cs
- (*%E *)
- (*%E *)
- (*%T _DLLOVL *)
- mov ax, [RestAdr]
- mov word [__exitgraph], ax
- mov ax, [RestAdr][2]
- mov word [__exitgraph][2], ax
- (*%E *)
- noInit:
- pop ds
- (*%F NearCall *)
- (*%T _DLLOVL *)
- pop bp
- (*%E *)
- ret far 0
- (*%E *)
- (*%T NearCall *)
- ret 0
- (*%E *)
- (*%E *)
- (****************************************************************************)
- (*%T _DLL *)
- section
- segment _DATA(DATA,28H)
- segment _TEXT(CODE,28H)
- extrn __setvideomode_vector
- extrn __initgraph_vector
- public __set_initgraph_vector :
- push bp
- mov bp, sp
- push ds
- push di
- mov di, _DATA
- mov ds, di
- mov [__setvideomode_vector][2], dx
- mov [__setvideomode_vector], cx
- mov [__initgraph_vector][2], bx
- mov [__initgraph_vector], ax
- pop di
- pop ds
- pop bp
- ret far 0
- (*%E *)
- end
|