ASMLIB.A 129 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759
  1. (* Release 3.10 *)
  2. (*-------------------------------------------------------------------------*
  3. * *
  4. * ASMLIB.A - Modula-2 assembly language implementations *
  5. * *
  6. * COPYRIGHT (C) 1989..1992 Clarion Software Corporation. *
  7. * All Rights Reserved *
  8. * *
  9. *--------------------------------------------------------------------------*)
  10. include "corelib.inc"
  11. module AsmLib
  12. (* Common Procedures *)
  13. (*****************************************************************************)
  14. section
  15. (* ------------------------------------------------------------------------
  16. PROCEDURE - Lib.Terminate.
  17. PRECONDITIONS - None.
  18. POSTCONDITIONS - Procedure appended to terminate chain.
  19. IN PARAMETERS - P (PROC), next link (VAR PROC).
  20. OUT PARAMETERS - None.
  21. CALLING CONVENTION - Standard.
  22. NOTES - None.
  23. VERSION - MSDOS.
  24. ------------------------------------------------------------------------ *)
  25. (*%F _DLL *)
  26. (*%T SameDS *)
  27. segment _TEXT(CODE,28H)
  28. (*%E *)
  29. (*%F SameDS *)
  30. segment Lib_TEXT(CODE,28H)
  31. (*%E *)
  32. (*%E *)
  33. (*%T _DLL *)
  34. segment LibDLL_TEXT(CODE,28H)
  35. (*%E *)
  36. extrn standard@haltChain
  37. extrn __core_lock
  38. extrn __core_unlock
  39. (*%F RegParam *)
  40. (*%F NearCall *)
  41. (*%F NearPtr *)
  42. a_ptrH = 6+frame
  43. a_ptrL = 4+frame
  44. c_ptrH = 2+frame
  45. c_ptrL = frame
  46. RetSize = 8
  47. (*%E *)
  48. (*%T NearPtr *)
  49. a_ptrH = 4+frame
  50. a_ptrL = 2+frame
  51. c_ptrL = frame
  52. RetSize = 6
  53. (*%E *)
  54. (*%E *)
  55. (*%T NearCall *)
  56. (*%T NearPtr *)
  57. a_ptrL = 2+frame
  58. c_ptrL = frame
  59. RetSize = 4
  60. (*%E *)
  61. (*%F NearPtr *)
  62. a_ptrL = 4+frame
  63. c_ptrH = 2+frame
  64. c_ptrL = frame
  65. RetSize = 6
  66. (*%E *)
  67. (*%E *)
  68. public Lib$Terminate :
  69. push bp
  70. mov bp,sp
  71. push ds
  72. (*%F SameDS *)
  73. mov ax, seg standard@haltChain
  74. mov ds, ax
  75. (*%E *)
  76. (*%T MThread *)
  77. (*%F _DLL *)
  78. call far [__core_lock]
  79. (*%E *)
  80. (*%T _DLL *)
  81. mov ax, seg __core_lock
  82. mov es, ax
  83. call far es:[__core_lock]
  84. (*%E *)
  85. (*%E *)
  86. mov ax,[bp][a_ptrL]
  87. xchg ax,[standard@haltChain]
  88. (*%F NearCall *)
  89. mov dx, [bp][a_ptrH]
  90. xchg dx,[standard@haltChain][2]
  91. (*%E *)
  92. (*%F NearPtr *)
  93. lds bx,[bp][c_ptrL]
  94. (*%E *)
  95. (*%T NearPtr *)
  96. mov bx,[bp][c_ptrL]
  97. (*%E *)
  98. mov [bx],ax
  99. (*%F NearCall *)
  100. mov [bx][2],dx
  101. (*%E *)
  102. (*%T MThread *)
  103. mov bx, seg __core_unlock
  104. mov es, bx
  105. call far es:[__core_unlock]
  106. (*%E *)
  107. pop ds
  108. pop bp
  109. (*%F NearCall *)
  110. ret far RetSize
  111. (*%E *)
  112. (*%T NearCall *)
  113. ret RetSize
  114. (*%E *)
  115. (*%E *)
  116. (*%T RegParam *)
  117. public Lib$Terminate :
  118. (*%T _DLLOVL *)
  119. push bp
  120. mov bp, sp
  121. (*%E *)
  122. push si
  123. (*%F NearPtr *)
  124. push ds
  125. (*%E *)
  126. (*%F SameDS *)
  127. mov si, seg standard@haltChain
  128. mov ds, si
  129. (*%E *)
  130. (*%T MThread *)
  131. (*%F _DLL *)
  132. call far [__core_lock]
  133. (*%E *)
  134. (*%T _DLL *)
  135. mov si, seg __core_lock
  136. mov es, si
  137. call far es:[__core_lock]
  138. (*%E *)
  139. (*%E *)
  140. (*%F NearCall *)
  141. xchg ax,[standard@haltChain]
  142. xchg bx,[standard@haltChain][2]
  143. (*%F NearPtr *)
  144. mov ds, dx
  145. (*%E *)
  146. mov si, cx
  147. mov [si],ax
  148. mov [si][2],bx
  149. (*%E *)
  150. (*%T NearCall *)
  151. xchg ax,[standard@haltChain]
  152. (*%F NearPtr *)
  153. mov ds, cx
  154. (*%E *)
  155. mov [bx],ax
  156. (*%E *)
  157. (*%T MThread *)
  158. mov bx, seg __core_unlock
  159. mov es, bx
  160. call far es:[__core_unlock]
  161. (*%E *)
  162. (*%F NearPtr *)
  163. pop ds
  164. (*%E *)
  165. pop si
  166. (*%T _DLLOVL *)
  167. pop bp
  168. (*%E *)
  169. (*%F NearCall *)
  170. ret far 0
  171. (*%E *)
  172. (*%T NearCall *)
  173. ret 0
  174. (*%E *)
  175. (*%E *)
  176. (*****************************************************************************)
  177. section
  178. (* ------------------------------------------------------------------------
  179. PROCEDURE - Lib.HashString.
  180. PRECONDITIONS - None.
  181. POSTCONDITIONS - None.
  182. IN PARAMETERS - string (ARRAY OF CHAR), hash range (CARDINAL).
  183. OUT PARAMETERS - Returns hash value (CARDINAL).
  184. CALLING CONVENTION - Standard.
  185. NOTES - None.
  186. VERSION - _OS2 and MSDOS.
  187. ------------------------------------------------------------------------ *)
  188. (*%F _DLL *)
  189. (*%T SameDS *)
  190. segment _TEXT(CODE,28H)
  191. (*%E *)
  192. (*%F SameDS *)
  193. segment Lib_TEXT(CODE,28H)
  194. (*%E *)
  195. (*%E *)
  196. (*%T _DLL *)
  197. segment LibDLL_TEXT(CODE,28H)
  198. (*%E *)
  199. (*%F RegParam *)
  200. (*%F NearPtr *)
  201. ssize = 6+frame
  202. segm = 4+frame
  203. offs = 2+frame
  204. modulus = frame
  205. RetSize = 8
  206. (*%E *)
  207. (*%T NearPtr *)
  208. ssize = 4+frame
  209. offs = 2+frame
  210. modulus = frame
  211. RetSize = 6
  212. (*%E *)
  213. (*%E *)
  214. (*%T RegParam *)
  215. modulus = -2
  216. locals = 2
  217. RetSize = 0
  218. (*%E *)
  219. public Lib$HashString :
  220. push bp
  221. mov bp,sp
  222. (*%T RegParam *)
  223. sub sp, locals
  224. (*%T NearPtr *)
  225. push dx
  226. (*%E *)
  227. (*%E *)
  228. (*%F NearPtr *)
  229. push ds
  230. (*%E *)
  231. push si
  232. push di
  233. (*%F RegParam *)
  234. mov cx,[bp][ssize]
  235. jcxz $Exit
  236. (*%F NearPtr *)
  237. mov ds,[bp][segm]
  238. (*%E *)
  239. mov si,[bp][offs]
  240. mov di,[bp][ssize]
  241. (*%E *)
  242. (*%T RegParam *)
  243. or ax, ax
  244. jz $Exit
  245. (*%F NearPtr *)
  246. mov ds, cx
  247. mov si, bx
  248. mov [bp][modulus], dx
  249. (*%E *)
  250. (*%T NearPtr *)
  251. mov si, bx
  252. mov [bp][modulus], cx
  253. (*%E *)
  254. mov cx, ax
  255. mov di, ax
  256. (*%E *)
  257. sub bx,bx
  258. sub dx,dx
  259. sub ax,ax
  260. $loop:
  261. lodsb
  262. or al, al
  263. jz $EndLoop
  264. xor dl, al
  265. rol dx, 1
  266. rol dx, 1
  267. rol dx, 1
  268. add dx, di
  269. sub dx, cx
  270. loop $loop
  271. $EndLoop:
  272. mov ax, dx
  273. sub dx, dx
  274. div word [bp][modulus]
  275. $Exit:
  276. mov ax, dx
  277. pop di
  278. pop si
  279. (*%F NearPtr *)
  280. pop ds
  281. (*%E *)
  282. (*%T RegParam *)
  283. (*%T NearPtr *)
  284. pop dx
  285. (*%E *)
  286. mov sp, bp
  287. (*%E *)
  288. pop bp
  289. (*%F NearCall *)
  290. ret far RetSize
  291. (*%E *)
  292. (*%T NearCall *)
  293. ret RetSize
  294. (*%E *)
  295. (*****************************************************************************)
  296. section
  297. (* ------------------------------------------------------------------------
  298. PROCEDURE - Lib.Fill.
  299. PRECONDITIONS - None.
  300. POSTCONDITIONS - block of bytes set tp specified value.
  301. IN PARAMETERS - destination (ADDRESS), byte count (CARDINAL),
  302. byte value (BYTE).
  303. OUT PARAMETERS - None.
  304. CALLING CONVENTION - Standard.
  305. NOTES - None.
  306. VERSION - _OS2 and MSDOS.
  307. ------------------------------------------------------------------------ *)
  308. (*%F _DLL *)
  309. (*%T SameDS *)
  310. segment _TEXT(CODE,28H)
  311. (*%E *)
  312. (*%F SameDS *)
  313. segment Lib_TEXT(CODE,28H)
  314. (*%E *)
  315. (*%E *)
  316. (*%T _DLL *)
  317. segment LibDLL_TEXT(CODE,28H)
  318. (*%E *)
  319. (*%F RegParam *)
  320. (*%F NearPtr *)
  321. d_seg = 6+frame
  322. d_ofs = 4+frame
  323. len = 2+frame
  324. val = frame
  325. RetSize = 8
  326. (*%E *)
  327. (*%T NearPtr *)
  328. d_ofs = 4+frame
  329. len = 2+frame
  330. val = frame
  331. RetSize = 6
  332. (*%E *)
  333. public Lib$Fill :
  334. push bp
  335. mov bp, sp
  336. push di
  337. mov cx, [bp][len]
  338. (*%F NearPtr *)
  339. les di, [bp][d_ofs]
  340. (*%E *)
  341. (*%T NearPtr *)
  342. mov di, [bp][d_ofs]
  343. push ds
  344. pop es
  345. (*%E *)
  346. mov ax, [bp][val]
  347. mov ah, al
  348. shr cx, 1
  349. rep ; stosw
  350. jnc $Exit
  351. stosb
  352. $Exit:
  353. pop di
  354. pop bp
  355. (*%F NearCall *)
  356. ret far RetSize
  357. (*%E *)
  358. (*%T NearCall *)
  359. ret RetSize
  360. (*%E *)
  361. (*%E *)
  362. (*%T RegParam *)
  363. RetSize = 0
  364. public Lib$Fill :
  365. (*%T _DLLOVL *)
  366. push bp
  367. mov bp, sp
  368. (*%E *)
  369. push di
  370. (*%F NearPtr *)
  371. mov di, ax
  372. mov es, bx
  373. mov ax, dx
  374. (*%E *)
  375. (*%T NearPtr *)
  376. mov di, ax
  377. mov ax, cx
  378. mov cx, bx
  379. push ds
  380. pop es
  381. (*%E *)
  382. mov ah, al
  383. shr cx, 1
  384. rep ; stosw
  385. jnc $Exit
  386. stosb
  387. $Exit:
  388. pop di
  389. (*%T _DLLOVL *)
  390. pop bp
  391. (*%E *)
  392. (*%F NearCall *)
  393. ret far RetSize
  394. (*%E *)
  395. (*%T NearCall *)
  396. ret RetSize
  397. (*%E *)
  398. (*%E *)
  399. (*****************************************************************************)
  400. section
  401. (* ------------------------------------------------------------------------
  402. PROCEDURE - Lib.FarFill.
  403. PRECONDITIONS - None.
  404. POSTCONDITIONS - block of bytes set tp specified value.
  405. IN PARAMETERS - destination (FarADDRESS), byte count (CARDINAL),
  406. byte value (BYTE).
  407. OUT PARAMETERS - None.
  408. CALLING CONVENTION - Standard.
  409. NOTES - Takes 32 pointer parameter.
  410. VERSION - _OS2 and MSDOS.
  411. ------------------------------------------------------------------------ *)
  412. (*%F _DLL *)
  413. (*%T SameDS *)
  414. segment _TEXT(CODE,28H)
  415. (*%E *)
  416. (*%F SameDS *)
  417. segment Lib_TEXT(CODE,28H)
  418. (*%E *)
  419. (*%E *)
  420. (*%T _DLL *)
  421. segment LibDLL_TEXT(CODE,28H)
  422. (*%E *)
  423. (*%F RegParam *)
  424. d_seg = 6+frame
  425. d_ofs = 4+frame
  426. len = 2+frame
  427. val = frame
  428. RetSize = 8
  429. public Lib$FarFill :
  430. push bp
  431. mov bp, sp
  432. push di
  433. mov cx, [bp][len]
  434. les di, [bp][d_ofs]
  435. mov ax, [bp][val]
  436. mov ah, al
  437. shr cx, 1
  438. rep ; stosw
  439. jnc $Exit
  440. stosb
  441. $Exit:
  442. pop di
  443. pop bp
  444. (*%F NearCall *)
  445. ret far RetSize
  446. (*%E *)
  447. (*%T NearCall *)
  448. ret RetSize
  449. (*%E *)
  450. (*%E *)
  451. (*%T RegParam *)
  452. RetSize = 0
  453. public Lib$FarFill :
  454. (*%T _DLLOVL *)
  455. push bp
  456. mov bp, sp
  457. (*%E *)
  458. push di
  459. mov di, ax
  460. mov es, bx
  461. mov ax, dx
  462. mov ah, al
  463. shr cx, 1
  464. rep ; stosw
  465. jnc $Exit
  466. stosb
  467. $Exit:
  468. pop di
  469. (*%T _DLLOVL *)
  470. pop bp
  471. (*%E *)
  472. (*%F NearCall *)
  473. ret far RetSize
  474. (*%E *)
  475. (*%T NearCall *)
  476. ret RetSize
  477. (*%E *)
  478. (*%E *)
  479. (*****************************************************************************)
  480. section
  481. (* ------------------------------------------------------------------------
  482. PROCEDURE - Lib.WordFill.
  483. PRECONDITIONS - None.
  484. POSTCONDITIONS - block of words set to specified value.
  485. IN PARAMETERS - destination (FarADDRESS), word count (CARDINAL),
  486. word value (WORD).
  487. OUT PARAMETERS - None.
  488. CALLING CONVENTION - Standard.
  489. NOTES - None.
  490. VERSION - _OS2 and MSDOS.
  491. ------------------------------------------------------------------------ *)
  492. (*%F _DLL *)
  493. (*%T SameDS *)
  494. segment _TEXT(CODE,28H)
  495. (*%E *)
  496. (*%F SameDS *)
  497. segment Lib_TEXT(CODE,28H)
  498. (*%E *)
  499. (*%E *)
  500. (*%T _DLL *)
  501. segment LibDLL_TEXT(CODE,28H)
  502. (*%E *)
  503. (*%F RegParam *)
  504. (*%F NearPtr *)
  505. d_seg = 6+frame
  506. d_ofs = 4+frame
  507. len = 2+frame
  508. val = frame
  509. RetSize = 8
  510. (*%E *)
  511. (*%T NearPtr *)
  512. d_ofs = 4+frame
  513. len = 2+frame
  514. val = frame
  515. RetSize = 6
  516. (*%E *)
  517. public Lib$WordFill :
  518. push bp
  519. mov bp, sp
  520. push di
  521. mov cx, [bp][len]
  522. (*%F NearPtr *)
  523. les di, [bp][d_ofs]
  524. (*%E *)
  525. (*%T NearPtr *)
  526. mov di, [bp][d_ofs]
  527. push ds
  528. pop es
  529. (*%E *)
  530. mov ax, [bp][val]
  531. rep ; stosw
  532. pop di
  533. pop bp
  534. (*%F NearCall *)
  535. ret far RetSize
  536. (*%E *)
  537. (*%T NearCall *)
  538. ret RetSize
  539. (*%E *)
  540. (*%E *)
  541. (*%T RegParam *)
  542. RetSize = 0
  543. public Lib$WordFill :
  544. (*%T _DLLOVL *)
  545. push bp
  546. mov bp, sp
  547. (*%E *)
  548. push di
  549. (*%F NearPtr *)
  550. mov di, ax
  551. mov es, bx
  552. mov ax, dx
  553. (*%E *)
  554. (*%T NearPtr *)
  555. mov di, ax
  556. mov ax, cx
  557. mov cx, bx
  558. push ds
  559. pop es
  560. (*%E *)
  561. rep ; stosw
  562. pop di
  563. (*%T _DLLOVL *)
  564. pop bp
  565. (*%E *)
  566. (*%F NearCall *)
  567. ret far RetSize
  568. (*%E *)
  569. (*%T NearCall *)
  570. ret RetSize
  571. (*%E *)
  572. (*%E *)
  573. (*****************************************************************************)
  574. section
  575. (* ------------------------------------------------------------------------
  576. PROCEDURE - Lib.FarWordFill.
  577. PRECONDITIONS - None.
  578. POSTCONDITIONS - block of words set to specified value.
  579. IN PARAMETERS - destination (FarADDRESS), word count (CARDINAL),
  580. word value (WORD).
  581. OUT PARAMETERS - None.
  582. CALLING CONVENTION - Standard.
  583. NOTES - Takes 32 pointer parameter.
  584. VERSION - _OS2 and MSDOS.
  585. ------------------------------------------------------------------------ *)
  586. (*%F _DLL *)
  587. (*%T SameDS *)
  588. segment _TEXT(CODE,28H)
  589. (*%E *)
  590. (*%F SameDS *)
  591. segment Lib_TEXT(CODE,28H)
  592. (*%E *)
  593. (*%E *)
  594. (*%T _DLL *)
  595. segment LibDLL_TEXT(CODE,28H)
  596. (*%E *)
  597. (*%F RegParam *)
  598. d_seg = 6+frame
  599. d_ofs = 4+frame
  600. len = 2+frame
  601. val = frame
  602. RetSize = 8
  603. public Lib$FarWordFill :
  604. push bp
  605. mov bp, sp
  606. push di
  607. mov cx, [bp][len]
  608. les di, [bp][d_ofs]
  609. mov ax, [bp][val]
  610. rep ; stosw
  611. pop di
  612. pop bp
  613. (*%F NearCall *)
  614. ret far RetSize
  615. (*%E *)
  616. (*%T NearCall *)
  617. ret RetSize
  618. (*%E *)
  619. (*%E *)
  620. (*%T RegParam *)
  621. RetSize = 0
  622. public Lib$FarWordFill :
  623. (*%T _DLLOVL *)
  624. push bp
  625. mov bp, sp
  626. (*%E *)
  627. push di
  628. mov di, ax
  629. mov es, bx
  630. mov ax, dx
  631. rep ; stosw
  632. pop di
  633. (*%T _DLLOVL *)
  634. pop bp
  635. (*%E *)
  636. (*%F NearCall *)
  637. ret far RetSize
  638. (*%E *)
  639. (*%T NearCall *)
  640. ret RetSize
  641. (*%E *)
  642. (*%E *)
  643. (*****************************************************************************)
  644. section
  645. (* ------------------------------------------------------------------------
  646. PROCEDURE - Lib.ScanR.
  647. PRECONDITIONS - None.
  648. POSTCONDITIONS - None.
  649. IN PARAMETERS - destination (ADDRESS), byte count (CARDINAL),
  650. byte value (BYTE).
  651. OUT PARAMETERS - position of value, count if not found (CARDINAL).
  652. CALLING CONVENTION - Standard.
  653. NOTES - Scans for byte from low address.
  654. VERSION - _OS2 and MSDOS.
  655. ------------------------------------------------------------------------ *)
  656. (*%F _DLL *)
  657. (*%T SameDS *)
  658. segment _TEXT(CODE,28H)
  659. (*%E *)
  660. (*%F SameDS *)
  661. segment Lib_TEXT(CODE,28H)
  662. (*%E *)
  663. (*%E *)
  664. (*%T _DLL *)
  665. segment LibDLL_TEXT(CODE,28H)
  666. (*%E *)
  667. (*%F RegParam *)
  668. (*%F NearPtr *)
  669. d_seg = 6+frame
  670. d_ofs = 4+frame
  671. len = 2+frame
  672. val = frame
  673. RetSize = 8
  674. (*%E *)
  675. (*%T NearPtr *)
  676. d_ofs = 4+frame
  677. len = 2+frame
  678. val = frame
  679. RetSize = 6
  680. (*%E *)
  681. public Lib$ScanR :
  682. push bp
  683. mov bp,sp
  684. push di
  685. mov cx,[bp][len]
  686. jcxz ExitScan
  687. (*%F NearPtr *)
  688. les di,[bp][d_ofs]
  689. (*%E *)
  690. (*%T NearPtr *)
  691. mov di,[bp][d_ofs]
  692. push ds
  693. pop es
  694. (*%E *)
  695. mov ax,[bp][val]
  696. repne
  697. scasb
  698. jne ExitScan
  699. inc cx
  700. ExitScan:
  701. mov ax,[bp][len]
  702. sub ax,cx
  703. pop di
  704. pop bp
  705. (*%F NearCall *)
  706. ret far RetSize
  707. (*%E *)
  708. (*%T NearCall *)
  709. ret RetSize
  710. (*%E *)
  711. (*%E *)
  712. (*%T RegParam *)
  713. RetSize = 0
  714. public Lib$ScanR :
  715. (*%T _DLLOVL *)
  716. push bp
  717. mov bp, sp
  718. (*%E *)
  719. push di
  720. push si
  721. (*%F NearPtr *)
  722. mov si, cx
  723. mov es, bx
  724. mov di, ax
  725. mov ax, dx
  726. (*%E *)
  727. (*%T NearPtr *)
  728. mov si, bx
  729. mov di, ax
  730. mov ax, cx
  731. mov cx, bx
  732. push ds
  733. pop es
  734. (*%E *)
  735. jcxz ExitScan
  736. repne
  737. scasb
  738. jne ExitScan
  739. inc cx
  740. ExitScan:
  741. mov ax, si
  742. sub ax, cx
  743. pop si
  744. pop di
  745. (*%T _DLLOVL *)
  746. pop bp
  747. (*%E *)
  748. (*%F NearCall *)
  749. ret far RetSize
  750. (*%E *)
  751. (*%T NearCall *)
  752. ret RetSize
  753. (*%E *)
  754. (*%E *)
  755. (*****************************************************************************)
  756. section
  757. (* ------------------------------------------------------------------------
  758. PROCEDURE - Lib.ScanL.
  759. PRECONDITIONS - None.
  760. POSTCONDITIONS - None.
  761. IN PARAMETERS - destination (ADDRESS), byte count (CARDINAL),
  762. byte value (BYTE).
  763. OUT PARAMETERS - position of value, count if not found (CARDINAL).
  764. CALLING CONVENTION - Standard.
  765. NOTES - Scans for byte from high address.
  766. VERSION - _OS2 and MSDOS.
  767. ------------------------------------------------------------------------ *)
  768. (*%F _DLL *)
  769. (*%T SameDS *)
  770. segment _TEXT(CODE,28H)
  771. (*%E *)
  772. (*%F SameDS *)
  773. segment Lib_TEXT(CODE,28H)
  774. (*%E *)
  775. (*%E *)
  776. (*%T _DLL *)
  777. segment LibDLL_TEXT(CODE,28H)
  778. (*%E *)
  779. (*%F RegParam *)
  780. (*%F NearPtr *)
  781. d_seg = 6+frame
  782. d_ofs = 4+frame
  783. len = 2+frame
  784. val = frame
  785. RetSize = 8
  786. (*%E *)
  787. (*%T NearPtr *)
  788. d_ofs = 4+frame
  789. len = 2+frame
  790. val = frame
  791. RetSize = 6
  792. (*%E *)
  793. public Lib$ScanL :
  794. push bp
  795. mov bp,sp
  796. push di
  797. mov cx,[bp][len]
  798. jcxz ExitScan
  799. (*%F NearPtr *)
  800. les di,[bp][d_ofs]
  801. (*%E *)
  802. (*%T NearPtr *)
  803. mov di,[bp][d_ofs]
  804. push ds
  805. pop es
  806. (*%E *)
  807. mov ax,[bp][val]
  808. std
  809. repne
  810. scasb
  811. cld
  812. jne ExitScan
  813. inc cx
  814. ExitScan:
  815. mov ax,[bp][len]
  816. sub ax,cx
  817. pop di
  818. pop bp
  819. (*%F NearCall *)
  820. ret far RetSize
  821. (*%E *)
  822. (*%T NearCall *)
  823. ret RetSize
  824. (*%E *)
  825. (*%E *)
  826. (*%T RegParam *)
  827. RetSize = 0
  828. public Lib$ScanL :
  829. (*%T _DLLOVL *)
  830. push bp
  831. mov bp, sp
  832. (*%E *)
  833. push di
  834. push si
  835. (*%F NearPtr *)
  836. mov si, cx
  837. mov es, bx
  838. mov di, ax
  839. mov ax, dx
  840. (*%E *)
  841. (*%T NearPtr *)
  842. mov si, bx
  843. mov di, ax
  844. mov ax, cx
  845. mov cx, bx
  846. push ds
  847. pop es
  848. (*%E *)
  849. jcxz ExitScan
  850. std
  851. repne
  852. scasb
  853. cld
  854. jne ExitScan
  855. inc cx
  856. ExitScan:
  857. mov ax, si
  858. sub ax, cx
  859. pop si
  860. pop di
  861. (*%T _DLLOVL *)
  862. pop bp
  863. (*%E *)
  864. (*%F NearCall *)
  865. ret far RetSize
  866. (*%E *)
  867. (*%T NearCall *)
  868. ret RetSize
  869. (*%E *)
  870. (*%E *)
  871. (*****************************************************************************)
  872. section
  873. (* ------------------------------------------------------------------------
  874. PROCEDURE - Lib.ScanNeR.
  875. PRECONDITIONS - None.
  876. POSTCONDITIONS - None.
  877. IN PARAMETERS - destination (ADDRESS), byte count (CARDINAL),
  878. byte value (BYTE).
  879. OUT PARAMETERS - position of first byte difering value,
  880. count if none found (CARDINAL).
  881. CALLING CONVENTION - Standard.
  882. NOTES - Scans for byte from low address.
  883. VERSION - _OS2 and MSDOS.
  884. ------------------------------------------------------------------------ *)
  885. (*%F _DLL *)
  886. (*%T SameDS *)
  887. segment _TEXT(CODE,28H)
  888. (*%E *)
  889. (*%F SameDS *)
  890. segment Lib_TEXT(CODE,28H)
  891. (*%E *)
  892. (*%E *)
  893. (*%T _DLL *)
  894. segment LibDLL_TEXT(CODE,28H)
  895. (*%E *)
  896. (*%F RegParam *)
  897. (*%F NearPtr *)
  898. d_seg = 6+frame
  899. d_ofs = 4+frame
  900. len = 2+frame
  901. val = frame
  902. RetSize = 8
  903. (*%E *)
  904. (*%T NearPtr *)
  905. d_ofs = 4+frame
  906. len = 2+frame
  907. val = frame
  908. RetSize = 6
  909. (*%E *)
  910. public Lib$ScanNeR :
  911. push bp
  912. mov bp,sp
  913. push di
  914. mov cx,[bp][len]
  915. jcxz ExitScan
  916. (*%F NearPtr *)
  917. les di,[bp][d_ofs]
  918. (*%E *)
  919. (*%T NearPtr *)
  920. mov di,[bp][d_ofs]
  921. push ds
  922. pop es
  923. (*%E *)
  924. mov ax,[bp][val]
  925. repe
  926. scasb
  927. je ExitScan
  928. inc cx
  929. ExitScan:
  930. mov ax,[bp][len]
  931. sub ax,cx
  932. pop di
  933. pop bp
  934. (*%F NearCall *)
  935. ret far RetSize
  936. (*%E *)
  937. (*%T NearCall *)
  938. ret RetSize
  939. (*%E *)
  940. (*%E *)
  941. (*%T RegParam *)
  942. RetSize = 0
  943. public Lib$ScanNeR :
  944. (*%T _DLLOVL *)
  945. push bp
  946. mov bp, sp
  947. (*%E *)
  948. push di
  949. push si
  950. (*%F NearPtr *)
  951. mov si, cx
  952. mov es, bx
  953. mov di, ax
  954. mov ax, dx
  955. (*%E *)
  956. (*%T NearPtr *)
  957. mov si, bx
  958. mov di, ax
  959. mov ax, cx
  960. mov cx, bx
  961. push ds
  962. pop es
  963. (*%E *)
  964. jcxz ExitScan
  965. repe
  966. scasb
  967. je ExitScan
  968. inc cx
  969. ExitScan:
  970. mov ax, si
  971. sub ax, cx
  972. pop si
  973. pop di
  974. (*%T _DLLOVL *)
  975. pop bp
  976. (*%E *)
  977. (*%F NearCall *)
  978. ret far RetSize
  979. (*%E *)
  980. (*%T NearCall *)
  981. ret RetSize
  982. (*%E *)
  983. (*%E *)
  984. (*****************************************************************************)
  985. section
  986. (* ------------------------------------------------------------------------
  987. PROCEDURE - Lib.ScanNeL.
  988. PRECONDITIONS - None.
  989. POSTCONDITIONS - None.
  990. IN PARAMETERS - destination (ADDRESS), byte count (CARDINAL),
  991. byte value (BYTE).
  992. OUT PARAMETERS - position of first byte differing from value,
  993. count if none found (CARDINAL).
  994. CALLING CONVENTION - Standard.
  995. NOTES - Scans for byte from high address.
  996. VERSION - _OS2 and MSDOS.
  997. ------------------------------------------------------------------------ *)
  998. (*%F _DLL *)
  999. (*%T SameDS *)
  1000. segment _TEXT(CODE,28H)
  1001. (*%E *)
  1002. (*%F SameDS *)
  1003. segment Lib_TEXT(CODE,28H)
  1004. (*%E *)
  1005. (*%E *)
  1006. (*%T _DLL *)
  1007. segment LibDLL_TEXT(CODE,28H)
  1008. (*%E *)
  1009. (*%F RegParam *)
  1010. (*%F NearPtr *)
  1011. d_seg = 6+frame
  1012. d_ofs = 4+frame
  1013. len = 2+frame
  1014. val = frame
  1015. RetSize = 8
  1016. (*%E *)
  1017. (*%T NearPtr *)
  1018. d_ofs = 4+frame
  1019. len = 2+frame
  1020. val = frame
  1021. RetSize = 6
  1022. (*%E *)
  1023. public Lib$ScanNeL :
  1024. push bp
  1025. mov bp,sp
  1026. push di
  1027. mov cx,[bp][len]
  1028. jcxz ExitScan
  1029. (*%F NearPtr *)
  1030. les di,[bp][d_ofs]
  1031. (*%E *)
  1032. (*%T NearPtr *)
  1033. mov di,[bp][d_ofs]
  1034. push ds
  1035. pop es
  1036. (*%E *)
  1037. mov ax,[bp][val]
  1038. std
  1039. repe
  1040. scasb
  1041. cld
  1042. je ExitScan
  1043. inc cx
  1044. ExitScan:
  1045. mov ax,[bp][len]
  1046. sub ax,cx
  1047. pop di
  1048. pop bp
  1049. (*%F NearCall *)
  1050. ret far RetSize
  1051. (*%E *)
  1052. (*%T NearCall *)
  1053. ret RetSize
  1054. (*%E *)
  1055. (*%E *)
  1056. (*%T RegParam *)
  1057. RetSize = 0
  1058. public Lib$ScanNeL :
  1059. (*%T _DLLOVL *)
  1060. push bp
  1061. mov bp, sp
  1062. (*%E *)
  1063. push di
  1064. push si
  1065. (*%F NearPtr *)
  1066. mov si, cx
  1067. mov es, bx
  1068. mov di, ax
  1069. mov ax, dx
  1070. (*%E *)
  1071. (*%T NearPtr *)
  1072. mov si, bx
  1073. mov di, ax
  1074. mov ax, cx
  1075. mov cx, bx
  1076. push ds
  1077. pop es
  1078. (*%E *)
  1079. jcxz ExitScan
  1080. std
  1081. repe
  1082. scasb
  1083. cld
  1084. je ExitScan
  1085. inc cx
  1086. ExitScan:
  1087. mov ax, si
  1088. sub ax, cx
  1089. pop si
  1090. pop di
  1091. (*%T _DLLOVL *)
  1092. pop bp
  1093. (*%E *)
  1094. (*%F NearCall *)
  1095. ret far RetSize
  1096. (*%E *)
  1097. (*%T NearCall *)
  1098. ret RetSize
  1099. (*%E *)
  1100. (*%E *)
  1101. (*****************************************************************************)
  1102. section
  1103. (* ------------------------------------------------------------------------
  1104. PROCEDURE - Lib.Compare.
  1105. PRECONDITIONS - None.
  1106. POSTCONDITIONS - None.
  1107. IN PARAMETERS - source, destination (ADDRESS), byte count (CARDINAL).
  1108. OUT PARAMETERS - position of first differing byte,
  1109. count if blocks equal (CARDINAL).
  1110. CALLING CONVENTION - Standard.
  1111. NOTES - Scans for byte from high address.
  1112. VERSION - _OS2 and MSDOS.
  1113. ------------------------------------------------------------------------ *)
  1114. (*%F _DLL *)
  1115. (*%T SameDS *)
  1116. segment _TEXT(CODE,28H)
  1117. (*%E *)
  1118. (*%F SameDS *)
  1119. segment Lib_TEXT(CODE,28H)
  1120. (*%E *)
  1121. (*%E *)
  1122. (*%T _DLL *)
  1123. segment LibDLL_TEXT(CODE,28H)
  1124. (*%E *)
  1125. public Lib$Compare :
  1126. (*%F RegParam *)
  1127. num = frame
  1128. (*%T NearPtr *)
  1129. s2 = 2+frame
  1130. s1 = 4+frame
  1131. RetSize = 6
  1132. (*%E *)
  1133. (*%F NearPtr *)
  1134. s2 = 2+frame
  1135. s1 = 6+frame
  1136. RetSize = 10
  1137. (*%E *)
  1138. push bp
  1139. mov bp, sp
  1140. push di
  1141. push si
  1142. (*%F NearPtr *)
  1143. push ds
  1144. lds si, [bp][s1]
  1145. les di, [bp][s2]
  1146. (*%E *)
  1147. (*%T NearPtr *)
  1148. mov si, [bp][s1]
  1149. mov di, [bp][s2]
  1150. push ds
  1151. pop es
  1152. (*%E *)
  1153. mov cx, [bp][num]
  1154. mov ax, cx
  1155. jcxz exitScan
  1156. repe ; cmpsb
  1157. je exitScan
  1158. inc cx
  1159. exitScan:
  1160. sub ax, cx
  1161. (*%F NearPtr *)
  1162. pop ds
  1163. (*%E *)
  1164. pop si
  1165. pop di
  1166. pop bp
  1167. (*%F NearCall *)
  1168. ret far RetSize
  1169. (*%E *)
  1170. (*%T NearCall *)
  1171. ret RetSize
  1172. (*%E *)
  1173. (*%E *)
  1174. (*%T RegParam *)
  1175. (*%T NearPtr *)
  1176. RetSize = 0
  1177. (*%E *)
  1178. (*%F NearPtr *)
  1179. RetSize = 2
  1180. (*%E *)
  1181. (*%F NearPtr *)
  1182. num = frame
  1183. (*%E *)
  1184. (*%F NearPtr *)
  1185. push bp
  1186. mov bp, sp
  1187. (*%E *)
  1188. push di
  1189. push si
  1190. (*%F NearPtr *)
  1191. push ds
  1192. mov ds, bx
  1193. mov si, ax
  1194. mov di, cx
  1195. mov es, dx
  1196. mov cx, [bp][num]
  1197. (*%E *)
  1198. (*%T NearPtr *)
  1199. mov si, ax
  1200. mov di, bx
  1201. push ds
  1202. pop es
  1203. (*%E *)
  1204. mov ax, cx
  1205. jcxz exitScan
  1206. repe ; cmpsb
  1207. je exitScan
  1208. inc cx
  1209. exitScan:
  1210. sub ax, cx
  1211. (*%F NearPtr *)
  1212. pop ds
  1213. (*%E *)
  1214. pop si
  1215. pop di
  1216. (*%F NearPtr *)
  1217. pop bp
  1218. (*%E *)
  1219. (*%F NearCall *)
  1220. ret far RetSize
  1221. (*%E *)
  1222. (*%T NearCall *)
  1223. ret RetSize
  1224. (*%E *)
  1225. (*%E *)
  1226. (*****************************************************************************)
  1227. section
  1228. (* ------------------------------------------------------------------------
  1229. PROCEDURE - Str.Caps.
  1230. PRECONDITIONS - None.
  1231. POSTCONDITIONS - String characters set to upper case.
  1232. IN PARAMETERS - string (VAR ARRAY OF CHAR).
  1233. OUT PARAMETERS - None.
  1234. CALLING CONVENTION - Standard.
  1235. NOTES - None.
  1236. VERSION - _OS2 and MSDOS.
  1237. ------------------------------------------------------------------------ *)
  1238. (*%F _DLL *)
  1239. (*%T SameDS *)
  1240. segment _TEXT(CODE,28H)
  1241. (*%E *)
  1242. (*%F SameDS *)
  1243. segment STR_TEXT(CODE,28H)
  1244. (*%E *)
  1245. (*%E *)
  1246. (*%T _DLL *)
  1247. segment STRDLL_TEXT(CODE,28H)
  1248. (*%E *)
  1249. (*%F RegParam *)
  1250. (*%F NearPtr *)
  1251. Slen = 4+frame
  1252. Sseg = 2+frame
  1253. Sofs = frame
  1254. RetSize = 6
  1255. (*%E *)
  1256. (*%T NearPtr *)
  1257. Slen = 2+frame
  1258. Sofs = frame
  1259. RetSize = 4
  1260. (*%E *)
  1261. (*%E *)
  1262. (*%T RegParam *)
  1263. RetSize = 0
  1264. (*%E *)
  1265. public Str$Caps :
  1266. (*%F RegParam *)
  1267. push bp
  1268. mov bp,sp
  1269. (*%E *)
  1270. (*%T RegParam *)
  1271. (*%T _DLLOVL *)
  1272. push bp
  1273. mov bp, sp
  1274. (*%E *)
  1275. (*%T NearPtr *)
  1276. push cx
  1277. (*%E *)
  1278. (*%E *)
  1279. push ds
  1280. push si
  1281. (*%F RegParam *)
  1282. (*%F NearPtr *)
  1283. lds si, [bp][Sofs]
  1284. (*%E *)
  1285. (*%T NearPtr *)
  1286. mov si, [bp][Sofs]
  1287. (*%E *)
  1288. mov cx,[bp][Slen]
  1289. (*%E *)
  1290. (*%T RegParam *)
  1291. (*%F NearPtr *)
  1292. mov ds, cx
  1293. (*%E *)
  1294. mov cx, ax
  1295. mov si, bx
  1296. (*%E *)
  1297. $loop:
  1298. lodsb
  1299. cmp al,97 (* 'a' *)
  1300. jb $notSmall
  1301. cmp al,122 (* 'z' *)
  1302. ja $notSmall
  1303. sub al,32
  1304. mov [si][-1],al
  1305. loop $loop
  1306. jmp $$Done
  1307. $notSmall:
  1308. or al,al
  1309. loopnz $loop
  1310. $$Done:
  1311. pop si
  1312. pop ds
  1313. (*%T RegParam *)
  1314. (*%T NearPtr *)
  1315. pop cx
  1316. (*%E *)
  1317. (*%T _DLLOVL *)
  1318. pop bp
  1319. (*%E *)
  1320. (*%E *)
  1321. (*%F RegParam *)
  1322. pop bp
  1323. (*%E *)
  1324. (*%F NearCall *)
  1325. ret far RetSize
  1326. (*%E *)
  1327. (*%T NearCall *)
  1328. ret RetSize
  1329. (*%E *)
  1330. (*****************************************************************************)
  1331. section
  1332. (* ------------------------------------------------------------------------
  1333. PROCEDURE - Str.Lows.
  1334. PRECONDITIONS - None.
  1335. POSTCONDITIONS - String characters set to lower case.
  1336. IN PARAMETERS - string (VAR ARRAY OF CHAR).
  1337. OUT PARAMETERS - None.
  1338. CALLING CONVENTION - Standard.
  1339. NOTES - None.
  1340. VERSION - _OS2 and MSDOS.
  1341. ------------------------------------------------------------------------ *)
  1342. (*%F _DLL *)
  1343. (*%T SameDS *)
  1344. segment _TEXT(CODE,28H)
  1345. (*%E *)
  1346. (*%F SameDS *)
  1347. segment STR_TEXT(CODE,28H)
  1348. (*%E *)
  1349. (*%E *)
  1350. (*%T _DLL *)
  1351. segment STRDLL_TEXT(CODE,28H)
  1352. (*%E *)
  1353. (*%F RegParam *)
  1354. (*%F NearPtr *)
  1355. Slen = 4+frame
  1356. Sseg = 2+frame
  1357. Sofs = frame
  1358. RetSize = 6
  1359. (*%E *)
  1360. (*%T NearPtr *)
  1361. Slen = 2+frame
  1362. Sofs = frame
  1363. RetSize = 4
  1364. (*%E *)
  1365. (*%E *)
  1366. (*%T RegParam *)
  1367. RetSize = 0
  1368. (*%E *)
  1369. public Str$Lows :
  1370. (*%F RegParam *)
  1371. push bp
  1372. mov bp,sp
  1373. (*%E *)
  1374. (*%T RegParam *)
  1375. (*%T _DLLOVL *)
  1376. push bp
  1377. mov bp, sp
  1378. (*%E *)
  1379. (*%T NearPtr *)
  1380. push cx
  1381. (*%E *)
  1382. (*%E *)
  1383. push ds
  1384. push si
  1385. (*%F RegParam *)
  1386. (*%F NearPtr *)
  1387. lds si, [bp][Sofs]
  1388. (*%E *)
  1389. (*%T NearPtr *)
  1390. mov si, [bp][Sofs]
  1391. push ds
  1392. pop es
  1393. (*%E *)
  1394. mov cx,[bp][Slen]
  1395. (*%E *)
  1396. (*%T RegParam *)
  1397. (*%F NearPtr *)
  1398. mov si, bx
  1399. mov ds, cx
  1400. mov cx, ax
  1401. (*%E *)
  1402. (*%T NearPtr *)
  1403. mov cx, ax
  1404. mov si, bx
  1405. push ds
  1406. pop es
  1407. (*%E *)
  1408. (*%E *)
  1409. $loop:
  1410. lodsb
  1411. cmp al, 'A'
  1412. jb $notSmall
  1413. cmp al, 'Z'
  1414. ja $notSmall
  1415. add al,32
  1416. mov [si][-1],al
  1417. $notSmall:
  1418. or al,al
  1419. loopnz $loop
  1420. pop si
  1421. pop ds
  1422. (*%T RegParam *)
  1423. (*%T NearPtr *)
  1424. pop cx
  1425. (*%E *)
  1426. (*%T _DLLOVL *)
  1427. pop bp
  1428. (*%E *)
  1429. (*%E *)
  1430. (*%F RegParam *)
  1431. pop bp
  1432. (*%E *)
  1433. (*%F NearCall *)
  1434. ret far RetSize
  1435. (*%E *)
  1436. (*%T NearCall *)
  1437. ret RetSize
  1438. (*%E *)
  1439. (*****************************************************************************)
  1440. section
  1441. (* ------------------------------------------------------------------------
  1442. PROCEDURE - Str.Length.
  1443. PRECONDITIONS - None.
  1444. POSTCONDITIONS - None.
  1445. IN PARAMETERS - string (VAR ARRAY OF CHAR).
  1446. OUT PARAMETERS - Length of string (CARDINAL).
  1447. CALLING CONVENTION - Standard.
  1448. NOTES - None.
  1449. VERSION - _OS2 and MSDOS.
  1450. ------------------------------------------------------------------------ *)
  1451. (*%F _DLL *)
  1452. (*%T SameDS *)
  1453. segment _TEXT(CODE,28H)
  1454. (*%E *)
  1455. (*%F SameDS *)
  1456. segment STR_TEXT(CODE,28H)
  1457. (*%E *)
  1458. (*%E *)
  1459. (*%T _DLL *)
  1460. segment STRDLL_TEXT(CODE,28H)
  1461. (*%E *)
  1462. (*%F RegParam *)
  1463. (*%F NearPtr *)
  1464. Slen = 4+frame
  1465. Sseg = 2+frame
  1466. Sofs = frame
  1467. RetSize = 6
  1468. (*%E *)
  1469. (*%T NearPtr *)
  1470. Slen = 2+frame
  1471. Sofs = frame
  1472. RetSize = 4
  1473. (*%E *)
  1474. (*%E *)
  1475. (*%T RegParam *)
  1476. RetSize = 0
  1477. (*%E *)
  1478. public Str$Length :
  1479. (*%F RegParam *)
  1480. push bp
  1481. mov bp,sp
  1482. (*%E *)
  1483. (*%T RegParam *)
  1484. (*%T _DLLOVL *)
  1485. push bp
  1486. mov bp, sp
  1487. (*%E *)
  1488. (*%T NearPtr *)
  1489. push cx
  1490. (*%E *)
  1491. push dx
  1492. (*%E *)
  1493. push di
  1494. (*%F RegParam *)
  1495. (*%F NearPtr *)
  1496. les di, [bp][Sofs]
  1497. (*%E *)
  1498. (*%T NearPtr *)
  1499. mov di, [bp][Sofs]
  1500. push ds
  1501. pop es
  1502. (*%E *)
  1503. mov cx, [bp][Slen]
  1504. (*%E *)
  1505. (*%T RegParam *)
  1506. (*%F NearPtr *)
  1507. mov di, bx
  1508. mov es, cx
  1509. mov cx, ax
  1510. mov dx, ax
  1511. (*%E *)
  1512. (*%T NearPtr *)
  1513. mov cx, ax
  1514. mov dx, ax
  1515. mov di, bx
  1516. push ds
  1517. pop es
  1518. (*%E *)
  1519. (*%E *)
  1520. sub al, al
  1521. repne
  1522. scasb
  1523. jne ExitLength
  1524. inc cx
  1525. ExitLength:
  1526. (*%F RegParam *)
  1527. mov ax,[bp][Slen]
  1528. (*%E *)
  1529. (*%T RegParam *)
  1530. mov ax, dx
  1531. (*%E *)
  1532. sub ax,cx
  1533. pop di
  1534. (*%T RegParam *)
  1535. pop dx
  1536. (*%T NearPtr *)
  1537. pop cx
  1538. (*%E *)
  1539. (*%T _DLLOVL *)
  1540. pop bp
  1541. (*%E *)
  1542. (*%E *)
  1543. (*%F RegParam *)
  1544. pop bp
  1545. (*%E *)
  1546. (*%F NearCall *)
  1547. ret far RetSize
  1548. (*%E *)
  1549. (*%T NearCall *)
  1550. ret RetSize
  1551. (*%E *)
  1552. (*****************************************************************************)
  1553. (*%T _WINDOWS *)
  1554. section
  1555. (* ------------------------------------------------------------------------
  1556. PROCEDURE - WinStr.Caps.
  1557. PRECONDITIONS - None.
  1558. POSTCONDITIONS - String characters set to upper case.
  1559. IN PARAMETERS - string (VAR ARRAY OF CHAR).
  1560. OUT PARAMETERS - None.
  1561. CALLING CONVENTION - Standard + far pointer.
  1562. NOTES - None.
  1563. ------------------------------------------------------------------------ *)
  1564. segment _TEXT(CODE,28H)
  1565. (*%F RegParam *)
  1566. Slen = 4+frame
  1567. Sseg = 2+frame
  1568. Sofs = frame
  1569. RetSize = 6
  1570. (*%E *)
  1571. (*%T RegParam *)
  1572. RetSize = 0
  1573. (*%E *)
  1574. public WinStr$Caps :
  1575. (*%F RegParam *)
  1576. push bp
  1577. mov bp,sp
  1578. (*%E *)
  1579. push ds
  1580. push si
  1581. (*%F RegParam *)
  1582. lds si, [bp][Sofs]
  1583. mov cx,[bp][Slen]
  1584. (*%E *)
  1585. (*%T RegParam *)
  1586. mov si, bx
  1587. mov ds, cx
  1588. mov cx, ax
  1589. (*%E *)
  1590. $loop:
  1591. lodsb
  1592. cmp al,97 (* 'a' *)
  1593. jb $notSmall
  1594. cmp al,122 (* 'z' *)
  1595. ja $notSmall
  1596. sub al,32
  1597. mov [si][-1],al
  1598. $notSmall:
  1599. or al,al
  1600. loopnz $loop
  1601. pop si
  1602. pop ds
  1603. (*%F RegParam *)
  1604. pop bp
  1605. (*%E *)
  1606. (*%T _fcall *)
  1607. ret far RetSize
  1608. (*%E *)
  1609. (*%F _fcall *)
  1610. ret RetSize
  1611. (*%E *)
  1612. (*****************************************************************************)
  1613. section
  1614. (* ------------------------------------------------------------------------
  1615. PROCEDURE - WinStr.Lows.
  1616. PRECONDITIONS - None.
  1617. POSTCONDITIONS - String characters set to lower case.
  1618. IN PARAMETERS - string (VAR ARRAY OF CHAR).
  1619. OUT PARAMETERS - None.
  1620. CALLING CONVENTION - Standard + far pointers.
  1621. NOTES - None.
  1622. ------------------------------------------------------------------------ *)
  1623. segment _TEXT(CODE,28H)
  1624. (*%F RegParam *)
  1625. Slen = 4+frame
  1626. Sseg = 2+frame
  1627. Sofs = frame
  1628. RetSize = 6
  1629. (*%E *)
  1630. (*%T RegParam *)
  1631. RetSize = 0
  1632. (*%E *)
  1633. public WinStr$Lows :
  1634. (*%F RegParam *)
  1635. push bp
  1636. mov bp,sp
  1637. (*%E *)
  1638. push ds
  1639. push si
  1640. (*%F RegParam *)
  1641. lds si, [bp][Sofs]
  1642. mov cx,[bp][Slen]
  1643. (*%E *)
  1644. (*%T RegParam *)
  1645. mov si, bx
  1646. mov ds, cx
  1647. mov cx, ax
  1648. (*%E *)
  1649. $loop:
  1650. lodsb
  1651. cmp al, 'A'
  1652. jb $notSmall
  1653. cmp al, 'Z'
  1654. ja $notSmall
  1655. add al,32
  1656. mov [si][-1],al
  1657. $notSmall:
  1658. or al,al
  1659. loopnz $loop
  1660. pop si
  1661. pop ds
  1662. pop bp
  1663. (*%T _fcall *)
  1664. ret far RetSize
  1665. (*%E *)
  1666. (*%F _fcall *)
  1667. ret RetSize
  1668. (*%E *)
  1669. (*****************************************************************************)
  1670. section
  1671. (* ------------------------------------------------------------------------
  1672. PROCEDURE - WinStr.Slice.
  1673. PRECONDITIONS - None.
  1674. POSTCONDITIONS - dest contains section of source, starting at position with
  1675. a maximum size of length.
  1676. IN PARAMETERS - dest (VAR ARRAY OF CHAR), source (ARRAY OF CHAR),
  1677. position, length (CARDINAL).
  1678. OUT PARAMETERS - None.
  1679. CALLING CONVENTION - Standard + far pointers.
  1680. NOTES - None.
  1681. ------------------------------------------------------------------------ *)
  1682. segment _TEXT(CODE,28H)
  1683. (*%F RegParam *)
  1684. NSlen = 14+frame
  1685. NSseg = 12+frame
  1686. NSofs = 10+frame
  1687. Slen = 8+frame
  1688. Sseg = 6+frame
  1689. Sofs = 4+frame
  1690. P = 2+frame
  1691. L = frame
  1692. RetSize = 16
  1693. (*%E *)
  1694. (*%T RegParam *)
  1695. NSlen = -2
  1696. NSseg = -4
  1697. NSofs = -6
  1698. Slen = -8
  1699. Sseg = 6+frame
  1700. Sofs = 4+frame
  1701. P = 2+frame
  1702. L = frame
  1703. RetSize = 8
  1704. locals = 8
  1705. (*%E *)
  1706. public WinStr$Slice :
  1707. push bp
  1708. mov bp, sp
  1709. (*%T RegParam *)
  1710. sub sp, locals
  1711. mov [bp][NSlen], ax
  1712. mov [bp][NSofs], bx
  1713. mov [bp][NSseg], cx
  1714. mov [bp][Slen], dx
  1715. (*%E *)
  1716. push ds
  1717. push si
  1718. push di
  1719. les di,[bp][Sofs]
  1720. mov cx,[bp][Slen]
  1721. sub al,al
  1722. repne
  1723. scasb
  1724. jne LengthCalc
  1725. inc cx
  1726. LengthCalc:
  1727. mov ax, [bp][Slen]
  1728. sub ax,cx
  1729. mov bx, [bp][P]
  1730. sub ax,bx
  1731. ja NotBeyondEnd
  1732. sub ax,ax
  1733. NotBeyondEnd:
  1734. cmp ax, [bp][L]
  1735. jb OffEnd
  1736. mov ax, [bp][L]
  1737. OffEnd:
  1738. lds si, [bp][Sofs]
  1739. add si,[bp][P]
  1740. mov cx,[bp][NSlen]
  1741. cmp ax,cx
  1742. ja SourceBigger
  1743. mov cx,ax
  1744. SourceBigger:
  1745. les di,[bp][NSofs]
  1746. rep
  1747. movsb
  1748. jae Exit
  1749. sub al,al
  1750. stosb
  1751. Exit:
  1752. pop di
  1753. pop si
  1754. pop ds
  1755. (*%T RegParam *)
  1756. mov sp, bp
  1757. (*%E *)
  1758. pop bp
  1759. (*%T _fcall *)
  1760. ret far RetSize
  1761. (*%E *)
  1762. (*%F _fcall *)
  1763. ret RetSize
  1764. (*%E *)
  1765. (**************************************************************************)
  1766. section
  1767. (* ------------------------------------------------------------------------
  1768. PROCEDURE - WinStr.CharPos.
  1769. PRECONDITIONS - None.
  1770. POSTCONDITIONS - None.
  1771. IN PARAMETERS - source (ARRAY OF CHAR), ch (CHAR).
  1772. OUT PARAMETERS - returns offset of ch in source CARDINAL),
  1773. MAX(CARDINAL) if not found.
  1774. CALLING CONVENTION - Standard + Far Pointers.
  1775. NOTES - None.
  1776. ------------------------------------------------------------------------ *)
  1777. segment _TEXT(CODE,28H)
  1778. public WinStr$CharPos :
  1779. (*%T RegParam *)
  1780. RetSize = 0
  1781. push di
  1782. mov es, cx
  1783. mov di, bx
  1784. mov cx, ax
  1785. mov ax, dx
  1786. mov dx, cx
  1787. push ax
  1788. sub al, al
  1789. repne ; scasb
  1790. jne lCalc
  1791. inc cx
  1792. lCalc:
  1793. sub dx, cx
  1794. xchg dx, cx
  1795. mov di, bx
  1796. pop ax
  1797. repne; scasb
  1798. jnz notFound
  1799. dec di
  1800. sub di, bx
  1801. mov ax, di
  1802. chrDone:
  1803. pop di
  1804. (*%T _fcall *)
  1805. ret far RetSize
  1806. (*%E *)
  1807. (*%F _fcall *)
  1808. ret RetSize
  1809. (*%E *)
  1810. notFound:
  1811. mov ax, -1
  1812. jmp chrDone
  1813. (*%E *)
  1814. (*%F RegParam *)
  1815. slen = 6+frame
  1816. s = 2+frame
  1817. chk = frame
  1818. RetSize = 8
  1819. push bp
  1820. mov bp, sp
  1821. push di
  1822. les di, [bp][s]
  1823. mov cx, [bp][slen]
  1824. mov dx, [bp][slen]
  1825. sub al, al
  1826. repne ; scasb
  1827. jne lCalc
  1828. inc cx
  1829. lCalc:
  1830. sub dx, cx
  1831. xchg dx, cx
  1832. mov di, [bp][s]
  1833. mov al, [bp][chk]
  1834. repne; scasb
  1835. jnz notFound
  1836. dec di
  1837. sub di, [bp][s]
  1838. mov ax, di
  1839. chrDone:
  1840. pop di
  1841. pop bp
  1842. (*%T _fcall *)
  1843. ret far RetSize
  1844. (*%E *)
  1845. (*%F _fcall *)
  1846. ret RetSize
  1847. (*%E *)
  1848. notFound:
  1849. mov ax, -1
  1850. jmp chrDone
  1851. (*%E *)
  1852. (**************************************************************************)
  1853. section
  1854. (* ------------------------------------------------------------------------
  1855. PROCEDURE - WinStr.RCharPos.
  1856. PRECONDITIONS - None.
  1857. POSTCONDITIONS - None.
  1858. IN PARAMETERS - source (ARRAY OF CHAR), ch (CHAR).
  1859. OUT PARAMETERS - returns offset of ch in source CARDINAL),
  1860. MAX(CARDINAL) if not found.
  1861. CALLING CONVENTION - Standard + far pointers.
  1862. NOTES - Starts search from last member of string.
  1863. ------------------------------------------------------------------------ *)
  1864. segment _TEXT(CODE,28H)
  1865. public WinStr$RCharPos :
  1866. (*%T RegParam *)
  1867. RetSize = 0
  1868. push di
  1869. mov es, cx
  1870. mov di, bx
  1871. mov cx, ax
  1872. mov ax, dx
  1873. mov dx, cx
  1874. push ax
  1875. sub al, al
  1876. repne ; scasb
  1877. jne lCalc
  1878. dec di
  1879. lCalc:
  1880. dec di
  1881. sub dx, cx
  1882. mov cx, dx
  1883. std
  1884. pop ax
  1885. repne; scasb
  1886. cld
  1887. jnz notFound
  1888. inc di
  1889. sub di, bx
  1890. mov ax, di
  1891. chrDone:
  1892. pop di
  1893. (*%T _fcall *)
  1894. ret far RetSize
  1895. (*%E *)
  1896. (*%F _fcall *)
  1897. ret RetSize
  1898. (*%E *)
  1899. notFound:
  1900. mov ax, -1
  1901. jmp chrDone
  1902. (*%E *)
  1903. (*%F RegParam *)
  1904. slen = 6+frame
  1905. s = 2+frame
  1906. chk = frame
  1907. RetSize = 8
  1908. push bp
  1909. mov bp, sp
  1910. push di
  1911. les di, [bp][s]
  1912. mov cx, [bp][slen]
  1913. mov dx, [bp][slen]
  1914. sub al, al
  1915. repne ; scasb
  1916. jne lCalc
  1917. dec di
  1918. lCalc:
  1919. dec di
  1920. mov al, [bp][chk]
  1921. sub dx, cx
  1922. mov cx, dx
  1923. std
  1924. repne; scasb
  1925. cld
  1926. jnz notFound
  1927. inc di
  1928. sub di, [bp][s]
  1929. mov ax, di
  1930. chrDone:
  1931. pop di
  1932. pop bp
  1933. (*%T _fcall *)
  1934. ret far RetSize
  1935. (*%E *)
  1936. (*%F _fcall *)
  1937. ret RetSize
  1938. (*%E *)
  1939. notFound:
  1940. mov ax, -1
  1941. jmp chrDone
  1942. (*%E *)
  1943. (***************************************************************************)
  1944. section
  1945. (* ------------------------------------------------------------------------
  1946. PROCEDURE - WinStr.Length.
  1947. PRECONDITIONS - None.
  1948. POSTCONDITIONS - None.
  1949. IN PARAMETERS - string (VAR ARRAY OF CHAR).
  1950. OUT PARAMETERS - Length of string (CARDINAL).
  1951. CALLING CONVENTION - Standard + far pointer.
  1952. NOTES - None.
  1953. VERSION - Windows.
  1954. ------------------------------------------------------------------------ *)
  1955. segment _TEXT(CODE,28H)
  1956. (*%F RegParam *)
  1957. Slen = 4+lframe
  1958. Sseg = 2+lframe
  1959. Sofs = lframe
  1960. RetSize = 6
  1961. (*%E *)
  1962. (*%T RegParam *)
  1963. RetSize = 0
  1964. (*%E *)
  1965. public WinStr$Length :
  1966. (*%F RegParam *)
  1967. push bp
  1968. mov bp,sp
  1969. (*%E *)
  1970. (*%T RegParam *)
  1971. push dx
  1972. (*%E *)
  1973. push di
  1974. (*%F RegParam *)
  1975. les di, [bp][Sofs]
  1976. mov cx, [bp][Slen]
  1977. (*%E *)
  1978. (*%T RegParam *)
  1979. mov di, bx
  1980. mov es, cx
  1981. mov cx, ax
  1982. mov dx, ax
  1983. (*%E *)
  1984. sub al, al
  1985. repne
  1986. scasb
  1987. jne ExitLength
  1988. inc cx
  1989. ExitLength:
  1990. (*%F RegParam *)
  1991. mov ax,[bp][Slen]
  1992. (*%E *)
  1993. (*%T RegParam *)
  1994. mov ax, dx
  1995. (*%E *)
  1996. sub ax,cx
  1997. pop di
  1998. (*%T RegParam *)
  1999. pop dx
  2000. (*%E *)
  2001. (*%F RegParam *)
  2002. pop bp
  2003. (*%E *)
  2004. (*%T _fcall *)
  2005. ret far RetSize
  2006. (*%E *)
  2007. (*%F _fcall *)
  2008. ret RetSize
  2009. (*%E *)
  2010. (*%E *)
  2011. (*****************************************************************************)
  2012. section
  2013. (* ------------------------------------------------------------------------
  2014. PROCEDURE - Str.Compare.
  2015. PRECONDITIONS - None.
  2016. POSTCONDITIONS - None.
  2017. IN PARAMETERS - string1, string2 (VAR ARRAY OF CHAR).
  2018. OUT PARAMETERS - returns difference of strings (INTEGER).
  2019. CALLING CONVENTION - Standard.
  2020. NOTES - None.
  2021. VERSION - _OS2 and MSDOS.
  2022. ------------------------------------------------------------------------ *)
  2023. (*%F _DLL *)
  2024. (*%T SameDS *)
  2025. segment _TEXT(CODE,28H)
  2026. (*%E *)
  2027. (*%F SameDS *)
  2028. segment STR_TEXT(CODE,28H)
  2029. (*%E *)
  2030. (*%E *)
  2031. (*%T _DLL *)
  2032. segment STRDLL_TEXT(CODE,28H)
  2033. (*%E *)
  2034. (*%F RegParam *)
  2035. (*%F NearPtr *)
  2036. S1len = 10+frame
  2037. S1seg = 8+frame
  2038. S1ofs = 6+frame
  2039. S2len = 4+frame
  2040. S2seg = 2+frame
  2041. S2ofs = frame
  2042. RetSize = 12
  2043. (*%E *)
  2044. (*%T NearPtr *)
  2045. S1len = 6+frame
  2046. S1ofs = 4+frame
  2047. S2len = 2+frame
  2048. S2ofs = frame
  2049. RetSize = 8
  2050. (*%E *)
  2051. (*%E *)
  2052. (*%T RegParam *)
  2053. (*%F NearPtr *)
  2054. S2seg = 2+frame
  2055. S2ofs = frame
  2056. RetSize =4
  2057. (*%E *)
  2058. (*%T NearPtr *)
  2059. RetSize = 0
  2060. (*%E *)
  2061. (*%E *)
  2062. public Str$Compare :
  2063. push bp
  2064. mov bp,sp
  2065. push ds
  2066. push si
  2067. push di
  2068. (*%F RegParam *)
  2069. (*%F NearPtr *)
  2070. lds si,[bp][S1ofs]
  2071. les di,[bp][S2ofs]
  2072. (*%E *)
  2073. (*%T NearPtr *)
  2074. mov si,[bp][S1ofs]
  2075. mov di,[bp][S2ofs]
  2076. push ds
  2077. pop es
  2078. (*%E *)
  2079. mov bx,[bp][S1len]
  2080. mov dx,[bp][S2len]
  2081. (*%E *)
  2082. (*%T RegParam *)
  2083. (*%F NearPtr *)
  2084. mov si, bx
  2085. mov ds, cx
  2086. les di,[bp][S2ofs]
  2087. mov bx, ax
  2088. (*%E *)
  2089. (*%T NearPtr *)
  2090. mov si, bx
  2091. mov di, dx
  2092. mov bx, ax
  2093. mov dx, cx
  2094. push ds
  2095. pop es
  2096. (*%E *)
  2097. (*%E *)
  2098. mov cx,bx
  2099. cmp cx,dx
  2100. jb CompareLoop
  2101. mov cx,dx
  2102. CompareLoop:
  2103. lodsb
  2104. scasb
  2105. jne NotEqual
  2106. or al,al
  2107. loopne CompareLoop
  2108. je Equal
  2109. cmp bx,dx
  2110. je Equal
  2111. ja CheckSi
  2112. cmp byte es:[di],0
  2113. je Equal
  2114. Less:
  2115. mov ax,-1
  2116. jmp Return
  2117. CheckSi:
  2118. cmp byte [si],0
  2119. je Equal
  2120. Greater:
  2121. mov ax,1
  2122. jmp Return
  2123. NotEqual:
  2124. cmp al,es:[di][-1]
  2125. jb Less
  2126. jmp Greater
  2127. Equal:
  2128. sub ax,ax
  2129. Return:
  2130. pop di
  2131. pop si
  2132. pop ds
  2133. pop bp
  2134. (*%F NearCall *)
  2135. ret far RetSize
  2136. (*%E *)
  2137. (*%T NearCall *)
  2138. ret RetSize
  2139. (*%E *)
  2140. (*****************************************************************************)
  2141. (*%T _WINDOWS *)
  2142. section
  2143. (* ------------------------------------------------------------------------
  2144. PROCEDURE - WinStr.Compare.
  2145. PRECONDITIONS - None.
  2146. POSTCONDITIONS - None.
  2147. IN PARAMETERS - string1, string2 (VAR ARRAY OF CHAR).
  2148. OUT PARAMETERS - returns difference of strings (INTEGER).
  2149. CALLING CONVENTION - Standard + far pointers.
  2150. NOTES - None.
  2151. VERSION - Windows.
  2152. ------------------------------------------------------------------------ *)
  2153. segment _TEXT(CODE,28H)
  2154. (*%F RegParam *)
  2155. S1len = 10+lframe
  2156. S1seg = 8+lframe
  2157. S1ofs = 6+lframe
  2158. S2len = 4+lframe
  2159. S2seg = 2+lframe
  2160. S2ofs = lframe
  2161. RetSize = 12
  2162. (*%E *)
  2163. (*%T RegParam *)
  2164. S2seg = 2+lframe
  2165. S2ofs = lframe
  2166. RetSize =4
  2167. (*%E *)
  2168. public WinStr$Compare :
  2169. push bp
  2170. mov bp,sp
  2171. push ds
  2172. push si
  2173. push di
  2174. (*%F RegParam *)
  2175. lds si,[bp][S1ofs]
  2176. les di,[bp][S2ofs]
  2177. mov bx,[bp][S1len]
  2178. mov dx,[bp][S2len]
  2179. (*%E *)
  2180. (*%T RegParam *)
  2181. mov si, bx
  2182. mov ds, cx
  2183. les di,[bp][S2ofs]
  2184. mov bx, ax
  2185. (*%E *)
  2186. mov cx,bx
  2187. cmp cx,dx
  2188. jb CompareLoop
  2189. mov cx,dx
  2190. CompareLoop:
  2191. lodsb
  2192. scasb
  2193. jne NotEqual
  2194. or al,al
  2195. loopne CompareLoop
  2196. je Equal
  2197. cmp bx,dx
  2198. je Equal
  2199. ja CheckSi
  2200. cmp byte es:[di],0
  2201. je Equal
  2202. Less:
  2203. mov ax,-1
  2204. jmp Return
  2205. CheckSi:
  2206. cmp byte [si],0
  2207. je Equal
  2208. Greater:
  2209. mov ax,1
  2210. jmp Return
  2211. NotEqual:
  2212. cmp al,es:[di][-1]
  2213. jb Less
  2214. jmp Greater
  2215. Equal:
  2216. sub ax,ax
  2217. Return:
  2218. pop di
  2219. pop si
  2220. pop ds
  2221. pop bp
  2222. (*%T _fcall *)
  2223. ret far RetSize
  2224. (*%E *)
  2225. (*%F _fcall *)
  2226. ret RetSize
  2227. (*%E *)
  2228. (*%E *)
  2229. (*****************************************************************************)
  2230. section
  2231. (* ------------------------------------------------------------------------
  2232. PROCEDURE - Str.Concat.
  2233. PRECONDITIONS - None.
  2234. POSTCONDITIONS - dest contains string1+string2.
  2235. IN PARAMETERS - dest (VAR ARRAY OF CHAR), string1, string2 (ARRAY OF CHAR).
  2236. OUT PARAMETERS - returns difference of strings (INTEGER).
  2237. CALLING CONVENTION - Standard.
  2238. NOTES - None.
  2239. VERSION - _OS2 and MSDOS.
  2240. ------------------------------------------------------------------------ *)
  2241. (*%F _DLL *)
  2242. (*%T SameDS *)
  2243. segment _TEXT(CODE,28H)
  2244. (*%E *)
  2245. (*%F SameDS *)
  2246. segment STR_TEXT(CODE,28H)
  2247. (*%E *)
  2248. (*%E *)
  2249. (*%T _DLL *)
  2250. segment STRDLL_TEXT(CODE,28H)
  2251. (*%E *)
  2252. (*%F RegParam *)
  2253. (*%F NearPtr *)
  2254. NSlen = 16+frame
  2255. NSseg = 14+frame
  2256. NSofs = 12+frame
  2257. S1len = 10+frame
  2258. S1seg = 8+frame
  2259. S1ofs = 6+frame
  2260. S2len = 4+frame
  2261. S2seg = 2+frame
  2262. S2ofs = frame
  2263. RetSize = 18
  2264. (*%E *)
  2265. (*%T NearPtr *)
  2266. NSlen = 10+frame
  2267. NSofs = 8+frame
  2268. S1len = 6+frame
  2269. S1ofs = 4+frame
  2270. S2len = 2+frame
  2271. S2ofs = frame
  2272. RetSize = 12
  2273. (*%E *)
  2274. (*%E *)
  2275. (*%T RegParam *)
  2276. (*%F NearPtr *)
  2277. S1seg = 8+frame
  2278. S1ofs = 6+frame
  2279. S2len = 4+frame
  2280. S2seg = 2+frame
  2281. S2ofs = frame
  2282. NSlen = -2
  2283. NSseg = -4
  2284. NSofs = -6
  2285. S1len = -8
  2286. locals = 8
  2287. RetSize = 10
  2288. (*%E *)
  2289. (*%T NearPtr *)
  2290. S2len = 2+frame
  2291. S2ofs = frame
  2292. NSlen = -2
  2293. NSofs = -4
  2294. S1len = -6
  2295. S1ofs = -8
  2296. locals = 8
  2297. RetSize = 4
  2298. (*%E *)
  2299. (*%E *)
  2300. public Str$Concat :
  2301. push bp
  2302. mov bp,sp
  2303. (*%T RegParam *)
  2304. sub sp, locals
  2305. (*%F NearPtr *)
  2306. mov [bp][NSlen], ax
  2307. mov [bp][NSofs], bx
  2308. mov [bp][NSseg], cx
  2309. mov [bp][S1len], dx
  2310. (*%E *)
  2311. (*%T NearPtr *)
  2312. mov [bp][NSlen], ax
  2313. mov [bp][NSofs], bx
  2314. mov [bp][S1len], cx
  2315. mov [bp][S1ofs], dx
  2316. (*%E *)
  2317. (*%E *)
  2318. push ds
  2319. push si
  2320. push di
  2321. mov cx,[bp][S2len]
  2322. sub sp,cx
  2323. (*%F NearPtr *)
  2324. lds si,[bp][S2ofs]
  2325. (*%E *)
  2326. (*%T NearPtr *)
  2327. mov si,[bp][S2ofs]
  2328. (*%E *)
  2329. push ss
  2330. pop es
  2331. mov di,sp
  2332. rep
  2333. movsb
  2334. (*%F NearPtr *)
  2335. lds si,[bp][S1ofs]
  2336. les di,[bp][NSofs]
  2337. (*%E *)
  2338. (*%T NearPtr *)
  2339. mov si,[bp][S1ofs]
  2340. mov di,[bp][NSofs]
  2341. push ds
  2342. pop es
  2343. (*%E *)
  2344. mov bx,[bp][NSlen]
  2345. mov cx,[bp][S1len]
  2346. (*%E *)
  2347. CopyLoop1:
  2348. lodsb
  2349. or al,al
  2350. jz Finished1
  2351. stosb
  2352. dec bx
  2353. loopnz CopyLoop1
  2354. jz Exit
  2355. Finished1:
  2356. push ss
  2357. pop ds
  2358. mov si,sp
  2359. mov cx,[bp][S2len]
  2360. CopyLoop2:
  2361. lodsb
  2362. stosb
  2363. or al,al
  2364. jz Exit
  2365. dec bx
  2366. loopnz CopyLoop2
  2367. jz Exit
  2368. sub al,al
  2369. stosb
  2370. Exit:
  2371. add sp, [bp][S2len]
  2372. pop di
  2373. pop si
  2374. pop ds
  2375. mov sp, bp
  2376. pop bp
  2377. (*%F NearCall *)
  2378. ret far RetSize
  2379. (*%E *)
  2380. (*%T NearCall *)
  2381. ret RetSize
  2382. (*%E *)
  2383. (*****************************************************************************)
  2384. (*%T _WINDOWS *)
  2385. section
  2386. (* ------------------------------------------------------------------------
  2387. PROCEDURE - WinStr.Concat.
  2388. PRECONDITIONS - None.
  2389. POSTCONDITIONS - dest contains string1+string2.
  2390. IN PARAMETERS - dest (VAR ARRAY OF CHAR), string1, string2 (ARRAY OF CHAR).
  2391. OUT PARAMETERS - returns difference of strings (INTEGER).
  2392. CALLING CONVENTION - Standard + far pointers.
  2393. NOTES - None.
  2394. VERSION - Windows.
  2395. ------------------------------------------------------------------------ *)
  2396. segment _TEXT(CODE,28H)
  2397. (*%F RegParam *)
  2398. NSlen = 16+lframe
  2399. NSseg = 14+lframe
  2400. NSofs = 12+lframe
  2401. S1len = 10+lframe
  2402. S1seg = 8+lframe
  2403. S1ofs = 6+lframe
  2404. S2len = 4+lframe
  2405. S2seg = 2+lframe
  2406. S2ofs = lframe
  2407. RetSize = 18
  2408. (*%E *)
  2409. (*%T RegParam *)
  2410. S1seg = 8+lframe
  2411. S1ofs = 6+lframe
  2412. S2len = 4+lframe
  2413. S2seg = 2+lframe
  2414. S2ofs = lframe
  2415. NSlen = -2
  2416. NSseg = -4
  2417. NSofs = -6
  2418. S1len = -8
  2419. locals = 8
  2420. RetSize = 10
  2421. (*%E *)
  2422. public WinStr$Concat :
  2423. push bp
  2424. mov bp,sp
  2425. (*%T RegParam *)
  2426. sub sp, locals
  2427. mov [bp][NSlen], ax
  2428. mov [bp][NSofs], bx
  2429. mov [bp][NSseg], cx
  2430. mov [bp][S1len], dx
  2431. (*%E *)
  2432. push ds
  2433. push si
  2434. push di
  2435. mov cx,[bp][S2len]
  2436. sub sp,cx
  2437. lds si,[bp][S2ofs]
  2438. push ss
  2439. pop es
  2440. mov di,sp
  2441. rep
  2442. movsb
  2443. lds si,[bp][S1ofs]
  2444. les di,[bp][NSofs]
  2445. mov bx,[bp][NSlen]
  2446. mov cx,[bp][S1len]
  2447. CopyLoop1:
  2448. lodsb
  2449. or al,al
  2450. jz Finished1
  2451. stosb
  2452. dec bx
  2453. loopnz CopyLoop1
  2454. jz Exit
  2455. Finished1:
  2456. push ss
  2457. pop ds
  2458. mov si,sp
  2459. mov cx,[bp][S2len]
  2460. CopyLoop2:
  2461. lodsb
  2462. stosb
  2463. or al,al
  2464. jz Exit
  2465. dec bx
  2466. loopnz CopyLoop2
  2467. jz Exit
  2468. sub al,al
  2469. stosb
  2470. Exit:
  2471. add sp, [bp][S2len]
  2472. pop di
  2473. pop si
  2474. pop ds
  2475. mov sp, bp
  2476. pop bp
  2477. (*%T _fcall *)
  2478. ret far RetSize
  2479. (*%E *)
  2480. (*%F _fcall *)
  2481. ret RetSize
  2482. (*%E *)
  2483. (*%E *)
  2484. (*****************************************************************************)
  2485. section
  2486. (* ------------------------------------------------------------------------
  2487. PROCEDURE - Str.Append.
  2488. PRECONDITIONS - None.
  2489. POSTCONDITIONS - dest contains dest+string.
  2490. IN PARAMETERS - dest (VAR ARRAY OF CHAR), string (ARRAY OF CHAR).
  2491. OUT PARAMETERS - None.
  2492. CALLING CONVENTION - Standard.
  2493. NOTES - None.
  2494. VERSION - _OS2 and MSDOS.
  2495. ------------------------------------------------------------------------ *)
  2496. (*%F _DLL *)
  2497. (*%T SameDS *)
  2498. segment _TEXT(CODE,28H)
  2499. (*%E *)
  2500. (*%F SameDS *)
  2501. segment STR_TEXT(CODE,28H)
  2502. (*%E *)
  2503. (*%E *)
  2504. (*%T _DLL *)
  2505. segment STRDLL_TEXT(CODE,28H)
  2506. (*%E *)
  2507. (*%F RegParam *)
  2508. (*%F NearPtr *)
  2509. NSlen = 10+frame
  2510. NSseg = 8+frame
  2511. NSofs = 6+frame
  2512. Slen = 4+frame
  2513. Sseg = 2+frame
  2514. Sofs = frame
  2515. RetSize = 12
  2516. (*%E *)
  2517. (*%T NearPtr *)
  2518. NSlen = 6+frame
  2519. NSofs = 4+frame
  2520. Slen = 2+frame
  2521. Sofs = frame
  2522. RetSize = 8
  2523. (*%E *)
  2524. (*%E *)
  2525. (*%T RegParam *)
  2526. (*%F NearPtr *)
  2527. Sseg = 2+frame
  2528. Sofs = frame
  2529. RetSize = 4
  2530. (*%E *)
  2531. (*%T NearPtr *)
  2532. RetSize = 0
  2533. (*%E *)
  2534. (*%E *)
  2535. public Str$Append :
  2536. push bp
  2537. mov bp, sp
  2538. push ds
  2539. push si
  2540. push di
  2541. (*%F RegParam *)
  2542. (*%F NearPtr *)
  2543. les di,[bp][NSofs]
  2544. (*%E *)
  2545. (*%T NearPtr *)
  2546. mov di,[bp][NSofs]
  2547. push ds
  2548. pop es
  2549. (*%E *)
  2550. mov cx,[bp][NSlen]
  2551. (*%E *)
  2552. (*%T RegParam *)
  2553. (*%F NearPtr *)
  2554. mov es, cx
  2555. mov di, bx
  2556. mov cx, ax
  2557. push dx
  2558. (*%E *)
  2559. (*%T NearPtr *)
  2560. mov di, bx
  2561. push ds
  2562. pop es
  2563. push cx
  2564. mov cx, ax
  2565. (*%E *)
  2566. (*%E *)
  2567. sub al,al
  2568. repne
  2569. scasb
  2570. (*%T RegParam *)
  2571. jne FullString
  2572. (*%E *)
  2573. (*%F RegParam *)
  2574. jne Exit
  2575. (*%E *)
  2576. dec di
  2577. mov bx,cx
  2578. inc bx
  2579. (*%F RegParam *)
  2580. (*%F NearPtr *)
  2581. lds si,[bp][Sofs]
  2582. (*%E *)
  2583. (*%T NearPtr *)
  2584. mov si,[bp][Sofs]
  2585. (*%E *)
  2586. mov cx,[bp][Slen]
  2587. (*%E *)
  2588. (*%T RegParam *)
  2589. (*%F NearPtr *)
  2590. lds si,[bp][Sofs]
  2591. (*%E *)
  2592. (*%T NearPtr *)
  2593. mov si, dx
  2594. (*%E *)
  2595. pop cx
  2596. (*%E *)
  2597. CopyLoop:
  2598. lodsb
  2599. stosb
  2600. or al,al
  2601. jz Exit
  2602. dec bx
  2603. loopnz CopyLoop
  2604. jz Exit
  2605. sub al,al
  2606. stosb
  2607. Exit:
  2608. pop di
  2609. pop si
  2610. pop ds
  2611. pop bp
  2612. (*%F NearCall *)
  2613. ret far RetSize
  2614. (*%E *)
  2615. (*%T NearCall *)
  2616. ret RetSize
  2617. (*%E *)
  2618. FullString:
  2619. pop cx
  2620. jmp Exit
  2621. (*****************************************************************************)
  2622. (*%T _WINDOWS *)
  2623. section
  2624. (* ------------------------------------------------------------------------
  2625. PROCEDURE - WinStr.Append.
  2626. PRECONDITIONS - None.
  2627. POSTCONDITIONS - dest contains dest+string.
  2628. IN PARAMETERS - dest (VAR ARRAY OF CHAR), string (ARRAY OF CHAR).
  2629. OUT PARAMETERS - None.
  2630. CALLING CONVENTION - Standard + far pointers.
  2631. NOTES - None.
  2632. VERSION - Windows.
  2633. ------------------------------------------------------------------------ *)
  2634. segment _TEXT(CODE,28H)
  2635. (*%F RegParam *)
  2636. NSlen = 10+lframe
  2637. NSseg = 8+lframe
  2638. NSofs = 6+lframe
  2639. Slen = 4+lframe
  2640. Sseg = 2+lframe
  2641. Sofs = lframe
  2642. RetSize = 12
  2643. (*%E *)
  2644. (*%T RegParam *)
  2645. Sseg = 2+lframe
  2646. Sofs = lframe
  2647. RetSize = 4
  2648. (*%E *)
  2649. public WinStr$Append :
  2650. push bp
  2651. mov bp, sp
  2652. push ds
  2653. push si
  2654. push di
  2655. (*%F RegParam *)
  2656. les di,[bp][NSofs]
  2657. mov cx,[bp][NSlen]
  2658. (*%E *)
  2659. (*%T RegParam *)
  2660. mov es, cx
  2661. mov di, bx
  2662. mov cx, ax
  2663. push dx
  2664. (*%E *)
  2665. sub al,al
  2666. repne
  2667. scasb
  2668. (*%T RegParam *)
  2669. jne FullString
  2670. (*%E *)
  2671. (*%F RegParam *)
  2672. jne Exit
  2673. (*%E *)
  2674. dec di
  2675. mov bx,cx
  2676. inc bx
  2677. (*%F RegParam *)
  2678. lds si,[bp][Sofs]
  2679. mov cx,[bp][Slen]
  2680. (*%E *)
  2681. (*%T RegParam *)
  2682. lds si,[bp][Sofs]
  2683. pop cx
  2684. (*%E *)
  2685. CopyLoop:
  2686. lodsb
  2687. stosb
  2688. or al,al
  2689. jz Exit
  2690. dec bx
  2691. loopnz CopyLoop
  2692. jz Exit
  2693. sub al,al
  2694. stosb
  2695. Exit:
  2696. pop di
  2697. pop si
  2698. pop ds
  2699. pop bp
  2700. (*%T _fcall *)
  2701. ret far RetSize
  2702. (*%E *)
  2703. (*%F _fcall *)
  2704. ret RetSize
  2705. (*%E *)
  2706. FullString:
  2707. pop cx
  2708. jmp Exit
  2709. (*%E *)
  2710. (*****************************************************************************)
  2711. section
  2712. (* ------------------------------------------------------------------------
  2713. PROCEDURE - Str.Copy.
  2714. PRECONDITIONS - None.
  2715. POSTCONDITIONS - dest contains source.
  2716. IN PARAMETERS - dest (VAR ARRAY OF CHAR), source (ARRAY OF CHAR).
  2717. OUT PARAMETERS - None.
  2718. CALLING CONVENTION - Standard.
  2719. NOTES - None.
  2720. VERSION - _OS2 and MSDOS.
  2721. ------------------------------------------------------------------------ *)
  2722. (*%F _DLL *)
  2723. (*%T SameDS *)
  2724. segment _TEXT(CODE,28H)
  2725. (*%E *)
  2726. (*%F SameDS *)
  2727. segment STR_TEXT(CODE,28H)
  2728. (*%E *)
  2729. (*%E *)
  2730. (*%T _DLL *)
  2731. segment STRDLL_TEXT(CODE,28H)
  2732. (*%E *)
  2733. (*%F RegParam *)
  2734. (*%F NearPtr *)
  2735. NSlen = 10+frame
  2736. NSseg = 8+frame
  2737. NSofs = 6+frame
  2738. Slen = 4+frame
  2739. Sseg = 2+frame
  2740. Sofs = frame
  2741. RetSize = 12
  2742. (*%E *)
  2743. (*%T NearPtr *)
  2744. NSlen = 6+frame
  2745. NSofs = 4+frame
  2746. Slen = 2+frame
  2747. Sofs = frame
  2748. RetSize = 8
  2749. (*%E *)
  2750. (*%E *)
  2751. (*%T RegParam *)
  2752. (*%F NearPtr *)
  2753. NSlen = -2
  2754. NSseg = -4
  2755. NSofs = -6
  2756. Slen = -8
  2757. Sseg = 2+frame
  2758. Sofs = frame
  2759. RetSize = 4
  2760. (*%E *)
  2761. (*%T NearPtr *)
  2762. NSlen = -2
  2763. NSofs = -4
  2764. Slen = -6
  2765. Sofs = -8
  2766. RetSize = 0
  2767. (*%E *)
  2768. locals = 8
  2769. (*%E *)
  2770. public Str$Copy :
  2771. push bp
  2772. mov bp,sp
  2773. (*%T RegParam *)
  2774. sub sp, locals
  2775. (*%F NearPtr *)
  2776. mov [bp][NSlen], ax
  2777. mov [bp][NSofs], bx
  2778. mov [bp][NSseg], cx
  2779. mov [bp][Slen], dx
  2780. (*%E *)
  2781. (*%T NearPtr *)
  2782. mov [bp][NSlen], ax
  2783. mov [bp][NSofs], bx
  2784. mov [bp][Slen], cx
  2785. mov [bp][Sofs], dx
  2786. (*%E *)
  2787. (*%E *)
  2788. push ds
  2789. push si
  2790. push di
  2791. (*%F NearPtr *)
  2792. les di,[bp][Sofs]
  2793. (*%E *)
  2794. (*%T NearPtr *)
  2795. mov di,[bp][Sofs]
  2796. push ds
  2797. pop es
  2798. (*%E *)
  2799. mov cx,[bp][Slen]
  2800. sub al,al
  2801. repne
  2802. scasb
  2803. jne LengthCalc
  2804. inc cx
  2805. LengthCalc:
  2806. mov ax,[bp][Slen]
  2807. sub ax,cx
  2808. mov cx,[bp][NSlen]
  2809. cmp ax,cx
  2810. ja SourceBigger
  2811. mov cx,ax
  2812. SourceBigger:
  2813. (*%F NearPtr *)
  2814. lds si,[bp][ Sofs]
  2815. les di,[bp][NSofs]
  2816. (*%E *)
  2817. (*%T NearPtr *)
  2818. mov si,[bp][ Sofs]
  2819. mov di,[bp][NSofs]
  2820. (*%E *)
  2821. rep
  2822. movsb
  2823. jae Exit
  2824. sub al,al
  2825. stosb
  2826. Exit:
  2827. pop di
  2828. pop si
  2829. pop ds
  2830. (*%T RegParam *)
  2831. mov sp, bp
  2832. (*%E *)
  2833. pop bp
  2834. (*%F NearCall *)
  2835. ret far RetSize
  2836. (*%E *)
  2837. (*%T NearCall *)
  2838. ret RetSize
  2839. (*%E *)
  2840. (*****************************************************************************)
  2841. (*%T _WINDOWS *)
  2842. section
  2843. (* ------------------------------------------------------------------------
  2844. PROCEDURE - WinStr.Copy.
  2845. PRECONDITIONS - None.
  2846. POSTCONDITIONS - dest contains source.
  2847. IN PARAMETERS - dest (VAR ARRAY OF CHAR), source (ARRAY OF CHAR).
  2848. OUT PARAMETERS - None.
  2849. CALLING CONVENTION - Standard + far pointers.
  2850. NOTES - None.
  2851. VERSION - Windows.
  2852. ------------------------------------------------------------------------ *)
  2853. segment _TEXT(CODE,28H)
  2854. (*%F RegParam *)
  2855. NSlen = 10+lframe
  2856. NSseg = 8+lframe
  2857. NSofs = 6+lframe
  2858. Slen = 4+lframe
  2859. Sseg = 2+lframe
  2860. Sofs = lframe
  2861. RetSize = 12
  2862. (*%E *)
  2863. (*%T RegParam *)
  2864. NSlen = -2
  2865. NSseg = -4
  2866. NSofs = -6
  2867. Slen = -8
  2868. Sseg = 2+lframe
  2869. Sofs = lframe
  2870. RetSize = 4
  2871. locals = 8
  2872. (*%E *)
  2873. public WinStr$Copy :
  2874. push bp
  2875. mov bp,sp
  2876. (*%T RegParam *)
  2877. sub sp, locals
  2878. mov [bp][NSlen], ax
  2879. mov [bp][NSofs], bx
  2880. mov [bp][NSseg], cx
  2881. mov [bp][Slen], dx
  2882. (*%E *)
  2883. push ds
  2884. push si
  2885. push di
  2886. les di,[bp][Sofs]
  2887. mov cx,[bp][Slen]
  2888. sub al,al
  2889. repne
  2890. scasb
  2891. jne LengthCalc
  2892. inc cx
  2893. LengthCalc:
  2894. mov ax,[bp][Slen]
  2895. sub ax,cx
  2896. mov cx,[bp][NSlen]
  2897. cmp ax,cx
  2898. ja SourceBigger
  2899. mov cx,ax
  2900. SourceBigger:
  2901. lds si,[bp][ Sofs]
  2902. les di,[bp][NSofs]
  2903. rep
  2904. movsb
  2905. jae Exit
  2906. sub al,al
  2907. stosb
  2908. Exit:
  2909. pop di
  2910. pop si
  2911. pop ds
  2912. (*%T RegParam *)
  2913. mov sp, bp
  2914. (*%E *)
  2915. pop bp
  2916. (*%T _fcall *)
  2917. ret far RetSize
  2918. (*%E *)
  2919. (*%F _fcall *)
  2920. ret RetSize
  2921. (*%E *)
  2922. (*%E *)
  2923. (*****************************************************************************)
  2924. section
  2925. (* ------------------------------------------------------------------------
  2926. PROCEDURE - Str.Slice.
  2927. PRECONDITIONS - None.
  2928. POSTCONDITIONS - dest contains section of source, starting at position with
  2929. a maximum size of length.
  2930. IN PARAMETERS - dest (VAR ARRAY OF CHAR), source (ARRAY OF CHAR),
  2931. position, length (CARDINAL).
  2932. OUT PARAMETERS - None.
  2933. CALLING CONVENTION - Standard.
  2934. NOTES - None.
  2935. VERSION - _OS2 and MSDOS.
  2936. ------------------------------------------------------------------------ *)
  2937. (*%F _DLL *)
  2938. (*%T SameDS *)
  2939. segment _TEXT(CODE,28H)
  2940. (*%E *)
  2941. (*%F SameDS *)
  2942. segment STR_TEXT(CODE,28H)
  2943. (*%E *)
  2944. (*%E *)
  2945. (*%T _DLL *)
  2946. segment STRDLL_TEXT(CODE,28H)
  2947. (*%E *)
  2948. (*%F RegParam *)
  2949. (*%F NearPtr *)
  2950. NSlen = 14+frame
  2951. NSseg = 12+frame
  2952. NSofs = 10+frame
  2953. Slen = 8+frame
  2954. Sseg = 6+frame
  2955. Sofs = 4+frame
  2956. P = 2+frame
  2957. L = frame
  2958. RetSize = 16
  2959. (*%E *)
  2960. (*%T NearPtr *)
  2961. NSlen = 10+frame
  2962. NSofs = 8+frame
  2963. Slen = 6+frame
  2964. Sofs = 4+frame
  2965. P = 2+frame
  2966. L = frame
  2967. RetSize = 12
  2968. (*%E *)
  2969. (*%E *)
  2970. (*%T RegParam *)
  2971. (*%F NearPtr *)
  2972. NSlen = -2
  2973. NSseg = -4
  2974. NSofs = -6
  2975. Slen = -8
  2976. Sseg = 6+frame
  2977. Sofs = 4+frame
  2978. P = 2+frame
  2979. L = frame
  2980. RetSize = 8
  2981. (*%E *)
  2982. (*%T NearPtr *)
  2983. NSlen = -2
  2984. NSofs = -4
  2985. Slen = -6
  2986. Sofs = -8
  2987. P = 2+frame
  2988. L = frame
  2989. RetSize = 4
  2990. (*%E *)
  2991. locals = 8
  2992. (*%E *)
  2993. public Str$Slice :
  2994. push bp
  2995. mov bp, sp
  2996. (*%T RegParam *)
  2997. sub sp, locals
  2998. (*%F NearPtr *)
  2999. mov [bp][NSlen], ax
  3000. mov [bp][NSofs], bx
  3001. mov [bp][NSseg], cx
  3002. mov [bp][Slen], dx
  3003. (*%E *)
  3004. (*%T NearPtr *)
  3005. mov [bp][NSlen], ax
  3006. mov [bp][NSofs], bx
  3007. mov [bp][Slen], cx
  3008. mov [bp][Sofs], dx
  3009. (*%E *)
  3010. (*%E *)
  3011. push ds
  3012. push si
  3013. push di
  3014. (*%F NearPtr *)
  3015. les di,[bp][Sofs]
  3016. (*%E *)
  3017. (*%T NearPtr *)
  3018. mov di,[bp][Sofs]
  3019. push ds
  3020. pop es
  3021. (*%E *)
  3022. mov cx,[bp][Slen]
  3023. sub al,al
  3024. repne
  3025. scasb
  3026. jne LengthCalc
  3027. inc cx
  3028. LengthCalc:
  3029. mov ax, [bp][Slen]
  3030. sub ax,cx
  3031. mov bx, [bp][P]
  3032. sub ax,bx
  3033. ja NotBeyondEnd
  3034. sub ax,ax
  3035. NotBeyondEnd:
  3036. cmp ax, [bp][L]
  3037. jb OffEnd
  3038. mov ax, [bp][L]
  3039. OffEnd:
  3040. (*%F NearPtr *)
  3041. lds si, [bp][Sofs]
  3042. (*%E *)
  3043. (*%T NearPtr *)
  3044. mov si, [bp][Sofs]
  3045. (*%E *)
  3046. add si,[bp][P]
  3047. mov cx,[bp][NSlen]
  3048. cmp ax,cx
  3049. ja SourceBigger
  3050. mov cx,ax
  3051. SourceBigger:
  3052. (*%F NearPtr *)
  3053. les di,[bp][NSofs]
  3054. (*%E *)
  3055. (*%T NearPtr *)
  3056. mov di,[bp][NSofs]
  3057. (*%E *)
  3058. rep
  3059. movsb
  3060. jae Exit
  3061. sub al,al
  3062. stosb
  3063. Exit:
  3064. pop di
  3065. pop si
  3066. pop ds
  3067. (*%T RegParam *)
  3068. mov sp, bp
  3069. (*%E *)
  3070. pop bp
  3071. (*%F NearCall *)
  3072. ret far RetSize
  3073. (*%E *)
  3074. (*%T NearCall *)
  3075. ret RetSize
  3076. (*%E *)
  3077. (*****************************************************************************)
  3078. section
  3079. (* ------------------------------------------------------------------------
  3080. PROCEDURE - Str.Pos.
  3081. PRECONDITIONS - None.
  3082. POSTCONDITIONS - None.
  3083. IN PARAMETERS - source (ARRAY OF CHAR), target (ARRAY OF CHAR).
  3084. OUT PARAMETERS - returns offset of target in source CARDINAL).
  3085. MAX(CARDINAL) if not found.
  3086. CALLING CONVENTION - Standard.
  3087. NOTES - None.
  3088. VERSION - _OS2 and MSDOS.
  3089. ------------------------------------------------------------------------ *)
  3090. (*%F _DLL *)
  3091. (*%T SameDS *)
  3092. segment _TEXT(CODE,28H)
  3093. (*%E *)
  3094. (*%F SameDS *)
  3095. segment STR_TEXT(CODE,28H)
  3096. (*%E *)
  3097. (*%E *)
  3098. (*%T _DLL *)
  3099. segment STRDLL_TEXT(CODE,28H)
  3100. (*%E *)
  3101. (*%F RegParam *)
  3102. (*%F NearPtr *)
  3103. Slen = 10+frame
  3104. Sseg = 8+frame
  3105. Sofs = 6+frame
  3106. Plen = 4+frame
  3107. Pseg = 2+frame
  3108. Pofs = frame
  3109. RetSize = 12
  3110. (*%E *)
  3111. (*%T NearPtr *)
  3112. Slen = 6+frame
  3113. Sofs = 4+frame
  3114. Plen = 2+frame
  3115. Pofs = frame
  3116. RetSize = 8
  3117. (*%E *)
  3118. (*%E *)
  3119. (*%T RegParam *)
  3120. (*%F NearPtr *)
  3121. Slen = -2
  3122. Sseg = -4
  3123. Sofs = -6
  3124. Plen = -8
  3125. Pseg = 2+frame
  3126. Pofs = frame
  3127. RetSize = 4
  3128. (*%E *)
  3129. (*%T NearPtr *)
  3130. Slen = -2
  3131. Sofs = -4
  3132. Plen = -6
  3133. Pofs = -8
  3134. RetSize = 0
  3135. (*%E *)
  3136. locals = 8
  3137. (*%E *)
  3138. public Str$Pos :
  3139. push bp
  3140. mov bp,sp
  3141. (*%T RegParam *)
  3142. sub sp, locals
  3143. (*%F NearPtr *)
  3144. mov [bp][Slen], ax
  3145. mov [bp][Sofs], bx
  3146. mov [bp][Sseg], cx
  3147. mov [bp][Plen], dx
  3148. (*%E *)
  3149. (*%T NearPtr *)
  3150. mov [bp][Slen], ax
  3151. mov [bp][Sofs], bx
  3152. mov [bp][Plen], cx
  3153. mov [bp][Pofs], dx
  3154. (*%E *)
  3155. (*%E *)
  3156. push ds
  3157. push si
  3158. push di
  3159. (*%F NearPtr *)
  3160. les di,[bp][Sofs]
  3161. (*%E *)
  3162. (*%T NearPtr *)
  3163. mov di,[bp][Sofs]
  3164. push ds
  3165. pop es
  3166. (*%E *)
  3167. mov cx,[bp][Slen]
  3168. mov bx,cx
  3169. sub al,al
  3170. repne
  3171. scasb
  3172. jne LengthCalc1
  3173. inc cx
  3174. LengthCalc1:
  3175. sub bx,cx
  3176. (*%F NearPtr *)
  3177. les di,[bp][Pofs]
  3178. (*%E *)
  3179. (*%T NearPtr *)
  3180. mov di,[bp][Pofs]
  3181. push ds
  3182. pop es
  3183. (*%E *)
  3184. mov cx,[bp][Plen]
  3185. mov dx,cx
  3186. sub al,al
  3187. repne
  3188. scasb
  3189. jne LengthCalc2
  3190. inc cx
  3191. LengthCalc2:
  3192. sub dx,cx
  3193. sub bx,dx
  3194. jb NotFound
  3195. (*%F NearPtr *)
  3196. mov ds,[bp][Sseg]
  3197. (*%E *)
  3198. sub ax,ax
  3199. SearchLoop:
  3200. mov si,[bp][Sofs]
  3201. add si,ax
  3202. mov di,[bp][Pofs]
  3203. mov cx,dx
  3204. repe
  3205. cmpsb
  3206. je Found
  3207. inc ax
  3208. cmp ax,bx
  3209. jbe SearchLoop
  3210. NotFound:
  3211. mov ax,0FFFFH
  3212. Found:
  3213. Exit:
  3214. pop di
  3215. pop si
  3216. pop ds
  3217. (*%T RegParam *)
  3218. mov sp, bp
  3219. (*%E *)
  3220. pop bp
  3221. (*%F NearCall *)
  3222. ret far RetSize
  3223. (*%E *)
  3224. (*%T NearCall *)
  3225. ret RetSize
  3226. (*%E *)
  3227. section
  3228. (*%T _WINDOWS *)
  3229. (*****************************************************************************)
  3230. (* ------------------------------------------------------------------------
  3231. PROCEDURE - WinStr.Pos.
  3232. PRECONDITIONS - None.
  3233. POSTCONDITIONS - None.
  3234. IN PARAMETERS - source (ARRAY OF CHAR), target (ARRAY OF CHAR).
  3235. OUT PARAMETERS - returns offset of target in source CARDINAL).
  3236. MAX(CARDINAL) if not found.
  3237. CALLING CONVENTION - Standard + Far Pointers.
  3238. NOTES - None.
  3239. VERSION - Windows.
  3240. ------------------------------------------------------------------------ *)
  3241. (*%F _DLL *)
  3242. (*%T SameDS *)
  3243. segment _TEXT(CODE,28H)
  3244. (*%E *)
  3245. (*%F SameDS *)
  3246. segment STR_TEXT(CODE,28H)
  3247. (*%E *)
  3248. (*%E *)
  3249. (*%T _DLL *)
  3250. segment STRDLL_TEXT(CODE,28H)
  3251. (*%E *)
  3252. (*%F RegParam *)
  3253. Slen = 10+frame
  3254. Sseg = 8+frame
  3255. Sofs = 6+frame
  3256. Plen = 4+frame
  3257. Pseg = 2+frame
  3258. Pofs = frame
  3259. RetSize = 12
  3260. (*%E *)
  3261. (*%T RegParam *)
  3262. Slen = -2
  3263. Sseg = -4
  3264. Sofs = -6
  3265. Plen = -8
  3266. Pseg = 2+frame
  3267. Pofs = frame
  3268. RetSize = 4
  3269. locals = 8
  3270. (*%E *)
  3271. public WinStr$Pos :
  3272. push bp
  3273. mov bp, sp
  3274. (*%T RegParam *)
  3275. sub sp, locals
  3276. mov [bp][Slen], ax
  3277. mov [bp][Sofs], bx
  3278. mov [bp][Sseg], cx
  3279. mov [bp][Plen], dx
  3280. (*%E *)
  3281. push ds
  3282. push si
  3283. push di
  3284. les di, [bp][Sofs]
  3285. mov cx, [bp][Slen]
  3286. mov bx, cx
  3287. sub al, al
  3288. repne; scasb
  3289. jne $$LengthCalc1
  3290. inc cx
  3291. $$LengthCalc1:
  3292. sub bx, cx
  3293. les di, [bp][Pofs]
  3294. mov cx, [bp][Plen]
  3295. mov dx, cx
  3296. sub al, al
  3297. repne; scasb
  3298. jne $$LengthCalc2
  3299. inc cx
  3300. $$LengthCalc2:
  3301. sub dx, cx
  3302. sub bx, dx
  3303. jb $$NotFound
  3304. mov ds, [bp][Sseg]
  3305. sub ax, ax
  3306. $$SearchLoop:
  3307. mov si, [bp][Sofs]
  3308. add si, ax
  3309. mov di, [bp][Pofs]
  3310. mov cx, dx
  3311. repe; cmpsb
  3312. je $$Found
  3313. inc ax
  3314. cmp ax, bx
  3315. jbe $$SearchLoop
  3316. $$NotFound:
  3317. mov ax, 0FFFFH
  3318. $$Found:
  3319. pop di
  3320. pop si
  3321. pop ds
  3322. (*%T RegParam *)
  3323. mov sp, bp
  3324. (*%E *)
  3325. pop bp
  3326. (*%F NearCall *)
  3327. ret far RetSize
  3328. (*%E *)
  3329. (*%T NearCall *)
  3330. ret RetSize
  3331. (*%E *)
  3332. (*%E _WINDOWS *)
  3333. (*****************************************************************************)
  3334. section
  3335. (* ------------------------------------------------------------------------
  3336. PROCEDURE - Str.NextPos.
  3337. PRECONDITIONS - None.
  3338. POSTCONDITIONS - None.
  3339. IN PARAMETERS - source (ARRAY OF CHAR), target (ARRAY OF CHAR),
  3340. place (CARDINAL).
  3341. OUT PARAMETERS - returns offset of target in source CARDINAL), starting
  3342. from member place. Returns MAX(CARDINAL) if not found.
  3343. CALLING CONVENTION - Standard.
  3344. NOTES - None.
  3345. VERSION - _OS2 and MSDOS.
  3346. ------------------------------------------------------------------------ *)
  3347. (*%F _DLL *)
  3348. (*%T SameDS *)
  3349. segment _TEXT(CODE,28H)
  3350. (*%E *)
  3351. (*%F SameDS *)
  3352. segment STR_TEXT(CODE,28H)
  3353. (*%E *)
  3354. (*%E *)
  3355. (*%T _DLL *)
  3356. segment STRDLL_TEXT(CODE,28H)
  3357. (*%E *)
  3358. (*%F RegParam *)
  3359. (*%F NearPtr *)
  3360. Slen = 12+frame
  3361. Sseg = 10+frame
  3362. Sofs = 8+frame
  3363. Plen = 6+frame
  3364. Pseg = 4+frame
  3365. Pofs = 2+frame
  3366. Shift = frame
  3367. RetSize = 14
  3368. (*%E *)
  3369. (*%T NearPtr *)
  3370. Slen = 8+frame
  3371. Sofs = 6+frame
  3372. Plen = 4+frame
  3373. Pofs = 2+frame
  3374. Shift = frame
  3375. RetSize = 10
  3376. (*%E *)
  3377. (*%E *)
  3378. (*%T RegParam *)
  3379. (*%F NearPtr *)
  3380. Slen = -2
  3381. Sseg = -4
  3382. Sofs = -6
  3383. Plen = -8
  3384. Pseg = 4+frame
  3385. Pofs = 2+frame
  3386. Shift = frame
  3387. RetSize = 6
  3388. (*%E *)
  3389. (*%T NearPtr *)
  3390. Slen = -2
  3391. Sofs = -4
  3392. Plen = -6
  3393. Pofs = -8
  3394. Shift = frame
  3395. RetSize = 2
  3396. (*%E *)
  3397. locals = 8
  3398. (*%E *)
  3399. public Str$NextPos :
  3400. push bp
  3401. mov bp,sp
  3402. (*%T RegParam *)
  3403. sub sp, locals
  3404. (*%F NearPtr *)
  3405. mov [bp][Slen], ax
  3406. mov [bp][Sofs], bx
  3407. mov [bp][Sseg], cx
  3408. mov [bp][Plen], dx
  3409. (*%E *)
  3410. (*%T NearPtr *)
  3411. mov [bp][Slen], ax
  3412. mov [bp][Sofs], bx
  3413. mov [bp][Plen], cx
  3414. mov [bp][Pofs], dx
  3415. (*%E *)
  3416. (*%E *)
  3417. push ds
  3418. push si
  3419. push di
  3420. mov ax, [bp][Shift]
  3421. cmp ax, [bp][Slen]
  3422. jae NotFound
  3423. add [bp][Sofs], ax
  3424. (*%F NearPtr *)
  3425. les di,[bp][Sofs]
  3426. (*%E *)
  3427. (*%T NearPtr *)
  3428. mov di,[bp][Sofs]
  3429. push ds
  3430. pop es
  3431. (*%E *)
  3432. mov cx,[bp][Slen]
  3433. mov bx,cx
  3434. sub al,al
  3435. repne
  3436. scasb
  3437. jne LengthCalc1
  3438. inc cx
  3439. LengthCalc1:
  3440. sub bx,cx
  3441. (*%F NearPtr *)
  3442. les di,[bp][Pofs]
  3443. (*%E *)
  3444. (*%T NearPtr *)
  3445. mov di,[bp][Pofs]
  3446. push ds
  3447. pop es
  3448. (*%E *)
  3449. mov cx,[bp][Plen]
  3450. mov dx,cx
  3451. sub al,al
  3452. repne
  3453. scasb
  3454. jne LengthCalc2
  3455. inc cx
  3456. LengthCalc2:
  3457. sub dx,cx
  3458. sub bx,dx
  3459. jb NotFound
  3460. (*%F NearPtr *)
  3461. mov ds,[bp][Sseg]
  3462. (*%E *)
  3463. sub ax,ax
  3464. SearchLoop:
  3465. mov si,[bp][Sofs]
  3466. add si,ax
  3467. mov di,[bp][Pofs]
  3468. mov cx,dx
  3469. repe
  3470. cmpsb
  3471. je Found
  3472. inc ax
  3473. cmp ax,bx
  3474. jbe SearchLoop
  3475. NotFound:
  3476. mov ax,0FFFFH
  3477. jmp Exit
  3478. Found:
  3479. add ax, [bp][Shift]
  3480. Exit:
  3481. pop di
  3482. pop si
  3483. pop ds
  3484. (*%T RegParam *)
  3485. mov sp, bp
  3486. (*%E *)
  3487. pop bp
  3488. (*%F NearCall *)
  3489. ret far RetSize
  3490. (*%E *)
  3491. (*%T NearCall *)
  3492. ret RetSize
  3493. (*%E *)
  3494. section
  3495. (*%T _WINDOWS *)
  3496. (*****************************************************************************)
  3497. (* ------------------------------------------------------------------------
  3498. PROCEDURE - WinStr.NextPos.
  3499. PRECONDITIONS - None.
  3500. POSTCONDITIONS - None.
  3501. IN PARAMETERS - source (ARRAY OF CHAR), target (ARRAY OF CHAR),
  3502. place (CARDINAL).
  3503. OUT PARAMETERS - returns offset of target in source CARDINAL), starting
  3504. from member place. Returns MAX(CARDINAL) if not found.
  3505. CALLING CONVENTION - Standard + Far Call.
  3506. NOTES - None.
  3507. VERSION - Windows.
  3508. ------------------------------------------------------------------------ *)
  3509. (*%F _DLL *)
  3510. (*%T SameDS *)
  3511. segment _TEXT(CODE,28H)
  3512. (*%E *)
  3513. (*%F SameDS *)
  3514. segment STR_TEXT(CODE,28H)
  3515. (*%E *)
  3516. (*%E *)
  3517. (*%T _DLL *)
  3518. segment STRDLL_TEXT(CODE,28H)
  3519. (*%E *)
  3520. (*%F RegParam *)
  3521. Slen = 12+frame
  3522. Sseg = 10+frame
  3523. Sofs = 8+frame
  3524. Plen = 6+frame
  3525. Pseg = 4+frame
  3526. Pofs = 2+frame
  3527. Shift = frame
  3528. RetSize = 14
  3529. (*%E *)
  3530. (*%T RegParam *)
  3531. Slen = -2
  3532. Sseg = -4
  3533. Sofs = -6
  3534. Plen = -8
  3535. Pseg = 4+frame
  3536. Pofs = 2+frame
  3537. Shift = frame
  3538. RetSize = 6
  3539. locals = 8
  3540. (*%E *)
  3541. public WinStr$NextPos :
  3542. push bp
  3543. mov bp,sp
  3544. (*%T RegParam *)
  3545. sub sp, locals
  3546. mov [bp][Slen], ax
  3547. mov [bp][Sofs], bx
  3548. mov [bp][Sseg], cx
  3549. mov [bp][Plen], dx
  3550. (*%E *)
  3551. push ds
  3552. push si
  3553. push di
  3554. mov ax, [bp][Shift]
  3555. cmp ax, [bp][Slen]
  3556. jae $$NotFound
  3557. add [bp][Sofs], ax
  3558. les di, [bp][Sofs]
  3559. mov cx, [bp][Slen]
  3560. mov bx, cx
  3561. sub al, al
  3562. repne; scasb
  3563. jne $$LengthCalc1
  3564. inc cx
  3565. $$LengthCalc1:
  3566. sub bx, cx
  3567. les di, [bp][Pofs]
  3568. mov cx, [bp][Plen]
  3569. mov dx, cx
  3570. sub al, al
  3571. repne; scasb
  3572. jne $$LengthCalc2
  3573. inc cx
  3574. $$LengthCalc2:
  3575. sub dx, cx
  3576. sub bx, dx
  3577. jb $$NotFound
  3578. mov ds, [bp][Sseg]
  3579. sub ax, ax
  3580. $$SearchLoop:
  3581. mov si, [bp][Sofs]
  3582. add si, ax
  3583. mov di, [bp][Pofs]
  3584. mov cx, dx
  3585. repe; cmpsb
  3586. je $$Found
  3587. inc ax
  3588. cmp ax, bx
  3589. jbe $$SearchLoop
  3590. $$NotFound:
  3591. mov ax, 0FFFFH
  3592. jmp $$Exit
  3593. $$Found:
  3594. add ax, [bp][Shift]
  3595. $$Exit:
  3596. pop di
  3597. pop si
  3598. pop ds
  3599. (*%T RegParam *)
  3600. mov sp, bp
  3601. (*%E *)
  3602. pop bp
  3603. (*%F NearCall *)
  3604. ret far RetSize
  3605. (*%E *)
  3606. (*%T NearCall *)
  3607. ret RetSize
  3608. (*%E *)
  3609. (*%E _WINDOWS *)
  3610. (**************************************************************************)
  3611. section
  3612. (* ------------------------------------------------------------------------
  3613. PROCEDURE - Str.CharPos.
  3614. PRECONDITIONS - None.
  3615. POSTCONDITIONS - None.
  3616. IN PARAMETERS - source (ARRAY OF CHAR), ch (CHAR).
  3617. OUT PARAMETERS - returns offset of ch in source CARDINAL),
  3618. MAX(CARDINAL) if not found.
  3619. CALLING CONVENTION - Standard.
  3620. NOTES - None.
  3621. VERSION - _OS2 and MSDOS.
  3622. ------------------------------------------------------------------------ *)
  3623. (*%F _DLL *)
  3624. (*%T SameDS *)
  3625. segment _TEXT(CODE,28H)
  3626. (*%E *)
  3627. (*%F SameDS *)
  3628. segment STR_TEXT(CODE,28H)
  3629. (*%E *)
  3630. (*%E *)
  3631. (*%T _DLL *)
  3632. segment STRDLL_TEXT(CODE,28H)
  3633. (*%E *)
  3634. public Str$CharPos :
  3635. (*%T RegParam *)
  3636. (*%T _DLLOVL *)
  3637. push bp
  3638. mov bp, sp
  3639. (*%E *)
  3640. (*%T NearPtr *)
  3641. push dx
  3642. (*%E *)
  3643. push di
  3644. (*%F NearPtr *)
  3645. mov es, cx
  3646. mov di, bx
  3647. mov cx, ax
  3648. mov ax, dx
  3649. mov dx, cx
  3650. (*%E *)
  3651. (*%T NearPtr *)
  3652. mov di, bx
  3653. mov dx, ax
  3654. mov ax, cx
  3655. mov cx, dx
  3656. push ds
  3657. pop es
  3658. (*%E *)
  3659. push ax
  3660. sub al, al
  3661. repne ; scasb
  3662. jne lCalc
  3663. inc cx
  3664. lCalc:
  3665. sub dx, cx
  3666. xchg dx, cx
  3667. mov di, bx
  3668. pop ax
  3669. repne; scasb
  3670. jnz notFound
  3671. dec di
  3672. sub di, bx
  3673. mov ax, di
  3674. chrDone:
  3675. pop di
  3676. (*%T NearPtr *)
  3677. pop dx
  3678. (*%E *)
  3679. (*%T _DLLOVL *)
  3680. pop bp
  3681. (*%E *)
  3682. (*%F NearCall *)
  3683. ret far 0
  3684. (*%E *)
  3685. (*%T NearCall *)
  3686. ret 0
  3687. (*%E *)
  3688. notFound:
  3689. mov ax, -1
  3690. jmp chrDone
  3691. (*%E *)
  3692. (*%F RegParam *)
  3693. (*%T NearPtr *)
  3694. slen = 4+frame
  3695. s = 2+frame
  3696. chk = frame
  3697. RetSize = 6
  3698. (*%E *)
  3699. (*%F NearPtr *)
  3700. slen = 6+frame
  3701. s = 2+frame
  3702. chk = frame
  3703. RetSize = 8
  3704. (*%E *)
  3705. push bp
  3706. mov bp, sp
  3707. push di
  3708. (*%F NearPtr *)
  3709. les di, [bp][s]
  3710. (*%E *)
  3711. (*%T NearPtr *)
  3712. mov di, [bp][s]
  3713. push ds
  3714. pop es
  3715. (*%E *)
  3716. mov cx, [bp][slen]
  3717. mov dx, [bp][slen]
  3718. sub al, al
  3719. repne ; scasb
  3720. jne lCalc
  3721. inc cx
  3722. lCalc:
  3723. sub dx, cx
  3724. xchg dx, cx
  3725. mov di, [bp][s]
  3726. mov al, [bp][chk]
  3727. repne; scasb
  3728. jnz notFound
  3729. dec di
  3730. sub di, [bp][s]
  3731. mov ax, di
  3732. chrDone:
  3733. pop di
  3734. pop bp
  3735. (*%F NearCall *)
  3736. ret far RetSize
  3737. (*%E *)
  3738. (*%T NearCall *)
  3739. ret RetSize
  3740. (*%E *)
  3741. notFound:
  3742. mov ax, -1
  3743. jmp chrDone
  3744. (*%E *)
  3745. (**************************************************************************)
  3746. section
  3747. (* ------------------------------------------------------------------------
  3748. PROCEDURE - Str.RCharPos.
  3749. PRECONDITIONS - None.
  3750. POSTCONDITIONS - None.
  3751. IN PARAMETERS - source (ARRAY OF CHAR), ch (CHAR).
  3752. OUT PARAMETERS - returns offset of ch in source CARDINAL),
  3753. MAX(CARDINAL) if not found.
  3754. CALLING CONVENTION - Standard.
  3755. NOTES - Starts search from last member of string.
  3756. VERSION - _OS2 and MSDOS.
  3757. ------------------------------------------------------------------------ *)
  3758. (*%F _DLL *)
  3759. (*%T SameDS *)
  3760. segment _TEXT(CODE,28H)
  3761. (*%E *)
  3762. (*%F SameDS *)
  3763. segment STR_TEXT(CODE,28H)
  3764. (*%E *)
  3765. (*%E *)
  3766. (*%T _DLL *)
  3767. segment STRDLL_TEXT(CODE,28H)
  3768. (*%E *)
  3769. public Str$RCharPos :
  3770. (*%T RegParam *)
  3771. (*%T _DLLOVL *)
  3772. push bp
  3773. mov bp, sp
  3774. (*%E *)
  3775. (*%T NearPtr *)
  3776. push dx
  3777. (*%E *)
  3778. push di
  3779. (*%F NearPtr *)
  3780. mov es, cx
  3781. mov di, bx
  3782. mov cx, ax
  3783. mov ax, dx
  3784. mov dx, cx
  3785. (*%E *)
  3786. (*%T NearPtr *)
  3787. mov di, bx
  3788. mov dx, ax
  3789. mov ax, cx
  3790. mov cx, dx
  3791. push ds
  3792. pop es
  3793. (*%E *)
  3794. push ax
  3795. sub al, al
  3796. repne ; scasb
  3797. jne lCalc
  3798. dec di
  3799. lCalc:
  3800. dec di
  3801. sub dx, cx
  3802. mov cx, dx
  3803. std
  3804. pop ax
  3805. repne; scasb
  3806. cld
  3807. jnz notFound
  3808. inc di
  3809. sub di, bx
  3810. mov ax, di
  3811. chrDone:
  3812. pop di
  3813. (*%T NearPtr *)
  3814. pop dx
  3815. (*%E *)
  3816. (*%T _DLLOVL *)
  3817. pop bp
  3818. (*%E *)
  3819. (*%F NearCall *)
  3820. ret far 0
  3821. (*%E *)
  3822. (*%T NearCall *)
  3823. ret 0
  3824. (*%E *)
  3825. notFound:
  3826. mov ax, -1
  3827. jmp chrDone
  3828. (*%E *)
  3829. (*%F RegParam *)
  3830. (*%T NearPtr *)
  3831. slen = 4+frame
  3832. s = 2+frame
  3833. chk = frame
  3834. RetSize = 6
  3835. (*%E *)
  3836. (*%F NearPtr *)
  3837. slen = 6+frame
  3838. s = 2+frame
  3839. chk = frame
  3840. RetSize = 8
  3841. (*%E *)
  3842. push bp
  3843. mov bp, sp
  3844. push di
  3845. (*%F NearPtr *)
  3846. les di, [bp][s]
  3847. (*%E *)
  3848. (*%T NearPtr *)
  3849. mov di, [bp][s]
  3850. push ds
  3851. pop es
  3852. (*%E *)
  3853. mov cx, [bp][slen]
  3854. mov dx, [bp][slen]
  3855. sub al, al
  3856. repne ; scasb
  3857. jne lCalc
  3858. dec di
  3859. lCalc:
  3860. dec di
  3861. mov al, [bp][chk]
  3862. sub dx, cx
  3863. mov cx, dx
  3864. std
  3865. repne; scasb
  3866. cld
  3867. jnz notFound
  3868. inc di
  3869. sub di, [bp][s]
  3870. mov ax, di
  3871. chrDone:
  3872. pop di
  3873. pop bp
  3874. (*%F NearCall *)
  3875. ret far RetSize
  3876. (*%E *)
  3877. (*%T NearCall *)
  3878. ret RetSize
  3879. (*%E *)
  3880. notFound:
  3881. mov ax, -1
  3882. jmp chrDone
  3883. (*%E *)
  3884. (*****************************************************************************)
  3885. section
  3886. (* ------------------------------------------------------------------------
  3887. PROCEDURE - STANDARD.NULLPROC.
  3888. PRECONDITIONS - None.
  3889. POSTCONDITIONS - Process terminated.
  3890. IN PARAMETERS - None.
  3891. OUT PARAMETERS - returns offset of ch in source CARDINAL),
  3892. MAX(CARDINAL) if not found.
  3893. CALLING CONVENTION - Standard.
  3894. NOTES - Null procedure variables should point to this procedure .
  3895. VERSION - _OS2 and MSDOS.
  3896. ------------------------------------------------------------------------ *)
  3897. segment _TEXT(CODE,28H)
  3898. extrn __FatalError
  3899. extrn __FatalErrorPos
  3900. public Standard$NULLPROC :
  3901. call far __FatalErrorPos
  3902. mov cx, 22H
  3903. push cx
  3904. push dx
  3905. push ax
  3906. call far __FatalError
  3907. (*****************************************************************************)
  3908. section
  3909. (* ------------------------------------------------------------------------
  3910. PROCEDURE - Lib.SetReturnCode.
  3911. PRECONDITIONS - None.
  3912. POSTCONDITIONS - Process exit code set.
  3913. IN PARAMETERS - code (CARDINAL).
  3914. OUT PARAMETERS - None.
  3915. CALLING CONVENTION - Standard.
  3916. NOTES - Only LSB used.
  3917. VERSION - _OS2 and MSDOS.
  3918. ------------------------------------------------------------------------ *)
  3919. (*%F _DLL *)
  3920. (*%T SameDS *)
  3921. segment _TEXT(CODE,28H)
  3922. (*%E *)
  3923. (*%F SameDS *)
  3924. segment Lib_TEXT(CODE,28H)
  3925. (*%E *)
  3926. (*%E *)
  3927. (*%T _DLL *)
  3928. segment LibDLL_TEXT(CODE,28H)
  3929. (*%E *)
  3930. extrn @ExitCode
  3931. retcode = frame
  3932. public Lib$SetReturnCode :
  3933. (*%F RegParam *)
  3934. push bp
  3935. mov bp, sp
  3936. (*%F SameDS *)
  3937. push ds
  3938. mov ax, seg @ExitCode
  3939. mov ds, ax
  3940. (*%E *)
  3941. mov ax,[bp][retcode]
  3942. mov [@ExitCode],al
  3943. (*%F SameDS *)
  3944. pop ds
  3945. (*%E *)
  3946. pop bp
  3947. (*%F NearCall *)
  3948. ret far 2
  3949. (*%E *)
  3950. (*%T NearCall *)
  3951. ret 2
  3952. (*%E *)
  3953. (*%E *)
  3954. (*%T RegParam *)
  3955. (*%T _DLLOVL *)
  3956. push bp
  3957. mov bp, sp
  3958. (*%E *)
  3959. (*%F SameDS *)
  3960. push bx
  3961. push ds
  3962. mov bx, seg @ExitCode
  3963. mov ds, bx
  3964. (*%E *)
  3965. mov [@ExitCode],al
  3966. (*%F SameDS *)
  3967. pop ds
  3968. pop bx
  3969. (*%E *)
  3970. (*%T _DLLOVL *)
  3971. pop bp
  3972. (*%E *)
  3973. (*%F NearCall *)
  3974. ret far 0
  3975. (*%E *)
  3976. (*%T NearCall *)
  3977. ret 0
  3978. (*%E *)
  3979. (*%E *)
  3980. (*****************************************************************************)
  3981. section
  3982. (* ------------------------------------------------------------------------
  3983. PROCEDURE - Standard.HALT.
  3984. PRECONDITIONS - None.
  3985. POSTCONDITIONS - Process terminated.
  3986. IN PARAMETERS - None.
  3987. OUT PARAMETERS - None.
  3988. CALLING CONVENTION - Standard.
  3989. NOTES - None.
  3990. VERSION - _OS2 and MSDOS.
  3991. ------------------------------------------------------------------------ *)
  3992. segment _TEXT(CODE,28H)
  3993. segment _DATA(DATA,28H)
  3994. extrn @ExitCode
  3995. extrn _exit
  3996. select _TEXT
  3997. public Standard$HALT:
  3998. (*%T _DLLOVL *)
  3999. push bp
  4000. mov bp, sp
  4001. (*%E *)
  4002. (*%F SameDS *)
  4003. mov ax, seg @ExitCode
  4004. mov ds, ax
  4005. (*%E *)
  4006. mov al, [@ExitCode]
  4007. sub ah, ah
  4008. (*%F RegParam *)
  4009. push ax
  4010. (*%E *)
  4011. (*%F NearCall *)
  4012. call far _exit
  4013. (*%E *)
  4014. (*%T NearCall *)
  4015. call _exit
  4016. (*%E *)
  4017. (**************************************************************************)
  4018. section
  4019. (* ------------------------------------------------------------------------
  4020. PROCEDURE - MATHLIB.InternalBcdToLong.
  4021. PRECONDITIONS - None.
  4022. POSTCONDITIONS - None.
  4023. IN PARAMETERS - BCD ARRAY.
  4024. OUT PARAMETERS - conversion to real number (LONGREAL).
  4025. CALLING CONVENTION - Stack frame.
  4026. NOTES - Called by BcdToLong.
  4027. VERSION - _OS2 and MSDOS.
  4028. ------------------------------------------------------------------------ *)
  4029. (*%T SameDS *)
  4030. segment _TEXT(CODE,28H)
  4031. (*%E *)
  4032. (*%F SameDS *)
  4033. segment MATHLIB_TEXT(CODE,28H)
  4034. (*%E *)
  4035. public MATHLIB$InternalBcdToLong :
  4036. Bcd = frame
  4037. retSize = 10
  4038. push bp
  4039. mov bp, sp
  4040. fbld st(0), [bp][Bcd]
  4041. fstp st(1), st(0)
  4042. pop bp
  4043. (*%F NearCall *)
  4044. ret far retSize
  4045. (*%E *)
  4046. (*%T NearCall *)
  4047. ret retSize
  4048. (*%E *)
  4049. (***************************************************************************)
  4050. section
  4051. (* ------------------------------------------------------------------------
  4052. PROCEDURE - MATHLIB.ClearExceptions.
  4053. PRECONDITIONS - None.
  4054. POSTCONDITIONS - 087 exceptions cleared.
  4055. IN PARAMETERS - None.
  4056. OUT PARAMETERS - None.
  4057. CALLING CONVENTION - Standard.
  4058. NOTES - None.
  4059. VERSION - _OS2 and MSDOS.
  4060. ------------------------------------------------------------------------ *)
  4061. (*%T SameDS *)
  4062. segment _TEXT(CODE,28H)
  4063. (*%E *)
  4064. (*%F SameDS *)
  4065. segment MATHLIB_TEXT(CODE,28H)
  4066. (*%E *)
  4067. public MATHLIB$ClearExceptions :
  4068. (*%T _DLLOVL *)
  4069. push bp
  4070. mov bp, sp
  4071. (*%E *)
  4072. fclex
  4073. (*%T _DLLOVL *)
  4074. pop bp
  4075. (*%E *)
  4076. (*%F NearCall *)
  4077. ret far 0
  4078. (*%E *)
  4079. (*%T NearCall *)
  4080. ret 0
  4081. (*%E *)
  4082. (***************************************************************************)
  4083. section
  4084. (* ------------------------------------------------------------------------
  4085. PROCEDURE - MATHLIB.LoadControlWord.
  4086. PRECONDITIONS - None.
  4087. POSTCONDITIONS - 097 control word set to parameter (BITSET).
  4088. IN PARAMETERS - new value (BITSET).
  4089. OUT PARAMETERS - None.
  4090. CALLING CONVENTION - Standard.
  4091. NOTES - None.
  4092. VERSION - _OS2 and MSDOS.
  4093. ------------------------------------------------------------------------ *)
  4094. (*%T SameDS *)
  4095. segment _TEXT(CODE,28H)
  4096. (*%E *)
  4097. (*%F SameDS *)
  4098. segment MATHLIB_TEXT(CODE,28H)
  4099. (*%E *)
  4100. public MATHLIB$LoadControlWord :
  4101. (*%F RegParam *)
  4102. push bp
  4103. mov bp, sp
  4104. fldcw [bp][frame]
  4105. pop bp
  4106. (*%F NearCall *)
  4107. ret far 2
  4108. (*%E *)
  4109. (*%T NearCall *)
  4110. ret 2
  4111. (*%E *)
  4112. (*%E *)
  4113. (*%T RegParam *)
  4114. (*%T _DLLOVL *)
  4115. push bp
  4116. mov bp, sp
  4117. (*%E *)
  4118. push bx
  4119. push ax
  4120. mov bx, sp
  4121. fldcw ss:[bx]
  4122. pop ax
  4123. pop bx
  4124. (*%T _DLLOVL *)
  4125. pop bp
  4126. (*%E *)
  4127. (*%F NearCall *)
  4128. ret far 0
  4129. (*%E *)
  4130. (*%T NearCall *)
  4131. ret 0
  4132. (*%E *)
  4133. (*%E *)
  4134. (***************************************************************************)
  4135. section
  4136. (* ------------------------------------------------------------------------
  4137. PROCEDURE - MATHLIB.StoreControlWord.
  4138. PRECONDITIONS - None.
  4139. POSTCONDITIONS - None.
  4140. IN PARAMETERS - dest (VAR BITSET).
  4141. OUT PARAMETERS - returns value of 087 control word (BITSET).
  4142. CALLING CONVENTION - Standard.
  4143. NOTES - None.
  4144. VERSION - _OS2 and MSDOS.
  4145. ------------------------------------------------------------------------ *)
  4146. (*%T SameDS *)
  4147. segment _TEXT(CODE,28H)
  4148. (*%E *)
  4149. (*%F SameDS *)
  4150. segment MATHLIB_TEXT(CODE,28H)
  4151. (*%E *)
  4152. public MATHLIB$StoreControlWord :
  4153. (*%T _DLLOVL *)
  4154. push bp
  4155. mov bp, sp
  4156. (*%E *)
  4157. push ax
  4158. mov bx, sp
  4159. fstcw ss:[bx]
  4160. fwait
  4161. pop ax
  4162. (*%T _DLLOVL *)
  4163. pop bp
  4164. (*%E *)
  4165. (*%F NearCall *)
  4166. ret far 0
  4167. (*%E *)
  4168. (*%T NearCall *)
  4169. ret 0
  4170. (*%E *)
  4171. (***************************************************************************)
  4172. section
  4173. (* ------------------------------------------------------------------------
  4174. PROCEDURE - MATHLIB.StoreEnvironment.
  4175. PRECONDITIONS - None.
  4176. POSTCONDITIONS - 087 state stored in buffer record.
  4177. IN PARAMETERS - buffer (VAR Environment).
  4178. OUT PARAMETERS - None.
  4179. CALLING CONVENTION - Standard.
  4180. NOTES - None.
  4181. VERSION - _OS2 and MSDOS.
  4182. ------------------------------------------------------------------------ *)
  4183. (*%T SameDS *)
  4184. segment _TEXT(CODE,28H)
  4185. (*%E *)
  4186. (*%F SameDS *)
  4187. segment MATHLIB_TEXT(CODE,28H)
  4188. (*%E *)
  4189. public MATHLIB$StoreEnvironment :
  4190. _res = frame
  4191. (*%T RegParam *)
  4192. retSize = 0
  4193. (*%E *)
  4194. (*%F RegParam *)
  4195. (*%F NearPtr *)
  4196. retSize = 4
  4197. (*%E *)
  4198. (*%T NearPtr *)
  4199. retSize = 2
  4200. (*%E *)
  4201. (*%E *)
  4202. (*%T RegParam *)
  4203. (*%T _DLLOVL *)
  4204. push bp
  4205. mov bp, sp
  4206. (*%E *)
  4207. (*%F NearPtr *)
  4208. mov dx, ds
  4209. mov ds, bx
  4210. (*%E *)
  4211. mov bx, ax
  4212. fstenv [bx]
  4213. fwait
  4214. (*%F NearPtr *)
  4215. mov ds, dx
  4216. (*%E *)
  4217. (*%T _DLLOVL *)
  4218. pop bp
  4219. (*%E *)
  4220. (*%E *)
  4221. (*%F RegParam *)
  4222. push bp
  4223. mov bp, sp
  4224. (*%F NearPtr *)
  4225. mov dx, ds
  4226. lds bx, [bp][_res]
  4227. (*%E *)
  4228. (*%T NearPtr *)
  4229. mov bx, [bp][_res]
  4230. (*%E *)
  4231. fstenv [bx]
  4232. fwait
  4233. (*%F NearPtr *)
  4234. mov ds, dx
  4235. (*%E *)
  4236. pop bp
  4237. (*%E *)
  4238. (*%F NearCall *)
  4239. ret far retSize
  4240. (*%E *)
  4241. (*%T NearCall *)
  4242. ret retSize
  4243. (*%E *)
  4244. (*****************************************************************************)
  4245. section
  4246. (* ------------------------------------------------------------------------
  4247. PROCEDURE - Lib.LongJmp.
  4248. PRECONDITIONS - Label initialised by call to SetJmp.
  4249. POSTCONDITIONS - Program execution continues after call to SetJmp.
  4250. IN PARAMETERS - label (VAR LongLabel).
  4251. OUT PARAMETERS - None.
  4252. CALLING CONVENTION - Standard.
  4253. NOTES - None.
  4254. VERSION - _OS2 and MSDOS.
  4255. ------------------------------------------------------------------------ *)
  4256. (*%F _DLL *)
  4257. (*%T SameDS *)
  4258. segment _TEXT(CODE,28H)
  4259. (*%E *)
  4260. (*%F SameDS *)
  4261. segment Lib_TEXT(CODE,28H)
  4262. (*%E *)
  4263. (*%E *)
  4264. (*%T _DLL *)
  4265. segment LibDLL_TEXT(CODE,28H)
  4266. (*%E *)
  4267. extrn _longjmp2
  4268. extrn __setjmp2
  4269. public Lib$LongJmp :
  4270. task_state = 2+frame
  4271. val = frame
  4272. push bp
  4273. mov bp, sp
  4274. (*%F RegParam *)
  4275. mov ax, [bp][val]
  4276. mov cx, [bp][task_state]
  4277. (*%F NearPtr *)
  4278. mov dx, [bp][task_state][2]
  4279. mov [bp][frame][0], cx
  4280. mov [bp][frame][2], dx
  4281. mov [bp][frame][4], ax
  4282. (*%E *)
  4283. (*%T NearPtr *)
  4284. mov [bp][frame][0], cx
  4285. mov [bp][frame][2], ax
  4286. (*%E *)
  4287. (*%E *)
  4288. jmp far _longjmp2
  4289. (* ------------------------------------------------------------------------
  4290. PROCEDURE - Lib.SetJmp.
  4291. PRECONDITIONS - None.
  4292. POSTCONDITIONS - label initialized for subsequent non-local goto.
  4293. IN PARAMETERS - label (VAR LongLabel).
  4294. OUT PARAMETERS - code (CARDINAL).
  4295. CALLING CONVENTION - Standard.
  4296. NOTES - None.
  4297. VERSION - _OS2 and MSDOS.
  4298. ------------------------------------------------------------------------ *)
  4299. public Lib$SetJmp :
  4300. push bp
  4301. mov bp, sp
  4302. jmp far __setjmp2
  4303. (*****************************************************************************)
  4304. (*%F _OS2 *) (* MSDOS Specific Procedures *)
  4305. (*****************************************************************************)
  4306. section
  4307. (* ------------------------------------------------------------------------
  4308. PROCEDURE - Lib.InternalDelay.
  4309. PRECONDITIONS - None.
  4310. POSTCONDITIONS - None.
  4311. IN PARAMETERS - microseconds delay (CARDINAL).
  4312. OUT PARAMETERS - None.
  4313. CALLING CONVENTION - Standard.
  4314. NOTES - Suspend execution of process. Internal library function called
  4315. by Lib.Delay.
  4316. VERSION - MSDOS.
  4317. ------------------------------------------------------------------------ *)
  4318. (*%F _DLL *)
  4319. (*%T SameDS *)
  4320. segment _TEXT(CODE,28H)
  4321. (*%E *)
  4322. (*%F SameDS *)
  4323. segment Lib_TEXT(CODE,28H)
  4324. (*%E *)
  4325. (*%E *)
  4326. (*%T _DLL *)
  4327. segment LibDLL_TEXT(CODE,28H)
  4328. (*%E *)
  4329. extrn _delay
  4330. msecs = frame
  4331. public Lib$InternalDelay :
  4332. (*%F RegParam *)
  4333. push bp
  4334. mov bp, sp
  4335. push [bp][msecs]
  4336. (*%F NearCall *)
  4337. call far _delay
  4338. (*%E *)
  4339. (*%T NearCall *)
  4340. call _delay
  4341. (*%E *)
  4342. add sp, 2
  4343. pop bp
  4344. (*%F NearCall *)
  4345. ret far 2
  4346. (*%E *)
  4347. (*%T NearCall *)
  4348. ret 2
  4349. (*%E *)
  4350. (*%E *)
  4351. (*%T RegParam *)
  4352. (*%T _DLLOVL *)
  4353. push bp
  4354. mov bp, sp
  4355. (*%E *)
  4356. (*%F NearCall *)
  4357. call far _delay
  4358. (*%E *)
  4359. (*%T NearCall *)
  4360. call _delay
  4361. (*%E *)
  4362. (*%T _DLLOVL *)
  4363. pop bp
  4364. (*%E *)
  4365. (*%F NearCall *)
  4366. ret far 0
  4367. (*%E *)
  4368. (*%T NearCall *)
  4369. ret 0
  4370. (*%E *)
  4371. (*%E *)
  4372. (*****************************************************************************)
  4373. section
  4374. (* ------------------------------------------------------------------------
  4375. PROCEDURE - Lib.InternalEnableBreakCheck.
  4376. PRECONDITIONS - None.
  4377. POSTCONDITIONS - Ctl C/Break checking enabled.
  4378. IN PARAMETERS - None.
  4379. OUT PARAMETERS - None.
  4380. CALLING CONVENTION - Standard.
  4381. NOTES - Internal procedure, calls procedure in CoreSig.
  4382. VERSION - MSDOS.
  4383. ------------------------------------------------------------------------ *)
  4384. (*%F _DLL *)
  4385. (*%T SameDS *)
  4386. segment _TEXT(CODE,28H)
  4387. (*%E *)
  4388. (*%F SameDS *)
  4389. segment Lib_TEXT(CODE,28H)
  4390. (*%E *)
  4391. (*%E *)
  4392. (*%T _DLL *)
  4393. segment LibDLL_TEXT(CODE,28H)
  4394. (*%E *)
  4395. extrn @SetBreakInterrupt
  4396. public Lib$InternalEnableBreakCheck :
  4397. (*%T _DLLOVL *)
  4398. push bp
  4399. mov bp, sp
  4400. (*%E *)
  4401. call far @SetBreakInterrupt
  4402. (*%T _DLLOVL *)
  4403. pop bp
  4404. (*%E *)
  4405. (*%F NearCall *)
  4406. ret far 0
  4407. (*%E *)
  4408. (*%T NearCall *)
  4409. ret 0
  4410. (*%E *)
  4411. (*****************************************************************************)
  4412. section
  4413. (* ------------------------------------------------------------------------
  4414. PROCEDURE - Lib.InternalDisableBreakCheck.
  4415. PRECONDITIONS - None.
  4416. POSTCONDITIONS - Ctl C/Break checking disabled.
  4417. IN PARAMETERS - None.
  4418. OUT PARAMETERS - None.
  4419. CALLING CONVENTION - Standard.
  4420. NOTES - Internal procedure, calls procedure in CoreSig.
  4421. VERSION - MSDOS.
  4422. ------------------------------------------------------------------------ *)
  4423. (*%F SameDS *)
  4424. segment SIG_TEXT(CODE,28H)
  4425. (*%E *)
  4426. (*%T SameDS *)
  4427. segment _TEXT(CODE,28H)
  4428. (*%E *)
  4429. extrn @ResetBreakInterrupt
  4430. public Lib$InternalDisableBreakCheck :
  4431. (*%T _DLLOVL *)
  4432. push bp
  4433. mov bp, sp
  4434. (*%E *)
  4435. push ax
  4436. push ds
  4437. call far @ResetBreakInterrupt
  4438. sub ax,ax
  4439. mov ds,ax
  4440. pushf
  4441. cli
  4442. mov word ds:[23H*4], DummyBreak
  4443. mov word ds:[23H*4][2],cs
  4444. popf
  4445. pop ds
  4446. pop ax
  4447. (*%T _DLLOVL *)
  4448. pop bp
  4449. (*%E *)
  4450. (*%F NearCall *)
  4451. ret far 0
  4452. (*%E *)
  4453. (*%T NearCall *)
  4454. ret 0
  4455. (*%E *)
  4456. DummyBreak :
  4457. iret
  4458. section
  4459. (*****************************************************************************)
  4460. (* ------------------------------------------------------------------------
  4461. PROCEDURE - Lib.DosExec.
  4462. PRECONDITIONS - Memory space allocated.
  4463. POSTCONDITIONS - Process executed.
  4464. IN PARAMETERS - Name (ARRAY OF CHAR), param block (FarADDRESS).
  4465. OUT PARAMETERS - None.
  4466. CALLING CONVENTION - Far Call, Reg params off.
  4467. NOTES - Called by Lib.Execute.
  4468. VERSION - MSDOS.
  4469. ------------------------------------------------------------------------ *)
  4470. (*%F _DLL *)
  4471. (*%T SameDS *)
  4472. segment _TEXT(CODE,28H)
  4473. (*%E *)
  4474. (*%F SameDS *)
  4475. segment Lib_TEXT(CODE,28H)
  4476. (*%E *)
  4477. (*%E *)
  4478. (*%T _DLL *)
  4479. segment LibDLL_TEXT(CODE,28H)
  4480. (*%E *)
  4481. SaveSS : dw 0
  4482. SaveSP : dw 0
  4483. public Lib$DosExec :
  4484. (*%F NearPtr *)
  4485. NameLen=14; NameSeg=12; NameOfs=10; ParamSeg=8; ParamOfs=6
  4486. RetSize = 10
  4487. (*%E *)
  4488. (*%T NearPtr *)
  4489. NameLen=12; NameOfs=10; ParamSeg=8; ParamOfs=6
  4490. RetSize = 8
  4491. (*%E *)
  4492. push bp; mov bp,sp
  4493. push ds; push es; push si; push di
  4494. pushf
  4495. mov ax,4B00H
  4496. (*%F NearPtr *)
  4497. mov ds,[bp][NameSeg]
  4498. (*%E *)
  4499. mov dx,[bp][NameOfs]
  4500. mov es,[bp][ParamSeg]
  4501. mov bx,[bp][ParamOfs]
  4502. push bp
  4503. push ss:[2EH] (* where DOS doth tread *)
  4504. push ss:[30H]
  4505. push cs:[SaveSS] (* to restore code seg *)
  4506. push cs:[SaveSP]
  4507. mov cs:[SaveSS],ss
  4508. mov cs:[SaveSP],sp
  4509. int 21H
  4510. mov ss,cs:[SaveSS]
  4511. mov sp,cs:[SaveSP]
  4512. pop cs:[SaveSP]
  4513. pop cs:[SaveSS]
  4514. pop ss:[30H]
  4515. pop ss:[2EH]
  4516. pop bp
  4517. jc ExitExec
  4518. sub ax,ax
  4519. ExitExec:
  4520. popf
  4521. pop di; pop si; pop es; pop ds
  4522. pop bp; ret far RetSize
  4523. (*****************************************************************************)
  4524. (*%F _WINDOWS *)
  4525. (* ------------------------------------------------------------------------
  4526. PROCEDURE - Lib.CpuId.
  4527. PRECONDITIONS - None.
  4528. POSTCONDITIONS - None.
  4529. IN PARAMETERS - Record (VAR CpuRec).
  4530. OUT PARAMETERS - None.
  4531. CALLING CONVENTION - Standard.
  4532. NOTES - Determines types processor and co-processor.
  4533. VERSION - MSDOS (Not windows).
  4534. ------------------------------------------------------------------------ *)
  4535. section
  4536. segment _DATA(DATA,28H)
  4537. (*%F _DLL *)
  4538. (*%T SameDS *)
  4539. segment _TEXT(CODE,28H)
  4540. (*%E *)
  4541. (*%F SameDS *)
  4542. segment Lib_TEXT(CODE,28H)
  4543. (*%E *)
  4544. (*%E *)
  4545. (*%T _DLL *)
  4546. segment LibDLL_TEXT(CODE,28H)
  4547. (*%E *)
  4548. ndp_cw: dw 0
  4549. ndp_stat: dw 0
  4550. temp87: dw 0
  4551. CpuXlat: db 1,2,0,0,0,0,0,7,3,4,5,6,0,0,0,7,8
  4552. public Lib$CpuId:
  4553. (*%F RegParam *)
  4554. cpurec = frame
  4555. ndp_save = -100
  4556. locals = 100
  4557. (*%F NearPtr *)
  4558. RetSize = 4
  4559. (*%E *)
  4560. (*%T NearPtr *)
  4561. RetSize = 2
  4562. (*%E *)
  4563. (*%E *)
  4564. (*%T RegParam *)
  4565. cpurec = -4
  4566. ndp_save = -104
  4567. locals = 104
  4568. RetSize = 0
  4569. (*%E *)
  4570. push bp
  4571. mov bp,sp
  4572. sub sp, locals
  4573. (*%T RegParam *)
  4574. mov [bp][cpurec], ax
  4575. (*%F NearPtr *)
  4576. mov [bp][cpurec][2], bx
  4577. (*%E *)
  4578. (*%T NearPtr *)
  4579. push bx
  4580. (*%E *)
  4581. push cx
  4582. push dx
  4583. (*%E *)
  4584. push ds
  4585. push es
  4586. push si
  4587. push di
  4588. push cs
  4589. pop ds
  4590. foption 0
  4591. fsave [bp][ndp_save]
  4592. fwait
  4593. xor dx,dx
  4594. sub si,si
  4595. mov es,si
  4596. mov cx,0FFFFH
  4597. sti
  4598. db 0F3H (* rep *)
  4599. db 026H (* es: *)
  4600. lodsb
  4601. jcxz a1
  4602. or dh,08H (* if CPU is Intel *)
  4603. a1:
  4604. push sp
  4605. pop ax
  4606. cmp ax,sp
  4607. jne a2
  4608. or dh,04H (* if cpu is 8028x *)
  4609. a2:
  4610. mov cl,21H
  4611. mov al,0FFH
  4612. shl al,cl
  4613. jz a3
  4614. or dh,02H (* if cpu is 8018x or 8028x *)
  4615. a3:
  4616. mov ch,0
  4617. cli
  4618. db 0EBH,00H (* jmp $+2 : empty queue *)
  4619. mov byte [a4],0
  4620. db 0B1H (* MOV CL,... *)
  4621. a4: db 1 (* ...1 *)
  4622. sti
  4623. jcxz a5
  4624. or dh,01H (* if PIQ length=6 (80x86) *)
  4625. a5:
  4626. mov byte [a4],1 (* reset for next time *)
  4627. cmp dh,7
  4628. jne Not386
  4629. pushf
  4630. pop ax
  4631. or ah,0F0H
  4632. push ax
  4633. popf
  4634. pushf
  4635. pop ax
  4636. and ah,0F0H
  4637. jz Not386
  4638. or dh,10H
  4639. Not386:
  4640. foption 2
  4641. mov word ds:[temp87], -1
  4642. finit
  4643. call wait
  4644. fstsw ds:[temp87]
  4645. call wait
  4646. mov al,0
  4647. cmp byte ds:[temp87],al
  4648. jne a6
  4649. fstcw ds:[ndp_cw]
  4650. call wait
  4651. and byte [ndp_cw],7FH
  4652. fldcw ds:[ndp_cw]
  4653. call wait
  4654. db 09BH,0DBH,0E1H (* fdisi *)
  4655. call wait
  4656. fstcw ds:[ndp_cw] (* Test for 87/287 *)
  4657. call wait
  4658. (* Test for 387 *)
  4659. fld1 st(0)
  4660. fldz st(0)
  4661. fdivp st(1),st(0)
  4662. fld st(0),st(0)
  4663. fchs st(0)
  4664. fcompp st(0),st(1)
  4665. fstsw [ndp_stat]
  4666. call wait
  4667. mov ax,[ndp_stat]
  4668. pushf
  4669. sahf
  4670. je is_87_287
  4671. popf
  4672. mov al,3 (* 387 *)
  4673. jmp a6
  4674. is_87_287:
  4675. popf
  4676. cmp word ds:[ndp_cw],3FFH (* was test byte 80H *)
  4677. mov al,1 (* 87 *)
  4678. jz a6
  4679. mov al,2 (* 287 *)
  4680. a6:
  4681. foption 0
  4682. frstor [bp][ndp_save]
  4683. call wait
  4684. mov bl,dh
  4685. sub bh,bh
  4686. cmp bl,15
  4687. jbe a7
  4688. mov bl,16
  4689. a7:
  4690. mov ah,al
  4691. mov al,cs:[CpuXlat][bx]
  4692. (*%F NearPtr *)
  4693. les di,[bp][cpurec]
  4694. (*%E *)
  4695. (*%T NearPtr *)
  4696. mov di,[bp][cpurec]
  4697. mov bx, ss
  4698. mov es, bx
  4699. (*%E *)
  4700. stosw
  4701. pop di
  4702. pop si
  4703. pop es
  4704. pop ds
  4705. (*%T RegParam *)
  4706. pop dx
  4707. pop cx
  4708. (*%T NearPtr *)
  4709. pop bx
  4710. (*%E *)
  4711. (*%E *)
  4712. mov sp,bp
  4713. pop bp
  4714. (*%F NearCall *)
  4715. ret far RetSize
  4716. (*%E *)
  4717. (*%T NearCall *)
  4718. ret RetSize
  4719. (*%E *)
  4720. wait: mov cx,400H
  4721. wloop: loop wloop
  4722. ret 0
  4723. (*%E *)
  4724. (*%E *) (* End Of DOS (not extender) *)
  4725. (*%T _XTDDOS *) (* DOS and extender routines, but not OS2 *)
  4726. (*****************************************************************************)
  4727. section
  4728. (* ------------------------------------------------------------------------
  4729. PROCEDURE - Lib.UserBreak.
  4730. PRECONDITIONS - None.
  4731. POSTCONDITIONS - Process terminated.
  4732. IN PARAMETERS - None.
  4733. OUT PARAMETERS - None.
  4734. CALLING CONVENTION - Standard.
  4735. NOTES - Calls procedure in CoreSig.
  4736. VERSION - MSDOS and extender.
  4737. ------------------------------------------------------------------------ *)
  4738. (*%F _DLL *)
  4739. (*%T SameDS *)
  4740. segment _TEXT(CODE,28H)
  4741. (*%E *)
  4742. (*%F SameDS *)
  4743. segment Lib_TEXT(CODE,28H)
  4744. (*%E *)
  4745. (*%E *)
  4746. (*%T _DLL *)
  4747. segment LibDLL_TEXT(CODE,28H)
  4748. (*%E *)
  4749. extrn @UserBreak
  4750. public Lib$UserBreak :
  4751. (*%T _DLLOVL *)
  4752. push bp
  4753. mov bp, sp
  4754. (*%E *)
  4755. call far @UserBreak
  4756. (*%T _DLLOVL *)
  4757. pop bp
  4758. (*%E *)
  4759. (*****************************************************************************)
  4760. section
  4761. (* ------------------------------------------------------------------------
  4762. PROCEDURE - Lib.Sound.
  4763. PRECONDITIONS - None.
  4764. POSTCONDITIONS - Noise.
  4765. IN PARAMETERS - Frequency (CARDINAL).
  4766. OUT PARAMETERS - None.
  4767. CALLING CONVENTION - Standard.
  4768. NOTES - None.
  4769. VERSION - MSDOS and extender.
  4770. ------------------------------------------------------------------------ *)
  4771. (*%F _DLL *)
  4772. (*%T SameDS *)
  4773. segment _TEXT(CODE,28H)
  4774. (*%E *)
  4775. (*%F SameDS *)
  4776. segment Lib_TEXT(CODE,28H)
  4777. (*%E *)
  4778. (*%E *)
  4779. (*%T _DLL *)
  4780. segment LibDLL_TEXT(CODE,28H)
  4781. (*%E *)
  4782. FreqHz = frame
  4783. (*%F RegParam *)
  4784. RetSize =2
  4785. (*%E *)
  4786. (*%T RegParam *)
  4787. RetSize =0
  4788. (*%E *)
  4789. public Lib$Sound :
  4790. (*%F RegParam *)
  4791. push bp
  4792. mov bp,sp
  4793. mov bx,[bp][FreqHz]
  4794. (*%E *)
  4795. (*%T RegParam *)
  4796. (*%T _DLLOVL *)
  4797. push bp
  4798. mov bp, sp
  4799. (*%E *)
  4800. push bx
  4801. push dx
  4802. mov bx, ax
  4803. (*%E *)
  4804. mov ax,34DDH (* 1.193181 MHz *)
  4805. mov dx,0012H
  4806. cmp dx,bx
  4807. jnb SOU9
  4808. div bx
  4809. mov bx,ax
  4810. in al,PPIport+1
  4811. test al,03H
  4812. jnz SOU1
  4813. or al,03H
  4814. out PPIport+1,al
  4815. (* 10 11 011 0 *)
  4816. mov al,0B6H (* Select timer 2, LSB,MSB, mode 3, bin *)
  4817. out Timer+3,al
  4818. SOU1:
  4819. mov al,bl
  4820. out Timer+2,al
  4821. mov al,bh
  4822. out Timer+2,al
  4823. SOU9:
  4824. (*%T RegParam *)
  4825. pop dx
  4826. pop bx
  4827. (*%T _DLLOVL *)
  4828. pop bp
  4829. (*%E *)
  4830. (*%E *)
  4831. (*%F RegParam *)
  4832. pop bp
  4833. (*%E *)
  4834. (*%F NearCall *)
  4835. ret far RetSize
  4836. (*%E *)
  4837. (*%T NearCall *)
  4838. ret RetSize
  4839. (*%E *)
  4840. (*****************************************************************************)
  4841. section
  4842. (* ------------------------------------------------------------------------
  4843. PROCEDURE - Lib.NoSound.
  4844. PRECONDITIONS - None.
  4845. POSTCONDITIONS - Silence.
  4846. IN PARAMETERS - None.
  4847. OUT PARAMETERS - None.
  4848. CALLING CONVENTION - Standard.
  4849. NOTES - None.
  4850. VERSION - MSDOS and extender.
  4851. ------------------------------------------------------------------------ *)
  4852. (*%F _DLL *)
  4853. (*%T SameDS *)
  4854. segment _TEXT(CODE,28H)
  4855. (*%E *)
  4856. (*%F SameDS *)
  4857. segment Lib_TEXT(CODE,28H)
  4858. (*%E *)
  4859. (*%E *)
  4860. (*%T _DLL *)
  4861. segment LibDLL_TEXT(CODE,28H)
  4862. (*%E *)
  4863. public Lib$NoSound :
  4864. (*%T _DLLOVL *)
  4865. push bp
  4866. mov bp, sp
  4867. (*%E *)
  4868. push ax
  4869. in al,PPIport+1
  4870. and al,0FCH
  4871. out PPIport+1,al
  4872. pop ax
  4873. (*%T _DLLOVL *)
  4874. pop bp
  4875. (*%E *)
  4876. (*%F NearCall *)
  4877. ret far 0
  4878. (*%E *)
  4879. (*%T NearCall *)
  4880. ret 0
  4881. (*%E *)
  4882. section
  4883. (*****************************************************************************)
  4884. (* ------------------------------------------------------------------------
  4885. PROCEDURE - @LoadRegisters.
  4886. PRECONDITIONS - Called by Intr, Dos.
  4887. POSTCONDITIONS - Registers loaded prior to software interrupt.
  4888. IN PARAMETERS - DS:SI points to register record.
  4889. OUT PARAMETERS - None.
  4890. CALLING CONVENTION - Near Call.
  4891. NOTES - None.
  4892. VERSION - MSDOS and extender.
  4893. ------------------------------------------------------------------------ *)
  4894. (*%T SameDS *)
  4895. segment _TEXT(CODE,28H)
  4896. (*%E *)
  4897. (*%F SameDS *)
  4898. segment SIG_TEXT(CODE,28H)
  4899. (*%E *)
  4900. axr=0; bxr=2; cxr=4; dxr=6; bpr=8;
  4901. sir=10; dir=12; dsr=14; esr=16; flags=18
  4902. _XTDWIN = _XTD | _WINDOWS
  4903. public @LoadRegisters :
  4904. (* loads register in register pack pointed to by DS:SI *)
  4905. (*%T _WINDOWS*)
  4906. (* validate segment registers *)
  4907. push sp
  4908. pop ax
  4909. cmp ax, sp
  4910. jne $$RealMode
  4911. db 00FH, 001H, 0E0H (*I smsw ax *)
  4912. test al, 1
  4913. jz $$RealMode
  4914. (*%E *)
  4915. (*%T _XTDWIN *)
  4916. (* check for invalid selectors *)
  4917. mov dx, [si][dsr]
  4918. db 00FH, 000H, 0E2H (*I verr dx *)
  4919. jz $$DSOk
  4920. sub dx, dx
  4921. $$DSOk:
  4922. push dx
  4923. mov dx, [si][esr]
  4924. db 00FH, 000H, 0E2H (*I verr dx *)
  4925. jz $$ESOk
  4926. sub dx, dx
  4927. $$ESOk:
  4928. mov es, dx
  4929. (*%E _XTDWIN*)
  4930. (*%T _WINDOWS *)
  4931. jmp $$RegsValidated
  4932. $$RealMode:
  4933. (*%E _WINDOWS*)
  4934. (*%F _XTD*)
  4935. mov es, [si][esr]
  4936. push [si][dsr]
  4937. (*%E _XTD*)
  4938. $$RegsValidated:
  4939. mov ax, [si][axr]
  4940. mov bx, [si][bxr]
  4941. mov cx, [si][cxr]
  4942. mov dx, [si][dxr]
  4943. mov di, [si][dir]
  4944. mov bp, [si][bpr]
  4945. mov si, [si][sir]
  4946. pop ds
  4947. ret near 0
  4948. (* ------------------------------------------------------------------------
  4949. PROCEDURE - @SaveRegisters.
  4950. PRECONDITIONS - Called by Intr, Dos.
  4951. POSTCONDITIONS - Registers loaded prior after software interrupt.
  4952. IN PARAMETERS - far pointer on stack points to register record.
  4953. OUT PARAMETERS - None.
  4954. CALLING CONVENTION - Near Call.
  4955. NOTES - None.
  4956. VERSION - MSDOS and extender.
  4957. ------------------------------------------------------------------------ *)
  4958. public @SaveRegisters :
  4959. (* saves register in register pack pointed to by pointer on stack *)
  4960. push ds
  4961. push si
  4962. mov si, sp
  4963. lds si, ss:[si][6]
  4964. pushf
  4965. pop [si][flags]
  4966. pop [si][sir]
  4967. pop [si][dsr]
  4968. mov [si][axr],ax
  4969. mov [si][bxr],bx
  4970. mov [si][cxr],cx
  4971. mov [si][dxr],dx
  4972. mov [si][dir],di
  4973. mov [si][bpr],bp
  4974. mov [si][esr],es
  4975. ret near 4
  4976. section
  4977. (*****************************************************************************)
  4978. (* ------------------------------------------------------------------------
  4979. PROCEDURE - Lib.Dos.
  4980. PRECONDITIONS - Regsiters record initialized.
  4981. POSTCONDITIONS - Interrupt 21H issued.
  4982. IN PARAMETERS - register record (VAR Registers).
  4983. OUT PARAMETERS - None.
  4984. CALLING CONVENTION - Standard.
  4985. NOTES - None.
  4986. VERSION - MSDOS and extender.
  4987. ------------------------------------------------------------------------ *)
  4988. (*%T SameDS *)
  4989. segment _TEXT(CODE,28H)
  4990. (*%E *)
  4991. (*%F SameDS *)
  4992. segment SIG_TEXT(CODE,28H)
  4993. (*%E *)
  4994. extrn @LoadRegisters
  4995. extrn @SaveRegisters
  4996. extrn @InProgramFlag
  4997. extrn @StopProgramFlag
  4998. extrn __FatalErrorPos
  4999. extrn __FatalError
  5000. (*%F RegParam *)
  5001. p_seg = 2+frame
  5002. p_off = frame
  5003. (*%F NearPtr *)
  5004. RetSize = 4
  5005. (*%E *)
  5006. (*%T NearPtr *)
  5007. RetSize = 2
  5008. (*%E *)
  5009. (*%E *)
  5010. (*%T RegParam *)
  5011. p_seg = -2
  5012. p_off = -4
  5013. locals = 4
  5014. RetSize = 0
  5015. (*%E *)
  5016. public Lib$Dos :
  5017. push bp
  5018. mov bp, sp
  5019. (*%T RegParam *)
  5020. sub sp, locals
  5021. (*%T NearPtr *)
  5022. push bx
  5023. (*%E *)
  5024. push cx
  5025. push dx
  5026. mov [bp][p_off], ax
  5027. (*%F NearPtr *)
  5028. mov [bp][p_seg], bx
  5029. (*%E *)
  5030. (*%E *)
  5031. push ds
  5032. push si
  5033. push di
  5034. pushf
  5035. (*%F _XTD *)
  5036. (*%F _WINDOWS *)
  5037. (*%F _DLL *)
  5038. cmp byte cs:[@InProgramFlag], 1
  5039. (*%E *)
  5040. (*%T _DLL *)
  5041. mov dx, seg @InProgramFlag
  5042. mov es, dx
  5043. cmp byte es:[@InProgramFlag], 1
  5044. (*%E *)
  5045. je ok
  5046. cld
  5047. call far __FatalErrorPos
  5048. mov cx, 13H
  5049. push cx
  5050. push dx
  5051. push ax
  5052. call far __FatalError
  5053. ok:
  5054. (*%F _DLL *)
  5055. cmp byte cs:[@StopProgramFlag], 1
  5056. je Stop (* wait for timer to stop us *)
  5057. mov byte cs:[@InProgramFlag], 0
  5058. (*%E *)
  5059. (*%T _DLL *)
  5060. cmp byte es:[@StopProgramFlag], 1
  5061. je Stop (* wait for timer to stop us *)
  5062. mov byte es:[@InProgramFlag], 0
  5063. (*%E *)
  5064. (*%E _WINDOWS*)
  5065. (*%E _XTD*)
  5066. (*%F NearPtr *)
  5067. lds si,[bp][p_off]
  5068. (*%E *)
  5069. (*%T NearPtr *)
  5070. mov si,[bp][p_off]
  5071. push ds
  5072. pop es
  5073. (*%E *)
  5074. push ds (* save register pointer *)
  5075. push si
  5076. call @LoadRegisters
  5077. int 21H
  5078. call @SaveRegisters
  5079. (*%F _XTD *)
  5080. (*%F _WINDOWS *)
  5081. (*%F _DLL *)
  5082. mov byte cs:[@InProgramFlag], 1
  5083. (*%E *)
  5084. (*%T _DLL *)
  5085. mov dx, seg @InProgramFlag
  5086. mov es, dx
  5087. mov byte es:[@InProgramFlag], 1
  5088. (*%E *)
  5089. (*%E _WINDOWS *)
  5090. (*%E _XTD *)
  5091. popf
  5092. pop di
  5093. pop si
  5094. pop ds
  5095. (*%T RegParam *)
  5096. pop dx
  5097. pop cx
  5098. (*%T NearPtr *)
  5099. pop bx
  5100. (*%E *)
  5101. add sp, locals
  5102. (*%E *)
  5103. pop bp
  5104. (*%F NearCall *)
  5105. ret far RetSize
  5106. (*%E *)
  5107. (*%T NearCall *)
  5108. ret RetSize
  5109. (*%E *)
  5110. Stop:
  5111. sti
  5112. jmp Stop
  5113. section
  5114. (*****************************************************************************)
  5115. (* ------------------------------------------------------------------------
  5116. PROCEDURE - Lib.Intr.
  5117. PRECONDITIONS - Regsiters record initialized.
  5118. POSTCONDITIONS - Specified Interrupt issued.
  5119. IN PARAMETERS - register record (VAR Registers), interupt no (CARDINAL).
  5120. OUT PARAMETERS - None.
  5121. CALLING CONVENTION - Standard.
  5122. NOTES - None.
  5123. VERSION - MSDOS and Windows and extender.
  5124. ------------------------------------------------------------------------ *)
  5125. (*%T SameDS *)
  5126. segment _TEXT(CODE,28H)
  5127. (*%E *)
  5128. (*%F SameDS *)
  5129. segment SIG_TEXT(CODE,28H)
  5130. (*%E *)
  5131. extrn @LoadRegisters
  5132. extrn $SWInt
  5133. extrn @SaveRegisters
  5134. (*%F _jpicall *)
  5135. p_num = frame
  5136. p_off = 2+frame
  5137. RetSize = 2 + DataPtrSize
  5138. (*%E *)
  5139. (*%T _jpicall *)
  5140. RetSize = 0
  5141. (*%E *)
  5142. public Lib$Intr :
  5143. push bp
  5144. (*%F _jpicall *)
  5145. mov bp, sp
  5146. (*%E *)
  5147. (*%T _jpicall *)
  5148. (*%F _fptr *)
  5149. push cx
  5150. (*%E *)
  5151. push dx
  5152. (*%E *)
  5153. push ds
  5154. push si
  5155. push di
  5156. pushf
  5157. (*%T _jpicall *)
  5158. (*%T _fptr *)
  5159. mov ds, bx
  5160. (*%E *)
  5161. mov si, ax
  5162. (*%E *)
  5163. (*%F _jpicall *)
  5164. (*%T _fptr *)
  5165. lds si, [bp][p_off]
  5166. (*%E *)
  5167. (*%F _fptr *)
  5168. mov si, [bp][p_off]
  5169. (*%E *)
  5170. (*%E *)
  5171. push ds (* save register pointer *)
  5172. push si
  5173. (*%T _jpicall *)
  5174. (*%T _fptr *)
  5175. push cx (* Push Interrupt Number *)
  5176. (*%E *)
  5177. (*%F _fptr *)
  5178. push bx (* Push Interrupt Number *)
  5179. (*%E *)
  5180. (*%E *)
  5181. (*%F _jpicall *)
  5182. push [bp][p_num] (* Push Interrupt Number *)
  5183. (*%E *)
  5184. call @LoadRegisters
  5185. (*%T _fcall *)
  5186. call far $SWInt
  5187. (*%E *)
  5188. (*%F _fcall *)
  5189. call $SWInt
  5190. (*%E *)
  5191. call @SaveRegisters
  5192. popf
  5193. pop di
  5194. pop si
  5195. pop ds
  5196. (*%T _jpicall *)
  5197. pop dx
  5198. (*%F _fptr *)
  5199. pop cx
  5200. (*%E *)
  5201. (*%E *)
  5202. pop bp
  5203. (*%T _fcall *)
  5204. ret far RetSize
  5205. (*%E *)
  5206. (*%F _fcall *)
  5207. ret RetSize
  5208. (*%E *)
  5209. (*****************************************************************************)
  5210. section
  5211. (* ------------------------------------------------------------------------
  5212. PROCEDURE - Lib.SetInProgramFlag.
  5213. PRECONDITIONS - None.
  5214. POSTCONDITIONS - @InProgramFlag set.
  5215. IN PARAMETERS - None.
  5216. OUT PARAMETERS - None.
  5217. CALLING CONVENTION - Standard.
  5218. NOTES - Allows entry to MSDOS.
  5219. VERSION - MSDOS and extender.
  5220. ------------------------------------------------------------------------ *)
  5221. (*%T SameDS *)
  5222. segment _TEXT(CODE,28H)
  5223. (*%E *)
  5224. (*%F SameDS *)
  5225. segment SIG_TEXT(CODE,28H)
  5226. (*%E *)
  5227. extrn @InProgramFlag
  5228. (*%F RegParam *)
  5229. on = frame
  5230. RetSize = 2
  5231. (*%E *)
  5232. (*%T RegParam *)
  5233. RetSize = 0
  5234. (*%E *)
  5235. public Lib$SetInProgramFlag :
  5236. (*%F RegParam *)
  5237. push bp
  5238. mov bp,sp
  5239. mov al, [bp][on]
  5240. (*%E *)
  5241. (*%T RegParam *)
  5242. (*%T _DLLOVL *)
  5243. push bp
  5244. mov bp, sp
  5245. (*%E *)
  5246. (*%E *)
  5247. (*%F _DLL *)
  5248. mov cs:[@InProgramFlag], al
  5249. (*%E *)
  5250. (*%T _DLL *)
  5251. push bx
  5252. mov bx, seg @InProgramFlag
  5253. mov es, bx
  5254. mov es:[@InProgramFlag], al
  5255. pop bx
  5256. (*%E *)
  5257. (*%F RegParam *)
  5258. pop bp
  5259. (*%E *)
  5260. (*%T RegParam *)
  5261. (*%T _DLLOVL *)
  5262. pop bp
  5263. (*%E *)
  5264. (*%E *)
  5265. (*%F NearCall *)
  5266. ret far RetSize
  5267. (*%E *)
  5268. (*%T NearCall *)
  5269. ret RetSize
  5270. (*%E *)
  5271. (* ------------------------------------------------------------------------
  5272. PROCEDURE - Lib.GetInProgramFlag.
  5273. PRECONDITIONS - None.
  5274. POSTCONDITIONS - None.
  5275. IN PARAMETERS - None.
  5276. OUT PARAMETERS - State of @InProgramFlag (BOOLEAN).
  5277. CALLING CONVENTION - Standard.
  5278. NOTES - None.
  5279. VERSION - MSDOS and extender.
  5280. ------------------------------------------------------------------------ *)
  5281. public Lib$GetInProgramFlag :
  5282. (*%T _DLLOVL *)
  5283. push bp
  5284. mov bp, sp
  5285. (*%E *)
  5286. sub ah,ah
  5287. (*%F _DLL *)
  5288. mov al,cs:[@InProgramFlag]
  5289. (*%E *)
  5290. (*%T _DLL *)
  5291. push bx
  5292. mov bx, seg @InProgramFlag
  5293. mov es, bx
  5294. mov al, es:[@InProgramFlag]
  5295. pop bx
  5296. (*%E *)
  5297. (*%T _DLLOVL *)
  5298. pop bp
  5299. (*%E *)
  5300. (*%F NearCall *)
  5301. ret far 0
  5302. (*%E *)
  5303. (*%T NearCall *)
  5304. ret 0
  5305. (*%E *)
  5306. (*%E *) (* End Of DOS/extender) *)
  5307. (*%T _OS2 *) (* OS/2 Specific Procedures *)
  5308. (*****************************************************************************)
  5309. section
  5310. (* ------------------------------------------------------------------------
  5311. PROCEDURE - Lib.SelectorLimit.
  5312. PRECONDITIONS - None.
  5313. POSTCONDITIONS - None.
  5314. IN PARAMETERS - Segment (CARDINAL).
  5315. OUT PARAMETERS - Limit (CARDINAL).
  5316. CALLING CONVENTION - Standard.
  5317. NOTES - Returns size of segment.
  5318. VERSION - OS2.
  5319. ------------------------------------------------------------------------ *)
  5320. (*%F _DLL *)
  5321. (*%T SameDS *)
  5322. segment _TEXT(CODE,28H)
  5323. (*%E *)
  5324. (*%F SameDS *)
  5325. segment Lib_TEXT(CODE,28H)
  5326. (*%E *)
  5327. (*%E *)
  5328. (*%T _DLL *)
  5329. segment LibDLL_TEXT(CODE,28H)
  5330. (*%E *)
  5331. extrn __osmode
  5332. (*%F RegParam *)
  5333. public Lib$SelectorLimit : Sel=frame
  5334. push bp; mov bp,sp;
  5335. push ds
  5336. mov ax,seg __osmode
  5337. mov ds,ax
  5338. cmp byte [__osmode],0
  5339. jz slmax
  5340. mov dx,[bp][Sel]
  5341. db 0FH;db 03H;db 0C2H (*I lsl ax,dx *)
  5342. jz slok
  5343. sub ax,ax
  5344. slok:
  5345. pop ds
  5346. pop bp;
  5347. (*%F NearCall *)
  5348. ret far 2
  5349. (*%E *)
  5350. (*%T NearCall *)
  5351. ret 2
  5352. (*%E *)
  5353. slmax:
  5354. mov ax,0FFFFH
  5355. jmp slok
  5356. (*%E *)
  5357. (*%T RegParam *)
  5358. public Lib$SelectorLimit :
  5359. push bx
  5360. push dx
  5361. push ds
  5362. mov bx,seg __osmode
  5363. mov ds,bx
  5364. cmp byte [__osmode],0
  5365. jz slmax
  5366. mov dx,ax
  5367. db 0FH;db 03H;db 0C2H (*I lsl ax,dx *)
  5368. jz slok
  5369. sub ax,ax
  5370. slok:
  5371. pop ds
  5372. pop dx
  5373. pop bx
  5374. (*%F NearCall *)
  5375. ret far 0
  5376. (*%E *)
  5377. (*%T NearCall *)
  5378. ret 0
  5379. (*%E *)
  5380. slmax:
  5381. mov ax,0FFFFH
  5382. jmp slok
  5383. (*%E *)
  5384. (* ------------------------------------------------------------------------
  5385. PROCEDURE - Lib.AddressOK.
  5386. PRECONDITIONS - None.
  5387. POSTCONDITIONS - None.
  5388. IN PARAMETERS - address (ADDRESS).
  5389. OUT PARAMETERS - State (BOOLEAN).
  5390. CALLING CONVENTION - Standard.
  5391. NOTES - Returns validity of segment.
  5392. VERSION - OS2.
  5393. ------------------------------------------------------------------------ *)
  5394. (*%F RegParam *)
  5395. public Lib$AddressOK: Ofs=6; Sel=8
  5396. push bp; mov bp,sp;
  5397. push ds
  5398. mov dx,[bp][Sel]
  5399. mov ax,seg __osmode
  5400. mov ds,ax
  5401. cmp byte [__osmode],0
  5402. jz aook
  5403. db 0FH;db 03H;db 0C2H (*I lsl ax,dx *)
  5404. jnz aofail
  5405. cmp ax,[bp][Ofs]
  5406. jb aofail
  5407. aook:
  5408. mov ax,1
  5409. jmp aoexit
  5410. aofail:
  5411. sub ax,ax
  5412. aoexit:
  5413. pop ds
  5414. pop bp;
  5415. (*%F NearCall *)
  5416. ret far 4
  5417. (*%E *)
  5418. (*%T NearCall *)
  5419. ret 4
  5420. (*%E *)
  5421. (*%E *)
  5422. (*%T RegParam *)
  5423. public Lib$AddressOK :
  5424. push cx
  5425. push dx
  5426. push ds
  5427. mov dx, bx
  5428. mov cx, ax
  5429. mov ax,seg __osmode
  5430. mov ds,ax
  5431. cmp byte [__osmode],0
  5432. jz aook
  5433. db 0FH;db 03H;db 0C2H (*I lsl ax,dx *)
  5434. jnz aofail
  5435. cmp ax, cx
  5436. jb aofail
  5437. aook:
  5438. mov ax,1
  5439. jmp aoexit
  5440. aofail:
  5441. sub ax,ax
  5442. aoexit:
  5443. pop ds
  5444. pop dx
  5445. pop cx
  5446. (*%F NearCall *)
  5447. ret far 4
  5448. (*%E *)
  5449. (*%T NearCall *)
  5450. ret 4
  5451. (*%E *)
  5452. (*%E *)
  5453. (*****************************************************************************)
  5454. section
  5455. (* ------------------------------------------------------------------------
  5456. PROCEDURE - Lib.ProtectedMode.
  5457. PRECONDITIONS - None.
  5458. POSTCONDITIONS - None.
  5459. IN PARAMETERS - address (ADDRESS).
  5460. OUT PARAMETERS - Proctected mode (BOOLEAN).
  5461. CALLING CONVENTION - Standard.
  5462. NOTES - Returns True if process running under protected mode.
  5463. VERSION - OS2.
  5464. ------------------------------------------------------------------------ *)
  5465. (*%F _DLL *)
  5466. (*%T SameDS *)
  5467. segment _TEXT(CODE,28H)
  5468. (*%E *)
  5469. (*%F SameDS *)
  5470. segment Lib_TEXT(CODE,28H)
  5471. (*%E *)
  5472. (*%E *)
  5473. (*%T _DLL *)
  5474. segment LibDLL_TEXT(CODE,28H)
  5475. (*%E *)
  5476. extrn __osmode
  5477. public Lib$ProtectedMode :
  5478. push ds
  5479. mov ax,seg __osmode
  5480. mov ds,ax
  5481. mov al,[__osmode]
  5482. mov ah,0
  5483. pop ds
  5484. (*%F NearCall *)
  5485. ret far 0
  5486. (*%E *)
  5487. (*%T NearCall *)
  5488. ret 0
  5489. (*%E *)
  5490. (*%E *)
  5491. (*%F ProtMode *) (* Procedures for real mode *)
  5492. (**************************************************************************)
  5493. section
  5494. (* ------------------------------------------------------------------------
  5495. PROCEDURE - $NormPtr.
  5496. PRECONDITIONS - None.
  5497. POSTCONDITIONS - Far pointer normalised.
  5498. IN PARAMETERS - pointer (FarADDRESS) dx:ax.
  5499. OUT PARAMETERS - pointer return (FarADDRESS).
  5500. CALLING CONVENTION - NearCall.
  5501. NOTES - None.
  5502. VERSION - MSDOS real mode.
  5503. ------------------------------------------------------------------------ *)
  5504. (*%F _DLL *)
  5505. (*%T SameDS *)
  5506. segment _TEXT(CODE,28H)
  5507. (*%E *)
  5508. (*%F SameDS *)
  5509. segment Lib_TEXT(CODE,28H)
  5510. (*%E *)
  5511. (*%E *)
  5512. (*%T _DLL *)
  5513. segment LibDLL_TEXT(CODE,28H)
  5514. (*%E *)
  5515. public @NormPtr :
  5516. mov cx,ax
  5517. and ax,000FH
  5518. shr cx,1
  5519. shr cx,1
  5520. shr cx,1
  5521. shr cx,1
  5522. add dx,cx
  5523. ret 0
  5524. (**************************************************************************)
  5525. section
  5526. (* ------------------------------------------------------------------------
  5527. PROCEDURE - Lib.AddFarAddr.
  5528. PRECONDITIONS - None.
  5529. POSTCONDITIONS - None.
  5530. IN PARAMETERS - pointer (FarADDRESS).
  5531. OUT PARAMETERS - pointer return (FarADDRESS).
  5532. CALLING CONVENTION - Standard.
  5533. NOTES - None.
  5534. VERSION - MSDOS real mode.
  5535. ------------------------------------------------------------------------ *)
  5536. (*%F _DLL *)
  5537. (*%T SameDS *)
  5538. segment _TEXT(CODE,28H)
  5539. (*%E *)
  5540. (*%F SameDS *)
  5541. segment Lib_TEXT(CODE,28H)
  5542. (*%E *)
  5543. (*%E *)
  5544. (*%T _DLL *)
  5545. segment LibDLL_TEXT(CODE,28H)
  5546. (*%E *)
  5547. extrn @NormPtr
  5548. public Lib$AddFarAddr :
  5549. (*%F RegParam *)
  5550. a_H = 4+frame
  5551. a_L = 2+frame
  5552. c_val = frame
  5553. push bp; mov bp,sp
  5554. mov ax,[bp][a_L]
  5555. mov dx,[bp][a_H]
  5556. add ax,[bp][c_val]
  5557. jnc $NoOverflow
  5558. add dx,1000H
  5559. $NoOverflow:
  5560. call near @NormPtr
  5561. pop bp;
  5562. (*%F NearCall *)
  5563. ret far 6
  5564. (*%E *)
  5565. (*%T NearCall *)
  5566. ret 6
  5567. (*%E *)
  5568. (*%E *)
  5569. (*%T RegParam *)
  5570. (*%T _DLLOVL *)
  5571. push bp
  5572. mov bp, sp
  5573. (*%E *)
  5574. mov dx,bx
  5575. add ax,cx
  5576. jnc $NoOverflow
  5577. add dx,1000H
  5578. $NoOverflow:
  5579. call @NormPtr
  5580. (*%T _DLLOVL *)
  5581. pop bp
  5582. (*%E *)
  5583. (*%F NearCall *)
  5584. ret far 0
  5585. (*%E *)
  5586. (*%T NearCall *)
  5587. ret 0
  5588. (*%E *)
  5589. (*%E *)
  5590. (**************************************************************************)
  5591. section
  5592. (* ------------------------------------------------------------------------
  5593. PROCEDURE - Lib.SubFarAddr.
  5594. PRECONDITIONS - None.
  5595. POSTCONDITIONS - None.
  5596. IN PARAMETERS - pointer (FarADDRESS).
  5597. OUT PARAMETERS - pointer return (FarADDRESS).
  5598. CALLING CONVENTION - Standard.
  5599. NOTES - None.
  5600. VERSION - MSDOS real mode.
  5601. ------------------------------------------------------------------------ *)
  5602. (*%F _DLL *)
  5603. (*%T SameDS *)
  5604. segment _TEXT(CODE,28H)
  5605. (*%E *)
  5606. (*%F SameDS *)
  5607. segment Lib_TEXT(CODE,28H)
  5608. (*%E *)
  5609. (*%E *)
  5610. (*%T _DLL *)
  5611. segment LibDLL_TEXT(CODE,28H)
  5612. (*%E *)
  5613. extrn @NormPtr
  5614. public Lib$SubFarAddr :
  5615. (*%F RegParam *)
  5616. a_H = 4+frame
  5617. a_L = 2+frame
  5618. c_val = frame
  5619. push bp; mov bp,sp
  5620. mov ax,[bp][a_L]
  5621. mov dx,[bp][a_H]
  5622. sub ax,[bp][c_val]
  5623. jnc $NoOverflow
  5624. sub dx,1000H
  5625. $NoOverflow:
  5626. call near @NormPtr
  5627. pop bp;
  5628. (*%F NearCall *)
  5629. ret far 6
  5630. (*%E *)
  5631. (*%T NearCall *)
  5632. ret 6
  5633. (*%E *)
  5634. (*%E *)
  5635. (*%T RegParam *)
  5636. (*%T _DLLOVL *)
  5637. push bp
  5638. mov bp, sp
  5639. (*%E *)
  5640. mov dx,bx
  5641. sub ax,cx
  5642. jnc $NoOverflow
  5643. sub dx,1000H
  5644. $NoOverflow:
  5645. call @NormPtr
  5646. (*%T _DLLOVL *)
  5647. pop bp
  5648. (*%E *)
  5649. (*%F NearCall *)
  5650. ret far 0
  5651. (*%E *)
  5652. (*%T NearCall *)
  5653. ret 0
  5654. (*%E *)
  5655. (*%E *)
  5656. (**************************************************************************)
  5657. section
  5658. (* ------------------------------------------------------------------------
  5659. PROCEDURE - Lib.IncFarAddr.
  5660. PRECONDITIONS - None.
  5661. POSTCONDITIONS - None.
  5662. IN PARAMETERS - pointer (VAR FarADDRESS).
  5663. OUT PARAMETERS - None.
  5664. CALLING CONVENTION - Standard.
  5665. NOTES - None.
  5666. VERSION - MSDOS real mode.
  5667. ------------------------------------------------------------------------ *)
  5668. (*%F _DLL *)
  5669. (*%T SameDS *)
  5670. segment _TEXT(CODE,28H)
  5671. (*%E *)
  5672. (*%F SameDS *)
  5673. segment Lib_TEXT(CODE,28H)
  5674. (*%E *)
  5675. (*%E *)
  5676. (*%T _DLL *)
  5677. segment LibDLL_TEXT(CODE,28H)
  5678. (*%E *)
  5679. extrn @NormPtr
  5680. public Lib$IncFarAddr :
  5681. (*%F RegParam *)
  5682. (*%F NearPtr *)
  5683. a_ptrH = 4+frame
  5684. a_ptrL = 2+frame
  5685. incr = frame
  5686. RetSize = 6
  5687. (*%E *)
  5688. (*%T NearPtr *)
  5689. a_ptrL = 2+frame
  5690. incr = frame
  5691. RetSize = 4
  5692. (*%E *)
  5693. push bp; mov bp,sp
  5694. (*%F NearPtr *)
  5695. push ds
  5696. lds bx,[bp][a_ptrL]
  5697. (*%E *)
  5698. (*%T NearPtr *)
  5699. mov bx,[bp][a_ptrL]
  5700. (*%E *)
  5701. mov ax,[bx]
  5702. mov dx,[bx][2]
  5703. add ax,[bp][incr]
  5704. jnc $NoOverflow
  5705. add dx,1000H
  5706. $NoOverflow:
  5707. call near @NormPtr
  5708. mov [bx],ax
  5709. mov [bx][2],dx
  5710. (*%F NearPtr *)
  5711. pop ds
  5712. (*%E *)
  5713. pop bp;
  5714. (*%F NearCall *)
  5715. ret far RetSize
  5716. (*%E *)
  5717. (*%T NearCall *)
  5718. ret RetSize
  5719. (*%E *)
  5720. (*%E *)
  5721. (*%T RegParam *)
  5722. (*%T _DLLOVL *)
  5723. push bp
  5724. mov bp, sp
  5725. (*%E *)
  5726. (*%F NearPtr *)
  5727. push dx
  5728. push ds
  5729. mov ds, bx
  5730. mov bx, ax
  5731. (*%E *)
  5732. (*%T NearPtr *)
  5733. push cx
  5734. push dx
  5735. mov cx, bx
  5736. mov bx, ax
  5737. (*%E *)
  5738. mov ax,[bx]
  5739. mov dx,[bx][2]
  5740. add ax,cx
  5741. jnc $NoOverflow
  5742. add dx,1000H
  5743. $NoOverflow:
  5744. call near @NormPtr
  5745. mov [bx],ax
  5746. mov [bx][2],dx
  5747. (*%F NearPtr *)
  5748. pop ds
  5749. pop dx
  5750. (*%E *)
  5751. (*%T NearPtr *)
  5752. pop dx
  5753. pop cx
  5754. (*%E *)
  5755. (*%T _DLLOVL *)
  5756. pop bp
  5757. (*%E *)
  5758. (*%F NearCall *)
  5759. ret far 0
  5760. (*%E *)
  5761. (*%T NearCall *)
  5762. ret 0
  5763. (*%E *)
  5764. (*%E *)
  5765. (**************************************************************************)
  5766. section
  5767. (* ------------------------------------------------------------------------
  5768. PROCEDURE - Lib.DecFarAddr.
  5769. PRECONDITIONS - None.
  5770. POSTCONDITIONS - None.
  5771. IN PARAMETERS - pointer (VAR FarADDRESS).
  5772. OUT PARAMETERS - None.
  5773. CALLING CONVENTION - Standard.
  5774. NOTES - None.
  5775. VERSION - MSDOS real mode.
  5776. ------------------------------------------------------------------------ *)
  5777. (*%F _DLL *)
  5778. (*%T SameDS *)
  5779. segment _TEXT(CODE,28H)
  5780. (*%E *)
  5781. (*%F SameDS *)
  5782. segment Lib_TEXT(CODE,28H)
  5783. (*%E *)
  5784. (*%E *)
  5785. (*%T _DLL *)
  5786. segment LibDLL_TEXT(CODE,28H)
  5787. (*%E *)
  5788. extrn @NormPtr
  5789. public Lib$DecFarAddr :
  5790. (*%F RegParam *)
  5791. (*%F NearPtr *)
  5792. a_ptrH = 4+frame
  5793. a_ptrL = 2+frame
  5794. decr = frame
  5795. (*%E *)
  5796. (*%T NearPtr *)
  5797. a_ptrL = 2+frame
  5798. decr = frame
  5799. (*%E *)
  5800. push bp; mov bp,sp
  5801. (*%F NearPtr *)
  5802. push ds
  5803. lds bx,[bp][a_ptrL]
  5804. (*%E *)
  5805. (*%T NearPtr *)
  5806. mov bx,[bp][a_ptrL]
  5807. (*%E *)
  5808. mov ax,[bx]
  5809. mov dx,[bx][2]
  5810. sub ax,[bp][decr]
  5811. jnc $NoOverflow
  5812. sub dx,1000H
  5813. $NoOverflow:
  5814. call near @NormPtr
  5815. mov [bx],ax
  5816. mov [bx][2],dx
  5817. (*%F NearPtr *)
  5818. pop ds
  5819. (*%E *)
  5820. pop bp
  5821. (*%F NearCall *)
  5822. ret far 6
  5823. (*%E *)
  5824. (*%T NearCall *)
  5825. ret 6
  5826. (*%E *)
  5827. (*%E *)
  5828. (*%T RegParam *)
  5829. (*%T _DLLOVL *)
  5830. push bp
  5831. mov bp, sp
  5832. (*%E *)
  5833. (*%F NearPtr *)
  5834. push dx
  5835. push ds
  5836. mov ds, bx
  5837. mov bx, ax
  5838. (*%E *)
  5839. (*%T NearPtr *)
  5840. push cx
  5841. push dx
  5842. mov cx, bx
  5843. mov bx, ax
  5844. (*%E *)
  5845. mov ax,[bx]
  5846. mov dx,[bx][2]
  5847. sub ax,cx
  5848. jnc $NoOverflow
  5849. sub dx,1000H
  5850. $NoOverflow:
  5851. call near @NormPtr
  5852. mov [bx],ax
  5853. mov [bx][2],dx
  5854. (*%F NearPtr *)
  5855. pop ds
  5856. pop dx
  5857. (*%E *)
  5858. (*%T NearPtr *)
  5859. pop dx
  5860. pop cx
  5861. (*%E *)
  5862. (*%T _DLLOVL *)
  5863. pop bp
  5864. (*%E *)
  5865. (*%F NearCall *)
  5866. ret far 0
  5867. (*%E *)
  5868. (*%T NearCall *)
  5869. ret 0
  5870. (*%E *)
  5871. (*%E *)
  5872. (*%E *)
  5873. (*%T ProtMode *) (* Protected mode procedures *)
  5874. (**************************************************************************)
  5875. section
  5876. (* ------------------------------------------------------------------------
  5877. PROCEDURE - Lib.AddFarAddr.
  5878. PRECONDITIONS - None.
  5879. POSTCONDITIONS - None.
  5880. IN PARAMETERS - pointer (FarADDRESS).
  5881. OUT PARAMETERS - incremented pointer(FarADDRESS).
  5882. CALLING CONVENTION - Standard.
  5883. NOTES - None.
  5884. VERSION - OS2 and Windows.
  5885. ------------------------------------------------------------------------ *)
  5886. (*%F _DLL *)
  5887. (*%T SameDS *)
  5888. segment _TEXT(CODE,28H)
  5889. (*%E *)
  5890. (*%F SameDS *)
  5891. segment Lib_TEXT(CODE,28H)
  5892. (*%E *)
  5893. (*%E *)
  5894. (*%T _DLL *)
  5895. segment LibDLL_TEXT(CODE,28H)
  5896. (*%E *)
  5897. public Lib$AddFarAddr :
  5898. (*%F RegParam *)
  5899. a_H = 4+frame
  5900. a_L = 2+frame
  5901. c_val = frame
  5902. push bp; mov bp,sp
  5903. mov ax,[bp][a_L]
  5904. mov dx,[bp][a_H]
  5905. add ax,[bp][c_val]
  5906. pop bp;
  5907. (*%F NearCall *)
  5908. ret far 6
  5909. (*%E *)
  5910. (*%T NearCall *)
  5911. ret 6
  5912. (*%E *)
  5913. (*%E *)
  5914. (*%T RegParam *)
  5915. mov dx,bx
  5916. add ax,cx
  5917. (*%F NearCall *)
  5918. ret far 0
  5919. (*%E *)
  5920. (*%T NearCall *)
  5921. ret 0
  5922. (*%E *)
  5923. (*%E *)
  5924. (**************************************************************************)
  5925. section
  5926. (* ------------------------------------------------------------------------
  5927. PROCEDURE - Lib.SubFarAddr.
  5928. PRECONDITIONS - None.
  5929. POSTCONDITIONS - None.
  5930. IN PARAMETERS - pointer (FarADDRESS).
  5931. OUT PARAMETERS - decremented pointer(FarADDRESS).
  5932. CALLING CONVENTION - Standard.
  5933. NOTES - None.
  5934. VERSION - OS2 and Windows.
  5935. ------------------------------------------------------------------------ *)
  5936. (*%F _DLL *)
  5937. (*%T SameDS *)
  5938. segment _TEXT(CODE,28H)
  5939. (*%E *)
  5940. (*%F SameDS *)
  5941. segment Lib_TEXT(CODE,28H)
  5942. (*%E *)
  5943. (*%E *)
  5944. (*%T _DLL *)
  5945. segment LibDLL_TEXT(CODE,28H)
  5946. (*%E *)
  5947. public Lib$SubFarAddr :
  5948. (*%F RegParam *)
  5949. a_H = 4+frame
  5950. a_L = 2+frame
  5951. c_val = frame
  5952. push bp; mov bp,sp
  5953. mov ax,[bp][a_L]
  5954. mov dx,[bp][a_H]
  5955. sub ax,[bp][c_val]
  5956. pop bp;
  5957. (*%F NearCall *)
  5958. ret far 6
  5959. (*%E *)
  5960. (*%T NearCall *)
  5961. ret 6
  5962. (*%E *)
  5963. (*%E *)
  5964. (*%T RegParam *)
  5965. mov dx,bx
  5966. sub ax,cx
  5967. (*%F NearCall *)
  5968. ret far 0
  5969. (*%E *)
  5970. (*%T NearCall *)
  5971. ret 0
  5972. (*%E *)
  5973. (*%E *)
  5974. (**************************************************************************)
  5975. section
  5976. (* ------------------------------------------------------------------------
  5977. PROCEDURE - Lib.IncFarAddr.
  5978. PRECONDITIONS - None.
  5979. POSTCONDITIONS - None.
  5980. IN PARAMETERS - pointer (VAR FarADDRESS).
  5981. OUT PARAMETERS - None.
  5982. CALLING CONVENTION - Standard.
  5983. NOTES - None.
  5984. VERSION - OS2 and Windows.
  5985. ------------------------------------------------------------------------ *)
  5986. (*%F _DLL *)
  5987. (*%T SameDS *)
  5988. segment _TEXT(CODE,28H)
  5989. (*%E *)
  5990. (*%F SameDS *)
  5991. segment Lib_TEXT(CODE,28H)
  5992. (*%E *)
  5993. (*%E *)
  5994. (*%T _DLL *)
  5995. segment LibDLL_TEXT(CODE,28H)
  5996. (*%E *)
  5997. public Lib$IncFarAddr :
  5998. (*%F RegParam *)
  5999. (*%F NearPtr *)
  6000. a_ptrH = 4+frame
  6001. a_ptrL = 2+frame
  6002. incr = frame
  6003. RetSize = 6
  6004. (*%E *)
  6005. (*%T NearPtr *)
  6006. a_ptrL = 2+frame
  6007. incr = frame
  6008. RetSize = 4
  6009. (*%E *)
  6010. push bp; mov bp,sp
  6011. (*%F NearPtr *)
  6012. push ds
  6013. lds bx,[bp][a_ptrL]
  6014. (*%E *)
  6015. (*%T NearPtr *)
  6016. mov bx,[bp][a_ptrL]
  6017. (*%E *)
  6018. mov ax,[bx]
  6019. mov dx,[bx][2]
  6020. add ax,[bp][incr]
  6021. mov [bx],ax
  6022. mov [bx][2],dx
  6023. (*%F NearPtr *)
  6024. pop ds
  6025. (*%E *)
  6026. pop bp;
  6027. (*%F NearCall *)
  6028. ret far RetSize
  6029. (*%E *)
  6030. (*%T NearCall *)
  6031. ret RetSize
  6032. (*%E *)
  6033. (*%E *)
  6034. (*%T RegParam *)
  6035. (*%F NearPtr *)
  6036. push dx
  6037. push ds
  6038. mov ds, bx
  6039. mov bx, ax
  6040. (*%E *)
  6041. (*%T NearPtr *)
  6042. push cx
  6043. push dx
  6044. mov cx, bx
  6045. mov bx, ax
  6046. (*%E *)
  6047. mov ax,[bx]
  6048. mov dx,[bx][2]
  6049. add ax,cx
  6050. mov [bx],ax
  6051. mov [bx][2],dx
  6052. (*%F NearPtr *)
  6053. pop ds
  6054. pop dx
  6055. (*%E *)
  6056. (*%T NearPtr *)
  6057. pop dx
  6058. pop cx
  6059. (*%E *)
  6060. (*%F NearCall *)
  6061. ret far 0
  6062. (*%E *)
  6063. (*%T NearCall *)
  6064. ret 0
  6065. (*%E *)
  6066. (*%E *)
  6067. (**************************************************************************)
  6068. section
  6069. (* ------------------------------------------------------------------------
  6070. PROCEDURE - Lib.DecFarAddr.
  6071. PRECONDITIONS - None.
  6072. POSTCONDITIONS - None.
  6073. IN PARAMETERS - pointer (VAR FarADDRESS).
  6074. OUT PARAMETERS - None.
  6075. CALLING CONVENTION - Standard.
  6076. NOTES - None.
  6077. VERSION - OS2 and Windows.
  6078. ------------------------------------------------------------------------ *)
  6079. (*%F _DLL *)
  6080. (*%T SameDS *)
  6081. segment _TEXT(CODE,28H)
  6082. (*%E *)
  6083. (*%F SameDS *)
  6084. segment Lib_TEXT(CODE,28H)
  6085. (*%E *)
  6086. (*%E *)
  6087. (*%T _DLL *)
  6088. segment LibDLL_TEXT(CODE,28H)
  6089. (*%E *)
  6090. public Lib$DecFarAddr :
  6091. (*%F RegParam *)
  6092. (*%F NearPtr *)
  6093. a_ptrH = 4+frame
  6094. a_ptrL = 2+frame
  6095. decr = frame
  6096. (*%E *)
  6097. (*%T NearPtr *)
  6098. a_ptrL = 2+frame
  6099. decr = frame
  6100. (*%E *)
  6101. push bp; mov bp,sp
  6102. (*%F NearPtr *)
  6103. push ds
  6104. lds bx,[bp][a_ptrL]
  6105. (*%E *)
  6106. (*%T NearPtr *)
  6107. mov bx,[bp][a_ptrL]
  6108. (*%E *)
  6109. mov ax,[bx]
  6110. mov dx,[bx][2]
  6111. sub ax,[bp][decr]
  6112. mov [bx],ax
  6113. mov [bx][2],dx
  6114. (*%F NearPtr *)
  6115. pop ds
  6116. (*%E *)
  6117. pop bp
  6118. (*%F NearCall *)
  6119. ret far 6
  6120. (*%E *)
  6121. (*%T NearCall *)
  6122. ret 6
  6123. (*%E *)
  6124. (*%E *)
  6125. (*%T RegParam *)
  6126. (*%F NearPtr *)
  6127. push ds
  6128. mov ds, bx
  6129. mov bx, ax
  6130. (*%E *)
  6131. (*%T NearPtr *)
  6132. push cx
  6133. mov cx, bx
  6134. mov bx, ax
  6135. (*%E *)
  6136. mov ax,[bx]
  6137. mov dx,[bx][2]
  6138. sub ax,cx
  6139. mov [bx],ax
  6140. mov [bx][2],dx
  6141. (*%F NearPtr *)
  6142. pop ds
  6143. (*%E *)
  6144. (*%T NearPtr *)
  6145. pop cx
  6146. (*%E *)
  6147. (*%F NearCall *)
  6148. ret far 0
  6149. (*%E *)
  6150. (*%T NearCall *)
  6151. ret 0
  6152. (*%E *)
  6153. (*%E *)
  6154. (*%E ProtMode*)
  6155. (*%T SameDS *)
  6156. segment _TEXT(CODE,28H)
  6157. (* PROCEDURE FastMove(Source,Dest:ADDRESS;Count:CARDINAL); *)
  6158. (* Source:2 | Dest:2 | Count:2 *)
  6159. (*%T NearPtr *)
  6160. public Lib$FastMove :
  6161. (*%E *)
  6162. public Lib$NearFastMove :
  6163. (*%T RegParam *)
  6164. Return = 0
  6165. (*%E *)
  6166. (*%F RegParam *)
  6167. Count = frame
  6168. Dest = frame + 2
  6169. Source = frame + 4
  6170. Return = 6
  6171. (*%E *)
  6172. (*%T RegParam *)
  6173. jcxz @FastMoveExit
  6174. (*%E *)
  6175. (*%F RegParam *)
  6176. push bp
  6177. mov bp, sp
  6178. push ax
  6179. push bx
  6180. push cx
  6181. (*%E *)
  6182. push si
  6183. push di
  6184. (*%T RegParam *)
  6185. mov si, ax
  6186. mov di, bx
  6187. (*%E *)
  6188. (*%F RegParam *)
  6189. mov si, [bp][Source]
  6190. mov di, [bp][Dest]
  6191. mov cx, [bp][Count]
  6192. jcxz @FastMoveDone
  6193. (*%E *)
  6194. mov ax, ds
  6195. mov es, ax
  6196. test bl, 1
  6197. jz @FastMoveEven
  6198. movsb
  6199. dec cx
  6200. @FastMoveEven:
  6201. shr cx, 1
  6202. rep; movsw
  6203. adc cx, cx
  6204. rep; movsb
  6205. @FastMoveDone:
  6206. pop di
  6207. pop si
  6208. (*%F RegParam*)
  6209. pop cx
  6210. pop bx
  6211. pop ax
  6212. pop bp
  6213. (*%E *)
  6214. @FastMoveExit:
  6215. (*%T NearCall *)
  6216. ret 0
  6217. (*%E *)
  6218. (*%F NearCall *)
  6219. ret far 0
  6220. (*%E *)
  6221. (*%E SameDS *)
  6222. section
  6223. (*%T SameDS *)
  6224. segment _TEXT(CODE,28H)
  6225. (*%E *)
  6226. (*%F SameDS *)
  6227. (*%F _DLL *)
  6228. segment Lib_TEXT(CODE,28H)
  6229. (*%E *)
  6230. (*%T _DLL *)
  6231. segment LibDLL_TEXT(CODE,28H)
  6232. (*%E *)
  6233. (*%E *)
  6234. (* PROCEDURE FastMove(Source,Dest:ADDRESS;Count:CARDINAL); *)
  6235. (* Source:4 | Dest:4 | Count:2 *)
  6236. (*%F NearPtr *)
  6237. public Lib$FastMove :
  6238. (*%E *)
  6239. public Lib$FarFastMove :
  6240. Count = frame
  6241. (*%T RegParam *)
  6242. Return = 2
  6243. (*%E *)
  6244. (*%F RegParam *)
  6245. Dest = frame + 2
  6246. Source = frame + 6
  6247. Return = 10
  6248. (*%E *)
  6249. push bp
  6250. mov bp, sp
  6251. push ds
  6252. (*%F RegParam *)
  6253. push ax
  6254. push bx
  6255. push cx
  6256. (*%E *)
  6257. push si
  6258. push di
  6259. (*%T RegParam *)
  6260. mov si, ax
  6261. mov ds, bx
  6262. mov di, cx
  6263. mov es, dx
  6264. (*%E *)
  6265. (*%F RegParam *)
  6266. lds si, [bp][Source]
  6267. les di, [bp][Dest]
  6268. (*%E *)
  6269. mov cx, [bp][Count]
  6270. jcxz @FastMoveExit
  6271. test di, 1
  6272. jz @FastMoveEven
  6273. movsb
  6274. dec cx
  6275. @FastMoveEven:
  6276. shr cx, 1
  6277. rep; movsw
  6278. adc cx, cx
  6279. rep; movsb
  6280. @FastMoveExit:
  6281. pop di
  6282. pop si
  6283. (*%F RegParam *)
  6284. pop cx
  6285. pop bx
  6286. pop ax
  6287. (*%E *)
  6288. pop ds
  6289. pop bp
  6290. (*%T NearCall *)
  6291. ret Return
  6292. (*%E *)
  6293. (*%F NearCall *)
  6294. ret far Return
  6295. (*%E *)
  6296. section
  6297. (*%T SameDS *)
  6298. segment _TEXT(CODE,28H)
  6299. (* PROCEDURE Move(Source,Dest:ADDRESS;Count:CARDINAL); *)
  6300. (* Source:2 | Dest:2 | Count:2 *)
  6301. (*%T NearPtr *)
  6302. public Lib$Move :
  6303. (*%E *)
  6304. public Lib$NearMove :
  6305. (*%T RegParam *)
  6306. Return = 0
  6307. (*%E *)
  6308. (*%F RegParam *)
  6309. Count = frame
  6310. Dest = frame + 2
  6311. Source = frame + 4
  6312. Return = 6
  6313. (*%E *)
  6314. (*%T RegParam *)
  6315. jcxz @MoveExit
  6316. (*%E *)
  6317. (*%F RegParam *)
  6318. push bp
  6319. mov bp, sp
  6320. push ax
  6321. push bx
  6322. push cx
  6323. (*%E *)
  6324. push si
  6325. push di
  6326. (*%T RegParam *)
  6327. mov si, ax
  6328. mov di, bx
  6329. (*%E *)
  6330. (*%F RegParam *)
  6331. mov si, [bp][Source]
  6332. mov di, [bp][Dest]
  6333. mov cx, [bp][Count]
  6334. jcxz @MoveDone
  6335. (*%E *)
  6336. mov ax, ds
  6337. mov es, ax
  6338. xor bx, bx
  6339. cmp di, si
  6340. jb @MoveDown
  6341. je @MoveDone
  6342. std
  6343. inc bx
  6344. add si, cx
  6345. dec si
  6346. add di, cx
  6347. dec di
  6348. test di, 1
  6349. jz @MoveEven
  6350. movsb
  6351. dec cx
  6352. jmp @MoveEven
  6353. @MoveDown:
  6354. test di, 1
  6355. jz @MoveEven
  6356. movsb
  6357. dec cx
  6358. @MoveEven:
  6359. sub si, bx
  6360. sub di, bx
  6361. shr cx, 1
  6362. rep; movsw
  6363. jnc @MoveDone
  6364. add si, bx
  6365. add di, bx
  6366. movsb
  6367. @MoveDone:
  6368. cld
  6369. pop di
  6370. pop si
  6371. (*%F RegParam *)
  6372. pop cx
  6373. pop bx
  6374. pop ax
  6375. pop bp
  6376. (*%E *)
  6377. @MoveExit:
  6378. (*%T NearCall *)
  6379. ret Return
  6380. (*%E *)
  6381. (*%F NearCall *)
  6382. ret far Return
  6383. (*%E *)
  6384. (*%E SameDS *)
  6385. section
  6386. (*%T SameDS *)
  6387. segment _TEXT(CODE,28H)
  6388. (*%E *)
  6389. (*%F SameDS *)
  6390. (*%F _DLL *)
  6391. segment Lib_TEXT(CODE,28H)
  6392. (*%E *)
  6393. (*%T _DLL *)
  6394. segment LibDLL_TEXT(CODE,28H)
  6395. (*%E *)
  6396. (*%E *)
  6397. (* PROCEDURE Move(Source,Dest:ADDRESS;Count:CARDINAL); *)
  6398. (* Source:4 | Dest:4 | Count:2 *)
  6399. (*%F NearPtr *)
  6400. public Lib$Move :
  6401. (*%E *)
  6402. public Lib$FarMove :
  6403. Count = frame
  6404. (*%T RegParam *)
  6405. Return = 2
  6406. (*%E *)
  6407. (*%F RegParam *)
  6408. Dest = frame + 2
  6409. Source = frame + 6
  6410. Return = 10
  6411. (*%E *)
  6412. push bp
  6413. mov bp, sp
  6414. push ds
  6415. (*%F RegParam *)
  6416. push ax
  6417. push bx
  6418. push cx
  6419. push dx
  6420. (*%E *)
  6421. push si
  6422. push di
  6423. (*%T RegParam *)
  6424. mov si, ax
  6425. mov ds, bx
  6426. mov di, cx
  6427. mov es, dx
  6428. (*%E *)
  6429. (*%F RegParam *)
  6430. lds si, [bp][Source]
  6431. les di, [bp][Dest]
  6432. (*%E *)
  6433. (*%F ProtMode*)
  6434. mov ax, ds (* Normalize Source Pointer *)
  6435. mov dx, 16
  6436. mul dx
  6437. add ax, si
  6438. adc dx, 0
  6439. mov bx, ax (* Save Source Low in bx *)
  6440. mov cx, dx (* Save Source High in cx *)
  6441. mov ax, es (* Normalize Destination Pointer *)
  6442. mov dx, 16
  6443. mul dx
  6444. add ax, di
  6445. adc dx, 0
  6446. cmp dx, cx (* Choose Move Direction *)
  6447. ja @MoveUp
  6448. jb @MoveDown
  6449. cmp ax, bx (* IF same segment, check offsets *)
  6450. jb @MoveDown
  6451. je @MoveExit
  6452. (*%E*)
  6453. (*%T ProtMode*)
  6454. cmp si,di
  6455. ja @MoveDown
  6456. (*%E*)
  6457. @MoveUp:
  6458. mov cx, [bp][Count]
  6459. jcxz @MoveExit
  6460. std
  6461. mov bx, 1
  6462. add si, cx
  6463. dec si
  6464. add di, cx
  6465. dec di
  6466. jmp @MoveStart
  6467. @MoveDown:
  6468. mov cx, [bp][Count]
  6469. jcxz @MoveExit
  6470. xor bx, bx
  6471. @MoveStart:
  6472. test di, 1
  6473. jz @MoveEven
  6474. movsb
  6475. dec cx
  6476. @MoveEven:
  6477. sub si, bx
  6478. sub di, bx
  6479. shr cx, 1
  6480. rep; movsw
  6481. jnc @MoveExit
  6482. add si, bx
  6483. add di, bx
  6484. movsb
  6485. @MoveExit:
  6486. cld
  6487. pop di
  6488. pop si
  6489. (*%F RegParam *)
  6490. pop dx
  6491. pop cx
  6492. pop bx
  6493. pop ax
  6494. (*%E *)
  6495. pop ds
  6496. pop bp
  6497. (*%T NearCall *)
  6498. ret Return
  6499. (*%E *)
  6500. (*%F NearCall *)
  6501. ret far Return
  6502. (*%E *)
  6503. section
  6504. (*%T SameDS *)
  6505. segment _TEXT(CODE,28H)
  6506. (* PROCEDURE WordMove(Source,Dest:ADDRESS;Count:CARDINAL); *)
  6507. (* Source:2 | Dest:2 | Count:2 *)
  6508. (*%T NearPtr *)
  6509. public Lib$WordMove :
  6510. (*%E *)
  6511. public Lib$NearWordMove :
  6512. (*%T RegParam *)
  6513. Return = 0
  6514. (*%E *)
  6515. (*%F RegParam *)
  6516. Count = frame
  6517. Dest = frame + 2
  6518. Source = frame + 4
  6519. Return = 6
  6520. (*%E *)
  6521. (*%T RegParam *)
  6522. jcxz @WordMoveExit
  6523. (*%E *)
  6524. (*%F RegParam *)
  6525. push bp
  6526. mov bp, sp
  6527. push ax
  6528. push bx
  6529. push cx
  6530. (*%E *)
  6531. push si
  6532. push di
  6533. (*%T RegParam *)
  6534. mov si, ax
  6535. mov di, bx
  6536. (*%E *)
  6537. (*%F RegParam *)
  6538. mov si, [bp][Source]
  6539. mov di, [bp][Dest]
  6540. mov cx, [bp][Count]
  6541. jcxz @WordMoveDone
  6542. (*%E *)
  6543. mov ax, ds
  6544. mov es, ax
  6545. cmp di, si
  6546. jb @WordMoveDown
  6547. je @WordMoveDone
  6548. std
  6549. mov bx, cx
  6550. dec bx
  6551. shl bx, 1
  6552. add si, bx
  6553. add di, bx
  6554. @WordMoveDown:
  6555. rep; movsw
  6556. cld
  6557. @WordMoveDone:
  6558. pop di
  6559. pop si
  6560. (*%F RegParam *)
  6561. pop cx
  6562. pop bx
  6563. pop ax
  6564. pop bp
  6565. (*%E *)
  6566. @WordMoveExit:
  6567. (*%T NearCall *)
  6568. ret Return
  6569. (*%E *)
  6570. (*%F NearCall *)
  6571. ret far Return
  6572. (*%E *)
  6573. (*%E SameDS *)
  6574. section
  6575. (*%T SameDS *)
  6576. segment _TEXT(CODE,28H)
  6577. (*%E *)
  6578. (*%F SameDS *)
  6579. (*%F _DLL *)
  6580. segment Lib_TEXT(CODE,28H)
  6581. (*%E *)
  6582. (*%T _DLL *)
  6583. segment LibDLL_TEXT(CODE,28H)
  6584. (*%E *)
  6585. (*%E *)
  6586. (* PROCEDURE WordMove(Source,Dest:ADDRESS;Count:CARDINAL); *)
  6587. (* Source:4 | Dest:4 | Count:2 *)
  6588. (*%F NearPtr *)
  6589. public Lib$WordMove :
  6590. (*%E *)
  6591. public Lib$FarWordMove :
  6592. Count = frame
  6593. (*%T RegParam *)
  6594. Return = 2
  6595. (*%E *)
  6596. (*%F RegParam *)
  6597. Dest = frame + 2
  6598. Source = frame + 6
  6599. Return = 10
  6600. (*%E *)
  6601. push bp
  6602. mov bp, sp
  6603. push ds
  6604. (*%F RegParam *)
  6605. push ax
  6606. push bx
  6607. push cx
  6608. push dx
  6609. (*%E *)
  6610. push si
  6611. push di
  6612. (*%T RegParam *)
  6613. mov si, ax
  6614. mov ds, bx
  6615. mov di, cx
  6616. mov es, dx
  6617. (*%E *)
  6618. (*%F RegParam *)
  6619. lds si, [bp][Source]
  6620. les di, [bp][Dest]
  6621. (*%E *)
  6622. (*%F ProtMode *)
  6623. mov ax, ds (* Normalize Source Pointer *)
  6624. mov dx, 16
  6625. mul dx
  6626. add ax, si
  6627. adc dx, 0
  6628. mov bx, ax (* Save Source Low in bx *)
  6629. mov cx, dx (* Save Source High in cx *)
  6630. mov ax, es (* Normalize Destination Pointer *)
  6631. mov dx, 16
  6632. mul dx
  6633. add ax, di
  6634. adc dx, 0
  6635. cmp dx, cx (* Choose WordMove Direction *)
  6636. ja @WordMoveUp
  6637. jb @WordMoveDown
  6638. cmp ax, bx (* IF same segment, check offsets *)
  6639. jb @WordMoveDown
  6640. je @WordMoveExit
  6641. (*%E*)
  6642. (*%T ProtMode*)
  6643. cmp si,di
  6644. ja @WordMoveDown
  6645. (*%E*)
  6646. @WordMoveUp:
  6647. mov cx, [bp][Count]
  6648. jcxz @WordMoveExit
  6649. std
  6650. mov bx, cx
  6651. dec bx
  6652. shl bx, 1
  6653. add si, bx
  6654. add di, bx
  6655. jmp @WordMoveStart
  6656. @WordMoveDown:
  6657. mov cx, [bp][Count]
  6658. jcxz @WordMoveExit
  6659. @WordMoveStart:
  6660. rep; movsw
  6661. cld
  6662. @WordMoveExit:
  6663. pop di
  6664. pop si
  6665. (*%F RegParam *)
  6666. pop dx
  6667. pop cx
  6668. pop bx
  6669. pop ax
  6670. (*%E *)
  6671. pop ds
  6672. pop bp
  6673. (*%T NearCall *)
  6674. ret Return
  6675. (*%E *)
  6676. (*%F NearCall *)
  6677. ret far Return
  6678. (*%E *)
  6679. end
  6680.