MgLibPAS 1.0 Beta Turbo Pascal Librairie Copyright (c) 1995, by Mark Gauthier. ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ Table Of Contents ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ What is MgLibPAS...........................................1 Help file..................................................1 How to contact the author..................................1 Licensing Information (Shareware version)..................2 How to register............................................2 Next version...............................................2 mgglobal.strptr............................................5 mgglobal.arrayofbyte.......................................5 mgglobal.arrayofchar.......................................5 mgglobal.arrayofshort......................................5 mgglobal.arrayofword.......................................6 mgglobal.arrayofint........................................6 mgglobal.arrayoflong.......................................6 mgglobal.arrayofptr........................................7 mgglobal.getctype..........................................7 mgglobal.putctype..........................................7 mgglobal.cpukind...........................................8 mgglobal.getcpu............................................8 mgglobal.forcecpu..........................................9 mgmem.movemem.............................................10 mgmem.cmpmem..............................................11 mgmem.swapmem.............................................11 mgmem.setmem..............................................12 mgmem.dostotalmem.........................................12 mgmem.dosmaxavail.........................................12 mgmem.memalloc............................................13 mgmem.memfree.............................................13 mgmem.memrealloc..........................................14 mgmem.getmemallocstrategy.................................14 mgmem.setmemallocstrategy.................................15 mgscreen.fastxy...........................................18 mgscreen.fastx............................................18 mgscreen.fasty............................................18 mgscreen.virtualmode......................................19 mgscreen.screenupdateofs..................................19 mgscreen.screenupdatesize.................................19 mgscreen.screenupdatex....................................20 mgscreen.screenupdatey....................................20 mgscreen.scrollallow......................................20 mgscreen.screenpage.......................................21 mgscreen.screenpageofs....................................21 mgscreen.screenheight.....................................21 mgscreen.screenwidth......................................21 mgscreen.screenaddr.......................................22 mgscreen.fastattr.........................................22 mgscreen.fastblink........................................22 mgscreen.fastforeground...................................23 mgscreen.fastbackground...................................23 mgscreen.fastcls..........................................24 mgscreen.fastgetca........................................24 mgscreen.fasthomecrs......................................24 mgscreen.fastgotoxy.......................................25 mgscreen.fastwherexy......................................25 mgscreen.fastwherex.......................................26 mgscreen.fastwherey.......................................26 mgscreen.fastcursordown...................................26 mgscreen.fastcursorup.....................................27 mgscreen.fastcursorleft...................................27 mgscreen.fastcursorright..................................28 mgscreen.fastchxy.........................................28 mgscreen.fastch...........................................29 mgscreen.fastchattr.......................................29 mgscreen.faststrxy........................................30 mgscreen.faststr..........................................30 mgscreen.faststrattr......................................31 mgscreen.fastgetscreen....................................31 mgscreen.fastputscreen....................................32 mgscreen.fastscrollup.....................................32 mgscreen.fastscrolldown...................................33 mgscreen.fastclreol.......................................33 mgscreen.getscreenaddr....................................33 mgscreen.biosch...........................................34 mgscreen.biosstr..........................................34 mgscreen.dosstr...........................................35 mgscreen.getca............................................35 mgscreen.clsbios..........................................36 mgscreen.homecrs..........................................36 mgscreen.setcursorsize....................................36 mgscreen.getcursorsize....................................37 mgscreen.blockcursor......................................37 mgscreen.halfblockcursor..................................38 mgscreen.linecursor.......................................38 mgscreen.cgotoxy..........................................38 mgscreen.cwherexy.........................................39 mgscreen.cwherex..........................................39 mgscreen.cwherey..........................................40 mgscreen.cursoroff........................................40 mgscreen.cursoron.........................................40 mgscreen.cursordown.......................................41 mgscreen.cursorup.........................................41 mgscreen.cursorleft.......................................42 mgscreen.cursorright......................................42 mgscreen.fansich..........................................42 mgscreen.dosch............................................43 mgscreen.ansidetect.......................................43 mgscreen.switchto50.......................................44 mgscreen.switchto43.......................................44 mgscreen.switchto25.......................................44 mgscreen.setactivepage....................................45 mgscreen.screenscroll.....................................45 mgscreen.cclreol..........................................46 mgscreen.fastwriteattr....................................46 mgscreen.fastreadattr.....................................46 mgmath.sqroot.............................................48 mgmath.factor.............................................48 mgmath.longshl............................................48 mgmath.longshr............................................49 mgmath.longdiv............................................49 mgmath.longmul............................................50 mgmath.abslong............................................50 mgmath.absint.............................................50 mgmath.divzero............................................51 mgkeyb.kbhookproc.........................................53 mgkeyb.breakproc..........................................54 mgkeyb.usectrlbreakhook...................................54 mgkeyb.ctrlbreakhook......................................54 mgkeyb.keyhookstatus......................................54 mgkeyb.hookkeyboard.......................................55 mgkeyb.keycodeput.........................................62 mgkeyb.keystringput.......................................62 mgkeyb.iskeybextend.......................................63 mgkeyb.breakactive........................................63 mgkeyb.printscreen........................................64 mgkeyb.isprntscr..........................................64 mgkeyb.isreboot...........................................64 mgkeyb.ispause............................................65 mgkeyb.setscrolllock......................................65 mgkeyb.setnumlock.........................................65 mgkeyb.setins.............................................66 mgkeyb.setcapslock........................................66 mgkeyb.scrolllockdown.....................................66 mgkeyb.numlockdown........................................67 mgkeyb.capslockdown.......................................67 mgkeyb.altkeydown.........................................68 mgkeyb.inskeydown.........................................68 mgkeyb.ctrlkeydown........................................68 mgkeyb.rightshiftdown.....................................69 mgkeyb.leftshiftdown......................................69 mgkeyb.clearscrolllock....................................69 mgkeyb.clearnumlock.......................................70 mgkeyb.clearins...........................................70 mgkeyb.clearcapslock......................................70 mgkeyb.capslockactive.....................................71 mgkeyb.scrollockactive....................................71 mgkeyb.numlockactive......................................72 mgkeyb.insactive..........................................72 mgkeyb.getkey.............................................72 mgkeyb.getlastkey.........................................73 mgkeyb.setkeydelay........................................73 mgkeyb.getekey............................................73 mgkeyb.iskeypressed.......................................74 mgkeyb.keyboardenable.....................................74 mgkeyb.keyboarddisable....................................75 mgkeyb.clearkeybuffer.....................................75 mgkeyb.freshkey...........................................75 mgfilhdl.fsucces..........................................78 mgfilhdl.freadeof.........................................78 mgfilhdl.fnomorememory....................................78 mgfilhdl.ffilenotfound....................................79 mgfilhdl.fpathnotfound....................................79 mgfilhdl.ftoomanyfile.....................................79 mgfilhdl.faccessdenied....................................79 mgfilhdl.finvalidehandle..................................80 mgfilhdl.fnomorefile......................................80 mgfilhdl.fdrivenotready...................................80 mgfilhdl.fdatacrcerror....................................80 mgfilhdl.fseekerror.......................................81 mgfilhdl.funknowmediumtype................................81 mgfilhdl.fsectornotfound..................................81 mgfilhdl.fgeneralfailure..................................81 mgfilhdl.fsharingviolation................................82 mgfilhdl.flockviolation...................................82 mgfilhdl.finvalidediskchange..............................82 mgfilhdl.ffilealreadyopen.................................82 mgfilhdl.foutofresssources................................83 mgfilhdl.ftemporary.......................................83 mgfilhdl.fpermission......................................83 mgfilhdl.finternal........................................83 mgfilhdl.fhardware........................................84 mgfilhdl.fsoftfailure.....................................84 mgfilhdl.fapplicationprgerror.............................84 mgfilhdl.fobjectnotfound..................................84 mgfilhdl.fobjectinvalide..................................85 mgfilhdl.fobjectinterlocked...............................85 mgfilhdl.fmedia...........................................85 mgfilhdl.fcollision.......................................85 mgfilhdl.fother...........................................86 mgfilhdl.fretry...........................................86 mgfilhdl.fpauseretry......................................86 mgfilhdl.fasknewinput.....................................86 mgfilhdl.fabort...........................................87 mgfilhdl.fimediatabort....................................87 mgfilhdl.fignore..........................................87 mgfilhdl.faskuser.........................................88 mgfilhdl.funknow..........................................88 mgfilhdl.fblockdevice.....................................88 mgfilhdl.fnetwork.........................................88 mgfilhdl.fserialdevice....................................89 mgfilhdl.fmemory..........................................89 mgfilhdl.areadonly........................................89 mgfilhdl.ahiden...........................................89 mgfilhdl.asystem..........................................90 mgfilhdl.avolumelabel.....................................90 mgfilhdl.adirectory.......................................90 mgfilhdl.aarchive.........................................90 mgfilhdl.mreadonly........................................91 mgfilhdl.mwriteonly.......................................91 mgfilhdl.mreadwrite.......................................91 mgfilhdl.compatibility....................................91 mgfilhdl.denyall..........................................92 mgfilhdl.denywrite........................................92 mgfilhdl.denyread.........................................92 mgfilhdl.denynone.........................................92 mgfilhdl.notinherit.......................................93 mgfilhdl.tfileptr.........................................93 mgfilhdl.tfile............................................93 mgfilhdl.fcreate..........................................94 mgfilhdl.fcreatenew.......................................94 mgfilhdl.fopen............................................95 mgfilhdl.fclose...........................................95 mgfilhdl.fread............................................96 mgfilhdl.freadbyte........................................96 mgfilhdl.fwrite...........................................97 mgfilhdl.fwritebyte.......................................97 mgfilhdl.fseekend.........................................98 mgfilhdl.fseekstart.......................................98 mgfilhdl.fseek............................................99 mgfilhdl.fseekeof.........................................99 mgfilhdl.fseekpos........................................100 mgfilhdl.ftrunc..........................................100 mgfilhdl.fflush..........................................101 mgfilhdl.flock...........................................101 mgfilhdl.funlock.........................................102 mgfilhdl.fpos............................................102 mgfilhdl.fsize...........................................103 mgfilhdl.feof............................................103 mgfilhdl.fgetattr........................................103 mgfilhdl.fsetattr........................................104 mgfilhdl.fsettime........................................104 mgfilhdl.fsetdate........................................105 mgfilhdl.fgettime........................................105 mgfilhdl.fgetdate........................................106 mgfiles.findfileptr......................................107 mgfiles.tfindfile........................................108 mgfiles.fencrypt.........................................108 mgfiles.fdecrypt.........................................109 mgfiles.fsplit...........................................109 mgfiles.fwild............................................110 mgfiles.fexist...........................................110 mgfiles.frename..........................................111 mgfiles.ferase...........................................111 mgfiles.findfirst........................................111 mgfiles.findnext.........................................112 mgstring.chrtableptr.....................................114 mgstring.chrtable........................................114 mgstring.upch............................................114 mgstring.upcstr..........................................115 mgstring.lwch............................................115 mgstring.lwcstr..........................................115 mgstring.null2pascal.....................................116 mgstring.pascal2null.....................................116 mgstring.txlat...........................................117 mgstring.addstr..........................................117 mgstring.wordcount.......................................118 mgstring.stringof........................................118 mgstring.searchstring....................................118 mgstring.padright........................................119 mgstring.padleft.........................................120 mgstring.padbooth........................................120 mgstring.padpos..........................................121 mgstring.overwrite.......................................121 mgstring.xchgchar........................................122 mgstring.deleteright.....................................122 mgstring.deleteleft......................................123 mgstring.deletech........................................123 mgstring.remove..........................................123 mgstring.precede.........................................124 mgstring.follow..........................................124 mgstring.sortstr.........................................125 mgstring.sortstrdec......................................125 mgmisc.type0040..........................................127 mgmisc.type0050..........................................135 mgmisc.Bios0040..........................................136 mgmisc.Bios0050..........................................136 mgmisc.envseg............................................137 mgmisc.envofs............................................137 mgmisc.envsize...........................................137 mgmisc.getintvec.........................................138 mgmisc.setintvec.........................................138 mgmisc.inportb...........................................138 mgmisc.outportb..........................................139 mgmisc.inportw...........................................139 mgmisc.outportw..........................................140 mgmisc.getprgname........................................140 mgmisc.getprgpath........................................140 mgmisc.getdoserrormsg....................................141 mgmisc.isenvvar..........................................141 mgmisc.changeenvvar......................................142 mgmisc.setturbo..........................................142 mgmisc.farjump...........................................143 mgmisc.dosversion........................................143 mgmisc.donothing.........................................143 mgmisc.donothingint......................................144 mgmisc.delayms...........................................144 mgmisc.coldboot..........................................145 mgmisc.warmboot..........................................145 mgmisc.getpsp............................................145 mgmisc.getdosbreakstatus.................................146 mgmisc.setdosbreakstatus.................................146 mgcrc.updcrc.............................................147 mgcrc.updcrc32...........................................148 mgcrc.reverse32..........................................148 mgdate.countryinfoptr....................................150 mgdate.countryinfo.......................................150 mgdate.dayspermonth......................................152 mgdate.secsperyear.......................................152 mgdate.secsperleapyear...................................152 mgdate.secsperday........................................153 mgdate.secsperhour.......................................153 mgdate.secsperminute.....................................153 mgdate.datetime..........................................153 mgdate.datetype..........................................154 mgdate.gettimezone.......................................154 mgdate.packtounixstr.....................................155 mgdate.unixstrtopack.....................................155 mgdate.normaltounix......................................156 mgdate.unixtonormal......................................156 mgdate.todayinunix.......................................157 mgdate.dayofyear.........................................157 mgdate.DayOfMonth........................................158 mgdate.dayofweek.........................................158 mgdate.thisyear..........................................159 mgdate.thismonth.........................................159 mgdate.thishour..........................................159 mgdate.thisminute........................................160 mgdate.thissecond........................................160 mgdate.wkday.............................................161 mgdate.gregoriantojuliandn...............................161 mgdate.juliandntogregorian...............................162 mgdate.gregoriantojuliandate.............................162 mgdate.juliantogregoriandate.............................163 mgdate.datestring........................................163 mgdate.timestring........................................164 mgdate.yesterday.........................................164 mgdate.tomorrow..........................................164 mgdate.isleapyear........................................165 mgdate.packtime..........................................165 mgdate.unpacktime........................................166 mgdate.gettime...........................................166 mgdate.settime...........................................167 mgdate.getdate...........................................167 mgdate.setdate...........................................168 mgdate.getcountrycode....................................168 mgdate.getcountrycodename................................168 mgdate.getcountryinfo....................................169 mgdate.countrydatestr....................................169 mgdate.countrytimestr....................................170 mgdrive.drv320...........................................172 mgdrive.drv12............................................172 mgdrive.drv720...........................................172 mgdrive.drv8ds...........................................173 mgdrive.drv8d............................................173 mgdrive.drvhd............................................173 mgdrive.drvtape..........................................173 mgdrive.drv144...........................................174 mgdrive.drvrwo...........................................174 mgdrive.drw288...........................................174 mgdrive.drvunknow........................................174 mgdrive.getcurdir........................................175 mgdrive.floppydriveready.................................175 mgdrive.drivetype........................................175 mgdrive.drivesize........................................176 mgdrive.drivefree........................................177 mgdrive.direxist.........................................177 mgdrive.ishdready........................................178 mgdrive.recalibratehd....................................178 mgdrive.detectfloppychange...............................178 mgdrive.parkhead.........................................179 mgdrive.setverifyflag....................................179 mgdrive.getverifyflag....................................180 mgdrive.numfloppies......................................180 mgdrive.setdefaultdrive..................................181 mgdrive.getdefaultdrive..................................181 mgdrive.getnumfixeddisk..................................181 mgdrive.makedirectory....................................182 mgdrive.numinstallcdromunits.............................182 mgdrive.firstcdromdrive..................................183 mgdrive.getstartupdrive..................................183 mgdrive.isnetworkdrive...................................183 mgdrive.shareload........................................184 mgcachef.cfile...........................................185 mgcachef.cfileptr........................................186 mgcachef.copen...........................................186 mgcachef.ccreate.........................................187 mgcachef.cclose..........................................187 mgcachef.ceof............................................188 mgcachef.cpos............................................188 mgcachef.csize...........................................189 mgcachef.cseek...........................................189 mgcachef.cread...........................................189 mgcachef.cwrite..........................................190 mgcachef.cfill...........................................190 mgcachef.cflush..........................................191 mgcom.hookrecvproc.......................................193 mgcom.hookrecvstatus.....................................194 mgcom.hookrecv...........................................194 mgcom.inbuffer...........................................195 mgcom.outbuffer..........................................195 mgcom.inhead.............................................195 mgcom.outhead............................................196 mgcom.intail.............................................196 mgcom.outtail............................................196 mgcom.bufferinsize.......................................197 mgcom.bufferoutsize......................................197 mgcom.rtson..............................................197 mgcom.rtsoff.............................................198 mgcom.portaddr...........................................198 mgcom.startcode..........................................198 mgcom.stopcode...........................................199 mgcom.comstatus..........................................199 mgcom.comctrl............................................199 mgcom.portopen...........................................200 mgcom.portint............................................200 mgcom.oldintvec..........................................200 mgcom.pbauds110..........................................201 mgcom.pbauds150..........................................201 mgcom.pbauds300..........................................201 mgcom.pbauds600..........................................201 mgcom.pbauds1200.........................................202 mgcom.pbauds2400.........................................202 mgcom.pbauds4800.........................................202 mgcom.pbauds9600.........................................202 mgcom.pbauds19200........................................203 mgcom.pbauds38400........................................203 mgcom.pbauds57600........................................203 mgcom.pbauds115200.......................................203 mgcom.pdatalen5..........................................204 mgcom.pdatalen6..........................................204 mgcom.pdatalen7..........................................204 mgcom.pdatalen8..........................................204 mgcom.pstopbitone........................................205 mgcom.pstopbittwo........................................205 mgcom.pparitynone........................................205 mgcom.pparityodd.........................................206 mgcom.pparityeven........................................206 mgcom.portsendbreak......................................206 mgcom.portsetregister....................................207 mgcom.portgetregister....................................207 mgcom.portsetdtr.........................................208 mgcom.portcdstatus.......................................209 mgcom.portsetrtsmode.....................................209 mgcom.portsetctsmode.....................................209 mgcom.portsofthandshake..................................210 mgcom.portpurgeout.......................................210 mgcom.portpurgein........................................211 mgcom.portgetoutleft.....................................211 mgcom.portgetinleft......................................212 mgcom.portflushout.......................................212 mgcom.portsetparams......................................212 mgcom.portopencom........................................213 mgcom.portclosecom.......................................214 mgcom.portread...........................................214 mgcom.portreadw..........................................215 mgcom.portwrite..........................................215 mgcom.portwritew.........................................216 mgcom.portwritestr.......................................216 mgcom.portputchin........................................217 mgcom.portpeek...........................................217 mgcom.portwriteblock.....................................218 mgcom.portrecvblock......................................218 mgdbhash.hsucces.........................................220 mgdbhash.hoverflowerror..................................220 mgdbhash.hmemoryerror....................................220 mgdbhash.hdiskerror......................................221 mgdbhash.hfileerror......................................221 mgdbhash.hasherror.......................................221 mgdbhash.recptr..........................................222 mgdbhash.rectype.........................................222 mgdbhash.hashfileptr.....................................222 mgdbhash.hashrec.........................................223 mgdbhash.hashdelete......................................223 mgdbhash.hashfind........................................224 mgdbhash.hashreadfirst...................................224 mgdbhash.hashreadnext....................................225 mgdbhash.hashclose.......................................225 mgdbhash.hashwrite.......................................226 mgdbhash.hashopen........................................226 mgdbhash.hashcreate......................................227 mgencryp.xorgetc.........................................228 mgencryp.xorputc.........................................229 mgencryp.xorencrypt......................................229 mgencryp.xordecrypt......................................230 mgexesfx.isexesfx........................................231 mgfossil.fmaxcom.........................................234 mgfossil.fmincom.........................................234 mgfossil.bauds300........................................235 mgfossil.bauds600........................................235 mgfossil.bauds1200.......................................235 mgfossil.bauds2400.......................................236 mgfossil.bauds4800.......................................236 mgfossil.bauds9600.......................................236 mgfossil.bauds19200......................................236 mgfossil.bauds38400......................................237 mgfossil.paritynone......................................237 mgfossil.parityodd.......................................237 mgfossil.parityeven......................................237 mgfossil.stopbitone......................................238 mgfossil.stopbittwo......................................238 mgfossil.datalen5........................................238 mgfossil.datalen6........................................238 mgfossil.datalen7........................................239 mgfossil.datalen8........................................239 mgfossil.fosstructptr....................................239 mgfossil.fosstruct.......................................239 mgfossil.mx5structptr....................................240 mgfossil.mx5struct.......................................241 mgfossil.fosinit.........................................241 mgfossil.fosdeinit.......................................242 mgfossil.fossetparams....................................242 mgfossil.fosreadw........................................243 mgfossil.fosread.........................................244 mgfossil.fosgetstatus....................................244 mgfossil.fosflushout.....................................245 mgfossil.fospurgeout.....................................245 mgfossil.fospurgein......................................246 mgfossil.foswriteblk.....................................246 mgfossil.fosreadblk......................................247 mgfossil.foscdstatus.....................................247 mgfossil.fossetdtr.......................................248 mgfossil.fossetflowctrl..................................248 mgfossil.foswritew.......................................249 mgfossil.foswrite........................................250 mgfossil.fospeek.........................................250 mgfossil.fosstartbreak...................................250 mgfossil.fosstopbreak....................................251 mgfossil.fossendbreak....................................251 mgfossil.fosctrlck.......................................252 mgfossil.fosdataavail....................................252 mgfossil.fospeekkey......................................253 mgfossil.fosreadkey......................................253 mgfossil.fosreadkeyw.....................................254 mgfossil.fossetcrsloc....................................254 mgfossil.fosgetcrsloc....................................254 mgfossil.fosdoswrite.....................................255 mgfossil.fosbioswrite....................................255 mgfossil.foscoldreboot...................................256 mgfossil.foswarmreboot...................................256 mgfossil.fossetwatchdog..................................257 mgfossil.fosgetinfo......................................257 mgfossil.fosgetoutleft...................................258 mgfossil.fosgetinleft....................................258 mgfossil.fosgetinsize....................................259 mgfossil.fosgetoutsize...................................259 mgfossil.fosgetbaud......................................259 mgfossil.fosgetversion...................................260 mgfossil.fosgetswidth....................................260 mgfossil.fosgetsheight...................................260 mgfossil.fosgetnameptr...................................261 mgfossil.fosinoverrun....................................261 mgfossil.fosspaceinoutbuf................................262 mgfossil.fosoutbufempty..................................262 mgfossil.mx5init.........................................262 mgfossil.mx5getinfo......................................263 mgfossil.mx5setmnplvl....................................263 mgfossil.mx5getmnplvl....................................264 mgfossil.mx5getmnpansorgmode.............................264 mgfossil.mx5setmnpansorgmode.............................264 mgfossil.mx5getmnpwaittck................................265 mgfossil.mx5setmnpwaittck................................265 mgfossil.mx5getmnpconnectsndlvl..........................266 mgfossil.mx5setmnpconnectsndlvl..........................266 mgfossil.mx5uninstall....................................267 mgfossil.mx5waitticks....................................267 mgfossil.mx5getactiveflag................................267 mgfossil.mx5getid........................................268 mgfossil.mx5getpacketssend...............................268 mgfossil.mx5getmaxsndspeed...............................269 mgfossil.mx5gettotalpacketrecv...........................269 mgfossil.mx5getduppacketrecv.............................269 mgfossil.mx5getduppackets................................270 mgfossil.mx5getmaxrcvspeed...............................270 mgfossil.x00init.........................................270 mgfossil.x00done.........................................271 mgfossil.x00getrts.......................................271 mgfossil.x00getout1......................................271 mgfossil.x00getout2......................................272 mgfossil.x00getlooptest..................................272 mgfossil.x00setrts.......................................273 mgfossil.x00setout1......................................273 mgfossil.x00setout2......................................273 mgfossil.x00setlooptest..................................274 mgfossil.x00writein......................................274 mgfossil.x00peek.........................................275 mgfossil.x00extinit......................................276 mggraph.videoseg.........................................278 mggraph.pcxheaderptr.....................................278 mggraph.pcxheader........................................278 mggraph.fillbox..........................................279 mggraph.getcol...........................................280 mggraph.setcol...........................................280 mggraph.initcol..........................................281 mggraph.setbrightness....................................281 mggraph.fadeout..........................................281 mggraph.fadein...........................................282 mggraph.setvideomode.....................................282 mggraph.getpixel.........................................283 mggraph.setpixel.........................................283 mggraph.line.............................................283 mggraph.getimage.........................................284 mggraph.putimage.........................................284 mggraph.trsputimage......................................285 mggraph.viewpcx..........................................285 mggraph.waitforretrace...................................286 mggraph.clearscr.........................................286 mglist.itemrecptr........................................288 mglist.itemrec...........................................288 mglist.lstptr............................................288 mglist.lst...............................................289 mglist.lstseekprev.......................................289 mglist.lstseeknext.......................................290 mglist.lstaddafter.......................................290 mglist.lstaddbefore......................................291 mglist.lstchangesize.....................................291 mglist.lstaddend.........................................292 mglist.lstaddstart.......................................292 mglist.lstdone...........................................293 mglist.lstdelete.........................................293 mglist.lstempty..........................................294 mglist.lstinit...........................................294 mglzh.lzhgetc............................................295 mglzh.lzhputc............................................296 mglzh.compresslzh........................................296 mglzh.expandlzh..........................................296 mgwindow.ptitlestr.......................................300 mgwindow.titlestr........................................300 mgwindow.pframe..........................................301 mgwindow.charsframe......................................301 mgwindow.pwinrec.........................................301 mgwindow.twinrec.........................................301 mgwindow.wininit.........................................303 mgwindow.wintop..........................................304 mgwindow.wincount........................................304 mgwindow.fnone...........................................304 mgwindow.fsingle.........................................304 mgwindow.fsingledouble...................................305 mgwindow.fdouble.........................................305 mgwindow.fdoublesingle...................................305 mgwindow.fbar............................................305 mgwindow.wingotoxy.......................................306 mgwindow.winwrite........................................306 mgwindow.winwriteln......................................307 mgwindow.winnext.........................................307 mgwindow.winprev.........................................307 mgwindow.winchxy.........................................308 mgwindow.wincls..........................................308 mgwindow.winopen.........................................309 mgwindow.winclose........................................309 mgwindow.winmove.........................................310 mgwindow.winactive.......................................310 mgwindow.winrefresh......................................311 mgwindow.winredrawall....................................311 mgwindow.winch...........................................311 mgwindow.winchattr.......................................312 mgwindow.winscrollup.....................................312 mgwindow.winscrolldown...................................313 mgwindow.wingetscreen....................................313 mgwindow.winputscreen....................................314 mgwindow.winclreol.......................................314 mgwindow.winblink........................................315 mgwindow.winforeground...................................315 mgwindow.winbackground...................................316 mgwindow.wingetca........................................316 mgwindow.winhomecrs......................................316 mgwindow.wincursordown...................................317 mgwindow.wincursorup.....................................317 mgwindow.wincursorleft...................................318 mgwindow.wincursorright..................................318 mgmenus.maxexitkey.......................................318 mgmenus.maxbars..........................................319 mgmenus.minbars..........................................319 mgmenus.exitkeytype......................................319 mgmenus.itemlstptr.......................................320 mgmenus.itemlst..........................................320 mgmenus.itemarrayptr.....................................321 mgmenus.itemarray........................................321 mgmenus.popmnuptr........................................321 mgmenus.popmnutype.......................................321 mgmenus.popmnutop........................................323 mgmenus.popmnucount......................................323 mgmenus.popmnuaddexitkey.................................323 mgmenus.popmnuset........................................324 mgmenus.popmnualloc......................................324 mgmenus.popmnumove.......................................325 mgmenus.popmnuclose......................................325 mgmenus.popmnuactive.....................................325 mgmenus.popmnucreate.....................................326 mgmouse.buttonstate......................................328 mgmouse.bleft............................................328 mgmouse.bright...........................................329 mgmouse.bmiddle..........................................329 mgmouse.ecursormove......................................329 mgmouse.eleftpressed.....................................329 mgmouse.eleftreleased....................................329 mgmouse.erightpressed....................................329 mgmouse.erigthreleased...................................330 mgmouse.emiddlepressed...................................330 mgmouse.emiddlereleased..................................330 mgmouse.lastmask.........................................330 mgmouse.lasthandler......................................331 mgmouse.minit............................................331 mgmouse.msetlcdlargep....................................331 mgmouse.mgetlcdlargep....................................332 mgmouse.mshow............................................332 mgmouse.mhide............................................333 mgmouse.mgetx............................................333 mgmouse.mgety............................................334 mgmouse.mgetbutton.......................................334 mgmouse.mbuttonpressed...................................335 mgmouse.mbuttonreleased..................................335 mgmouse.msetcursor.......................................335 mgmouse.mlastxpress......................................336 mgmouse.mlastypress......................................336 mgmouse.mbuttonpresses...................................337 mgmouse.mlastxrelease....................................337 mgmouse.mlastyrelease....................................337 mgmouse.mbuttonreleases..................................338 mgmouse.mbox.............................................338 mgmouse.mhardwaretextcursor..............................339 mgmouse.msoftwaretextcursor..............................339 mgmouse.mrecentxmovement.................................340 mgmouse.mrecentymovement.................................340 mgmouse.menablelightpenemulation.........................341 mgmouse.mdisablelightpenemulation........................341 mgmouse.mdefinesensetivity...............................341 mgmouse.msethidecursorbox................................342 mgmouse.mdefinedoublespeedtreshhold......................342 mgmouse.mdisabletreshhold................................343 mgmouse.mdefaulttreshhold................................343 mgmouse.msave............................................343 mgmouse.mrestore.........................................344 mgmouse.mtextmode........................................344 mgmouse.mseteventhandler.................................345 mgmouse.mswapeventhandler................................345 mgmouse.mgetlastevent....................................346 mgmouse.minstalldefaulthandler...........................346 mgmouse.msetintrrate.....................................347 mgmouse.msetpage.........................................347 mgmouse.mgetpage.........................................348 mgmouse.msetlanguage.....................................348 mgmouse.mgetlanguage.....................................349 mgmouse.mgetinfo.........................................349 mgmouse.mgetdrvinfo......................................349 mgnstrg.nnamecase........................................351 mgnstrg.nlowercase.......................................352 mgnstrg.nlowercasen......................................352 mgnstrg.nuppercase.......................................353 mgnstrg.nuppercasen......................................353 mgnstrg.ncompare.........................................353 mgnstrg.nicompare........................................354 mgnstrg.nstrcat..........................................354 mgnstrg.nstrchrch........................................355 mgnstrg.nstrlen..........................................355 mgnumber.sortword........................................357 mgnumber.sortint.........................................357 mgnumber.sortbyte........................................358 mgnumber.sortshort.......................................358 mgnumber.sortlong........................................359 mgnumber.basechange......................................359 mgnumber.swapb...........................................359 mgnumber.swapw...........................................360 mgnumber.swapl...........................................360 mgnumber.getbit..........................................361 mgnumber.setbit..........................................361 mgnumber.getbitarray.....................................362 mgnumber.setbitarray.....................................362 mgnumber.nrandom.........................................363 mgnumber.rotlongleft.....................................363 mgnumber.rotlongright....................................363 mgnumber.rotwordleft.....................................364 mgnumber.rotwordright....................................364 mgnumber.rotbyteright....................................365 mgnumber.rotbyteleft.....................................365 mgnumber.maxs............................................366 mgnumber.mins............................................366 mgnumber.maxb............................................367 mgnumber.minb............................................367 mgnumber.maxi............................................368 mgnumber.mini............................................369 mgnumber.maxw............................................369 mgnumber.minw............................................370 mgnumber.maxl............................................370 mgnumber.minl............................................371 mgnumber.longodd.........................................371 mgnumber.wordodd.........................................372 mgnumber.byteodd.........................................372 mgnumber.longsign........................................373 mgnumber.intsign.........................................373 mgnumber.lolong..........................................373 mgnumber.hilong..........................................374 mgnumber.loint...........................................374 mgnumber.hiint...........................................375 mgparse.parseend.........................................376 mgparse.slashsalpha......................................377 mgparse.slashsnumeric....................................377 mgparse.slashfstring.....................................378 mgparse.slashfnumeric....................................378 mgparse.slashstring......................................379 mgparse.slashnumeric.....................................379 mgparse.flatstring.......................................380 mgparse.flatnumeric......................................380 mgparse.parsenext........................................381 mgplay.vocptr............................................382 mgplay.vocrec............................................383 mgplay.vocdataptr........................................383 mgplay.vocdatarec........................................383 mgplay.playprocvar.......................................384 mgplay.soundpresent......................................384 mgplay.getheader.........................................385 mgplay.vocplay...........................................385 mgplay.pause.............................................385 mgplay.continue..........................................386 mgplay.isplaying.........................................386 mgqcii.qcii..............................................388 mgqcii.qcii..............................................389 mgqcii.qciidismount......................................391 mgqcii.qciiflush.........................................391 mgqcii.qciicachestatus...................................392 mgqcii.qciisetsectors....................................392 mgqcii.qciisetflushinterval..............................392 mgqcii.qciiuninstall.....................................393 mgqcii.qciiinstallchk....................................393 mgqcii.qciiautodismount..................................394 mgqcii.qciisetbufsz......................................394 mgqcii.qciisetbufedwrites................................394 mgqcii.qciisetbufedread..................................395 mgqcii.qciisetflushcnt...................................395 mgqcii.qciiforceimincflush...............................396 mgqcii.qciigetinfo.......................................396 mgqcii.qciienablecache...................................397 mgqcii.qciidisablecache..................................397 mgqcii.qciisectlock......................................397 mgqcii.qciisetlockpoolsize...............................398 mgqcii.qciisetbuffedreaddrv..............................398 mgqcii.qciisetbuffedwrtdrv...............................399 mgqcii.qciisetrdbufszdrv.................................399 mgqcii.qciisetwrbufszdrv.................................400 mgrle.rlegetc............................................401 mgrle.rleputc............................................402 mgrle.compressrle........................................402 mgrle.expandrle..........................................402 mgsmtdrv.smdrvinstcheck..................................404 mgsmtdrv.smdrvflushbuf...................................405 mgsmtdrv.smdrvresetcache.................................405 mgsmtdrv.smdrvgetsetstatus...............................405 mgsmtdrv.smdrvchkdrvcacheable............................406 mgsound.tone.............................................407 mgsound.notone...........................................408 mgstackd.nodeptr.........................................409 mgstackd.nodetype........................................410 mgstackd.stackdtype......................................410 mgstackd.stackdptr.......................................411 mgstackd.stackddone......................................411 mgstackd.stackdinit......................................411 mgstackd.stackdempty.....................................412 mgstackd.stackdpush......................................412 mgstackd.stackdpop.......................................413 mgstackd.stackdpeek......................................413 mgstackd.stackdclear.....................................413 mgstacks.stacktype.......................................415 mgstacks.stackptr........................................416 mgstacks.stackinit.......................................416 mgstacks.stackempty......................................417 mgstacks.stackpush.......................................417 mgstacks.stackpop........................................417 mgstacks.stackpeek.......................................418 mgstacks.stackclear......................................418 mgtasker.taskmin.........................................420 mgtasker.taskmaj.........................................420 mgtasker.windowmode......................................420 mgtasker.multitask.......................................421 mgtasker.giveslice.......................................421 mgtasker.winbegincritic..................................421 mgtasker.winendcritic....................................422 mgtasker.wininstall......................................422 mgtasker.wingiveslice....................................423 mgtasker.dpmiinstall.....................................423 mgtasker.dpmigiveslice...................................424 mgtasker.detectos2.......................................424 mgtasker.os2giveslice....................................424 mgtasker.dos5giveslice...................................425 mgtasker.tvgetver........................................425 mgtasker.dvgetver........................................426 mgtasker.tvdvgetshadowbuf................................426 mgtasker.tvdvgiveslice...................................426 mgtasker.tvdvbegincritic.................................427 mgtasker.tvdvendcritic...................................427 mgtasker.dvscrninfo......................................428 mgtasker.ddinstall.......................................428 mgtasker.ddmenucontrol...................................428 mgtasker.ddsendch2otherjob...............................429 mgtasker.ddaddch2buf.....................................429 mgtasker.ddotherprgstatus................................430 mgtasker.ddsettimesharing................................430 mgtasker.ddtaskswitchoff.................................431 mgtasker.ddtaskswitchon..................................431 mgtasker.ddgetvideoaddr..................................431 mgtasker.ddgivetimeslice.................................432 mgtasker.ddclrkeybuffer..................................432 mgtasker.ddkeysflags.....................................432 mgvwarc.archdr...........................................434 mgvwarc.arcptr...........................................435 mgvwarc.arcprocvar.......................................435 mgvwarc.nextarcfile......................................436 mgvwarc.arcview..........................................436 mgvwarj.afilerec.........................................437 mgvwarj.afileptr.........................................438 mgvwarj.arjvarproc.......................................439 mgvwarj.nextarjfile......................................439 mgvwarj.arjview..........................................439 mgvwlzh.lzhhdrptr........................................440 mgvwlzh.lzhheader........................................441 mgvwlzh.lzhprocvar.......................................441 mgvwlzh.nextlzhfile......................................442 mgvwlzh.lzhview..........................................442 mgvwzip.zfheader.........................................443 mgvwzip.zfheaderptr......................................444 mgvwzip.zipprocvar.......................................445 mgvwzip.nextzipfile......................................445 mgvwzip.zipview..........................................445 mgvwzoo.zoomainhdrptr....................................446 mgvwzoo.zoomainhdr.......................................447 mgvwzoo.zoohdrptr........................................447 mgvwzoo.zoohdr...........................................448 mgvwzoo.zooprocvar.......................................450 mgvwzoo.nextzoofile......................................450 mgvwzoo.zooview..........................................450 - 1 - First, let me say that my English is quit rusty, but it should be good enough. What is MglibPAS. ____________________________________________________________ This Turbo Pascal (7.0,6.0,5.5) library covert all aspect of PC programming such as windowing, compression, disk and files access, comport, etc. This library also automatically support 386 for memory movement. This version as not yet implemented all function in 386 code. Currently only memory and math functions are able to detect CPU type and use the fastest possible code. In futur version some function that can be optimized on a 386 (like mggraph) will automatically support CPU 386+. Help file. ____________________________________________________________ If you don't like text documentation or don't want to print more than 400 pages you can use help files. Help files are really easy to install and cover ALL aspect of this documentation. First go into your Turbo Pascal environnement, press Alt-H, to go in Help menu. Then press 'f' for file and 'n' for new. Now you select MGLIBPAS.TPH and save your configuration. Help file can't be install in TP version other than 7.0 How to contact the author. ____________________________________________________________ There is many way you can contact me the best and fastest way is to use netmail over network such as Fidonet or internet. Any of theses address are subject to change at any time, so if you do not get any respond from one of theses try another one. Fidonet: 1:167/717.6 MTL-Net: 17:514/840.6 Francomedia: 101:153/0 Internet e-mail: Mark.Gauthier@514-840-6.mba.org CompuServe: >INTERNET:Mark.Gauthier@514-840-6.mba.org You can also call at Silicon Palace BBS (1-514-432-2953) and leave me message, but don't try to chat me at this BBS, i'm not the sysop. You can also reach me via conventional mail at this address. MgLib / Mark Gauthier 58 Emilien-Frenette Sainte-Therese, PQ, Canada. J7E 5K3 - 2 - Licensing Information (Shareware version). ____________________________________________________________ This library is not free. But shareware concept give you the opportunity to test it and use it for 30 days. After 30 days you must pay to keep it. Once you have registred this library you don't have to pay more than 10$ S&H include for an upgrade. How to register. ____________________________________________________________ Print 'ORDER.FRM' you will find all information is this file including what type of registration are offer and prices. Next version. ____________________________________________________________ Now what the next step. Some modules are already in development and more will be develope if YOU register. On development: (currently in progress) MGLZSS: unit to support LZSS (Sliding dictionary) compression. MGNOVELL: complete novell module to login, acces user and server information etc. MGMATH: module to support statistics, this module will deal with simple operation such as "khi-carre", "average", up to test on normal distribution, and propability. One module to support fixed and float point and more math functions. MGSB: a module to support SoundBlaster card with or without driver. MGDBTREE: a simple Database module using B-TREE algo. MGSPRITE: a module to create sprite in modeX (320x200x256). MGZMODEM: a module to support Zmodem protocol, and meaby other like X/Ymodem. MGXMS and MGEMS: two module to support high memory. MGPRN: printer module. In projet: (not started yet) MGHELP: a module that will allow you to create HELP files and insert it into your program. And thoses you will suggest. Mark. - 3 - Contents of MGLIBPAS help file Units: mgglobal mgmem mgscreen mgmath mgkeyb mgfilhdl mgfiles mgstring mgmisc mgcrc mgdate mgdrive mgcachef mgcom mgdbhash mgencryp mgexesfx mgfossil mggraph mglist mglzh mgmenus mgwindow mgmouse mgnstrg mgnumber mgparse mgplay mgqcii mgrle mgsmtdrv mgsound mgstackd mgstacks mgtasker mgvwarc mgvwarj mgvwlzh mgvwzip mgvwzoo - 4 - MGGLOBAL.TPU ____________________________________________________________ Description: This unit contain the CPU type and function to handle or set CPU type. It also contain information that more than one unit must share. The main task of this unit is to determine at initialization time what type of CPU is available and give this information to module that support CPU up to 386. Language Used: coded in PASCAL and ASSEMBLER. Linked With: Nothing. Example File: 'MGPAS013.PAS' this file give you an example that use all functions and procedures of this unit. Constants: cpukind Types: strptr arrayofbyte arrayofchar arrayofshort arrayofword arrayofint arrayoflong arrayofptr getctype putctype Functions And Procedures: getcpu forcecpu - 5 - strptr (unit MGGLOBAL) ____________________________________________________________ Synopsis: mgglobal.strptr = ^string; Description: This type is used to access a string at specific address. arrayofbyte (unit MGGLOBAL) ____________________________________________________________ Synopsis: mgglobal.arrayofbyte = array[1..$FFF0 div sizeof(byte)] of byte; Description: This type is used to access array of byte. arrayofchar (unit MGGLOBAL) ____________________________________________________________ Synopsis: mgglobal.arrayofchar = array[1..$FFF0 div sizeof(char)] of char; Description: This type is used to access array of char. arrayofshort (unit MGGLOBAL) ____________________________________________________________ Synopsis: mgglobal.arrayofshort = array[1..$FFF0 div sizeof(shortint)] of shortint; - 6 - Description: This type is used to access array of shortint. arrayofword (unit MGGLOBAL) ____________________________________________________________ Synopsis: mgglobal.arrayofword = array[1..$FFF0 div sizeof(word)] of word; Description: This type is used to access array of word. arrayofint (unit MGGLOBAL) ____________________________________________________________ Synopsis: mgglobal.arrayofint = array[1..$FFF0 div sizeof(integer)] of integer; Description: This type is used to access array of integer. arrayoflong (unit MGGLOBAL) ____________________________________________________________ Synopsis: mgglobal.arrayoflong = array[1..$FFF0 div sizeof(longint)] of longint; Description: This type is used to access array of longint. - 7 - arrayofptr (unit MGGLOBAL) ____________________________________________________________ Synopsis: mgglobal.arrayofptr = array[1..$FFF0 div sizeof(pointer)] of pointer; Description: This type is used to access array of pointer. getctype (unit MGGLOBAL) ____________________________________________________________ Synopsis: mgglobal.getctype = function : integer; Description: This type is used to declare an address of one input function. See Also: putctype putctype (unit MGGLOBAL) ____________________________________________________________ Synopsis: mgglobal.putctype = procedure (c: integer); Description: This type is used to declare an address of one output function. See Also: getctype - 8 - cpukind (unit MGGLOBAL) ____________________________________________________________ Synopsis: Const mgglobal.cpukind: byte = $FF; Description: This constant old the value of current CPU. This value is used to choose between 386 or 8086 code for memory movement. At initialization, this constant is set, but you can force 386 or 8086 code by setting this constant. Valid value are: cpu8088 = 0; cpu8086 = 1; cpuV20 = 2; cpuV30 = 3; cpu80188 = 4; cpu80186 = 5; cpu80286 = 6; cpu80386 = 7; cpu80486 = 8; cpuPentium = 9; See Also: forcecpu getcpu (unit MGGLOBAL) ____________________________________________________________ Synopsis: function mgglobal.getcpu: byte; Description: This function determine what type of CPU is use, this function is call at initialization. Input: nothing. Output: function result = cpu type. - 9 - forcecpu (unit MGGLOBAL) ____________________________________________________________ Synopsis: procedure mgglobal.forcecpu(cpu: byte); Description: This function is used to change the CPU type used by function that support more than one CPU. Input: cpu: cpu to use. Output: nothing. - 10 - MGMEM.TPU ____________________________________________________________ Description: This unit implement memory function, like compare, move, swap, set, etc. It also implement function to allocate huge memory block. Language Used: coded in ASSEMBLER. Linked With: MGGLOBAL. Example File: 'MGPAS019.PAS' this file give you an example that use all functions and procedures of this unit. Functions And Procedures: movemem cmpmem swapmem setmem dostotalmem dosmaxavail memalloc memfree memrealloc getmemallocstrategy setmemallocstrategy movemem (unit MGMEM) ____________________________________________________________ Synopsis: procedure mgmem.movemem(source, dest: pointer; size: word); Description: This procedure move one block of memory (source) to a specific position (destination) this function is equal to move from Pascal unit but this function use the best CPU available. Input: - 11 - source: address of source memory block. dest: address of destination memory block. size: number of bytes to move. Output: nothing. cmpmem (unit MGMEM) ____________________________________________________________ Synopsis: function mgmem.cmpmem(firstblock, secondblock: pointer; size: word): boolean; Description: This function compare two blocks of memory using the best CPU available. This function return true if blocks are equal, else it return false. Input: firstblock: address of first memory block. secondblock: address of second memory block. size: number of bytes to compare. Output: function result = true if both are equal. swapmem (unit MGMEM) ____________________________________________________________ Synopsis: procedure mgmem.swapmem(firstblock, secondblock: pointer; size: word); Description: This procedure swap two blocks of memory. (A=B and B=A) This function use the best CPU available. Input: firstblock: address of first memory block. secondblock: address of second memory block. size: number of bytes to swap. Output: nothing. - 12 - setmem (unit MGMEM) ____________________________________________________________ Synopsis: procedure mgmem.setmem(source: pointer; value: byte; size: word); Description: This procedure initialize one block of memory. This function is equal to fillchar from Pascal unit, but use best CPU available. Input: source: address of buffer to initialized. value: value to give to each byte of buffer. size: size of buffer to initialized. Output: nothing. dostotalmem (unit MGMEM) ____________________________________________________________ Synopsis: function mgmem.dostotalmem: longint; Description: This function returns the number of memory installed in bytes. Input: nothing. Output: function result = memory size. dosmaxavail (unit MGMEM) ____________________________________________________________ Synopsis: function mgmem.dosmaxavail: longint; Description: This function returns the size of the largest contiguous - 13 - free memory block. This function should be called when HeapMin/HeapMax are set to zero. Input: nothing. Output: function result = size of largest block available. memalloc (unit MGMEM) ____________________________________________________________ Synopsis: function mgmem.memalloc(memsize: longint): pointer; Description: This function creates a dynamic variable of the specified size and returns the pointer to it. This function should be called when HeapMin/HeapMax are set to zero. Input: memsize: size of memory block to allocate. Output: function result = pointer to allocate block or nil. See Also: memfree memrealloc memfree (unit MGMEM) ____________________________________________________________ Synopsis: procedure mgmem.memfree(p: pointer); Description: This procedure free a dynamic variable previously allocate by memalloc. This function should be called when HeapMin/HeapMax memory allocation parameters are set to zero. Input: p: address of memory block to release. Output: nothing. - 14 - See Also: memalloc memrealloc (unit MGMEM) ____________________________________________________________ Synopsis: function mgmem.memrealloc(p: pointer; newsize: longint): boolean; Description: This function changes the size of en existed memory block allocate by memalloc. This function should be called when HeapMin/HeapMax memory allocation parameters set to zero. This function return address of new allocate block. Input: p: address of memory block to resize. newsize: new size of memory block. Output: function result = pointer of new allocate block or nil. See Also: memalloc memfree getmemallocstrategy (unit MGMEM) ____________________________________________________________ Synopsis: function mgmem.getmemallocstrategy: integer; Description: This function return the memory allocation strategy. Input: nothing. Output: function result = = 00 first fit (default) = 01 best fit = 02 last fit = -1 error. - defaults to first fit, first block large enough is chosen - in first fit, DOS searches the MCB chain from - 15 - low addresses to high for the first block large enough to fill the request. For best fit, DOS searches all memory blocks for the closest fit. In last fit, DOS starts at high addresses and works downward and uses the high part of the chosen block - any strategy value greater than 2 defaults to 2, but the last value set, even if incorrect, is the value returned by the get strategy See Also: setmemallocstrategy setmemallocstrategy (unit MGMEM) ____________________________________________________________ Synopsis: procedure mgmem.setmemallocstrategy(strategy: byte); Description: This function changes the memory allocation strategy. See getmemallocstrategy for description on availables strategy. Input: Strategy: new strategy. Output: nothing. See Also: getmemallocstrategy - 16 - MGSCREEN.TPU ____________________________________________________________ Description: This unit implement miscellaneous screen functions like write, txtscroll, cursor move, etc. There are two set of function in this module: The first set (normal) function use dos and bios to do there job this mean that they can be intercept by another program like multitasker, doorway, etc. But this set is very slow compare to set number two. The second set: fastxxxxx function cover all aspect of screen writing like set one but this set use direct screen write and add some good option like automatically support DeskView, TopView, and DoubleDos, allow you to suspend scrolling, paging etc. Language Used: coded in PASCAL AND ASSEMBLER. Linked With: nothing. Example File: 'MGPAS030.PAS' this file give you an example that use all functions and procedures of this unit. Constants: fastattr Variables: fastxy fastx fasty virtualmode screenupdateofs screenupdatesize screenupdatex screenupdatey scrollallow screenpage screenpageofs screenheight screenwidth screenaddr - 17 - Functions And Procedures: fastblink fastforeground fastbackground fastcls fastgetca fasthomecrs fastgotoxy fastwherexy fastwherex fastwherey fastcursordown fastcursorup fastcursorleft fastcursorright fastchxy fastch fastchattr faststrxy faststr faststrattr fastgetscreen fastputscreen fastscrollup fastscrolldown fastclreol getscreenaddr biosch biosstr dosstr getca clsbios homecrs setcursorsize getcursorsize blockcursor halfblockcursor linecursor cgotoxy cwherexy cwherex cwherey cursoroff cursoron cursordown cursorup cursorleft cursorright fansich dosch ansidetect switchto50 switchto43 switchto25 setactivepage - 18 - screenscroll cclreol fastwriteattr fastreadattr fastxy (unit MGSCREEN) ____________________________________________________________ Synopsis: mgscreen.fastxy: word; Description: This variable hold the cursor position in format y*width+x. See Also: fastx fasty fastx (unit MGSCREEN) ____________________________________________________________ Synopsis: mgscreen.fastx: byte; Description: This variable hold the horizontal cursor position. See Also: fastxy fasty fasty (unit MGSCREEN) ____________________________________________________________ Synopsis: mgscreen.fasty: byte; Description: This variable hold the vertical cursor position. See Also: fastx - 19 - virtualmode (unit MGSCREEN) ____________________________________________________________ Synopsis: mgscreen.virtualmode: boolean; Description: This variable is use to enable virtualmode, this is use by MGWINDOW, when virtualmode = true there is not cursor move and active page is always zero. screenupdateofs (unit MGSCREEN) ____________________________________________________________ Synopsis: mgscreen.screenupdateofs: word; Description: This variable hold the offset of the last screen update. See Also: screenupdatesize screenupdatex screenupdatey screenupdatesize (unit MGSCREEN) ____________________________________________________________ Synopsis: mgscreen.screenupdatesize: word; Description: This variable hold the size of the last screen update. See Also: screenupdateofs screenupdatex screenupdatey - 20 - screenupdatex (unit MGSCREEN) ____________________________________________________________ Synopsis: mgscreen.screenupdatex: byte; Description: This variable hold the horizontal position of last screen update. See Also: screenupdateofs screenupdatesize screenupdatey screenupdatey (unit MGSCREEN) ____________________________________________________________ Synopsis: mgscreen.screenupdatey: byte; Description: This variable hold the vertical position of last screen update. See Also: screenupdateofs screenupdatesize screenupdatex scrollallow (unit MGSCREEN) ____________________________________________________________ Synopsis: mgscreen.scrollallow: boolean; Description: This variable hold the status of scroll: if scrollallow = false, then scroll is disable. - 21 - screenpage (unit MGSCREEN) ____________________________________________________________ Synopsis: mgscreen.screenpage: byte; Description: This variable hold the current active page. screenpageofs (unit MGSCREEN) ____________________________________________________________ Synopsis: mgscreen.screenpageofs: word; Description: This variable hold the offset of current active page in video buffer. screenheight (unit MGSCREEN) ____________________________________________________________ Synopsis: mgscreen.screenheight: byte; Description: This variable hold the screen height. See Also: screenwidth screenwidth (unit MGSCREEN) ____________________________________________________________ Synopsis: mgscreen.screenwidth: word; Description: This variable hold the screen width. - 22 - See Also: screenheight screenaddr (unit MGSCREEN) ____________________________________________________________ Synopsis: mgscreen.screenaddr: pointer; Description: This constant hold address of screen used by fastxxxx functions. At initialization time this variable is set. fastattr (unit MGSCREEN) ____________________________________________________________ Synopsis: Const mgscreen.fastattr: byte = $07; Description: This constant hold the current text attribute for fastxxxxx functions. Default color attribute is set to $07, light gray on black. Bit map is: 7 6 5 4 3 2 1 0 ³ ³ ³ ³ ÀÄÁÄÁÄÁÄÄ Foreground color. (0..15) ³ ÀÄÁÄÁÄÄÄÄÄÄÄÄÄÄ Background color. (0..7) ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ Blink status. 1 = enable, 0 = disable. fastblink (unit MGSCREEN) ____________________________________________________________ Synopsis: procedure mgscreen.fastblink(assert: boolean); Description: This function enable or disable the blink status in fastattr constant. - 23 - Input: assert: true to enable blink, false to disable it. Output: nothing. fastforeground (unit MGSCREEN) ____________________________________________________________ Synopsis: procedure mgscreen.fastforeground(color: byte); Description: This function change to default foreground color value. This is done by setting a new value to fastattr constant. Input: color: new foreground color. Output: nothing. See Also: fastbackground fastbackground (unit MGSCREEN) ____________________________________________________________ Synopsis: procedure mgscreen.fastbackground(color: byte); Description: This function change to default background color value. This is done by setting a new value to fastattr constant. Input: color: new background color. Output: nothing. See Also: fastforeground - 24 - fastcls (unit MGSCREEN) ____________________________________________________________ Synopsis: procedure mgscreen.fastcls(c: char; attr: byte); Description: This procedure clear screen using specific character and attribute. This is normally done whit character #32 and background color black. Input: c: character to use normally #32 (space) attr: color attribute to use. Output: nothing. fastgetca (unit MGSCREEN) ____________________________________________________________ Synopsis: function mgscreen.fastgetca: word; Description: This function return the attribute and ASCII value of character at current cursor position. Input: nothing. Output: function result = lo part(character) hi part(attribute). fasthomecrs (unit MGSCREEN) ____________________________________________________________ Synopsis: procedure mgscreen.fasthomecrs; Description: This procedure move then cursor at (0,0). Input: nothing. - 25 - Output: nothing. fastgotoxy (unit MGSCREEN) ____________________________________________________________ Synopsis: procedure mgscreen.fastgotoxy(x, y: byte); Description: This procedure move cursor at specific position on current page. Input: x,y: new position to move cursor. Output: nothing. fastwherexy (unit MGSCREEN) ____________________________________________________________ Synopsis: function mgscreen.fastwherexy: word; Description: This function return the current cursor position as row in high order byte and col in low order byte of function result this procedure use the current page. Input: nothing. Output: function result = lo part = Y, Hi part = X See Also: fastwherex fastwherey - 26 - fastwherex (unit MGSCREEN) ____________________________________________________________ Synopsis: function mgscreen.fastwherex: byte; Description: This function return the current cursor col for current page. Input: nothing. Output: function result = X position. See Also: fastwherexy fastwherey fastwherey (unit MGSCREEN) ____________________________________________________________ Synopsis: function mgscreen.fastwherey: byte; Description: This function return the current cursor row for current page. Input: nothing. Output: function result = Y position. See Also: fastwherex fastwherexy fastcursordown (unit MGSCREEN) ____________________________________________________________ Synopsis: function mgscreen.fastcursordown: byte; Description: - 27 - This function move cursor down and return the new row value. Input: nothing. Output: function result = new Y position. See Also: fastcursorup fastcursorup (unit MGSCREEN) ____________________________________________________________ Synopsis: function mgscreen.fastcursorup: byte; Description: This function move cursor up and return the new row value. Input: nothing. Output: function result = new Y position. See Also: fastcursordown fastcursorleft (unit MGSCREEN) ____________________________________________________________ Synopsis: function mgscreen.fastcursorleft: byte; Description: This function move cursor left and return the new column. Input: nothing. Output: function result = new X position. See Also: fastcursorright - 28 - fastcursorright (unit MGSCREEN) ____________________________________________________________ Synopsis: function mgscreen.fastcursorright: byte; Description: This function move cursor right and return the new column. Input: nothing. Output: function result = new X position. See Also: fastcursorleft fastchxy (unit MGSCREEN) ____________________________________________________________ Synopsis: procedure mgscreen.fastchxy(c: char; x, y, attr: byte); Description: This procedure write one character at a specific position on screen with a specific attribute. This procedure doesn't update cursor position. Input: c: character to write. x,y: position on screen. attr: attribute to use. Output: nothing. See Also: fastch fastchattr - 29 - fastch (unit MGSCREEN) ____________________________________________________________ Synopsis: procedure mgscreen.fastch(c: char); Description: This procedure write one character at cursor position, using current attribute defined in fastattr and update the cursor position. If cursor is at bottom of screen the screen will be scrolled. Input: c: character to write. Output: nothing. See Also: fastchattr fastchxy fastchattr (unit MGSCREEN) ____________________________________________________________ Synopsis: procedure mgscreen.fastchattr(c: char; attr: byte); Description: This procedure write one character at cursor position, using specific attribute and update the cursor position. If cursor is at bottom of screen the screen will be scrolled. Input: c: character to write. attr: attribute to use. Output: nothing. See Also: fastch fastchxy - 30 - faststrxy (unit MGSCREEN) ____________________________________________________________ Synopsis: procedure mgscreen.faststrxy(x, y, attr: byte; const s: string); Description: This procedure write one string at a specific position using specific attribute. This procedure doesn't update cursor position. if string go out of bound it is cut! Input: x,y: position on screen. s: string to write. Output: nothing. See Also: faststr faststrattr faststr (unit MGSCREEN) ____________________________________________________________ Synopsis: procedure mgscreen.faststr(const s: string); Description: This procedure write one string using default attribute stored in fastattr at current position cursor position. The cursor position is update and if cursor is at bottom of screen, screen will be scrolled. Input: s: string to write. Output: nothing. See Also: faststrattr faststrxy - 31 - faststrattr (unit MGSCREEN) ____________________________________________________________ Synopsis: procedure mgscreen.faststrattr(attr: byte; const s: string); Description: This procedure write one string at current position with a specific color attribute. This procedure update the cursor position and if cursor is at bottom of screen, screen will be scrolled. Input: attr: attribute to use. s: string to write. Output: nothing. See Also: faststr faststrxy fastgetscreen (unit MGSCREEN) ____________________________________________________________ Synopsis: procedure mgscreen.fastgetscreen(x1, y1, xlen, ylen: byte; buffer: pointer); Description: This procedure save a specific region of screen, the first two byte of buffer are xlen and ylen save into buffer, to calculate buffer size use this formula: size = (ylen * xlen * 2) + 2; Input: x1,y1: upper left corner of box. xlen: box width. ylen: box height. buffer: address of memory where to stored saved box. Output: nothing. See Also: - 32 - fastputscreen fastputscreen (unit MGSCREEN) ____________________________________________________________ Synopsis: procedure mgscreen.fastputscreen(x1, y1: byte; buffer: pointer); Description: This procedure restore a specific region of screen previously saved by fastgetscreen. Xlen and Ylen are get from fastgetscreen. Input: x1,y1: upper left corner of box. buffer: address of memory where the box is stored. Output: nothing. See Also: fastgetscreen fastscrollup (unit MGSCREEN) ____________________________________________________________ Synopsis: procedure mgscreen.fastscrollup(times: word); Description: This procedure scroll screen up a specific number of times. Input: times: number of lines to scroll. Output: nothing. See Also: fastscrolldown - 33 - fastscrolldown (unit MGSCREEN) ____________________________________________________________ Synopsis: procedure mgscreen.fastscrolldown(times: word); Description: This procedure scroll screen down a specific number of times. Input: times: number of lines to scroll. Output: nothing. See Also: fastscrollup fastclreol (unit MGSCREEN) ____________________________________________________________ Synopsis: procedure mgscreen.fastclreol(c: char; attr: byte); Description: This procedure clear current line from cursor position to end of line without updating the cursor position. Input: c: character to use for clear. attr: attribute to use for clear. Output: nothing. fastscreenaddr (unit MGSCREEN) ____________________________________________________________ Synopsis: function mgscreen.getscreenaddr: pointer; Description: This function return address of video buffer as defined in BIOS. This function is called at initialization time to initialize screenaddr constant. If multitasker - 34 - are present then screenaddr = address of multitasker shadow buffer. Input: nothing. Output: address of video buffer. biosch (unit MGSCREEN) ____________________________________________________________ Synopsis: procedure mgscreen.biosch(c: char; attr: byte; times: word); Description: This procedure write one character at cursor position using BIOS service. This procedure do NOT update the cursor position. Input: c: character to write. attr: attribute to use. times: number of times to write character. Output: nothing. See Also: dosch biosstr (unit MGSCREEN) ____________________________________________________________ Synopsis: procedure mgscreen.biosstr(service, attr: byte; len: word; x, y: byte; s: pointer); Description: This procedure write one string using BIOS service. This procedure do NOT update the cursor position. There is two thing that service give first you can choose to update the cursor, and you can choose to use attr or attribute in string. If you choose attribute in string your string should look like this: - 35 - 'M$1a$34r$5k$6' each character is follow by it attribute. Input: service: bit map for service is: 7 6 5 4 3 2 1 0 ³ ³ ³ ³ ³ ³ ³ ÀÄÄ 1 = move cursor, 0 = don't move. ³ ³ ³ ³ ³ ³ ÀÄÄÄÄ 0 = string attr, 1 = attr in str. ÀÄÁÄÁÄÁÄÁÄÁÄÄÄÄÄÄ not used. attr: attribute to use. len: length of string. x,y: position on screen to write string. s: string to write. Output: nothing. See Also: dosstr dosstr (unit MGSCREEN) ____________________________________________________________ Synopsis: procedure mgscreen.dosstr(const s: string); Description: This procedure write one string using DOS function. Input: s: string to write. Output: nothing. See Also: biosstr getca (unit MGSCREEN) ____________________________________________________________ Synopsis: function mgscreen.getca: word; Description: This function return then attribute and ASCII value of character at cursor position. Input: - 36 - nothing. Output: function result = lo part character, hi part attribute. clsbios (unit MGSCREEN) ____________________________________________________________ Synopsis: procedure mgscreen.clsbios(attr: byte); Description: This procedure clear screen using a specific attribute. Clear is done by scroll screen (a BIOS function). Input: attr: color attribute to use for clear. Output: nothing. hmocrs (unit MGSCREEN) ____________________________________________________________ Synopsis: procedure mgscreen.homecrs; Description: This procedure move the cursor at (0,0). Input: nothing. Output: nothing. setcursorsize (unit MGSCREEN) ____________________________________________________________ Synopsis: procedure mgscreen.setcursorsize(startline: byte; endline: byte); Description: - 37 - This procedure change the cursor size. Input: startline: startline for cursor shape. endline: endline for cursor shape. Output: nothing. See Also: getcursorsize getcursorsize (unit MGSCREEN) ____________________________________________________________ Synopsis: procedure mgscreen.getcursorsize(var startline, endline: byte); Description: This procedure return the current cursor size. Input: nothing. Output: startline: startline of cursor shape. endline: endline of cursor shape. See Also: setcursorsize blockcursor (unit MGSCREEN) ____________________________________________________________ Synopsis: procedure mgscreen.blockcursor; Description: This procedure change the cursor shape to BLOCK. Input: nothing. Output: nothing. See Also: - 38 - halfblockcursor linecursor halfblockcursor (unit MGSCREEN) ____________________________________________________________ Synopsis: procedure mgscreen.halfblockcursor; Description: This procedure the cursor shape to HALF BLOCK. Input: nothing. Output: nothing. See Also: blockcursor linecursor linecursor (unit MGSCREEN) ____________________________________________________________ Synopsis: procedure mgscreen.linecursor; Description: This procedure change the cursor shape to LINE. Input: nothing. Output: nothing. See Also: blockcursor halfblockcursor cgotoxy (unit MGSCREEN) ____________________________________________________________ Synopsis: procedure mgscreen.cgotoxy(x, y: byte); Description: - 39 - This procedure move the cursor at a specific position on current page. Input: x,y: position to move cursor. Output: nothing. cwherexy (unit MGSCREEN) ____________________________________________________________ Synopsis: function mgscreen.cwherexy: word; Description: This function return the current cursor position. Row is return in the high order byte and column is return in the low order byte of function result. Input: nothing. Output: function result = lo part column, high part row. See Also: cwherex cwherey cwherex (unit MGSCREEN) ____________________________________________________________ Synopsis: function mgscreen.cwherex: byte; Description: This function return the current cursor column for current page. Input: nothing. Output: function result = x position. See Also: cwherexy - 40 - cwherey cwherey (unit MGSCREEN) ____________________________________________________________ Synopsis: function mgscreen.cwherey: byte; Description: This function return the current cursor row for current page. Input: nothing. Output: function result = y position. See Also: cwherex cwherexy cursoroff (unit MGSCREEN) ____________________________________________________________ Synopsis: procedure mgscreen.cursoroff; Description: This procedure hide cursor. Input: nothing. Output: nothing. See Also: cursoron cursoron (unit MGSCREEN) ____________________________________________________________ Synopsis: procedure mgscreen.cursoron; Description: - 41 - This cursor show cursor. Input: nothing. Output: nothing. See Also: cursoroff cursordown (unit MGSCREEN) ____________________________________________________________ Synopsis: function mgscreen.cursordown: byte; Description: This function move the cursor down, and return the new row. This function use active page. Input: nothing. Output: function result = new Y position. See Also: cursorup cursorup (unit MGSCREEN) ____________________________________________________________ Synopsis: function mgscreen.cursorup: byte; Description: This function move the up down, and return the new row. This function use active page. Input: nothing. Output: function result = new Y position. See Also: cursordown - 42 - cursorleft (unit MGSCREEN) ____________________________________________________________ Synopsis: function mgscreen.cursorleft: byte; Description: This function move the to left, and return the new column. This function use active page. Input: nothing. Output: function result = new X position. See Also: cursorright cursorright (unit MGSCREEN) ____________________________________________________________ Synopsis: function mgscreen.cursorright: byte; Description: This function move the to right, and return the new column. This function use active page. Input: nothing. Output: function result = new X position. See Also: cursorleft fansich (unit MGSCREEN) ____________________________________________________________ Synopsis: procedure mgscreen.fansich(c: char); Description: This procedure write one character and using undocumented dos function. This procedure allow ANSI.SYS to - 43 - intercept and print character and run faster than dosch. Input: c: character to write. Output: nothing. dosch (unit MGSCREEN) ____________________________________________________________ Synopsis: procedure mgscreen.dosch(c: char); Description: This procedure write one character using DOS function. Input: c: character to write. Output: nothing. See Also: biosch ansidetect (unit MGSCREEN) ____________________________________________________________ Synopsis: function mgscreen.ansidetect: boolean; Description: This function detect the presence of ANSI.SYS. If ANSI.SYS is detect this function return true, else it return false. Input: nothing. Output: function result = true if ANSI.SYS is loaded. See Also: fansich - 44 - switchto50 (unit MGSCREEN) ____________________________________________________________ Synopsis: procedure mgscreen.switchto50; Description: This procedure switch video mode to 50 row mode. Input: nothing. Output: nothing. See Also: switchto25 switchto43 switchto43 (unit MGSCREEN) ____________________________________________________________ Synopsis: procedure mgscreen.switchto43; Description: This procedure switch video mode to 43 row mode. Input: nothing. Output: nothing. See Also: switchto25 switchto50 switchto25 (unit MGSCREEN) ____________________________________________________________ Synopsis: procedure mgscreen.switchto25; Description: This procedure switch video mode to 25 row mode. - 45 - Input: nothing. Output: nothing. See Also: switchto43 switchto50 setactivepage (unit MGSCREEN) ____________________________________________________________ Synopsis: procedure mgscreen.setactivepage(page: byte); Description: This procedure change the current active page. Input: page: new page number. Output: nothing. screenscroll (unit MGSCREEN) ____________________________________________________________ Synopsis: procedure mgscreen.screenscroll(x1, y1, x2, y2, direction, attr, numtimes: byte); Description: This procedure scroll vertically a region of screen using bios functions. Input: x1,y1: top left corner of box. x2,y2: bottom right corner of box. direction: 0 = up, 1 = down. attr: attribute for new lines. numtimes: number of lines to scroll. Output: nothing. - 46 - cclreol (unit MGSCREEN) ____________________________________________________________ Synopsis: procedure mgscreen.cclreol; Description: This procedure clear line from cursor position to end of line without updating the cursor position. Input: nothing. Output: nothing. fastwriteattr (unit MGSCREEN) ____________________________________________________________ Synopsis: procedure mgscreen.fastwriteattr(x, y, color: byte); Description: This procedure change attribute of specific character. Input: x: column. y: row. color: new attribute. Output: nothing. See Also: fastreadattr fastreadattr (unit MGSCREEN) ____________________________________________________________ Synopsis: function mgscreen.fastreadattr(x, y: byte): byte; Description: This function return color of specific character. Input: - 47 - x: column. y: row. Output: function result = attribute value. See Also: fastwriteattr MGMATH.TPU ____________________________________________________________ Description: This unit is created to support 386 math functions. More math functions will be added soon, currently only the basic functions are done. Language Used: coded in PASCAL AND ASSEMBLER. Linked With: MGGLOBAL. Example File: 'MGPAS018.PAS' this file give you an example that use all functions and procedures of this unit. Constants: divzero Functions And Procedures: sqroot factor longshl longshr longdiv longmul abslong absint - 48 - sqroot (unit MGMATH) ____________________________________________________________ Synopsis: function mgmath.sqroot(n: word): word; Description: This function calculate the square root value of one word. This function is very fast but value is truncate. Input: n: any number. Output: function result = square root of n. factor (unit MGMATH) ____________________________________________________________ Synopsis: function mgmath.factor(i: word): longint; Description: This function calculate the factor of one number. Input: i: number to factories. Output: function result = factor of i. longshl (unit MGMATH) ____________________________________________________________ Synopsis: function mgmath.longshl(n: longint; num: word): longint; Description: This function do a shift left over a 32-BITS long integer using CPU in mgglobal.cpukind. Input: n: number to use. num: number of shift to do. - 49 - Output: function result = n shift left num. See Also: longshr longshr (unit MGMATH) ____________________________________________________________ Synopsis: function mgmath.longshr(n: longint; num: word): longint; Description: This function do a shift right over a 32-BITS long integer using CPU in mgglobal.cpukind. Input: n: number to use. num: number of shift to do. Output: function result = n shift right num. See Also: longshl longdiv (unit MGMATH) ____________________________________________________________ Synopsis: function mgmath.longdiv(n: longint; divisor: longint): longint; Description: This function do a division with two 32-BITS long integer using CPU in mgglobal.cpukind. Input: n: number to be divided. divisor: divisor value. Output: function result = n divided by divisor. See Also: longmul - 50 - longmul (unit MGMATH) ____________________________________________________________ Synopsis: function mgmath.longmul(n, m: longint): longint; Description: This function do a multiplicatition with two 32-BITS long integer using CPU in mgglobal.cpukind. Input: n: first number. m: second number. Output: function result = n multiply by m. See Also: longdiv abslong (unit MGMATH) ____________________________________________________________ Synopsis: function mgmath.abslong(l: longint): longint; Description: This function calculate the absolute value of one longint, for example absolute value of -5 = 5, 5 = 5. This convert negative values to positive values. Input: l: any longint number. Output: function result = absolute value of l. See Also: absint absint (unit MGMATH) ____________________________________________________________ Synopsis: function mgmath.absint(i: integer): integer; Description: - 51 - This function calculate the absolute value of one integer, for example absolute value of -5 = 5, 5 = 5. This convert negative values to positive values. Input: i: any integer number. Output: function result = absolute value of i. See Also: abslong divzero (unit MGMATH) ____________________________________________________________ Synopsis: Const mgmath.divzero: pointer = nil; Description: This constant old address of procedure to be call if a division by zero occur. If this constant = nil no call is done and result return by longdiv are false. - 52 - MGKEYB.TPU ____________________________________________________________ Description: This unit allow you to handle keyboard operations. It can disable keyboard, getkey, disable special key such as pause, etc. It also allow you to install one hook to received key pressed. All function here that use a loop until give cpu time to multitasker automatically if MGTASKER as detect a multi-tasking environnement at initialization time. Language Used: coded in ASSEMBLER. Linked With: nothing. Example File: 'MGPAS015.PAS' this file give you an example that use all functions and procedures of this unit. Constants: usectrlbreakhook ctrlbreakhook keyhookstatus hookkeyboard Types: kbhookproc breakproc Functions And Procedures: keycodeput keystringput iskeybextend breakactive printscreen isprntscr isreboot ispause setscrolllock setnumlock setins setcapslock scrolllockdown numlockdown capslockdown - 53 - altkeydown inskeydown ctrlkeydown rightshiftdown leftshiftdown clearscrolllock clearnumlock clearins clearcapslock capslockactive scrollockactive numlockactive insactive getkey getlastkey setkeydelay getekey iskeypressed keyboardenable keyboarddisable clearkeybuffer freshkey Other: keycodes1 keycodes2 keycodes3 keycodes4 keycodes5 keycodes6 keycodes7 kbhookproc (unit MGKEYB) ____________________________________________________________ Synopsis: mgkeyb.kbhookproc = procedure ; Description: Type use to declare hook procedure. - 54 - breakproc (unit MGKEYB) ____________________________________________________________ Synopsis: mgkeyb.breakproc = procedure ; Description: Type use to declare break replacement procedure. usectrlbreakhook (unit MGKEYB) ____________________________________________________________ Synopsis: Const mgkeyb.usectrlbreakhook: boolean = false; Description: If this constant is set to true than newbreakproc is call each time break-key is pressed if hook as been installed. This constant activated or desactived temporary break-handler, when break-handler as been installed. (see example file) ctrlbreakhook (unit MGKEYB) ____________________________________________________________ Synopsis: Const mgkeyb.ctrlbreakhook: breakproc = nil; Description: If usenewbreakproc is set to true a call is made at this address. Where we expect to find a FAR procedure. keyhookstatus (unit MGKEYB) ____________________________________________________________ Synopsis: Const mgkeyb.keyhookstatus: boolean = false; Description: - 55 - If this constant is set to true each time a key is pressed hookkeyboard is called. keykeyboard (unit MGKEYB) ____________________________________________________________ Synopsis: Const mgkeyb.hookkeyboard: kbhookproc = nil; Description: if keyhookstatus is set to true and a key is pressed, a call is produce at this address. keycodes1 (unit MGKEYB) ____________________________________________________________ Synopsis: Description: This is all the keycodes availables part 1 of 7. keyaa = $1e61 code for A keya = $1e41 code for a keyctrla = $1e01 code for ^a keyalta = $1e00 code for alt a keybb = $3062 code for B keyb = $3042 code for b keyctrlb = $3002 code for ^b keyaltb = $3000 code for alt b keycc = $2e63 code for C keyc = $2e43 code for c keyctrlc = $2e03 code for ^c keyaltc = $2e00 code for alt c keydd = $2064 code for D keyd = $2044 code for d keyctrld = $2004 code for ^d keyaltd = $2000 code for alt d keyee = $1265 code for E keye = $1245 code for e keyctrle = $1205 code for ^e keyalte = $1200 code for alt e keyff = $2166 code for F keyf = $2146 code for f keyctrlf = $2106 code for ^f - 56 - keyaltf = $2100 code for alt f keygg = $2267 code for G keyg = $2247 code for g keyctrlg = $2207 code for ^g keyaltg = $2200 code for alt g keyhh = $2368 code for H keyh = $2348 code for h keyctrlh = $2308 code for ^h keyalth = $2300 code for alt h keyii = $1769 code for I keyi = $1749 code for i keyctrli = $1709 code for ^i keyalti = $1700 code for alt i keyjj = $246a code for J keyj = $244a code for j keyctrlj = $240a code for ^j keyaltj = $2400 code for alt j See Also: keycodes2 keycodes3 keycodes4 keycodes5 keycodes6 keycodes7 keycodes2 (unit MGKEYB) ____________________________________________________________ Synopsis: Description: This is all the keycodes availables part 2 of 7. keykk = $256b code for K keyk = $254b code for k keyctrlk = $250b code for ^k keyaltk = $2500 code for alt k keyll = $266c code for L keyl = $264c code for l keyctrll = $260c code for ^l keyaltl = $2600 code for alt l keymm = $326d code for M keym = $324d code for m keyctrlm = $320d code for ^m keyaltm = $3200 code for alt m keynn = $316e code for N keyn = $314e code for n keyctrln = $310e code for ^n keyaltn = $3100 code for alt n keyoo = $186f code for O - 57 - keyo = $184f code for o keyctrlo = $180f code for ^o keyalto = $1800 code for alt o keypp = $1970 code for P keyp = $1950 code for p keyctrlp = $1910 code for ^p keyaltp = $1900 code for alt p keyqq = $1071 code for Q keyq = $1051 code for q keyctrlq = $1011 code for ^q keyaltq = $1000 code for alt q keyrr = $1372 code for R keyr = $1352 code for r keyctrlr = $1312 code for ^r keyaltr = $1300 code for alt r keyss = $1f73 code for S keys = $1f53 code for s keyctrls = $1f13 code for ^s keyalts = $1f00 code for alt s See Also: keycodes1 keycodes3 keycodes4 keycodes5 keycodes6 keycodes7 keycodes3 (unit MGKEYB) ____________________________________________________________ Synopsis: Description: This is all the keycodes availables part 3 of 7. keytt = $1474 code for T keyt = $1454 code for t keyctrlt = $1414 code for ^t keyaltt = $1400 code for alt t keyuu = $1675 code for U keyu = $1655 code for u keyctrlu = $1615 code for ^u keyaltu = $1600 code for alt u keyvv = $2f76 code for V keyv = $2f56 code for v keyctrlv = $2f16 code for ^v keyaltv = $2f00 code for alt v keyww = $1177 code for W keyw = $1157 code for w keyctrlw = $1117 code for ^w keyaltw = $1100 code for alt w - 58 - keyxx = $2d78 code for X keyx = $2d58 code for x keyctrlx = $2d18 code for ^x - keyaltx = $2d00 code for alt x keyyy = $1579 code for Y keyy = $1559 code for y keyctrly = $1519 code for ^y keyalty = $1500 code for alt y keyzz = $2c7a code for Z keyz = $2c5a code for z keyctrlz = $2c1a code for ^z keyaltz = $2c00 code for alt z key1 = $0231 code for 1 keypad1 = $4f31 code for shf 1 number pad keyalt1 = $7800 code for alt 1 key2 = $0332 code for 2 keypad2 = $5032 code for shf 2 number pad keyalt2 = $7900 code for alt 2 keyctrl2 = $0300 code for ^1 (nul) key3 = $0433 code for 3 keypad3 = $5133 code for shf 3 number pad keyalt3 = $7a00 code for alt 3 See Also: keycodes1 keycodes2 keycodes4 keycodes5 keycodes6 keycodes7 keycodes4 (unit MGKEYB) ____________________________________________________________ Synopsis: Description: This is all the keycodes availables part 4 of 7. key4 = $0534 code for 4 keypad4 = $4b34 code for shf 4 number pad keyalt4 = $7b00 code for alt 4 key5 = $0635 code for 5 keypad5 = $4c35 code for shf 5 number pad keyalt5 = $7c00 code for alt 5 key6 = $0736 code for 6 keypad6 = $4d36 code for shf 6 number pad keyctrl6 = $071e code for ^6 (rs) keyalt6 = $7d00 code for alt 6 key7 = $0837 code for 7 keypad7 = $4737 code for shf 7 number pad keyalt7 = $7e00 code for alt 7 - 59 - key8 = $0938 code for 8 keypad8 = $4838 code for shf 8 number pad keyalt8 = $7f00 code for alt 8 key9 = $0a39 code for 9 keypad9 = $4939 code for shf 9 number pad keyalt9 = $8000 code for alt 9 key0 = $0b30 code for 0 keypad0 = $5230 code for shf 0 number pad keyalt0 = $8100 code for alt 0 keyless = $333c code for < keygreat = $343e code for > keyminus = $352d code for - keygrayminus = $4a2d code for - keyctrlminus = $0c1f code for ^- keyaltminus = $8200 code for alt - keyshiftgrayminus= $4a2d code for shf - keyplus = $1a2b code for + keygrayplus = $4e2b code for + keywitheplus = $0d2b code for + keyshiftgrayplus = $4e2b code for shf + keyequal = $0d3d code for = keyaltequal = $8300 code for alt = keyslash = $352f code for / keybackslash = $2b5c code for \ keyctrlbackslash = $2b1c code for ^\ See Also: keycodes1 keycodes2 keycodes3 keycodes5 keycodes6 keycodes7 keycodes5 (unit MGKEYB) ____________________________________________________________ Synopsis: Description: This is all the keycodes availables part 5 of 7. keyopenbrak = $1a5b code for [ keyctrlopenbrak = $1a1b code for ^[ keyclosebrak = $1b5d code for ] keyctrlclosebrak = $1b1d code for ^] keyopenparenth = $0a28 code for ( keycloseparenth = $0b29 code for ) keyopenbrace = $1a7b code for keyclosebrace = $1b7d code for keyapostrophe = $2827 code for ' keygrave = $2960 code for ` - 60 - keyquote = $2822 code for " keytilde = $297e code for ~ keycater = $075e code for ^ keysemicolon = $273b code for ; keycomma = $332c code for , keycolon = $273a code for : keyperiod = $342e code for . keyshiftperiod = $532e code for shift . number pad keygrayasterisk = $372a code for * keywitheasterisk = $1a2a code for * keyexclpoint = $0221 code for ! keyquestionmark = $353f code for ? keynumbersign = $0423 code for # keydollar = $0524 code for $ keypercent = $0625 code for % keyampersand = $0826 code for & keyat = $0340 code for @ keyunitseparator = $0c5f code for _ keyvertical = $2b7c code for | keyspace = $3920 code for space bar keyf1 = $3b00 code for f1 keyshiftf1 = $5400 code for shift f1 keyctrlf1 = $5e00 code for ^f1 keyaltf1 = $6800 code for alt f1 keyf2 = $3c00 code for f2 keyshiftf2 = $5500 code for shift f2 keyctrlf2 = $5f00 code for ^f2 keyaltf2 = $6900 code for alt f2 See Also: keycodes1 keycodes2 keycodes3 keycodes4 keycodes6 keycodes7 keycodes6 (unit MGKEYB) ____________________________________________________________ Synopsis: Description: This is all the keycodes availables part 6 of 7. keyf3 = $3d00 code for f3 keyshiftf3 = $5600 code for shift f3 keyctrlf3 = $6000 code for ^f3 keyaltf3 = $6a00 code for alt f3 keyf4 = $3e00 code for f4 keyshiftf4 = $5700 code for shift f4 keyctrlf4 = $6100 code for ^f4 - 61 - keyaltf4 = $6b00 code for alt f4 keyf5 = $3f00 code for f5 keyshiftf5 = $5800 code for shift f5 keyctrlf5 = $6200 code for ^f5 keyaltf5 = $6c00 code for alt f5 keyf6 = $4000 code for f6 keyshiftf6 = $5900 code for shift f6 keyctrlf6 = $6300 code for ^f6 keyaltf6 = $6d00 code for alt f6 keyf7 = $4100 code for f7 keyshiftf7 = $5a00 code for shift f7 keyctrlf7 = $6400 code for ^f7 keyaltf7 = $6e00 code for alt f7 keyf8 = $4200 code for f8 keyshiftf8 = $5b00 code for shift f8 keyctrlf8 = $6500 code for ^f8 keyaltf8 = $6f00 code for alt f8 keyf9 = $4300 code for f9 keyshiftf9 = $5c00 code for shift f9 keyctrlf9 = $6600 code for ^f9 keyaltf9 = $7000 code for alt f9 keyf10 = $4400 code for f10 keyshiftf10 = $5d00 code for shift f10 keyctrlf10 = $6700 code for ^f10 keyaltf10 = $7100 code for alt f1\0 keyup = $4800 code for up keydown = $5000 code for down keyleft = $4b00 code for left keyctrlleft = $7300 code for ^left keyright = $4d00 code for right keyctrlright = $7400 code for ^right See Also: keycodes1 keycodes2 keycodes3 keycodes4 keycodes5 keycodes7 keycodes7 (unit MGKEYB) ____________________________________________________________ Synopsis: Description: This is all the keycodes availables part 7 of 7. keyhome = $4700 code for home keyctrlhome = $7700 code for ^home keyend = $4f00 code for end keyctrlend = $7500 code for ^end - 62 - keypgup = $4900 code for pg up keyctrlpgup = $8400 code for ^pg up keypgdown = $5100 code for pg dn keyctrlpgdown = $7600 code for ^pg dn keyesc = $011b code for esc keyenter = $1c0d code for return keyctrlenter = $1c0a code for ^enter keybackspace = $0e08 code for backspace keyctrlbackspace = $0e7f code for^backspace keytab = $0f09 code for tab keyshift_tab = $0f00 code for shift tab keyins = $5200 code for insert keydel = $5300 code for delete keyctrlprtsc = $7200 code for ^prtsc keyctrlbreak = $0000 code for ^break See Also: keycodes1 keycodes2 keycodes3 keycodes4 keycodes5 keycodes6 keycodeput (unit MGKEYB) ____________________________________________________________ Synopsis: function mgkeyb.keycodeput(key: word): boolean; Description: This function store one key code into keyboard buffer. This function simulate a key pressed. If keyboard buffer is full this function return false else it return true and key as been insert. Input: key: keycode to insert into keyboard buffer. Output: function result = true if character as been accepted. keystringput (unit MGKEYB) ____________________________________________________________ Synopsis: function mgkeyb.keystringput(s: string): word; Description: - 63 - This function store one string into keyboard buffer. This function return the number of character transfert from string to keyboard buffer. Input: s: string of characters. Output: function result = number of characters transfert. iskeybextend (unit MGKEYB) ____________________________________________________________ Synopsis: function mgkeyb.iskeybextend: boolean; Description: This function test the keyboard to determine if it is an extended keyboard or a normal keyboard. Input: nothing. Output: function result = true if keyboard is extended. breakactive (unit MGKEYB) ____________________________________________________________ Synopsis: function mgkeyb.breakactive: boolean; Description: This function return true if break as been pressed. Input: nothing. Output: function result = true if break pressed. - 64 - printscreen (unit MGKEYB) ____________________________________________________________ Synopsis: procedure mgkeyb.printscreen; Description: This function execute print screen, because print screen interrupt is intercept you can't call interrupt 05 to execute a print screen. Input: nothing. Output: nothing. isprntscr (unit MGKEYB) ____________________________________________________________ Synopsis: function mgkeyb.isprntscr: boolean; Description: This function return true if print screen key as been pressed. Input: nothing. Output: function result = true if print screen key pressed. isreboot (unit MGKEYB) ____________________________________________________________ Synopsis: function mgkeyb.isreboot: boolean; Description: This function return true if ctrl-alt-del (reboot) as been pressed. Input: nothing. - 65 - Output: function result = true if reboot key pressed. ispause (unit MGKEYB) ____________________________________________________________ Synopsis: function mgkeyb.ispause: boolean; Description: This function return true if pause key as been pressed. Input: nothing. Output: function result = true if pause key pressed. setscrolllock (unit MGKEYB) ____________________________________________________________ Synopsis: procedure mgkeyb.setscrolllock; Description: This procedure set scroll lock on. Input: nothing. Output: nothing. setnumlock (unit MGKEYB) ____________________________________________________________ Synopsis: procedure mgkeyb.setnumlock; Description: This procedure set num lock on. Input: - 66 - nothing. Output: nothing. setins (unit MGKEYB) ____________________________________________________________ Synopsis: procedure mgkeyb.setins; Description: This procedure set insert on. Input: nothing. Output: nothing. setcapslock (unit MGKEYB) ____________________________________________________________ Synopsis: procedure mgkeyb.setcapslock; Description: This procedure set capslock on. Input: nothing. Output: nothing. scrolllockdown (unit MGKEYB) ____________________________________________________________ Synopsis: function mgkeyb.scrolllockdown: boolean; Description: This function test scroll lock down status, this function return true if scroll lock is down, else it return - 67 - false. Input: nothing. Output: function result = true if status = activated, else false. numlockdown (unit MGKEYB) ____________________________________________________________ Synopsis: function mgkeyb.numlockdown: boolean; Description: This function test num lock down status, this function return true if numlock is down, else it return false. Input: nothing. Output: function result = true if status = activated, else false. capslockdown (unit MGKEYB) ____________________________________________________________ Synopsis: function mgkeyb.capslockdown: boolean; Description: This function test caps lock key down status, this function return true if caps lock down, else it return false. Input: nothing. Output: function result = true if status = activated, else false. - 68 - altkeydown (unit MGKEYB) ____________________________________________________________ Synopsis: function mgkeyb.altkeydown: boolean; Description: This function test alt key down status, this function return true if altkey is down, else it return false. Input: nothing. Output: function result = true if status = activated, else false. inskeydown (unit MGKEYB) ____________________________________________________________ Synopsis: function mgkeyb.inskeydown: boolean; Description: This function test insert key down status, this function return true if insert is down, else it return false. Input: nothing. Output: function result = true if status = activated, else false. ctrlkeydown (unit MGKEYB) ____________________________________________________________ Synopsis: function mgkeyb.ctrlkeydown: boolean; Description: This function test ctrl key down status, this function return true if ctrl key is down, else it return false. Input: nothing. - 69 - Output: function result = true if status = activated, else false. rightshiftdown (unit MGKEYB) ____________________________________________________________ Synopsis: function mgkeyb.rightshiftdown: boolean; Description: This function test right shift down status, this function return true if right shift is down, else it return false. Input: nothing. Output: function result = true if status = activated, else false. leftshiftdown (unit MGKEYB) ____________________________________________________________ Synopsis: function mgkeyb.leftshiftdown: boolean; Description: This function test left shift down status, this function return true if left shift is down, else it return false. Input: nothing. Output: function result = true if status = activated, else false. clearscrolllock (unit MGKEYB) ____________________________________________________________ Synopsis: procedure mgkeyb.clearscrolllock; Description: This procedure desactivated scroll lock. - 70 - Input: nothing. Output: nothing. clearnumlock (unit MGKEYB) ____________________________________________________________ Synopsis: procedure mgkeyb.clearnumlock; Description: This procedure desactivated num lock. Input: nothing. Output: nothing. clearins (unit MGKEYB) ____________________________________________________________ Synopsis: procedure mgkeyb.clearins; Description: This procedure desactivated insert. Input: nothing. Output: nothing. clearcapslock (unit MGKEYB) ____________________________________________________________ Synopsis: procedure mgkeyb.clearcapslock; Description: This procedure desactivated capitalize lock. - 71 - Input: nothing. Output: nothing. capslockactive (unit MGKEYB) ____________________________________________________________ Synopsis: function mgkeyb.capslockactive: boolean; Description: This function test caps lock on status, this function return true if caps lock is on, else it return false. Input: nothing. Output: function result = true if status = activated, else false. scrollockactive (unit MGKEYB) ____________________________________________________________ Synopsis: function mgkeyb.scrollockactive: boolean; Description: This function test scrolllock on status, this function return true if scroll lock is on, else it return false. Input: nothing. Output: function result = true if status = activated, else false. - 72 - numlockactive (unit MGKEYB) ____________________________________________________________ Synopsis: function mgkeyb.numlockactive: boolean; Description: This function test num lock status this function return true if num lock is on, else it return false. Input: nothing. Output: function result = true if status = activated, else false. inskeyactive (unit MGKEYB) ____________________________________________________________ Synopsis: function mgkeyb.insactive: boolean; Description: This function test insert status this function return true if insert is activated, else it return false. Input: nothing. Output: function result = true if status = activated, else false. getkey (unit MGKEYB) ____________________________________________________________ Synopsis: function mgkeyb.getkey: word; Description: This function return one key from keyboard buffer and wait if no key present. Input: nothing. - 73 - Output: function result = key code. See Also: getekey getlastkey (unit MGKEYB) ____________________________________________________________ Synopsis: function mgkeyb.getlastkey: word; Description: This function return the last key remove from buffer. Input: nothing. Output: function result = key code or $FF if buffer was empty. setkeydelay (unit MGKEYB) ____________________________________________________________ Synopsis: procedure mgkeyb.setkeydelay(d: word); Description: This procedure change the keyboard delay rate. Input: d: new delay in milliseconds. Output: nothing. getekey (unit MGKEYB) ____________________________________________________________ Synopsis: function mgkeyb.getekey: word; Description: This function return a key from extended keyboard. - 74 - Input: nothing. Output: function result = key code. See Also: getkey iskeypressed (unit MGKEYB) ____________________________________________________________ Synopsis: function mgkeyb.iskeypressed: boolean; Description: This function test for keyboard buffer empty, this function return true if keyboard buffer is NOT empty, else it return false. Input: nothing. Output: function result = true if keyboard buffer is NOT empty. keyboarddisable (unit MGKEYB) ____________________________________________________________ Synopsis: procedure mgkeyb.keyboardenable; Description: This procedure enable keyboard operations. Input: nothing. Output: nothing. See Also: keyboarddisable - 75 - keyboarddisable (unit MGKEYB) ____________________________________________________________ Synopsis: procedure mgkeyb.keyboarddisable; Description: This procedure disable keyboard operations. Input: nothing. Output: nothing. See Also: keyboardenable clearkeybuffer (unit MGKEYB) ____________________________________________________________ Synopsis: procedure mgkeyb.clearkeybuffer; Description: This procedure clear any key inside keyboard buffer, buffer is then empty. Input: nothing. Output: nothing. freshkey (unit MGKEYB) ____________________________________________________________ Synopsis: function mgkeyb.freshkey: word; Description: This function clear the keyboard buffer and then get a key from keyboard buffer. Input: nothing. - 76 - Output: function result = keycode get. MGFILHDL.TPU ____________________________________________________________ Description: This unit implemented file access functions. These functions are good replacement for Pascal read, write, blockwrite, etc, but it doesn't support textfile. These function work with DOS handles so it work only on DOS 2.0+ Language Used: coded in ASSEMBLER. Linked With: nothing. Example File: 'MGPAS011.PAS' this file give you an example that use all functions and procedures of this unit. Constants: fsucces freadeof fnomorememory ffilenotfound fpathnotfound ftoomanyfile faccessdenied finvalidehandle fnomorefile fdrivenotready fdatacrcerror fseekerror funknowmediumtype fsectornotfound fgeneralfailure fsharingviolation flockviolation finvalidediskchange ffilealreadyopen foutofresssources ftemporary fpermission finternal fhardware - 77 - fsoftfailure fapplicationprgerror fobjectnotfound fobjectinvalide fobjectinterlocked fmedia fcollision fother fretry fpauseretry fasknewinput fabort fimediatabort fignore faskuser funknow fblockdevice fnetwork fserialdevice fmemory areadonly ahiden asystem avolumelabel adirectory aarchive mreadonly mwriteonly mreadwrite compatibility denyall denywrite denyread denynone notinherit Types: tfileptr tfile Functions And Procedures: fcreate fcreatenew fopen fclose fread freadbyte fwrite fwritebyte fseekend fseekstart fseek fseekeof fseekpos - 78 - ftrunc fflush flock funlock fpos fsize feof fgetattr fsetattr fsettime fsetdate fgettime fgetdate fsucces (unit MGFILHDL) ____________________________________________________________ Synopsis: Const mgfilhdl.fsucces = $00; Description: Error type: No error occur. freadeof (unit MGFILHDL) ____________________________________________________________ Synopsis: Const mgfilhdl.freadeof = $54; Description: Error type: Try to read pass end of file. fnomorememory (unit MGFILHDL) ____________________________________________________________ Synopsis: Const mgfilhdl.fnomorememory = $55; Description: Error type: Need more memory. - 79 - ffilenotfound (unit MGFILHDL) ____________________________________________________________ Synopsis: Const mgfilhdl.ffilenotfound = $02; Description: Error type: File not found. fpathnotfound (unit MGFILHDL) ____________________________________________________________ Synopsis: Const mgfilhdl.fpathnotfound = $03; Description: Error type: Path not found. ftoomanyfile (unit MGFILHDL) ____________________________________________________________ Synopsis: Const mgfilhdl.ftoomanyfile = $04; Description: Error type: Too many open files (no handles left). faccessdenied (unit MGFILHDL) ____________________________________________________________ Synopsis: Const mgfilhdl.faccessdenied = $05; Description: Error type: Access denied. - 80 - finvalidehandle (unit MGFILHDL) ____________________________________________________________ Synopsis: Const mgfilhdl.finvalidehandle = $06; Description: Error type: Invalid handle. fnomorefile (unit MGFILHDL) ____________________________________________________________ Synopsis: Const mgfilhdl.fnomorefile = $12; Description: Error type: No more files. fdrivenotready (unit MGFILHDL) ____________________________________________________________ Synopsis: Const mgfilhdl.fdrivenotready = $15; Description: Error type: Drive not ready. fdatacrcerror (unit MGFILHDL) ____________________________________________________________ Synopsis: Const mgfilhdl.fdatacrcerror = $17; Description: Error type: CRC error. - 81 - fseekerror (unit MGFILHDL) ____________________________________________________________ Synopsis: Const mgfilhdl.fseekerror = $19; Description: Error type: Seek error. funknowmediumtype (unit MGFILHDL) ____________________________________________________________ Synopsis: Const mgfilhdl.funknowmediumtype = $1a; Description: Error type: Unknown media type. fsectornotfound (unit MGFILHDL) ____________________________________________________________ Synopsis: Const mgfilhdl.fsectornotfound = $1b; Description: Error type: Sector not found. fgeneralfailure (unit MGFILHDL) ____________________________________________________________ Synopsis: Const mgfilhdl.fgeneralfailure = $1f; Description: Error type: General failure. - 82 - fsharingviolation (unit MGFILHDL) ____________________________________________________________ Synopsis: Const mgfilhdl.fsharingviolation = $20; Description: Error type: Sharing violation. flockviolation (unit MGFILHDL) ____________________________________________________________ Synopsis: Const mgfilhdl.flockviolation = $21; Description: Error type: Lock violation. finvalidediskchange (unit MGFILHDL) ____________________________________________________________ Synopsis: Const mgfilhdl.finvalidediskchange = $22; Description: Error type: Invalid disk change. ffilealreadyopen (unit MGFILHDL) ____________________________________________________________ Synopsis: Const mgfilhdl.ffilealreadyopen = $50; Description: Error type: Try to open an already opened file. - 83 - foutofressources (unit MGFILHDL) ____________________________________________________________ Synopsis: Const mgfilhdl.foutofresssources = $01; Description: Error type: Out of resource, out of space, channel, etc. ftemporary (unit MGFILHDL) ____________________________________________________________ Synopsis: Const mgfilhdl.ftemporary = $02; Description: Error type: Temporary situation, not an error, ex: file lock. fpermission (unit MGFILHDL) ____________________________________________________________ Synopsis: Const mgfilhdl.fpermission = $03; Description: Error type: Authorization, permission denied. finternal (unit MGFILHDL) ____________________________________________________________ Synopsis: Const mgfilhdl.finternal = $04; Description: Error type: Internal, system detected internal error. - 84 - fhardware (unit MGFILHDL) ____________________________________________________________ Synopsis: Const mgfilhdl.fhardware = $05; Description: Error type: Hardware failure, serious problem related to hardware. fsoftfailure (unit MGFILHDL) ____________________________________________________________ Synopsis: Const mgfilhdl.fsoftfailure = $06; Description: Error type: System failure, ex: invalid configuration. fapplicationprgerror (unit MGFILHDL) ____________________________________________________________ Synopsis: Const mgfilhdl.fapplicationprgerror = $07; Description: Error type: Application error, inconsistent request. fobjectnotfound (unit MGFILHDL) ____________________________________________________________ Synopsis: Const mgfilhdl.fobjectnotfound = $08; Description: Error type: Not found, file/item not found. - 85 - fobjectinvalide (unit MGFILHDL) ____________________________________________________________ Synopsis: Const mgfilhdl.fobjectinvalide = $09; Description: Error type: Bad format, file/item in invalid format. fobjectinterlocked (unit MGFILHDL) ____________________________________________________________ Synopsis: Const mgfilhdl.fobjectinterlocked = $0a; Description: Error type: Locked, file/item interlocked. fmedia (unit MGFILHDL) ____________________________________________________________ Synopsis: Const mgfilhdl.fmedia = $0b; Description: Error type: Media failure, ECC/CRC error, wrong or bad disk. fcollision (unit MGFILHDL) ____________________________________________________________ Synopsis: Const mgfilhdl.fcollision = $0c; Description: Error type: Already exists, collision with existing item. - 86 - fother (unit MGFILHDL) ____________________________________________________________ Synopsis: Const mgfilhdl.fother = $0d; Description: Error type: Unknown, classification doesn't exist or is inappropriate. fretry (unit MGFILHDL) ____________________________________________________________ Synopsis: Const mgfilhdl.fretry = $01; Description: Error type: Retry, attempt a few more times and re-prompt. fpauseretry (unit MGFILHDL) ____________________________________________________________ Synopsis: Const mgfilhdl.fpauseretry = $02; Description: Error type: Delay retry, retry a few more times after a pause. fasknewinput (unit MGFILHDL) ____________________________________________________________ Synopsis: Const mgfilhdl.fasknewinput = $03; Description: Error type: Re-enter input, prompt user to re-enter - 87 - input. fabort (unit MGFILHDL) ____________________________________________________________ Synopsis: Const mgfilhdl.fabort = $04; Description: Error type: Abort with cleanup, orderly abort and shutdown. fimediatabort (unit MGFILHDL) ____________________________________________________________ Synopsis: Const mgfilhdl.fimediatabort = $05; Description: Error type: Immediate abort, exit immediately without cleanup. fignore (unit MGFILHDL) ____________________________________________________________ Synopsis: Const mgfilhdl.fignore = $06; Description: Error type: Ignore error. - 88 - faskuser (unit MGFILHDL) ____________________________________________________________ Synopsis: Const mgfilhdl.faskuser = $07; Description: Error type: User intervention, retry after user fixes the problem. funknow (unit MGFILHDL) ____________________________________________________________ Synopsis: Const mgfilhdl.funknow = $01; Description: Error type: Source of error is unknown. fblockdevice (unit MGFILHDL) ____________________________________________________________ Synopsis: Const mgfilhdl.fblockdevice = $02; Description: Error type: Source of error is a block device. fnetwork (unit MGFILHDL) ____________________________________________________________ Synopsis: Const mgfilhdl.fnetwork = $03; Description: Error type: Source of error is network. - 89 - fserialdevice (unit MGFILHDL) ____________________________________________________________ Synopsis: Const mgfilhdl.fserialdevice = $04; Description: Error type: Source of error is serial device. fmemory (unit MGFILHDL) ____________________________________________________________ Synopsis: Const mgfilhdl.fmemory = $05; Description: Error type: Source of error is memory. areadonly (unit MGFILHDL) ____________________________________________________________ Synopsis: Const mgfilhdl.areadonly = $01; Description: File attribute: read only. ahiden (unit MGFILHDL) ____________________________________________________________ Synopsis: Const mgfilhdl.ahiden = $02; Description: File attribute: hidden. - 90 - asystem (unit MGFILHDL) ____________________________________________________________ Synopsis: Const mgfilhdl.asystem = $04; Description: File attribute: system. avolumelabel (unit MGFILHDL) ____________________________________________________________ Synopsis: Const mgfilhdl.avolumelabel = $08; Description: File attribute: volume label. adirectory (unit MGFILHDL) ____________________________________________________________ Synopsis: Const mgfilhdl.adirectory = $10; Description: File attribute: directory. aarchive (unit MGFILHDL) ____________________________________________________________ Synopsis: Const mgfilhdl.aarchive = $20; Description: File attribute: archive. - 91 - mreadonly (unit MGFILHDL) ____________________________________________________________ Synopsis: Const mgfilhdl.mreadonly = $00; Description: Open mode: read only mode. mwriteonly (unit MGFILHDL) ____________________________________________________________ Synopsis: Const mgfilhdl.mwriteonly = $01; Description: Open mode: write only mode. mreadwrite (unit MGFILHDL) ____________________________________________________________ Synopsis: Const mgfilhdl.mreadwrite = $02; Description: Open mode: read and write. compatibility (unit MGFILHDL) ____________________________________________________________ Synopsis: Const mgfilhdl.compatibility = $00; Description: Open mode: compatibility mode. - 92 - denyall (unit MGFILHDL) ____________________________________________________________ Synopsis: Const mgfilhdl.denyall = $10; Description: Open mode: deny all (SHARE). denywrite (unit MGFILHDL) ____________________________________________________________ Synopsis: Const mgfilhdl.denywrite = $20; Description: Open mode: deny write (SHARE). denyread (unit MGFILHDL) ____________________________________________________________ Synopsis: Const mgfilhdl.denyread = $30; Description: Open mode: deny read (SHARE). debynone (unit MGFILHDL) ____________________________________________________________ Synopsis: Const mgfilhdl.denynone = $40; Description: Open mode: deny none (SHARE). - 93 - notinherit (unit MGFILHDL) ____________________________________________________________ Synopsis: Const mgfilhdl.notinherit = $80; Description: Open mode: not inherit from previous EXEC. tfileptr (unit MGFILHDL) ____________________________________________________________ Synopsis: mgfilhdl.tfileptr = ^tfile; Description: Pointer of tfile. tfile (unit MGFILHDL) ____________________________________________________________ Synopsis: mgfilhdl.tfile = record Description: This type is used to access a file. This type hold DOS handle, filename, and errorcode. Unlike turbo Pascal, this unit give you an IOresult in each file instead of using a global variable. Fields: handle: word; fname: string... reserved: byte; errcode: word; errclasse: byte; erraction: byte; errsource: byte; - 94 - tfile.handle: word; DOS handle. tfile.fname: string[128] ; file name. tfile.errcode: word; error code. tfile.errclasse: byte; error classe. tfile.erraction: byte; error action. tfile.errsource: byte; error sources. fcreate (unit MGFILHDL) ____________________________________________________________ Synopsis: procedure mgfilhdl.fcreate(f: tfileptr; attr: word); Description: This procedure will create a file. If the file already exist the file is truncate (deleted). The filename must be set in f.fname. If error occur errcode is not equal to fsucces. Input: f: file type variable. attr: attribute of file to created. Output: f.errcode is not equal to fsucess if error occur. See Also: fcreatenew fcreatenew (unit MGFILHDL) ____________________________________________________________ Synopsis: procedure mgfilhdl.fcreatenew(f: tfileptr; attr: word); Description: This procedure is similar to fcreate but if the file already exist, it won't delete the file and return with an error. If error occur errcode is not equal to fsucces. Input: f: file type variable. attr: attribute of file to created. - 95 - Output: f.errcode is not equal to fsucess if error occur. See Also: fcreate fopen (unit MGFILHDL) ____________________________________________________________ Synopsis: procedure mgfilhdl.fopen(f: tfileptr; mode: byte); Description: This procedure open a specific file, if file doesn't already exist this function failed. If error occur errcode is not equal to fsucces. Input: f: file type variable. mode: share mode and write read access. Output: f.errcode is not equal to fsucess if error occur. fclose (unit MGFILHDL) ____________________________________________________________ Synopsis: procedure mgfilhdl.fclose(f: tfileptr); Description: This procedure will close an open file. If error occur errcode is not equal to fsucces. Input: f: file type variable. Output: f.errcode is not equal to fsucess if error occur. - 96 - fread (unit MGFILHDL) ____________________________________________________________ Synopsis: function mgfilhdl.fread(f: tfileptr; buffer: pointer; maxread: word): word; Description: This function is similar to blockread from turbo Pascal, it allow you to read a specific number of bytes from file. function return the number of bytes read. If error occur errcode is not equal to fsucces. Input: f: file type variable. buffer: address of buffer where to save bytes read. maxread: maximum number of bytes to read. Output: f.errcode is not equal to fsucess if error occur. function result = number of bytes read. See Also: fwrite freadbyte (unit MGFILHDL) ____________________________________________________________ Synopsis: function mgfilhdl.freadbyte(f: tfileptr): byte; Description: This function will read one byte from file. If error occur errcode is not equal to fsucces. Input: f: file type variable. Output: f.errcode is not equal to fsucess if error occur. function result = byte read. See Also: fwritebyte - 97 - fwrite (unit MGFILHDL) ____________________________________________________________ Synopsis: function mgfilhdl.fwrite(f: tfileptr; buffer: pointer; maxwrite: word): word; Description: This function is similar to blockwrite from turbo Pascal, it allow you to write a specific number of bytes to file. Function return the number of bytes write. If error occur errcode is not equal to fsucces. Input: f: file type variable. buffer: address of bytes to write. maxwrite: maximum number of bytes to write. Output: f.errcode is not equal to fsucess if error occur. function result = number of bytes written. See Also: fread fwritebyte (unit MGFILHDL) ____________________________________________________________ Synopsis: procedure mgfilhdl.fwritebyte(f: tfileptr; value: byte); Description: This function will write one byte to file. If error occur errcode is not equal to fsucces. Input: f: file type variable. value: byte to write. Output: f.errcode is not equal to fsucess if error occur. See Also: freadbyte - 98 - fseekend (unit MGFILHDL) ____________________________________________________________ Synopsis: procedure mgfilhdl.fseekend(f: tfileptr); Description: This procedure move file pointer to end of file. If error occur errcode is not equal to fsucces. Input: f: file type variable. Output: f.errcode is not equal to fsucess if error occur. See Also: fseek fseekeof fseekpos fseekstart fseekstart (unit MGFILHDL) ____________________________________________________________ Synopsis: procedure mgfilhdl.fseekstart(f: tfileptr); Description: This procedure move file pointer to beginning of file. If error occur errcode is not equal to fsucces. Input: f: file type variable. Output: f.errcode is not equal to fsucess if error occur. See Also: fseek fseekend fseekeof fseekpos - 99 - fseek (unit MGFILHDL) ____________________________________________________________ Synopsis: procedure mgfilhdl.fseek(f: tfileptr; position: longint); Description: This procedure move file pointer from start of file for a specific number of bytes. If error occur errcode is not equal to fsucces. Input: f: file type variable. pos: number of move in bytes. Output: f.errcode is not equal to fsucess if error occur. See Also: fseekend fseekeof fseekpos fseekstart fseekeof (unit MGFILHDL) ____________________________________________________________ Synopsis: procedure mgfilhdl.fseekeof(f: tfileptr; pos: longint); Description: This procedure move file pointer from end of file for a specific number of bytes. If error occur errcode is not equal to fsucces. Input: f: file type variable. pos: number of move in bytes. Output: f.errcode is not equal to fsucess if error occur. See Also: fseek fseekend fseekpos fseekstart - 100 - fseekpos (unit MGFILHDL) ____________________________________________________________ Synopsis: procedure mgfilhdl.fseekpos(f: tfileptr; pos: longint); Description: This procedure move file pointer from current file pos to a specific number of byte from start to end direction. If error occur errcode is not equal to fsucces. Input: f: file type variable. pos: number of move in bytes. Output: f.errcode is not equal to fsucess if error occur. See Also: fseek fseekend fseekeof fseekstart ftrunc (unit MGFILHDL) ____________________________________________________________ Synopsis: procedure mgfilhdl.ftrunc(f: tfileptr; fsize: longint); Description: This procedure truncate file, this allow you to change the size of one file. if error occur errcode is not equal to fsucces. Input: f: file type variable. fsize: truncate file at this position in bytes. Output: f.errcode is not equal to fsucess if error occur. - 101 - fflush (unit MGFILHDL) ____________________________________________________________ Synopsis: procedure mgfilhdl.fflush(f: tfileptr); Description: This procedure will flush DOS file buffer. If error occur errcode is not equal to fsucces. Input: f: file type variable. Output: f.errcode is not equal to fsucess if error occur. flock (unit MGFILHDL) ____________________________________________________________ Synopsis: procedure mgfilhdl.flock(f: tfileptr; startofs: longint; len: longint); Description: This procedure allow you to lock file access at specified position for specified length. This function is useful when your program work in multi-tasking or networking environment and you don't want to give access to your file for a specific number of time. If error occur errcode is not equal to fsucces. Input: f: file type variable. startofs: position of block to lock. len: length of block to lock. Output: f.errcode is not equal to fsucess if error occur. See Also: funlock - 102 - funlock (unit MGFILHDL) ____________________________________________________________ Synopsis: procedure mgfilhdl.funlock(f: tfileptr; startofs: longint; len: longint); Description: This procedure will unlock file access at specified position for specified length. File must have been lock using flock. If error occur errcode is not equal to fsucces. Input: f: file type variable. startofs: position of block to unlock. len: length of block to unlock. Output: f.errcode is not equal to fsucess if error occur. See Also: flock fpos (unit MGFILHDL) ____________________________________________________________ Synopsis: function mgfilhdl.fpos(f: tfileptr): longint; Description: This function will return the position of file pointer in file. If error occur errcode is not equal to fsucces. Input: f: file type variable. Output: f.errcode is not equal to fsucess if error occur. function result = position in file. - 103 - fsize (unit MGFILHDL) ____________________________________________________________ Synopsis: function mgfilhdl.fsize(f: tfileptr): longint; Description: This function return the size of file. If error occur errcode is not equal to fsucces. Input: f: file type variable. Output: f.errcode is not equal to fsucess if error occur. function result = file size. feof (unit MGFILHDL) ____________________________________________________________ Synopsis: function mgfilhdl.feof(f: tfileptr): boolean; Description: This function test the end of file status, if this function return true it mean your are at end of file and can't read more bytes. If error occur errcode is not equal to fsucces. Input: f: file type variable. Output: f.errcode is not equal to fsucess if error occur. function result = true if currently at end of file. fgetattr (unit MGFILHDL) ____________________________________________________________ Synopsis: function mgfilhdl.fgetattr(f: tfileptr): word; Description: This function return attribute of file. If error occur errcode is not equal to fsucces. - 104 - Input: f: file type variable. Output: f.errcode is not equal to fsucess if error occur. function result = file attributs. See Also: fsetattr fsetattr (unit MGFILHDL) ____________________________________________________________ Synopsis: procedure mgfilhdl.fsetattr(f: tfileptr; attr: word); Description: This procedure change the attribute of file. If error occur errcode is not equal to fsucces. Input: f: file type variable. attr: new attributs to stamp. Output: f.errcode is not equal to fsucess if error occur. See Also: fgetattr fsettime (unit MGFILHDL) ____________________________________________________________ Synopsis: procedure mgfilhdl.fsettime(f: tfileptr; time: word); Description: This procedure change the time of file. If error occur errcode is not equal to fsucces. Input: f: file type variable. time: new time to stamp. Output: f.errcode is not equal to fsucess if error occur. See Also: fgetdate - 105 - fgettime fsetdate fsetdate (unit MGFILHDL) ____________________________________________________________ Synopsis: procedure mgfilhdl.fsetdate(f: tfileptr; date: word); Description: This procedure change the date of file. If error occur errcode is not equal to fsucces. Input: f: file type variable. date: new date to stamp. Output: f.errcode is not equal to fsucess if error occur. See Also: fgetdate fgettime fsettime fgettime (unit MGFILHDL) ____________________________________________________________ Synopsis: function mgfilhdl.fgettime(f: tfileptr): word; Description: This function return the time of file. If error occur errcode is not equal to fsucces. Input: f: file type variable. Output: f.errcode is not equal to fsucess if error occur. function result = filetime. See Also: fgetdate fsetdate fsettime - 106 - fgetdate (unit MGFILHDL) ____________________________________________________________ Synopsis: function mgfilhdl.fgetdate(f: tfileptr): word; Description: This function return the date of file. If error occur errcode is not equal to fsucces. Input: f: file type variable. Output: f.errcode is not equal to fsucess if error occur. function result = filedate. See Also: fgettime fsetdate fsettime - 107 - MGFILES.TPU ____________________________________________________________ Description: This unit give you access to miscellaneous files functions like encrypt files, split, etc. Language Used: coded in PASCAL. Linked With: MGSTRING, MGFILHDL. Example File: 'MGPAS010.PAS' this file give you an example that use all functions and procedures of this unit. Types: findfileptr tfindfile Functions And Procedures: fencrypt fdecrypt fsplit fwild fexist frename ferase findfirst findnext findfileptr (unit MGFILES) ____________________________________________________________ Synopsis: mgfiles.findfileptr = ^tfindfile; Description: Pointer of tfindfile. - 108 - tfindfile (unit MGFILES) ____________________________________________________________ Synopsis: mgfiles.tfindfile = record Description: This record is equal to dirsearch in DOS.TPU, it is use to return information for find file functions. Fields: reserved: array... findattr: byte; findtime: word; finddate: word; findsize: longint; findname: array... tfindfile.findattr: byte; file attributs. tfindfile.findtime: word; file time. tfindfile.finddate: word; file date. tfindfile.findsize: longint; file size. tfindfile.findname: array[1..13] of char; file name: ASCIIZ string. fencrypt (unit MGFILES) ____________________________________________________________ Synopsis: function mgfiles.fencrypt(filename, key: string): boolean; Description: This procedure allow you to xor encrypt a file. Note, that NO BACKUP file are create. Input: filename: name of file to decrypt. key: decryption key. Output: nothing. - 109 - See Also: fdecrypt fdecrypt (unit MGFILES) ____________________________________________________________ Synopsis: function mgfiles.fdecrypt(filename, key: string): boolean; Description: This procedure allow you to xor decrypt a file. Input: filename: name of file to decrypt. key: decryption key. Output: nothing. See Also: fencrypt fsplit (unit MGFILES) ____________________________________________________________ Synopsis: function mgfiles.fsplit(filename: string; blocksize: word): boolean; Description: This function allow you to split large file into many blocks of specific size. Block are name as: filename.0, filename.1, etc. This function will return false if any error occur, if it work properly this function return true. Input: filename: name of file to split. blocksize: maximum size per block. Output: function result = true if no error occur. - 110 - fwild (unit MGFILES) ____________________________________________________________ Synopsis: function mgfiles.fwild(filename, wildcard: string): boolean; Description: This function test to see if one filename match a specific wildcard, for example: "mark.txt" will match in "*.txt". This function return true if filename match in wildcard, else this function return false. Input: filename: name of file to test. wildcard: wildcard to use for test. Output: function result = true if file match wildcard. fexist (unit MGFILES) ____________________________________________________________ Synopsis: function mgfiles.fexist(filename: string): boolean; Description: This function test existence of specific file. This function use get attribute function from DOS since it one of the fastest method. This function return true if filename exist, else it return false. Input: filename: name of file to search. Output: function result = true if file exist. frename (unit MGFILES) ____________________________________________________________ Synopsis: function mgfiles.frename(oldname, newname: string): boolean; - 111 - Description: This function will rename an existing file to a specific name. This function return true if oldname as been renamed to newname, else it return false. Input: oldname: current name of file to be renamed. newname: change file name to this name. Output: function result = true if file renamed. ferase (unit MGFILES) ____________________________________________________________ Synopsis: function mgfiles.ferase(filename: string): boolean; Description: This function delete a specific file. This function return true if filename as been deleted, else it return false. Input: filename: name of file to be deleted. Output: function result = true if file delete. findfirst (unit MGFILES) ____________________________________________________________ Synopsis: function mgfiles.findfirst(spec: string; attr: word; buffer: findfileptr): boolean; Description: This function is used to find files. It will Find the first matching file with match attribute and specs. If file is not found function return false, else function return true and file information is load into buffer. Note: archive files are always return by this function, except if volume label files are request. So it up to you to determine if file attribute match your request. - 112 - Input: spec: file spec to search example: "*.*" attr: search for attribute. buffer: where data stored if file found/ Output: function result = true if find one file. See Also: findnext findnext (unit MGFILES) ____________________________________________________________ Synopsis: function mgfiles.findnext(buffer: findfileptr): boolean; Description: This function is a complement of findfirst. This function must be call AFTER a call to findfirst, it will search for the next file with the same attributs and specs of findfirst. Input: buffer: this pointer is where we send data if file found. Output: function result = true if find one more file. See Also: findfirst - 113 - MGSTRING.TPU ____________________________________________________________ Description: This unit allow you to handle strings, you will find functions like uppercase, Pascal-to-null, padstring, etc. Language Used: coded in PASCAL AND ASSEMBLER. Linked With: nothing. Example File: 'MGPAS035.PAS' this file give you an example that use all functions and procedures of this unit. Types: chrtableptr chrtable Functions And Procedures: upch upcstr lwch lwcstr null2pascal pascal2null txlat addstr wordcount stringof searchstring padright padleft padbooth padpos overwrite xchgchar deleteright deleteleft deletech remove precede follow sortstr sortstrdec - 114 - chrtableptr (unit MGSTRING) ____________________________________________________________ Synopsis: mgstring.chrtableptr = ^chrtable; Description: A pointer of chrtable. chrtable (unit MGSTRING) ____________________________________________________________ Synopsis: mgstring.chrtable = array[0..255] of char; Description: This type is use to create a table of characters for Xlate function. upch (unit MGSTRING) ____________________________________________________________ Synopsis: function mgstring.upch(c: char): char; inline; Description: This function convert a character to it upper case value. It does the same job as upcase from turbo Pascal crt unit, but this one is very fast. Input: c: character to convert. Output: function result = character convert to uppercase. See Also: lwch - 115 - upcstr (unit MGSTRING) ____________________________________________________________ Synopsis: function mgstring.upcstr(const s: string): string; inline; Description: This function convert a string to it upper case value. This function is very fast because it use inline code. Input: s: string to convert. Output: function result = string convert to uppercase. See Also: lwcstr lwch (unit MGSTRING) ____________________________________________________________ Synopsis: function mgstring.lwch(c: char): char; inline; Description: This function convert a character to it lower case value. This function is a complement of upch. Input: c: character to convert. Output: function result = character convert to lowercase See Also: upch lwcstr (unit MGSTRING) ____________________________________________________________ Synopsis: function mgstring.lwcstr(const s: string): string; inline; - 116 - Description: This function convert a string to it lower case value. This function is very fast because it use inline code. Input: s: string to convert. Output: function result = string convert to lowercase. See Also: upcstr null2Pascal (unit MGSTRING) ____________________________________________________________ Synopsis: function mgstring.null2pascal(s: pointer): string; Description: This function will convert a ASCIIZ (null-terminated) string to a Pascal string format. Input: nstr: address of null string. Output: function result = string convert to Pascal. See Also: Pascal2null Pascal2null (unit MGSTRING) ____________________________________________________________ Synopsis: procedure mgstring.pascal2null(const s: string; n: pointer); Description: This function will convert a Pascal string to an ASCIIZ (null-terminated) string format. Input: s: string in Pascal format. Output: n: string convert to ASCIIZ. - 117 - See Also: null2Pascal txlat (unit MGSTRING) ____________________________________________________________ Synopsis: function mgstring.txlat(const source: string; table: chrtableptr): string; Description: This function will translate a string using a table of 256 characters. This is useful to create an upper case that support international characters. This function WON'T work if source and table are not in the same data segment. If your using static variable this mean table and source must be declared in the same unit. If your are using dynamic variable you must check if seg(var1) = seg(var2). Input: sources: string to be translate. table: table to do translation. Output: function result = string translate. addstr (unit MGSTRING) ____________________________________________________________ Synopsis: procedure mgstring.addstr(var src: string; const s: string); Description: This procedure will append one string at the end of another string. Input: str: any string. s: string to add to. Output: str: new string. - 118 - wordcount (unit MGSTRING) ____________________________________________________________ Synopsis: function mgstring.wordcount(const s: string): integer; Description: This function will calculate and return the number of words into a specific string. Input: s: string to scan. Output: function result = number of word in s. stringof (unit MGSTRING) ____________________________________________________________ Synopsis: function mgstring.stringof(const s: string; length: integer): string; Description: This function return a specific number of character from a specific string. If request length is greater than string length, string is copy more than one time. Characters are get from first character in string to last character. Input: substrg: string where we get character from. length: number of character to get. Output: function result = new string. searchstring (unit MGSTRING) ____________________________________________________________ Synopsis: function mgstring.searchstring(const s, substr: string; start: integer): integer; - 119 - Description: This function will search for a sub string into a string, ignoring case. A specific position can be set to tell where to start searching. If sub string is found then function result is equal to index where sub string as been found, if error occur or match not found, then function result = 0. Input: str: string source. substr: sub string to search. start: where to start in string (str). Output: function result = position where match is found or 0. padright (unit MGSTRING) ____________________________________________________________ Synopsis: procedure mgstring.padright(var s: string; c: char; length: integer); Description: This procedure add character on end of string until string length is equal to length. If string length of s is already greater or equal to length nothing is done. Input: s: string to pad. c: character to add. length: new length string. Output: s: string may have change. See Also: padbooth padleft padpos - 120 - padleft (unit MGSTRING) ____________________________________________________________ Synopsis: procedure mgstring.padleft(var s: string; c: char; length: integer); Description: This procedure add character on beginning of string until string length is equal to length. If string length of s is already greater or equal to length nothing is done. Input: s: string to pad. c: character to add. length: new length string. Output: s: string may have change. See Also: padbooth padpos padright padbooth (unit MGSTRING) ____________________________________________________________ Synopsis: procedure mgstring.padbooth(var s: string; c: char; length: integer); Description: This procedure add character on end of string and beginning of string until string length is equal to length. This is generally used to center a string. If string length of s is already greater or equal to length nothing is done. Input: s: string to pad. c: character to add. length: new length string. Output: s: string may have change. - 121 - See Also: padleft padpos padright padpos (unit MGSTRING) ____________________________________________________________ Synopsis: procedure mgstring.padpos(var s: string; c: char; position, length: integer); Description: This procedure add character at a specific position of string until string length is equal to length. If string length of s is already greater or equal to length nothing is done. Input: s: string to pad. c: character to add. position: position in s where to add character. length: new length string. Output: s: string may have change. See Also: padbooth padleft padright overwrite (unit MGSTRING) ____________________________________________________________ Synopsis: procedure mgstring.overwrite(var s: string; const subs: string; position: integer); Description: This procedure stored a sub string into a source string at a specific position in string. When characters are stored, old character are overwrite. Input: s: source string. subs: subs string to stored. position: position in s where to add subs. - 122 - Output: s: new string. xchgchar (unit MGSTRING) ____________________________________________________________ Synopsis: procedure mgstring.xchgchar(var s: string; search, replace: char); Description: This procedure search and change all characters in one string to a specific character. Input: s: source string. search: character to search. replace: character replacement for search. Output: s: string may have changed. deleteright (unit MGSTRING) ____________________________________________________________ Synopsis: procedure mgstring.deleteright(var s: string; c: char); Description: This procedure delete all characters from right until specific character is found. Input: s: source string. c: character use to stop delete. Output: s: string may have changed. See Also: deleteleft - 123 - deleteleft (unit MGSTRING) ____________________________________________________________ Synopsis: procedure mgstring.deleteleft(var s: string; c: char); Description: This procedure delete all character from left until specific character is found. Input: s: source string. c: character use to stop delete. Output: s: string may have changed. See Also: deleteright deletech (unit MGSTRING) ____________________________________________________________ Synopsis: procedure mgstring.deletech(var s: string; c: char); Description: This procedure delete all specific characters into string a specific string. Input: s: source string. c: character to delete. Output: s: string may have changed. remove (unit MGSTRING) ____________________________________________________________ Synopsis: function mgstring.remove(s: string; const srch: string; index: byte): string; Description: - 124 - This function search for a sub string, if sub string is found it is remove of source string. This function return the new string without the sub string. Input: s: source string. srch: sub string. index: position to start for search in s. Output: function result = new string. precede (unit MGSTRING) ____________________________________________________________ Synopsis: function mgstring.precede(const s, target: string; index: byte): string; Description: This function search for a target string and return all characters that precede this target. Input: s: source string. target: sub string to find. index: position to start for search in s. Output: function result = characters that precede target. See Also: follow follow (unit MGSTRING) ____________________________________________________________ Synopsis: function mgstring.follow(const s, target: string; index: byte): string; Description: This function search for target string and return all characters that follow this target. Input: s: source string. - 125 - target: sub string to find. index: position to start for search in s. Output: function result = characters that follow target. See Also: precede sortstr (unit MGSTRING) ____________________________________________________________ Synopsis: procedure mgstring.sortstr(item: pointer; n: integer); Description: This procedure will sort an array of strings in ascending order. Input: item: address of an array of string. n: number of elements in array. Output: nothing. See Also: sortstrdec sortstrdec (unit MGSTRING) ____________________________________________________________ Synopsis: procedure mgstring.sortstrdec(item: pointer; n: integer); Description: This procedure will sort an array of strings in descending order. Input: item: address of an array of string. n: number of elements in array. Output: nothing. See Also: sortstr - 126 - MGMISC.TPU ____________________________________________________________ Description: This unit include a lot of miscellaneous functions, like functions to get information from bios, functions to access environment variables, get DOS version, check if share is loaded etc. Language Used: coded in PASCAL AND ASSEMBLER. Linked With: MGGLOBAL, MGMEM, MGSTRING. Example File: 'MGPAS020.PAS' this file give you an example that use all functions and procedures of this unit. Types: type0040 type0050 Variables: Bios0040 Bios0050 envseg envofs envsize Functions And Procedures: getintvec setintvec inportb outportb inportw outportw getprgname getprgpath getdoserrormsg isenvvar changeenvvar setturbo farjump dosversion donothing donothingint delayms - 127 - coldboot warmboot getpsp getdosbreakstatus setdosbreakstatus type0040 (unit MGMISC) ____________________________________________________________ Synopsis: mgmisc.type0040 = record Description: This record is used to get bios segment information. Fields: combase: array... lptbase: array... installedhardware: array... post_status: byte; memorysize: word; _reserved1: byte; ps2controlflg: byte; keyboardcontrol: array... alternatekeypadentry: byte; keyboardbufferheadptr: word; keyboardbuffertailptr: word; keyboardbuffer: array... floppyrecalstatus: byte; floppymotorstatus: byte; floppymotoroffcounter: byte; floppyprevopstatus: byte; floppycontrollerstatus: array... displaymode: byte; numberofcolumns: word; regenbufferlength: word; regenbufferaddress: word; cursorposition: array... cursortype: word; currentdisplaypage: byte; videocontrollerbaseaddress: word; current3x8register: byte; current3x9register: byte; infopointer: pointer; _reserved2: byte; timercounter: pointer; timeroverflowflag: byte; breakkeystate: byte; resetflag: word; fixeddiskprevopstatus: byte; - 128 - numberoffixeddrives: byte; fixeddiskdrivecontrol: byte; fixeddiskcontrollerport: byte; lpttimeout: array... comtimeout: array... keybdbufferstartoffsetptr: word; keybdbufferendoffsetptr: word; videorows: byte; characterheight: word; initdelay: byte; videomodeopt: byte; reserved_4: byte; videodisplaydata: byte; reserved_5: byte; lastdiskrate: byte; harddiskstatus: byte; harddiskerror: byte; harddiskintctrl: byte; combhardfloppy: byte; drivemediastate: array... trackseekedtodrive0: byte; trackseekedtodrive1: byte; keyboardmode: byte; keyboardledflg: byte; userwaitflgptr: pointer; userwaittimeoutptr: longint; rtswaitfunctionflg: byte; lanadmachanelflg: byte; lanastatus: array... harddiskintrvec: pointer; biosvideosave: pointer; reserved_6: array... keyboardnmuflgs: byte; keyboardbreakflags: longint; port60singlequeue: byte; lastkey: byte; nmiheadptr: byte; nmitailptr: byte; nmibuffer: array... daycounter: word; reserved_7: array... iac: array... type0040.combase: array[1..4] of word; port number for COM1, COM2, COM3, COM4. type0040.lptbase: array[1..4] of word; port number for LPT1, LPT2. - 129 - type0040.installedhardware: array[1..2] of byte; information about installed hardware byte #1 7 6 5 4 3 2 1 0 40:10 (value in INT 11 register AL) ³ ³ ³ ³ ³ ³ ³ ÀÄ IPL diskette installed ³ ³ ³ ³ ³ ³ ÀÄÄ math coprocessor ³ ³ ³ ³ ÃÄÅÄÄÄ old PC system board RAM < 256K ³ ³ ³ ³ ³ ÀÄÄ pointing device installed (PS/2) ³ ³ ³ ³ ÀÄÄÄ not used on PS/2 ³ ³ ÀÄÁÄÄÄÄ initial video mode ÀÄÁÄÄÄÄÄÄÄ # of diskette drives, less 1 byte #2 7 6 5 4 3 2 1 0 40:11 (value in INT 11 register AH) ³ ³ ³ ³ ³ ³ ³ ÀÄ 0 if DMA installed ³ ³ ³ ³ ÀÄÁÄÁÄÄ number of serial ports ³ ³ ³ ÀÄÄÄÄÄÄÄ game adapter ³ ³ ÀÄÄÄÄÄÄÄÄ not used, internal modem (PS/2) ÀÄÁÄÄÄÄÄÄÄÄÄ number of printer ports type0040.post_status: byte; PCjr: infrared keyboard link error count. type0040.memorysize: word; Memory size in Kbytes. type0040.ps2controlflg: byte; PS/2 BIOS control flags. type0040.keyboardcontrol: array[1..2] of byte; Keyboard flags byte #1 7 6 5 4 3 2 1 0 keyboard flag byte 0 ³ ³ ³ ³ ³ ³ ³ ÀÄÄÄ right shift key depressed ³ ³ ³ ³ ³ ³ ÀÄÄÄÄ left shift key depressed ³ ³ ³ ³ ³ ÀÄÄÄÄÄ CTRL key depressed ³ ³ ³ ³ ÀÄÄÄÄÄÄ ALT key depressed ³ ³ ³ ÀÄÄÄÄÄÄÄ scroll-lock is active ³ ³ ÀÄÄÄÄÄÄÄÄ num-lock is active ³ ÀÄÄÄÄÄÄÄÄÄ caps-lock is active ÀÄÄÄÄÄÄÄÄÄÄ insert is active byte #2 7 6 5 4 3 2 1 0 keyboard flag byte ³ ³ ³ ³ ³ ³ ³ ÀÄÄÄ left CTRL key depressed ³ ³ ³ ³ ³ ³ ÀÄÄÄÄ left ALT key depressed ³ ³ ³ ³ ³ ÀÄÄÄÄÄ system key depressed and held ³ ³ ³ ³ ÀÄÄÄÄÄÄ suspend key has been toggled ³ ³ ³ ÀÄÄÄÄÄÄÄ scroll lock key is depressed ³ ³ ÀÄÄÄÄÄÄÄÄ num-lock key is depressed ³ ÀÄÄÄÄÄÄÄÄÄ caps-lock key is depressed ÀÄÄÄÄÄÄÄÄÄÄ insert key is depressed - 130 - type0040.alternatekeypadentry: byte; Storage for alternate keypad entry. type0040.keyboardbufferheadptr: word; Offset from 40:00 to keyboard buffer head. type0040.keyboardbuffertailptr: word; Offset from 40:00 to keyboard buffer tail. type0040.keyboardbuffer: array[1..16] of word; 32bytes Keyboard buffer. type0040.floppyrecalstatus: byte; Drive recalibration status 7 6 5 4 3 2 1 0 drive recalibration status ³ ³ ³ ³ ³ ³ ³ ÀÄÄ 1=recalibrate drive 0 ³ ³ ³ ³ ³ ³ ÀÄÄÄ 1=recalibrate drive 1 ³ ³ ³ ³ ³ ÀÄÄÄÄ 1=recalibrate drive 2 ³ ³ ³ ³ ÀÄÄÄÄÄ 1=recalibrate drive 3 ³ ÀÄÁÄÁÄÄÄÄÄÄ unused ÀÄÄÄÄÄÄÄÄÄÄÄ 1=working interrupt flag type0040.floppymotorstatus: byte; Diskette motor status 7 6 5 4 3 2 1 0 diskette motor status ³ ³ ³ ³ ³ ³ ³ ÀÄÄ 1=drive 0 motor on ³ ³ ³ ³ ³ ³ ÀÄÄÄ 1=drive 1 motor on ³ ³ ³ ³ ³ ÀÄÄÄÄ 1=drive 2 motor on ³ ³ ³ ³ ÀÄÄÄÄÄ 1=drive 3 motor on ³ ÀÄÁÄÁÄÄÄÄÄÄ unused ÀÄÄÄÄÄÄÄÄÄÄÄ 1=write operation type0040.floppymotoroffcounter: byte; Motor shutoff counter. type0040.floppyprevopstatus: byte; Status of last diskette operation 7 6 5 4 3 2 1 0 status of last diskette operation ³ ³ ³ ³ ³ ³ ³ ÀÄÄÄ invalid diskette command ³ ³ ³ ³ ³ ³ ÀÄÄÄÄ diskette address mark not found ³ ³ ³ ³ ³ ÀÄÄÄÄÄ sector not found ³ ³ ³ ³ ÀÄÄÄÄÄÄ diskette DMA error ³ ³ ³ ÀÄÄÄÄÄÄÄ CRC check / data error ³ ³ ÀÄÄÄÄÄÄÄÄ diskette controller failure ³ ÀÄÄÄÄÄÄÄÄÄ seek to track failed ÀÄÄÄÄÄÄÄÄÄÄ diskette time-out type0040.floppycontrollerstatus: array[1..7] of byte; NEC diskette controller status. - 131 - type0040.displaymode: byte; Current video mode. type0040.numberofcolumns: word; Number of screen columns. type0040.regenbufferlength: word; Size of current video regen buffer in bytes. type0040.regenbufferaddress: word; Offset of current video page in video regen buffer. type0040.cursorposition: array[1..8] of word; Cursor position of pages 1-8, high order byte=row low order byte=column; changing this data isn't reflected immediately on the display type0040.cursortype: word; low order byte = Cursor ending (bottom) scan line (don't modify) high order byte = Cursor starting (top) scan line (don't ' +'modify) type0040.currentdisplaypage: byte; Active display page number. type0040.videocontrollerbaseaddress: word; Base port address for active 6845 CRT controller 3B4h = mono, 3D4h = color type0040.current3x8register: byte; 6845 CRT mode control register value (port 3x8h) EGA/VGA values emulate those of the MDA/CGA type0040.current3x9register: byte; CGA current color palette mask setting (port 3d9h) EGA and VGA values emulate the CGA type0040.infopointer: pointer; CS:IP for 286 return from protected mode Temp storage for SS:SP during shutdown Day counter on all products after AT PS/2 Pointer to reset code with memory preserved 5 bytes Cassette tape control (before AT) type0040.timercounter: pointer; Daily timer counter, equal to zero at midnight. type0040.timeroverflowflag: byte; Clock rollover flag, set when daily timer exceeds 24hrs. type0040.breakkeystate: byte; BIOS break flag, bit 7 is set if Ctrl-Break was hit. type0040.resetflag: word; Soft reset flag via Ctl-Alt-Del or JMP FFFF:0 1234h Bypass memory tests & CRT initialization 4321h Preserve memory 5678h System suspend 9ABCh Manufacturer test ABCDh Convertible POST loop ????h many other values are used during POST - 132 - type0040.fixeddiskprevopstatus: byte; Status of last hard disk operation. type0040.numberoffixeddrives: byte; Number of hard disks attached. type0040.fixeddiskdrivecontrol: byte; XT fixed disk drive control byte. type0040.fixeddiskcontrollerport: byte; Port offset to current fixed disk adapter. type0040.lpttimeout: array[1..4] of byte; Time-Out value for LPT1,LPT2,LPT3(,LPT4 except PS/2) type0040.comtimeout: array[1..4] of byte; Time-Out value for COM1,COM2,COM3,COM4. type0040.keybdbufferstartoffsetptr: word; Keyboard buffer start offset. type0040.keybdbufferendoffsetptr: word; Keyboard buffer end offset. type0040.videorows: byte; Rows on the screen (less 1, EGA+) type0040.characterheight: word; Point height of character matrix (EGA+) type0040.initdelay: byte; PCjr: initial delay before repeat key action begins. type0040.videomodeopt: byte; PCjr: current Fn function key number Video mode options (EGA+) 7 6 5 4 3 2 1 0 Video mode options (EGA+) ³ ³ ³ ³ ³ ³ ³ ÀÄÄ 1=alphanum. cursor emu. enabled ³ ³ ³ ³ ³ ³ ÀÄÄÄ 1=video subsys attached to mono ³ ³ ³ ³ ³ ÀÄÄÄÄ reserved ³ ³ ³ ³ ÀÄÄÄÄÄ 1=video subsystem is inactive ³ ³ ³ ÀÄÄÄÄÄÄ reserved ³ ÀÄÁÄÄÄÄÄÄÄ video RAM 00-64K 10-192K 01-128K 11-256K ÀÄÄÄÄÄÄÄÄÄÄ video mode number. type0040.videodisplaydata: byte; Video display data area (MCGA and VGA) 7 6 5 4 3 2 1 0 Video display data area (MCGA and VGA) ³ ³ ³ ³ ³ ³ ³ ÀÄÄ 1=VGA is active ³ ³ ³ ³ ³ ³ ÀÄÄÄ 1=gray scale is enabled ³ ³ ³ ³ ³ ÀÄÄÄÄ 1=using monochrome monitor ³ ³ ³ ³ ÀÄÄÄÄÄ 1=default palette loading is disabled ³ ³ ³ ÀÄÄÄÄÄÄ see table below ³ ³ ÀÄÄÄÄÄÄÄ reserved ³ ÀÄÄÄÄÄÄÄÄ 1=display switching enabled ÀÄÄÄÄÄÄÄÄÄ alphanumeric scan lines (see table below) Bit7 Bit4 Scan Lines 0 0 350 line mode 0 1 400 line mode 1 0 200 line mode 1 1 reserved - 133 - type0040.lastdiskrate: byte; Last diskette data rate selected 7 6 5 4 3 2 1 0 last diskette data rate selected ³ ³ ³ ³ ÀÄÁÄÁÄÁÄÄÄ reserved ³ ³ ÀÄÁÄÄÄÄÄÄÄÄÄÄ last floppy drive step rate selected ÀÄÁÄÄÄÄÄÄÄÄÄÄÄÄ last floppy data rate selected Data Rate Step Rate 00 500K bps 00 step rate time of 0C 01 300K bps 01 step rate time of 0D 10 250K bps 10 step rate time of 0A 11 reserved 11 reserved type0040.harddiskstatus: byte; Hard disk status returned by controller. type0040.harddiskerror: byte; Hard disk error returned by controller. type0040.harddiskintctrl: byte; Hard disk interrupt control flag(bit 7=working int) type0040.combhardfloppy: byte; Combination hard/floppy disk card when bit 0 set. type0040.drivemediastate: array[0..3] of byte; Drive 0,1,2,3 media state 7 6 5 4 3 2 1 0 drive media state (4 copies) ³ ³ ³ ³ ³ ÀÄÁÄÁÄÄÄ drive/media state (see below) ³ ³ ³ ³ ÀÄÄÄÄÄÄÄ reserved ³ ³ ³ ÀÄÄÄÄÄÄÄ 1=media/drive established ³ ³ ÀÄÄÄÄÄÄÄ double stepping required ÀÄÁÄÄÄÄÄÄÄ data rate: 00=500K bps 01=300K bps 10=250K bps 11=reserved Bits 210 Drive Media State 000 360Kb diskette/360Kb drive not established 001 360Kb diskette/1.2Mb drive not established 010 1.2Mb diskette/1.2Mb drive not established 011 360Kb diskette/360Kb drive established 100 360Kb diskette/1.2Mb drive established 101 1.2Mb diskette/1.2Mb drive established 110 Reserved 111 None of the above type0040.trackseekedtodrive0: byte; Track currently seeked to on drive 0. type0040.trackseekedtodrive1: byte; Track currently seeked to on drive 1. - 134 - type0040.keyboardmode: byte; Keyboard mode/type 7 6 5 4 3 2 1 0 Keyboard mode/type ³ ³ ³ ³ ³ ³ ³ ÀÄÄÄ last code was the E1 hidden code ³ ³ ³ ³ ³ ³ ÀÄÄÄÄ last code was the E0 hidden code ³ ³ ³ ³ ³ ÀÄÄÄÄÄ right CTRL key depressed ³ ³ ³ ³ ÀÄÄÄÄÄÄ right ALT key depressed ³ ³ ³ ÀÄÄÄÄÄÄÄ 101/102 enhanced keyboard installed ³ ³ ÀÄÄÄÄÄÄÄÄ force num-lock if Rd ID & KBX ³ ÀÄÄÄÄÄÄÄÄÄ last char was first ID char ÀÄÄÄÄÄÄÄÄÄÄ read ID in process type0040.keyboardledflg: byte; Keyboard LED flags 7 6 5 4 3 2 1 0 Keyboard LED flags ³ ³ ³ ³ ³ ³ ³ ÀÄÄÄ scroll lock indicator ³ ³ ³ ³ ³ ³ ÀÄÄÄÄ num-lock indicator ³ ³ ³ ³ ³ ÀÄÄÄÄÄ caps-lock indicator ³ ³ ³ ³ ÀÄÄÄÄÄÄ circus system indicator ³ ³ ³ ÀÄÄÄÄÄÄÄ ACK received ³ ³ ÀÄÄÄÄÄÄÄÄ re-send received flag ³ ÀÄÄÄÄÄÄÄÄÄ mode indicator update ÀÄÄÄÄÄÄÄÄÄÄ keyboard transmit error flag type0040.userwaitflgptr: pointer; Pointer to user wait complete flag. type0040.userwaittimeoutptr: longint; User wait Time-Out value in microsecond. type0040.rtswaitfunctionflg: byte; RTC wait function flag 7 6 5 4 3 2 1 0 INT 15,86 RTC wait function flag ³ ³ ³ ³ ³ ³ ³ ÀÄÄÄ 1= wait pending ³ ÀÄÁÄÁÄÁÄÁÄÁÄÄÄÄ not used ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ 1=INT 15,86 wait time elapsed type0040.lanadmachanelflg: byte; LANA DMA channel flags. type0040.lanastatus: array[0..1] of byte; Status of LANA 0,1. type0040.harddiskintrvec: pointer; Saved hard disk interrupt vector. type0040.biosvideosave: pointer; BIOS Video Save/Override Pointer Table address. type0040.keyboardnmuflgs: byte; Keyboard NMI control flags (convertible) - 135 - type0040.keyboardbreakflags: longint; Keyboard break pending flags (convertible) type0040.port60singlequeue: byte; Port 60 single byte queue (convertible) type0040.lastkey: byte; Scan code of last key (convertible) type0040.nmiheadptr: byte; NMI buffer head pointer (convertible) type0040.nmitailptr: byte; NMI buffer tail pointer (convertible) type0040.nmibuffer: array[1..16] of byte; NMI scan code buffer (convertible) type0040.daycounter: word; Day counter (convertible and after) type0040.iac: array[1..16] of byte; Intra-Applications Communications Area (IBM Technical Reference incorrectly locates this at 50:F0-50:FF) type0050 (unit MGMISC) ____________________________________________________________ Synopsis: mgmisc.type0050 = record Description: This record is used to get bios segment information. Fields: prnscreenstatus: byte; basic: array... dossinglediskmode: byte; postworkarea: array... basicshellflg: byte; basicdefaultds: word; basicint1c: pointer; basicint23: pointer; basicint24: pointer; dosdynstorage: word; dosdiskinittable: array... modecommand: array... type0050.prnscreenstatus: byte; Print screen status byte 00 = PrtSc not active, 01 = PrtSc in progress FF = error - 136 - type0050.basic: array[1..3] of byte; 3 bytes Used by BASIC. type0050.dossinglediskmode: byte; DOS single diskette mode flag, 0=A:, 1=B: type0050.postworkarea: array[1..10] of byte; 10bytes POST work area. type0050.basicshellflg: byte; BASIC shell flag; set to 2 if current shell. type0050.basicdefaultds: word; BASICs default DS value (DEF SEG) type0050.basicint1c: pointer; Pointer to BASIC INT 1C interrupt handler. type0050.basicint23: pointer; Pointer to BASIC INT 23 interrupt handler. type0050.basicint24: pointer; Pointer to BASIC INT 24 disk error handler. type0050.dosdynstorage: word; DOS dynamic storage. type0050.dosdiskinittable: array[1..14] of byte; 14bytes DOS diskette initialization table. type0050.modecommand: array[1..4] of byte; MODE command. Bios0040 (unit MGMISC) ____________________________________________________________ Synopsis: mgmisc.Bios0040: type0040 absolute $0040: 0000; Description: This variable old bios information see type0040 for available information. See Also: Bios0050 Bios0050 (unit MGMISC) ____________________________________________________________ Synopsis: mgmisc.Bios0050: type0050 absolute $0050: 0000; Description: This variable old bios information see type0050 for available information. See Also: Bios0040 - 137 - envseg (unit MGMISC) ____________________________________________________________ Synopsis: mgmisc.envseg: word; Description: This variable is one part of environment variable address. This variable contain the segment value of environment variable address. See Also: envofs envsize envofs (unit MGMISC) ____________________________________________________________ Synopsis: mgmisc.envofs: word; Description: This variable is one part of environment variable address. This variable contain the offset value of environment variable address. See Also: envseg envsize envsize (unit MGMISC) ____________________________________________________________ Synopsis: mgmisc.envsize: word; Description: This variable old the current size of environment variables. See Also: envofs envseg - 138 - getintvec (unit MGMISC) ____________________________________________________________ Synopsis: function mgmisc.getintvec(intnum: byte): pointer; Description: This function return address of a specific interrupt. Input: intnum: interrupt number. Output: function result = address of interrupt. See Also: setintvec setintvec (unit MGMISC) ____________________________________________________________ Synopsis: procedure mgmisc.setintvec(intnum: byte; procaddr: pointer); Description: This procedure change address of a specific interrupt. Input: intnum: interrupt number. procaddr: new address for interrupt. Output: nothing. See Also: getintvec inportb (unit MGMISC) ____________________________________________________________ Synopsis: function mgmisc.inportb(port: word): byte; Description: This function return one byte from a specific port. This - 139 - procedure do the same job as pascal command Port[]. Input: port: port address. Output: function result = byte get from port. See Also: outportb outportb (unit MGMISC) ____________________________________________________________ Synopsis: procedure mgmisc.outportb(port: word; b: byte); Description: This procedure send one byte to a specific port. This procedure do the same job as pascal command Port[]. Input: port: port address. b: byte to output. Output: nothing. See Also: inportb inportw (unit MGMISC) ____________________________________________________________ Synopsis: function mgmisc.inportw(port: word): word; Description: This function return one word from a specific port. This procedure do the same job as pascal command Portw[]. Input: port: port address. Output: function result = word get from port. See Also: outportw - 140 - outportw (unit MGMISC) ____________________________________________________________ Synopsis: procedure mgmisc.outportw(port: word; w: word); Description: This procedure send one word to a specific port. This procedure do the same job as pascal command Portw[]. Input: port: port address. w: word to output. Output: nothing. See Also: inportw getprgname (unit MGMISC) ____________________________________________________________ Synopsis: function mgmisc.getprgname: string; Description: This function allow you to get the name of file currently running and it path. For example if you are in TP IDE, C:\TP\TURBO.EXE will be the running file. To get only the running path, see getprgpath. Input: nothing. Output: function result = program path+name. See Also: getprgpath getprgpath (unit MGMISC) ____________________________________________________________ Synopsis: function mgmisc.getprgpath: string; Description: - 141 - This function allow you to get the path of file currently running. For example if you are in TP IDE, C:\TP\ will be the path of running file (TURBO.EXE). To get the path an the file name refer to getprgname. Input: nothing. Output: function result = program path. See Also: getprgname getdoserrormsg (unit MGMISC) ____________________________________________________________ Synopsis: function mgmisc.getdoserrormsg(errorcode: integer): string; Description: This function will convert almost any error code number return by DOS to it corresponding string value. Input: errorcode: error type number return by DOS (function 59h) Output: function result = error msg -> string. isenvvar (unit MGMISC) ____________________________________________________________ Synopsis: function mgmisc.isenvvar(variable: string; var value: string): boolean; Description: This function allow you to test the existence of a specific environment variable and get it value. Input: variable: variable to search. value: address of string where we store variable value if it exist. - 142 - Output: value: contain variable value if variable exist. function result = true if variable exist. See Also: changeenvvar findenv changeenvvar (unit MGMISC) ____________________________________________________________ Synopsis: procedure mgmisc.changeenvvar(variable, newval: string); Description: This procedure allow you to change the content of a specific environment variable. Variable must exist before the call. Input: variable: environment variable to change. newval: new value to set. Output: nothing. See Also: findenv isenvvar setturbo (unit MGMISC) ____________________________________________________________ Synopsis: procedure mgmisc.setturbo(mode: boolean); Description: This procedure allow you to disable or enable turbo mode. Input: mode: true to enable turbo mode, false to disable it. Output: nothing. - 143 - farjump (unit MGMISC) ____________________________________________________________ Synopsis: procedure mgmisc.farjump(addr: pointer); Description: This procedure do a far jump at a certain address, if you are using this function you must know what your doing, this function will never go back and values pushed on stack (ADDR,CS,IP) are remove. Input: addr: 32 bits (seg:ofs) address where do to the jump. Output: never return, no output possible. dosversion (unit MGMISC) ____________________________________________________________ Synopsis: function mgmisc.dosversion: word; Description: This function return the current DOS version. Input: nothing. Output: function result = low part of word = minor version, high part of word = major version. donothing (unit MGMISC) ____________________________________________________________ Synopsis: procedure mgmisc.donothing; Description: This procedure like it name say, do nothing. This procedure can be use when an hook must be set but at the same time you don't need this hook to - 144 - work. Input: nothing. Output: nothing. See Also: donothingint donothingint (unit MGMISC) ____________________________________________________________ Synopsis: procedure mgmisc.donothingint; Description: This procedure like it name say, do nothing. This procedure do nothing but return LIKE A INTERRUPT!. So it can be used as an interrupt replacement. Input: nothing. Output: nothing. See Also: donothing delayms (unit MGMISC) ____________________________________________________________ Synopsis: procedure mgmisc.delayms(ms: word); Description: This procedure create a delay for a specific number of miliseconds and this procedure is machine-independent, this mean all machines from 8086 to Pentium will wait the same number of ms. Input: ms: number of milliseconds to wait. Output: nothing. - 145 - coldboot (unit MGMISC) ____________________________________________________________ Synopsis: procedure mgmisc.coldboot; Description: This procedure reboot the computer using a cold boot, this reboot it like the boot that reset doses, it will test memory. Input: nothing. Output: nothing. See Also: warmboot warmboot (unit MGMISC) ____________________________________________________________ Synopsis: procedure mgmisc.warmboot; Description: This procedure reboot the computer using a warm boot, it won't test memory like it doses at reset. Input: nothing. Output: nothing. See Also: coldboot getpsp (unit MGMISC) ____________________________________________________________ Synopsis: function mgmisc.getpsp: word; Description: This function return the segment of current PSP. - 146 - Input: nothing. Output: function result = segment of PSP. getdosbreakstatus (unit MGMISC) ____________________________________________________________ Synopsis: function mgmisc.getdosbreakstatus: boolean; Description: This function return the status of dos break check. Input: nothing. Output: function result = break status. See Also: setdosbreakstatus setdosbreakstatus (unit MGMISC) ____________________________________________________________ Synopsis: procedure mgmisc.setdosbreakstatus(status: boolean); Description: This procedure change the status of dos break check. Input: status: new status. Output: nothing. See Also: getdosbreakstatus - 147 - MGCRC.TPU ____________________________________________________________ Description: This unit allow you to calculate CRC-16 and CRC-32 bits for a specific buffer. This is useful to check if a file is corrupt or a block transfer by a protocol such as X/Y/ZMODEM. Language Used: coded in Inline. Linked With: Nothing. Example File: 'MGPAS003.PAS' this file give you an example that use all functions and procedures of this unit. Functions And Procedures: updcrc updcrc32 reverse32 updcrc (unit MGCRC) ____________________________________________________________ Synopsis: function mgcrc.updcrc(c: byte; crc: word): word; inline; Description: This function return the new CRC-16 after you add a new byte. Before the first call your crc variable must be initialized to zero. The algorythme to calculate a CRC buffer is quit simple: crc = 0 repeat read next byte. update crc with next byte. until no byte left. Input: c: next byte of buffer. crc: current crc value. - 148 - Output: function result = new crc value. See Also: Updcrc32 Updcrc32 (unit MGCRC) ____________________________________________________________ Synopsis: function mgcrc.updcrc32(c: byte; crc: longint): longint; inline; Description: This function return the new CRC-32 after you add a new byte. Before the first call your crc variable must be initialized to -1 of $FFFFFFFF. VERY IMPORTANT!!!! -> This routine was developed for data communications and returns the crc bytes in LOW to HIGH order, NOT byte reversed! To turn the value into a 'normal' LONGINT, you must reverse the bytes! Input: c: next byte of buffer. crc: current crc value. Output: function result = new crc value. See Also: Reverse32 Updcrc Reverse32 (unit MGCRC) ____________________________________________________________ Synopsis: function mgcrc.reverse32(crc: longint): longint; inline; Description: This function is implemented to reverse the byte of longint return by UpdCRC32. Because UpdCRC32 is implemented to support communication it reverse the byte. This function will correct this by reversing the bytes. Input: - 149 - crc: crc value before reverse. Output: function result = crc normalized (bytes reverses). See Also: updcrc32 MGDATE.TPU ____________________________________________________________ Description: This unit allow you to manipulate date and time functions, such as conversion from or to Unix format, return the current date information, etc. Language Used: coded in PASCAL. Linked With: MGSTRING, MGMISC. Example File: 'MGPAS004.PAS' this file give you an example that use all functions and procedures of this unit. Constants: dayspermonth secsperyear secsperleapyear secsperday secsperhour secsperminute Types: countryinfoptr countryinfo datetime datetype Functions And Procedures: gettimezone packtounixstr unixstrtopack normaltounix unixtonormal todayinunix dayofyear - 150 - DayOfMonth dayofweek thisyear thismonth thishour thisminute thissecond wkday gregoriantojuliandn juliandntogregorian gregoriantojuliandate juliantogregoriandate datestring timestring yesterday tomorrow isleapyear packtime unpacktime gettime settime getdate setdate getcountrycode getcountrycodename getcountryinfo countrydatestr countrytimestr countryinfoptr (unit MGDATE) ____________________________________________________________ Synopsis: mgdate.countryinfoptr = ^countryinfo; Description: A pointer of countryinfo. countryinfo (unit MGDATE) ____________________________________________________________ Synopsis: mgdate.countryinfo = record Description: This record is create to allow you to get information from country system information. With these information - 151 - you will be able to support international date and time format. Fields: cidateformat: word; cicurrency: array... cithousands: array... cidecimal: array... cidatesep: array... citimesep: array... cibitfield: byte; cicurrencyplaces: byte; citimeformat: byte; cicasemap: pointer; cidatasep: array... cireserved: array countryinfo.cidateformat: word; Date and time format 0 = month day year, hh:mm:ss (USA) 1 = day month year, hh:mm:ss (Europe) 2 = year month day, hh:mm:ss (Japan) countryinfo.cicurrency: array[1..5] of char; ASCIIZ currency symbol. countryinfo.cithousands: array[0..1] of char; ASCIIZ thousands separator. countryinfo.cidecimal: array[0..1] of char; ASCIIZ decimal separator. countryinfo.cidatesep: array[0..1] of char; ASCIIZ date separator. countryinfo.citimesep: array[0..1] of char; ASCIIZ time separator. countryinfo.cibitfield: byte; Currency symbol format 0 = symbol leads, without space 1 = symbol follows, without space 2 = symbol leads, one space 3 = symbol follows, one space 4 = symbol replace decimal separator countryinfo.cicurrencyplaces: byte; Number of digits after decimal. countryinfo.citimeformat: byte; Time format 0 = 12 hour clock 1 = 24 hour clock - 152 - countryinfo.cicasemap: pointer; Case map call address. countryinfo.cidatasep: array[0..1] of char; ASCIIZ data list separator. Const mgdate.dayspermonth: array[1..12] of byte = (31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31); dayspermonth (unit MGDATE) ____________________________________________________________ Description: This array of number contain the number of day per month. Month are in order this mean DaysPerMonth[1] is equal to number of days in January. The number of day in February is 29 if current year is leap. secsperyear (unit MGDATE) ____________________________________________________________ Synopsis: Const mgdate.secsperyear: longint = 31536000; Description: This constant old the number of seconds in one year, if year is leap refer to secsperleapyear this value is use for Unix conversion. secsperleapyear (unit MGDATE) ____________________________________________________________ Synopsis: Const mgdate.secsperleapyear: longint = 31622400; Description: This constant old the number of seconds in one leap year, if year is not leap refer to secsperyear this value is use for Unix conversion. - 153 - secsperday (unit MGDATE) ____________________________________________________________ Synopsis: Const mgdate.secsperday: longint = 86400; Description: This constant old the number of seconds in one day. secsperhour (unit MGDATE) ____________________________________________________________ Synopsis: Const mgdate.secsperhour: word = 3600; Description: This constant old the number of seconds in one hours. secsperminute (unit MGDATE) ____________________________________________________________ Synopsis: Const mgdate.secsperminute: shortint = 60; Description: This constant old the number of seconds in one minute. datetime (unit MGDATE) ____________________________________________________________ Synopsis: mgdate.datetime = record Description: This type is use to pack and unpack time. Fields: - 154 - year: word; month: word; day: word; hour: word; min: word; sec: word; datetype (unit MGDATE) ____________________________________________________________ Synopsis: mgdate.datetype = record Description: This type is use by some procedures and functions for input/output of date value. Fields: day: word; month: word; year: word; dow: word; datetype.day: word; this variable of the value: day. datetype.month: word; this variable of the value: month. datetype.year: word; this variable of the value: year. datetype.dow: word; this variable of the value: day of week value, Sunday = 0. gettimezone (unit MGDATE) ____________________________________________________________ Synopsis: function mgdate.gettimezone: shortint; Description: This function return current time zone. Since this information is not written in computer, environment variable 'TZ' must be set. This function will scan all environment variables for 'TZ' and return it value. Input: - 155 - nothing. Output: if TZ = 'EST05' return -05 if TZ = 'EST05EDT' return -06 if TZ = 'CST06' return -06 if TZ = 'CST06CDT' return -07 if TZ = 'MST07' return -07 if TZ = 'MST07MDT' return -08 if TZ = 'PST08' return -08 if TZ = 'PST08PDT' return -09 if TZ = 'YST09' return -09 if TZ = 'AST10' return -10 if TZ = 'BST11' return -11 if TZ = 'CET-1' return 01 if TZ = 'CET-01' return 01 if TZ = 'EST-10' return 10 if TZ = 'WST-8' return 08 if TZ = 'WST-08' return 08 packtounixstr (unit MGDATE) ____________________________________________________________ Synopsis: function mgdate.packtounixstr(fdate: longint): string; Description: This function will convert a normal date-time in packtime format, this format is support by turbo Pascal, to a string of Unix format. This function converted date to Unix number and then convert the Unix number into a string. Input: fdate: date-time in pack format. Output: function result = date time in Unix string format. See Also: UnixStrToPack unixstrtopack (unit MGDATE) ____________________________________________________________ Synopsis: function mgdate.unixstrtopack(s: string): longint; Description: - 156 - This function will convert a date-time in Unix string format to packtime support by turbo Pascal. Input: s: date-time in Unix string format. Output: function result = date-time in pack format. See Also: PackToUnixStr normaltounix (unit MGDATE) ____________________________________________________________ Synopsis: function mgdate.normaltounix(y, m, d, h, min, s: word): longint; Description: This function will convert date in normal format: year, month, day, hours, minutes and seconds to a Unix date format. Input: y: years. m: month. d: day. h: hours. min: minutes. s: seconds. Output: function result = date-time in Unix format. See Also: unixtonormal unixtonormal (unit MGDATE) ____________________________________________________________ Synopsis: procedure mgdate.unixtonormal(date: longint; var y, m, d, h, min, s: word); Description: This procedure convert a date-time in Unix format to normal date format: year, month, day, hours, etc. - 157 - Input: Date: date in Unix format. Output: y: year. m: month. d: day. h: hours. min: minutes. s: seconds. See Also: normaltounix todayinunix (unit MGDATE) ____________________________________________________________ Synopsis: function mgdate.todayinunix: longint; Description: This function return the current date-time in Unix format. Input: nothing. Output: function result = current date-time in Unix format. dayofyear (unit MGDATE) ____________________________________________________________ Synopsis: function mgdate.dayofyear: word; Description: This function will return the current day number range of return value is from 1 to 365. Input: nothing. Output: function result = current days of year number. See Also: dayofmonth - 158 - dayofweek dayofmonth (unit MGDATE) ____________________________________________________________ Synopsis: function mgdate.DayOfMonth: word; Description: This function will return the current day number in current month, range for return value is from 1 to 31. Input: nothing. Output: function result = current day of month number. See Also: dayofweek dayofyear dayofweek (unit MGDATE) ____________________________________________________________ Synopsis: function mgdate.dayofweek: word; Description: This function will return the current day of week number. Range for return values are from 0 to 6 where 0 = Sunday. Input: nothing. Output: function result = day of week number. See Also: dayofmonth dayofyear - 159 - thisyear (unit MGDATE) ____________________________________________________________ Synopsis: function mgdate.thisyear: word; Description: This function will return current year value. Input: nothing. Output: function result = years number. See Also: thishour thisminute thismonth thismonth (unit MGDATE) ____________________________________________________________ Synopsis: function mgdate.thismonth: word; Description: This function will return the month of year, range for return value is from 1 to 12. Input: nothing. Output: function result = month of year number. See Also: thishour thisminute thisyear thishour (unit MGDATE) ____________________________________________________________ Synopsis: function mgdate.thishour: word; Description: - 160 - This function will return current hour value. Input: nothing. Output: function result = current hours number. See Also: thisminute thismonth thisyear thisminute (unit MGDATE) ____________________________________________________________ Synopsis: function mgdate.thisminute: word; Description: This function will return current minute value. Input: nothing. Output: function result = current minute value. See Also: thishour thismonth thisyear thisminute (unit MGDATE) ____________________________________________________________ Synopsis: function mgdate.thissecond: word; Description: This function will return current second value. Input: nothing. Output: function result = current second value. See Also: - 161 - thishour thisminute thismonth thisyear wkday (unit MGDATE) ____________________________________________________________ Synopsis: function mgdate.wkday(year, month, day: word): word; Description: This function will determine day of week for a specific date. Return code 0 = Sunday. Input: year: year number. month: month number. day: day number. Output: function result = day number (0=Sunday, 1=Monday, ...) gregoriantojulianDN (unit MGDATE) ____________________________________________________________ Synopsis: procedure mgdate.gregoriantojuliandn(year, month, day: word; var juliandn: longint); Description: This function will convert a gregorian type date to a julian day number type date. Input: year: year number. month: month number. day: day number. Output: juliandn: date converted to julian day number format. See Also: JulianDNToGregorian - 162 - juliandntogregorian (unit MGDATE) ____________________________________________________________ Synopsis: procedure mgdate.juliandntogregorian(juliandn: longint; var year, month, day: word); Description: This function will convert a julian day number type date to a gregorian type date. Input: juliandn: julian date. Output: year: year number. month: month number. day: day number. See Also: GregorianToJulianDN gregoriantojuliandate (unit MGDATE) ____________________________________________________________ Synopsis: procedure mgdate.gregoriantojuliandate(year, month, day: word; var juliandate: word); Description: This function will convert a gregorian type date to a julian type date. Input: year: year number. month: month number. day: day number. Output: juliandate: date converted to julian format. See Also: juliantogregoriandate - 163 - juliantogregoriandate (unit MGDATE) ____________________________________________________________ Synopsis: procedure mgdate.juliantogregoriandate(juliandate, year: word; var month, day: word); Description: This function will converted a julian type date to a gregorian type date. Input: juliandn: julian date. Output: year: year number. month: month number. day: day number. See Also: gregoriandatetojuliandate datestring (unit MGDATE) ____________________________________________________________ Synopsis: function mgdate.datestring: string; Description: This function will returns current system date as "mm-dd-yy" string. Input: nothing. Output: function result = current date in string. See Also: timestring - 164 - timestring (unit MGDATE) ____________________________________________________________ Synopsis: function mgdate.timestring: string; Description: This function will returns current system time as "00:00:00" string. Input: nothing. Output: function result = current time string. See Also: datestring yesterday (unit MGDATE) ____________________________________________________________ Synopsis: procedure mgdate.yesterday(var y, m, d: word); Description: This function will return the date value of yesterday. Input: nothing. Output: y,m,d: yesterday date value. See Also: tomorrow tomorrow (unit MGDATE) ____________________________________________________________ Synopsis: procedure mgdate.tomorrow(var y, m, d: word); Description: This function will return the date value of tomorrow. Input: - 165 - nothing. Output: y,m,d: tomorrow date value. See Also: yesterday isleapyear (unit MGDATE) ____________________________________________________________ Synopsis: function mgdate.isleapyear(y: word): boolean; Description: This function will test a specific year to see if year is leap. Input: y: year to test. Output: function result = true if year is leap. packtime (unit MGDATE) ____________________________________________________________ Synopsis: procedure mgdate.packtime(var t: datetime; var time: longint); Description: This function pack a date in datetime format to a 32-bits date format. Input: t: Date in datetime format. Output: Time: Date-Time in 32 bits format. See Also: unpacktime - 166 - unpacktime (unit MGDATE) ____________________________________________________________ Synopsis: procedure mgdate.unpacktime(time: longint; var t: datetime); Description: This function unpack date in 32-bits format to datetime format. Input: Time: date-time in 32-bits format. Output: t: Time in datetime format. See Also: packtime gettime (unit MGDATE) ____________________________________________________________ Synopsis: procedure mgdate.gettime(var hour, minute, second, sec100: word); Description: Get current time using DOS function. Input: nothing. Output: Hour, Minute, Second, Sec100 : Time information. See Also: getdate setdate settime - 167 - settime (unit MGDATE) ____________________________________________________________ Synopsis: procedure mgdate.settime(hour, minute, second, sec100: word); Description: Change current time using DOS function. Input: Hour, Minute, Second, Sec100 : Time information. Output: nothing. See Also: getdate gettime setdate getdate (unit MGDATE) ____________________________________________________________ Synopsis: procedure mgdate.getdate(var year, month, day, dayofweek: word); Description: Get current date using DOS function. Input: nothing. Output: Year, Month, Day : Date information. See Also: gettime setdate settime - 168 - setdate (unit MGDATE) ____________________________________________________________ Synopsis: procedure mgdate.setdate(year, month, day: word); Description: Change current date using DOS function. Input: Year, Month, Day : Date information. Output: nothing. See Also: getdate gettime settime getcountrycode (unit MGDATE) ____________________________________________________________ Synopsis: function mgdate.getcountrycode(var code: word): byte; Description: This function return the current country code. Input: nothing. Output: code: current country code. function result = error_code, 0 = Success. getcountrycodename (unit MGDATE) ____________________________________________________________ Synopsis: function mgdate.getcountrycodename(code: word): string; Description: This function return the name of country for a specific - 169 - code. Input: code: country code. Output: function result = country name. getcountryinfo (unit MGDATE) ____________________________________________________________ Synopsis: function mgdate.getcountryinfo(info: countryinfoptr): boolean; Description: This function return information about current country code. Input: info: address of buffer where to store information. Output: function result = true if country information found. countrydatestr (unit MGDATE) ____________________________________________________________ Synopsis: function mgdate.countrydatestr: string; Description: This function return current date in select country format. Input: Nothing. Output: function result = Date string. See Also: countrytimestr - 170 - countrytimestr (unit MGDATE) ____________________________________________________________ Synopsis: function mgdate.countrytimestr: string; Description: This function return current time in select country format. Input: Nothing. Output: function result = Time string. See Also: countrydatestr - 171 - MGDRIVE.TPU ____________________________________________________________ Description: This unit allow you to access to drive and it directory's. In this unit you will find function like get drive type or get default directory, etc. Language Used: coded in PASCAL AND ASSEMBLER. Linked With: Nothing. Example File: 'MGPAS006.PAS' this file give you an example that use all functions and procedures of this unit. Constants: drv320 drv12 drv720 drv8ds drv8d drvhd drvtape drv144 drvrwo drw288 drvunknow Functions And Procedures: getcurdir floppydriveready drivetype drivesize drivefree direxist ishdready recalibratehd detectfloppychange parkhead setverifyflag getverifyflag numfloppies setdefaultdrive getdefaultdrive getnumfixeddisk makedirectory - 172 - numinstallcdromunits firstcdromdrive getstartupdrive isnetworkdrive shareload drv320 (unit MGDRIVE) ____________________________________________________________ Synopsis: Const mgdrive.drv320 = 0; Description: Drive type: 320k. drv12 (unit MGDRIVE) ____________________________________________________________ Synopsis: Const mgdrive.drv12 = 1; Description: Drive type: 1.2 MBytes floppy. drv720 (unit MGDRIVE) ____________________________________________________________ Synopsis: Const mgdrive.drv720 = 2; Description: Drive type: 720 KBytes floppy. - 173 - drv8ds (unit MGDRIVE) ____________________________________________________________ Synopsis: Const mgdrive.drv8ds = 3; Description: Drive type: 8" single density floppy. drv8d (unit MGDRIVE) ____________________________________________________________ Synopsis: Const mgdrive.drv8d = 4; Description: Drive type: 8" double density floppy. drvhd (unit MGDRIVE) ____________________________________________________________ Synopsis: Const mgdrive.drvhd = 5; Description: Drive type: hard disk. drvtape (unit MGDRIVE) ____________________________________________________________ Synopsis: Const mgdrive.drvtape = 6; Description: Drive type: tape drive. - 174 - drv144 (unit MGDRIVE) ____________________________________________________________ Synopsis: Const mgdrive.drv144 = 7; Description: Drive type: 1.44 MBytes floppy. drvrwo (unit MGDRIVE) ____________________________________________________________ Synopsis: Const mgdrive.drvrwo = 8; Description: Drive type: read/write optical disk. drw288 (unit MGDRIVE) ____________________________________________________________ Synopsis: Const mgdrive.drw288 = 9; Description: Drive type: 2.88 MBytes floppy. drvunknow (unit MGDRIVE) ____________________________________________________________ Synopsis: Const mgdrive.drvunknow = $ff; Description: Drive type: unknown. - 175 - getcurdir (unit MGDRIVE) ____________________________________________________________ Synopsis: function mgdrive.getcurdir(drive: char): string; Description: This function return the current directory name, for a specific drive of default drive. To get default drive use character #0 else use 'A', 'B', etc. Input: drive: drive letter or #0. Output: function result = directory name. floppydriveready (unit MGDRIVE) ____________________________________________________________ Synopsis: function mgdrive.floppydriveready(drive: char): boolean; Description: This function test a drive (floppy only) to see if it ready to be used. If drive is ready this function return true. Input: drive: drive letter. Output: function result = true if floppy drive ready. See Also: ishdready drivetype (unit MGDRIVE) ____________________________________________________________ Synopsis: function mgdrive.drivetype(drive: char): byte; Description: This function try to detect what format of drive is installed. To get default drive format use #0 else use - 176 - 'A', 'B', etc. Drv320 Drv12 Drv720 Drv8ds Drv8d DrvHd DrvTape Drv144 DrvRWO Drw288 DrvUnknow Input: drive: drive letter or #0. Output: function result = drive type. drivesize (unit MGDRIVE) ____________________________________________________________ Synopsis: function mgdrive.drivesize(drive: char): longint; Description: This function return the drive size. This function also check if drive size is greater than one gig. Drive must be the drive number, NOT the drive letter. Possible answer are: -1: drive is invalid or can't access to it. 1: drive is greater than 1 gig any other number will be the drive size. To get default drive size use #0 else use 'A', 'B', etc. Input: drive: drive letter or #0. Output: function result = -1 if > 1gig else drive size in bytes. See Also: drivefree - 177 - dirfree (unit MGDRIVE) ____________________________________________________________ Synopsis: function mgdrive.drivefree(drive: char): longint; Description: This function return the drive free size. This function also check if drive free size is greater than one gig. Drive must be the drive number, NOT the drive letter. Possible answer are: -1: drive is invalid or can't access to it. 1: free size is greater than 1 gig any other number will be the drive free size. To get default drive size use #0 else use 'A', 'B', etc. Input: drive: drive letter or #0. Output: function result = -1 if > 1gig else drive free bytes. See Also: drivesize direxist (unit MGDRIVE) ____________________________________________________________ Synopsis: function mgdrive.direxist(const dirname: string): boolean; Description: This function test existence of specific directory, if directory exist this function return true, else function return false. Input: dirname: directory to search. Output: function result = true if directory exist. - 178 - ishdready (unit MGDRIVE) ____________________________________________________________ Synopsis: function mgdrive.ishdready(drive: char): boolean; Description: This function test hard disk ready status. If hard disk is ready to be used this function return true, else it return false. Use drive letter 'C', 'D', etc. Input: drive: drive letter. Output: function result = true if drive ready. See Also: floppydriveready recalibratehd (unit MGDRIVE) ____________________________________________________________ Synopsis: function mgdrive.recalibratehd(drive: char): boolean; Description: This function causes hard disk controller to seek the specified drive to cylinder 0. If recalibrate as been done this function return true, else it return false. Use drive letter 'C', 'D', etc. Input: drive: drive letter. Output: function result = true if drive recalibrate. detectfloppychange (unit MGDRIVE) ____________________________________________________________ Synopsis: function mgdrive.detectfloppychange(drive: char): boolean; Description: - 179 - This function check if disk in a specific floppy drive as been change. If disk as been changed, this function return true, else it return false. Use drive letter 'A', 'B', etc. Input: drive: floppy drive letter. Output: function result = true if detect change. parkhead (unit MGDRIVE) ____________________________________________________________ Synopsis: function mgdrive.parkhead(drive: char): boolean; Description: This function park head of hard disk. Now many hard disk auto-park themselves, but some old HD doesn't park head when you want to move your computer. This function return true if disk as been parked, else it return false. Use drive letter 'C', 'D', etc. Note: This function required AT or newer. Input: drive: drive letter. Output: function result = true if head park. setverifyflag (unit MGDRIVE) ____________________________________________________________ Synopsis: procedure mgdrive.setverifyflag(assert: boolean); Description: This procedure change the status of DOS verify flags. With verify flag is set disk I/O are much safer, but the counter part is that disk I/O are longer. Input: assert: if true = enable, else disable. Output: function result = true if verify enable else false. - 180 - See Also: getverifyflag getverifyflag (unit MGDRIVE) ____________________________________________________________ Synopsis: function mgdrive.getverifyflag: boolean; Description: This function return the current status of DOS verify flags. With verify flag is set disk I/O are much safer, but the counter part is that disk I/O are longer. Input: nothing. Output: function result = true if verify enable else false. See Also: setverifyflag numfloppies (unit MGDRIVE) ____________________________________________________________ Synopsis: function mgdrive.numfloppies: byte; Description: This function return the number of floppies drive installed. This function get information from BIOS segment. Input: nothing. Output: function result = number of floppies drive installed. - 181 - setdefaultdrive (unit MGDRIVE) ____________________________________________________________ Synopsis: procedure mgdrive.setdefaultdrive(drive: char); Description: This procedure change the default drive. Input: drive: new default drive. Output: nothing. See Also: getdefaultdrive getdefaultdrive (unit MGDRIVE) ____________________________________________________________ Synopsis: function mgdrive.getdefaultdrive: char; Description: This function return the current default drive. Input: nothing. Output: function result = default drive number. See Also: setdefaultdrive getnumfixeddisk (unit MGDRIVE) ____________________________________________________________ Synopsis: function mgdrive.getnumfixeddisk: byte; Description: This function return the number of fixed disk installed (hard disk). This information is get from BIOS segment. - 182 - Input: nothing. Output: number of fixed disk installed. makedirectory (unit MGDRIVE) ____________________________________________________________ Synopsis: function mgdrive.makedirectory(dirname: string): boolean; Description: This procedure create a new directory. Input: dirname: new directory name. Output: function result = true if directory as been create. numinstallcdromunits (unit MGDRIVE) ____________________________________________________________ Synopsis: function mgdrive.numinstallcdromunits: byte; Description: This function return the number of CD-ROM install on running system. Input: nothing. Output: function result = number of CD-ROM installed. See Also: firstcdromdrive - 183 - firstcdromdrive (unit MGDRIVE) ____________________________________________________________ Synopsis: function mgdrive.firstcdromdrive: char; Description: This function return the first CD-ROM drive letter. Input: nothing. Output: function result = first CD-ROM drive letter : 'A', 'C', etc. See Also: numinstallcdromunits getstartupdrive (unit MGDRIVE) ____________________________________________________________ Synopsis: function mgdrive.getstartupdrive: char; Description: This function return the start up drive letter, the drive where DOS is first search this is normally drive 'A', or drive 'C'. Note: This function required DOS 4.x+ Input: nothing. Output: function result = startup drive letter : 'A', 'C', etc. isnetworkdrive (unit MGDRIVE) ____________________________________________________________ Synopsis: function mgdrive.isnetworkdrive(drive: char): boolean; Description: This function test a drive to see if it a local or a network drive. This function will return true if - 184 - drive is a network drive. To get default drive status use #0 else use 'A', 'B', etc. Input: drive: drive letter. Output: function result = true if drive is network drive. shareload (unit MGDRIVE) ____________________________________________________________ Synopsis: function mgdrive.shareload: boolean; Description: This function return true if share is load. Input: nothing. Output: function result = true if share is loaded. - 185 - MGCACHEF.TPU ____________________________________________________________ Description: This module implement routines to use disk cache buffer to speed up file access. This way we can reduce the number of access to disk. If you need to use many write/read, this module can easily increase I/O speed by 100% Language Used: coded in PASCAL. Linked With: MGFILHDL, MGGLOBAL, and MGMEM. Example File: 'MGPAS001.PAS' this file give you an example that use all functions and procedures of this unit. Types: cfile cfileptr Functions And Procedures: copen ccreate cclose ceof cpos csize cseek cread cwrite cfill cflush cfile (unit MGCACHEF) ____________________________________________________________ Synopsis: mgcachef.cfile = record Description: This type is the main type use to declare file variable. - 186 - Fields: buffile: tfile; buf: pointer; dirty: boolean; buffilepos: longint; bufsize: word; bufpos: word; buftop: word; cfile.buffile: tfile; variable use to access physical file. cfile.buf: pointer; cache buffer address. cfile.dirty: boolean; true if buffer need to be write. cfile.buffilepos: longint; current position in file. cfile.bufsize: word; cache buffer size. cfile.bufpos: word; current position in buffer. cfile.buftop: word; top of buffer pointer. cfileptr (unit MGCACHEF) ____________________________________________________________ Synopsis: mgcachef.cfileptr = ^cfile; Description: Pointer of type cfile. copen (unit MGCACHEF) ____________________________________________________________ Synopsis: procedure mgcachef.copen(f: cfileptr; filename: string; bsize: word; bptr: pointer); Description: This procedure is use to open a specific file. It initialized variables and open file. File is open with read/write access and deny all (not shareable due to - 187 - cache buffer). If I/O error occur variable f^.BufFile.errcode is not equal to fSucces (zero). Input: f: file variable. Filename: filename to open. BSize: Size of cache buffer. BPtr: a pointer to a currently allocated buffer. Output: f.buffile.errcode <> zero if error occur. See Also: ccreate ccreate (unit MGCACHEF) ____________________________________________________________ Synopsis: procedure mgcachef.ccreate(f: cfileptr; filename: string; bsize: word; bptr: pointer); Description: This procedure is use to create and open a file. It initialized variables and create a file. If file already exist, the file size is truncate to zero. File is create with attribute archive. If I/O error occur variable f^.BufFile.errcode is not equal to fSucces (zero). Input: f: file variable. Filename: filename to open. BSize: Size of cache buffer. BPtr: pointer to a currently allocated buffer. Output: f.buffile.errcode <> zero if error occur. See Also: copen cclose (unit MGCACHEF) ____________________________________________________________ Synopsis: procedure mgcachef.cclose(f: cfileptr); Description: - 188 - This procedure flush cache buffer and close file. If I/O error occur variable f^.BufFile.errcode is not equal to fSucces (zero). Input: f: file variable. Output: f.buffile.errcode <> zero if error occur. ceof (unit MGCACHEF) ____________________________________________________________ Synopsis: function mgcachef.ceof(f: cfileptr): boolean; Description: This function check if file pointer is at end of file. If it currently at end of file function return true else it return false. Input: f: file variable. Output: function result = true if at end of file else false. f.buffile.errcode <> zero if error occur. cpos (unit MGCACHEF) ____________________________________________________________ Synopsis: function mgcachef.cpos(f: cfileptr): longint; Description: This function return current virtual position in file, since we use a cache buffer, physical file position may not be good, this function return position in cache buffer. Input: f: file variable. Output: function result = file pointer position value. f.buffile.errcode <> zero if error occur. - 189 - csize (unit MGCACHEF) ____________________________________________________________ Synopsis: function mgcachef.csize(f: cfileptr): longint; Description: This function return the current file size. This function first flush buffer than physical file size is return. Input: f: file variable. Output: function result = file size. f.buffile.errcode <> zero if error occur. cseek (unit MGCACHEF) ____________________________________________________________ Synopsis: procedure mgcachef.cseek(f: cfileptr; pos: longint); Description: This function move the file pointer to a specific position in file from beginning of file. This function can cause a flush or a fill buffer, these two are describe lower. Input: f: file variable. pos: position to go to. Output: f.buffile.errcode <> zero if error occur. cread (unit MGCACHEF) ____________________________________________________________ Synopsis: function mgcachef.cread(f: cfileptr; v: pointer; bytes: word): word; Description: - 190 - This function read multiple bytes at current file pointer and store bytes into a specific user buffer. Input: f: file variable. V: user buffer. Bytes: number of bytes to read. Output: function result = number of bytes read. f.buffile.errcode <> zero if error occur. See Also: cwrite cwrite (unit MGCACHEF) ____________________________________________________________ Synopsis: function mgcachef.cwrite(f: cfileptr; v: pointer; bytes: word): word; Description: This function write multiple bytes at current file pointer and get theses bytes from a specific user buffer. Input: f: file variable. V: user buffer. Bytes: number of bytes to write. Output: function result = number of bytes written. f.buffile.errcode <> zero if error occur. See Also: cread cfill (unit MGCACHEF) ____________________________________________________________ Synopsis: procedure mgcachef.cfill(f: cfileptr); Description: This function is call by other functions (internally), it fill cache buffer. It can be useful if you want to access directly to cache buffer. - 191 - Input: f: file variable. Output: f.buffile.errcode <> zero if error occur. See Also: cflush cflush (unit MGCACHEF) ____________________________________________________________ Synopsis: procedure mgcachef.cflush(f: cfileptr); Description: This function is call by other functions (internally), it write cache buffer. It can be useful if you want to access directly to cache buffer. Input: f: file variable. Output: f.buffile.errcode <> zero if error occur. See Also: cfill - 192 - MGCOM.TPU ____________________________________________________________ Description: This module give full access to serial port with I/O buffers, software and hardware flow control and you will be able to install hook procedure on received characters. This module support only one comport and use 8250 UART. Language Used: coded in ASSEMBLER. Linked With: Nothing. Example File: 'MGPAS002.PAS' this file give you an example that use all functions and procedures of this unit. Constants: hookrecvstatus hookrecv inbuffer outbuffer inhead outhead intail outtail bufferinsize bufferoutsize rtson rtsoff portaddr startcode stopcode comstatus comctrl portopen portint oldintvec pbauds110 pbauds150 pbauds300 pbauds600 pbauds1200 pbauds2400 pbauds4800 pbauds9600 pbauds19200 - 193 - pbauds38400 pbauds57600 pbauds115200 pdatalen5 pdatalen6 pdatalen7 pdatalen8 pstopbitone pstopbittwo pparitynone pparityodd pparityeven Types: hookrecvproc Functions And Procedures: portsendbreak portsetregister portgetregister portsetdtr portcdstatus portsetrtsmode portsetctsmode portsofthandshake portpurgeout portpurgein portgetoutleft portgetinleft portflushout portsetparams portopencom portclosecom portread portreadw portwrite portwritew portwritestr portputchin portpeek portwriteblock portrecvblock hookrecvproc (unit MGCOM) ____________________________________________________________ Synopsis: mgcom.hookrecvproc = procedure (b: byte); Description: - 194 - This type is use to declare user hook procedure. If you are using a hook procedure don't forget it must be (far). See Also: hookrecv hookrecvstatus hookrecvstatus (unit MGCOM) ____________________________________________________________ Synopsis: Const mgcom.hookrecvstatus: boolean = false; Description: This constant old the status of hook. BEFORE to set this constant to true, be sure that you have ALREADY set hookrecv or when you will received a character the system may crash! When this constant is set to true character are NOT buffered instead a function hookrecv is call each time a character is received. Note: If you want to create a protocol or something that need fast I/O operation and you can't write a fast procedure don't use this hook because you may lost characters. If speed is not request than you may use this option without any problems. See Also: hookrecv hookrecvproc hookrecv (unit MGCOM) ____________________________________________________________ Synopsis: Const mgcom.hookrecv: hookrecvproc = nil; Description: This constant old the address of procedure to be call if a character is received from comport and hookrecvstatus is equal to true, if hookrecvstatus = false then this constant is not use. See Also: hookrecvproc hookrecvstatus - 195 - inbuffer (unit MGCOM) ____________________________________________________________ Synopsis: Const mgcom.inbuffer: pointer = nil; Description: This constant old the address of input buffer. See Also: outbuffer outbuffer (unit MGCOM) ____________________________________________________________ Synopsis: Const mgcom.outbuffer: pointer = nil; Description: This constant old the address of output buffer. See Also: inbuffer inhead (unit MGCOM) ____________________________________________________________ Synopsis: Const mgcom.inhead: word = 0; Description: This constant old the head pointer for input buffer. See Also: inhead outhead outtail - 196 - outhead (unit MGCOM) ____________________________________________________________ Synopsis: Const mgcom.outhead: word = 0; Description: This constant old the head pointer for output buffer. See Also: inhead intail outtail intail (unit MGCOM) ____________________________________________________________ Synopsis: Const mgcom.intail: word = 0; Description: This constant old the tail pointer for input buffer. See Also: inhead outhead outtail outtail (unit MGCOM) ____________________________________________________________ Synopsis: Const mgcom.outtail: word = 0; Description: This constant old the tail pointer for output buffer. See Also: inhead intail outhead - 197 - bufferinsize (unit MGCOM) ____________________________________________________________ Synopsis: Const mgcom.bufferinsize: word = 0; Description: This constant old the size of input buffer. See Also: bufferoutsize bufferoutsize (unit MGCOM) ____________________________________________________________ Synopsis: Const mgcom.bufferoutsize: word = 0; Description: This constant old the size of output buffer. See Also: bufferinsize rtson (unit MGCOM) ____________________________________________________________ Synopsis: Const mgcom.rtson: word = 0; Description: This constant old the value: when rts line is assert. See Also: rtsoff - 198 - rtsoff (unit MGCOM) ____________________________________________________________ Synopsis: Const mgcom.rtsoff: word = 0; Description: This constant old the value: when rts line is dropped. See Also: rtson portaddr (unit MGCOM) ____________________________________________________________ Synopsis: Const mgcom.portaddr: word = $3f8; Description: This constant old the port address of the current opened port, by default set to COM1 = $3F8. Standard COM2 = $2F8. startcode (unit MGCOM) ____________________________________________________________ Synopsis: Const mgcom.startcode: char = #17; Description: This constant old the start character for soft handshake, this is the XON value. See Also: stopcode - 199 - stopcode (unit MGCOM) ____________________________________________________________ Synopsis: Const mgcom.stopcode: char = #19; Description: This constant old the stop character for soft handshake, this is the XOFF value. See Also: startcode comstatus (unit MGCOM) ____________________________________________________________ Synopsis: Const mgcom.comstatus: byte = 5; Description: This constant old information on current port. bit-map of comstatus: 0x01 = input buffer empty 0x02 = input buffer full 0x04 = output buffer empty 0x08 = output buffer full 0x10 = input buffer overflow 0x20 = output buffer overflow 0x40 = hard handshake active 0x80 = soft handshake active See Also: comctrl comctrl (unit MGCOM) ____________________________________________________________ Synopsis: Const mgcom.comctrl: byte = 0; Description: This constant old information on current port. - 200 - bit-map of comctrl: 0x01 = enable rts handshake 0x02 = enable cts handshake 0x04 = enable software handshake 0x08 = overrun error 0x10 = parity error 0x20 = framing error 0x40 = break sense. 0x80 = reserved. (currently not used) See Also: comstatus portopen (unit MGCOM) ____________________________________________________________ Synopsis: Const mgcom.portopen: boolean = false; Description: This constant old the status of current port. Set to true if port currently open. portint (unit MGCOM) ____________________________________________________________ Synopsis: Const mgcom.portint: byte = 4; Description: This constant old the comport IRQ. By default set to 4 for COM1, COM2 = 3, COM3 = 4, COM4 = 3. oldintvec (unit MGCOM) ____________________________________________________________ Synopsis: Const mgcom.oldintvec: pointer = nil; Description: - 201 - This pointer keep the old interrupt address. pbauds110 (unit MGCOM) ____________________________________________________________ Synopsis: Const mgcom.pbauds110 = $0417; Description: Pre-calculate baud rate divisor for 110 bauds. pbauds150 (unit MGCOM) ____________________________________________________________ Synopsis: Const mgcom.pbauds150 = $0300; Description: Pre-calculate baud rate divisor for 150 bauds. pbauds300 (unit MGCOM) ____________________________________________________________ Synopsis: Const mgcom.pbauds300 = $0180; Description: Pre-calculate baud rate divisor for 300 bauds. pbauds600 (unit MGCOM) ____________________________________________________________ Synopsis: Const mgcom.pbauds600 = $00c0; Description: - 202 - Pre-calculate baud rate divisor for 600 bauds. pbauds1200 (unit MGCOM) ____________________________________________________________ Synopsis: Const mgcom.pbauds1200 = $0060; Description: Pre-calculate baud rate divisor for 1200 bauds. pbauds2400 (unit MGCOM) ____________________________________________________________ Synopsis: Const mgcom.pbauds2400 = $0030; Description: Pre-calculate baud rate divisor for 2400 bauds. pbauds4800 (unit MGCOM) ____________________________________________________________ Synopsis: Const mgcom.pbauds4800 = $0018; Description: Pre-calculate baud rate divisor for 4800 bauds. pbauds9600 (unit MGCOM) ____________________________________________________________ Synopsis: Const mgcom.pbauds9600 = $000c; Description: - 203 - Pre-calculate baud rate divisor for 9600 bauds. pbauds19200 (unit MGCOM) ____________________________________________________________ Synopsis: Const mgcom.pbauds19200 = $0006; Description: Pre-calculate baud rate divisor for 19200 bauds. pbauds38400 (unit MGCOM) ____________________________________________________________ Synopsis: Const mgcom.pbauds38400 = $0003; Description: Pre-calculate baud rate divisor for 38400 bauds. pbauds57200 (unit MGCOM) ____________________________________________________________ Synopsis: Const mgcom.pbauds57600 = $0002; Description: Pre-calculate baud rate divisor for 57200 bauds. pbauds115200 (unit MGCOM) ____________________________________________________________ Synopsis: Const mgcom.pbauds115200 = $0001; Description: - 204 - Pre-calculate baud rate divisor for 115200 bauds. pdatalen5 (unit MGCOM) ____________________________________________________________ Synopsis: Const mgcom.pdatalen5 = $00; Description: Data: used to define data length in portsetparams pdatalen6 (unit MGCOM) ____________________________________________________________ Synopsis: Const mgcom.pdatalen6 = $01; Description: Data: used to define data length in portsetparams pdatalen7 (unit MGCOM) ____________________________________________________________ Synopsis: Const mgcom.pdatalen7 = $02; Description: Data: used to define data length in portsetparams pdatalen8 (unit MGCOM) ____________________________________________________________ Synopsis: Const mgcom.pdatalen8 = $03; Description: - 205 - Data: used to define data length in portsetparams pstopbitone (unit MGCOM) ____________________________________________________________ Synopsis: Const mgcom.pstopbitone = $00; Description: StopBit: used to define number of stopbit in portsetparams pstopbittwo (unit MGCOM) ____________________________________________________________ Synopsis: Const mgcom.pstopbittwo = $04; Description: StopBit: used to define number of stopbit in portsetparams pparitynone (unit MGCOM) ____________________________________________________________ Synopsis: Const mgcom.pparitynone = $00; Description: Parity: used to define parity in portsetparams - 206 - pparityodd (unit MGCOM) ____________________________________________________________ Synopsis: Const mgcom.pparityodd = $08; Description: Parity: used to define parity in portsetparams pparityeven (unit MGCOM) ____________________________________________________________ Synopsis: Const mgcom.pparityeven = $18; Description: Parity: used to define parity in portsetparams portsendbreak (unit MGCOM) ____________________________________________________________ Synopsis: procedure mgcom.portsendbreak(ms: word); Description: This procedure send a break signal for a specific number of milliseconds. Input: ms: number of millisecond. Output: nothing. - 207 - portsetregister (unit MGCOM) ____________________________________________________________ Synopsis: procedure mgcom.portsetregister(reg, value: byte); Description: This procedure change the value of one UART register. See portgetregister for UART registers description. Input: reg: register. value: new value to set. Output: nothing. See Also: portgetregister portgetregister (unit MGCOM) ____________________________________________________________ Synopsis: function mgcom.portgetregister(reg: byte): byte; Description: This function return the value of one UART register. I will not detail all UART registers usage. If you want to use very low level access this function is what you need so you probably have a reference guide for UART. Detailed UART Description reg = 0 - Transmit/Receive Buffer (read/write) Baud Rate Divisor LSB if bit 7 of LCR is set (read/write) reg = 1 - Interrupt Enable Register - IER (read/write) Baud Rate Divisor MSB if bit 7 of LCR is set (read/write) bits-map: 7 6 5 4 3 2 1 0 Interrupt Enable Register ³ ³ ³ ³ ³ ³ ³ ÀÄÄÄÄ 1 = enable data available interrupt. ³ ³ ³ ³ ³ ³ ÀÄÄÄÄÄ 1 = enable THRE interrupt ³ ³ ³ ³ ³ ÀÄÄÄÄÄÄ 1 = enable lines status interrupt ³ ³ ³ ³ ÀÄÄÄÄÄÄÄ 1 = enable modem-status-change interrupt ÀÄÁÄÁÄÁÄÄÄÄÄÄÄÄ reserved - 208 - reg = 2 - Interrupt Identification Register - IIR (read only) bits-map: 7 6 5 4 3 2 1 0 Interrupt ID Register ³ ³ ³ ³ ³ ³ ³ ÀÄÄÄÄ 1 = no int. pending, 0=int. pending ³ ³ ³ ³ ³ ÀÄÁÄÄÄÄÄ Interrupt Id bits (see below) ³ ³ ³ ³ ÀÄÄÄÄÄÄÄÄ reserved ³ ³ ÀÄÁÄÄÄÄÄÄÄÄÄ reserved ÀÄÁÄÄÄÄÄÄÄÄÄÄÄÄ reserved Possible id: Priority To reset 00 modem-status-change lowest read MSR 01 transmit-reg-empty low read IIR/write THR 10 data-available high read rec buffer reg 11 line-status highest read LSR reg = 3 - Line Control Register - LCR (read/write) bits-map: 7 6 5 4 3 2 1 0 Line Control Register ³ ³ ³ ³ ³ ³ ÀÄÁÄÄÄÄ word length select bits See Also: portsetregister portsetdtr (unit MGCOM) ____________________________________________________________ Synopsis: procedure mgcom.portsetdtr(assert: boolean); Description: This procedure change the status of DTR line. When DTR is dropped, line is dropped and communication is lost (use to hang up). Input: assert: true = enable, false = disable. Output: nothing. - 209 - portcdstatus (unit MGCOM) ____________________________________________________________ Synopsis: function mgcom.portcdstatus: boolean; Description: This function report the status of Carrier Detect line. Carrier detect line is set true when communication is still establish. if you have a communication establish and CD become false you have lost your connection. Input: nothing. Output: function result = true if carrier detect is enable. portsetrtsmode (unit MGCOM) ____________________________________________________________ Synopsis: procedure mgcom.portsetrtsmode(mode: boolean); Description: This procedure allow you to enable or disable automatic RTS, default is disable. Input: mode: true = enable, false = disable. Output: nothing. See Also: portsetctsmode rtsoff rtson portsetctsmode (unit MGCOM) ____________________________________________________________ Synopsis: procedure mgcom.portsetctsmode(mode: boolean); Description: - 210 - This procedure allow you to enable or disable automatic CTS, default is disable. Input: mode: true = enable, false = disable. Output: nothing. See Also: portsetrtsmode rtsoff rtson portsofthandshake (unit MGCOM) ____________________________________________________________ Synopsis: procedure mgcom.portsofthandshake(mode: boolean); Description: This procedure allow you to enable or disable software handshaking. If you enable this kind of handshaking, transmission will be halted if the character in stopchar is received. Transmission is re-enabled if the startchar char is received. Both character must be under 32, and be different they are set by default to ^Q for start and ^S for stop character. Input: mode: true = enable, false = disable. Output: nothing. See Also: startchar stopchar portpurgeout (unit MGCOM) ____________________________________________________________ Synopsis: procedure mgcom.portpurgeout; Description: This procedure clear all pending bytes into output buffer, so buffer become empty and bytes are NOT send. Input: - 211 - nothing. Output: nothing. See Also: portpurgein portpurgein (unit MGCOM) ____________________________________________________________ Synopsis: procedure mgcom.portpurgein; Description: This procedure clear all pending bytes into input buffer, so buffer become empty and bytes are LOST. Input: nothing. Output: nothing. See Also: portpurgeout portgetoutleft (unit MGCOM) ____________________________________________________________ Synopsis: function mgcom.portgetoutleft: word; Description: This function return the amount of space left into output buffer. If it return zero output buffer is full. If you want to know if output buffer is empty or full a bit test on comstatus is faster. Input: nothing. Output: function result = space left in output buffer. See Also: portgetinleft - 212 - portgetinleft (unit MGCOM) ____________________________________________________________ Synopsis: function mgcom.portgetinleft: word; Description: This function return the amount of space left into input buffer. If it return zero input buffer is full. To test buffer empty use comstatus it faster. Input: nothing. Output: function result = space left in input buffer. See Also: portgetoutleft portflushout (unit MGCOM) ____________________________________________________________ Synopsis: procedure mgcom.portflushout; Description: This procedure wait until all character in output buffer are sent before coming back. This procedure is useful when you need to be sure that all characters as been sent, but you can also do it by testing comstatus (is buffer empty). Input: nothing. Output: nothing. portsetparams (unit MGCOM) ____________________________________________________________ Synopsis: procedure mgcom.portsetparams(baud: word; params: byte); Description: - 213 - This procedure allow you to change the communication parameter such as speed, parity, data, length. Input: baud: Specific baud rate divisor. These Are Pre-calculate Baud Rate Constants: Bauds110, Bauds150, Bauds300, Bauds600, Bauds1200 Bauds2400, Bauds4800, Bauds9600, Bauds19200, Bauds38400 Bauds57600, Bauds115200 - Baud rate divisors can be calculated using this formula: divisor = 1843200 / (BaudRate * 16); So you may create the speed you need like 2230 bauds, etc. params: data length, stop bit and parity. datalen5, datalen6, datalen7, datalen8 stopbitone, stopbittwo paritynone, parityodd, parityeven. example for : (2400,8,N,1) portsetparams(Bauds2400, datalen8+stopbitone+paritynone); Output: nothing. portopencom (unit MGCOM) ____________________________________________________________ Synopsis: function mgcom.portopencom(inbuf, outbuf: pointer; insize, outsize: word): boolean; Description: This function will save current serial interrupt address, install a new interrupt and initialize all globals variables. If this function return false comport can't be use. Note: portaddr and portint are COM address and COM IRQ they must be set (if needed) before this function can be call. By default they are set to all standard COM1. Input: inbuf: address of input buffer (!! must be already allocate ) outbuf: address of output buffer (!! must be - 214 - already allocate ) insize: size of input buffer outsize: size of output buffer Output: function result = true is port initialized. See Also: portclosecom portclosecom (unit MGCOM) ____________________________________________________________ Synopsis: procedure mgcom.portclosecom; Description: This function remove com interrupt and restore previous serial interrupt vector that portopencom as saved in oldintvec. This function will be call automatically at end of your program if com is still open! Note: DTR is not change by this call so connection is not lost. Input: nothing. Output: nothing. See Also: portopencom portread (unit MGCOM) ____________________________________________________________ Synopsis: function mgcom.portread: integer; Description: This function read one character from input buffer. if input buffer is empty the value return is -1. Input: nothing. Output: function result = character received or -1 if empty. See Also: - 215 - portreadw portreadw (unit MGCOM) ____________________________________________________________ Synopsis: function mgcom.portreadw: integer; Description: This function do the same as portread except this function will wait if input buffer is empty. If this function return -1 (error occur). Input: nothing. Output: function result = character received or -1 if error. See Also: portread portwrite (unit MGCOM) ____________________________________________________________ Synopsis: function mgcom.portwrite(b: byte): boolean; Description: This function will send one character in output buffer. If character is stored in output buffer this function will return true. Input: b: character to store. Output: function result = true if character as been store into output buffer. See Also: portwritew - 216 - portwritew (unit MGCOM) ____________________________________________________________ Synopsis: function mgcom.portwritew(b: byte): boolean; Description: This function is similar to portwrite except this one will wait if output buffer is full. This is not a good procedure to use because it may take a lot of time (infinity) if output buffer is full and the receiver doesn't request more bytes (if receiver froze you will be to!). Input: b: character to store. Output: function result = true is character stored into output buffer. See Also: portwrite portwritestr (unit MGCOM) ____________________________________________________________ Synopsis: function mgcom.portwritestr(const s: string; delay: word): word; Description: This function write one string to output buffer, it return the number of character transfer from string. Before sending another character this procedure wait a specific number of miliseconds. This function useful to send string command such as 'ATA'#13, etc. Input: s: string to send. delay: delay in millisecond between each character. Output: function result = number of character send. - 217 - portputchin (unit MGCOM) ____________________________________________________________ Synopsis: function mgcom.portputchin(b: byte): boolean; Description: This function allow you to store one character in input buffer. This is useful to simulate a character received. If character is store this function will return true. Input: b: character to store. Output: function result = true if character insert into input buffer. portpeek (unit MGCOM) ____________________________________________________________ Synopsis: function mgcom.portpeek: integer; Description: This function will get one character from input buffer, but character is not remove from input buffer. If input buffer is empty, this function return -1. Input: nothing. Output: function result = character received or -1 if buffer was empty. See Also: portread portreadw portwriteblock (unit MGCOM) ____________________________________________________________ Synopsis: function mgcom.portwriteblock(userbuffer: pointer; maxwrite: word): word; - 218 - Description: This function allow you to transfer more than one byte to output buffer. This function will return the number of bytes moved. Input: userbuffer: address of buffer where the bytes are read. maxwrite: maximum number of bytes to transfer. Output: function result = number of bytes transfer. See Also: portrecvblock portrecvblock (unit MGCOM) ____________________________________________________________ Synopsis: function mgcom.portrecvblock(userbuffer: pointer; maxwrite: word): word; Description: This function allow you to get more than one byte from input buffer. This function will return the number of bytes moved. Input: userbuffer: address of buffer where the bytes will be store. maxwrite: maximum number of bytes to transfer. Output: function result = number of bytes transfer. See Also: portwriteblock - 219 - MGDBHASH.TPU ____________________________________________________________ Description: This unit allow you to create a database that use hashing key. Hashing is probably the fastest method to access database, but it take many space and you must a know how much record will be insert in database. Language Used: coded in PASCAL. Linked With: MGFILHDL, MGCRC, MGMEM, MGMATH. Example File: 'MGPAS005.PAS' this file give you an example that use all functions and procedures of this unit. Constants: hsucces hoverflowerror hmemoryerror hdiskerror hfileerror hasherror Types: recptr rectype hashfileptr hashrec Functions And Procedures: hashdelete hashfind hashreadfirst hashreadnext hashclose hashwrite hashopen hashcreate Other: mgdbhasherrcode - 220 - Theses are the possible errors code contain in hasherror: hsucces hoverflowerror hmemoryerror hdiskerror hfileerror hsucces (unit MGDBHASH) ____________________________________________________________ Synopsis: Const mgdbhash.hsucces = 0; Description: Error type: No error occur. See Also: mgdbhasherrcode hoverflowerror (unit MGDBHASH) ____________________________________________________________ Synopsis: Const mgdbhash.hoverflowerror = 1; Description: Error type: Can't insert this element. If this error occur element can't be added to database because overflow part of database if full. IMPORTANT: This doesn't mean database is full but nearly full and the number of collisions as reach it limits. See Also: mgdbhasherrcode hmemoryerror (unit MGDBHASH) ____________________________________________________________ Synopsis: Const mgdbhash.hmemoryerror = 2; Description: Error type: Need more memory to run. - 221 - See Also: mgdbhasherrcode hdiskerror (unit MGDBHASH) ____________________________________________________________ Synopsis: Const mgdbhash.hdiskerror = 3; Description: Error type: Disk error occur. See Also: mgdbhasherrcode hfileerror (unit MGDBHASH) ____________________________________________________________ Synopsis: Const mgdbhash.hfileerror = 4; Description: Error type: File error occur. See Also: mgdbhasherrcode hasherror (unit MGDBHASH) ____________________________________________________________ Synopsis: Const mgdbhash.hasherror: byte = hsucces; Description: Error type: This constant contain last error code read this constant each time you call a function cause this constant is reset in the beginning of next function call. See Also: hdiskerror hfileerrpr hmemoryerror hoverflowerror hsucces - 222 - recptr (unit MGDBHASH) ____________________________________________________________ Synopsis: mgdbhash.recptr = ^rectype; Description: Pointer of rectype. rectype (unit MGDBHASH) ____________________________________________________________ Synopsis: mgdbhash.rectype = record Description: This record is the header of each file record, you don't need to use this except if you want to access database directly without this unit. Fields: status... next: longint; rectype.status: (empty, full); status of file record. rectype.next: longint; address of next record in database. hashfileptr (unit MGDBHASH) ____________________________________________________________ Synopsis: mgdbhash.hashfileptr = ^hashrec; Description: Pointer of hashrec. - 223 - hashrec (unit MGDBHASH) ____________________________________________________________ Synopsis: mgdbhash.hashrec = record Description: This type is use to declare a database, each database must have it own variable this way you can access more than one database at the same time. Fields: f: tfile; recptr: rectype; recsize: word; numrec: longint; numover: longint; keyoffset: word; hashrec.f: tfile; variable to access database file. hashrec.recptr: rectype; buffer to old record header from database. hashrec.recsize: word; database record size. hashrec.numrec: longint; Number of record ~must~ be a prime number. hashrec.numover: longint; Number of overflow space 25% of numrec hashrec.keyoffset: word; Offset of key in record refer to example file. hashdelete (unit MGDBHASH) ____________________________________________________________ Synopsis: function mgdbhash.hashdelete(hash: hashfileptr; element: pointer): boolean; Description: This function will search for a specific element in database. If all fields of element match a specific record in file, record is delete. This function will only delete one record. If one record as been delete this function return true. Input: - 224 - Element: address of element that contain record to delete, key must be set as well as all element for identical match. hash: database variable to use. Output: function result = true if element as been delete. HashError is <> hsucces if error occur. hashfind (unit MGDBHASH) ____________________________________________________________ Synopsis: function mgdbhash.hashfind(hash: hashfileptr; element: pointer): boolean; Description: This function search for a element that match hashing key. If one element is found this function return true. Input: Element: address of element that contain record to find, key must be set as well as all element for identical match. hash: database variable to use. Output: function result = true if element as been found. HashError is <> hsucces if error occur. hashreadfirst (unit MGDBHASH) ____________________________________________________________ Synopsis: function mgdbhash.hashreadfirst(hash: hashfileptr; element: pointer): boolean; Description: This function will seek to the first element that match the hashing key inside element. If no element is found at the location request by key, this function return false, else element is read. Input: Element: address of element that contain search key. hash: database variable to use. Output: - 225 - function result = true if found and read one element. HashError is <> hsucces if error occur. hashreadnext (unit MGDBHASH) ____________________________________________________________ Synopsis: function mgdbhash.hashreadnext(hash: hashfileptr; element: pointer): boolean; Description: This function must only be used after a call to hashreadfirst. This function do the same as hashreadfirst, if another element match the hashing key it is read. Input: Element: address of element that contain search key. hash: database variable to use. Output: function result = true if found and read next element. HashError is <> hsucces if error occur. See Also: hashreadfirst hashclose (unit MGDBHASH) ____________________________________________________________ Synopsis: procedure mgdbhash.hashclose(hash: hashfileptr); Description: This procedure close a specific database file, if database is not opened error will be return in hasherror. Input: hash: database variable to close. Output: HashError is <> hsucces if error occur. - 226 - hashopen (unit MGDBHASH) ____________________________________________________________ Synopsis: procedure mgdbhash.hashwrite(hash: hashfileptr; element: pointer); Description: This procedure add one element into a specific database. Database must be open first. After calling this procedure, you must check HashError to see if element as been insert into database. Input: Element: address of element to add into database. hash: database variable to use. Output: HashError is <> hsucces if error occur. hashopen (unit MGDBHASH) ____________________________________________________________ Synopsis: procedure mgdbhash.hashopen(filename: string; recsize: word; keystart: word; numrec, numover: longint; var hash: hashfileptr); Description: This procedure open a database file that was previously create using hashcreate. Record size, key offset and other information MUST HAVE THE SAME value used for creation or database won't be readable. Check hasherror to see if database as been opened, or error occur. Input: Filename: name of database to create. recsize: size of each record. keystart: keyoffset in record. (key must be of string type) numrec: number of record in database. numover: number of record in overflow part. hash: database variable to initialize. Output: HashError is <> hsucces if error occur. - 227 - hashcreate (unit MGDBHASH) ____________________________________________________________ Synopsis: procedure mgdbhash.hashcreate(filename: string; recsize: word; keystart: word; numrec, numover: longint; var hash: hashfileptr); Description: This procedure create a database file, if database already exist, the file will be truncate (deleted). Check hasherror to see if database as been opened, or error occur. Input: Filename: name of database to create. recsize: size of each record. keystart: keyoffset in record. (key must be of string type) numrec: number of record in database. numover: number of record in overflow part. hash: database variable to initialize. Output: HashError is <> hsucces if error occur. - 228 - MGENCRYP.TPU ____________________________________________________________ Description: This unit allow you to encrypt and decrypt data, currently only support XOR encryption. Language Used: coded in ASSEMBLER. Linked With: MGGLOBAL. Example File: 'MGPAS007.PAS' this file give you an example that use all functions and procedures of this unit. Constants: xorgetc xorputc Functions And Procedures: xorencrypt xordecrypt xorgetc (unit MGENCRYP) ____________________________________________________________ Synopsis: Const mgencryp.xorgetc: getctype = nil; Description: xorgetc is a const that point over a function. This function is use by compression and expansion routine to input the next byte. Where there no by left to be compressed, getc must receive -1. remember this function wait for an integer NOT A BYTE!! Note: This function must be far! See Also: mgglobal.getctype - 229 - xorputc (unit MGENCRYP) ____________________________________________________________ Synopsis: Const mgencryp.xorputc: putctype = nil; Description: xorputc is a const that point over a procedure. This procedure is use by compression and expansion routine to output the next byte. If this procedure send -1 this mean error occur and you must stop compression or decompression by sending -1 thrue xorgetc. Note: This function must be far! See Also: mgglobal.putctype xorencrypt (unit MGENCRYP) ____________________________________________________________ Synopsis: procedure mgencryp.xorencrypt(key: pointer; keysize: word); Description: This procedure start XOR encryption, this procedure do is I/O transfer using xorgetc and xorputc. If this two constant are NOT set and you call this function, your program may crash. Input: key: address of key to use for encryption. keysize: size of encoding key. Output: nothing. See Also: xordecrypt - 230 - xordecrypt (unit MGENCRYP) ____________________________________________________________ Synopsis: procedure mgencryp.xordecrypt(key: pointer; keysize: word); Description: This procedure start XOR decryption, this procedure do is I/O transfer using xorgetc and xorputc. If this two constant are NOT set and you call this function, your program may crash. Input: key: address of key to use for decryption. keysize: size of decoding key. Output: nothing. See Also: xorencrypt - 231 - MGEXESFX.TPU ____________________________________________________________ Description: This unit allow you to determine if one .EXE file as been created by a compression program. Program support, are PKZIP and ARJ. Language Used: coded in PASCAL. Linked With: MGSTRING, MGMEM, MGFILHDL. Example File: 'MGPAS009.PAS' this file give you an example that use all functions and procedures of this unit. Functions And Procedures: isexesfx isexesfx (unit MGEXESFX) ____________________________________________________________ Synopsis: function mgexesfx.isexesfx(const filename: string): boolean; Description: This function scan a .EXE file and try to determine if this file as been created by a compression program. If file is .ZIP or .ARJ this function will return true, else it return false. Input: filename: name of file to check. Output: function result = true if .EXE is ARJ or ZIP. - 232 - MGFOSSIL.TPU ____________________________________________________________ Description: This unit allow you to access some fossil driver. First it give you access to all fossil that support level 5 functions. It also support the MX5 fossil driver this driver implemented a software support for MNP communication. This unit also support extended function of X00 driver. Language Used: coded in ASSEMBLER. Linked With: MGMISC. Example File: 'MGPAS012.PAS' this file give you an example that use all functions and procedures of this unit. Constants: fmaxcom fmincom bauds300 bauds600 bauds1200 bauds2400 bauds4800 bauds9600 bauds19200 bauds38400 paritynone parityodd parityeven stopbitone stopbittwo datalen5 datalen6 datalen7 datalen8 Types: fosstructptr fosstruct mx5structptr mx5struct Functions And Procedures: - 233 - fosinit fosdeinit fossetparams fosreadw fosread fosgetstatus fosflushout fospurgeout fospurgein foswriteblk fosreadblk foscdstatus fossetdtr fossetflowctrl foswritew foswrite fospeek fosstartbreak fosstopbreak fossendbreak fosctrlck fosdataavail fospeekkey fosreadkey fosreadkeyw fossetcrsloc fosgetcrsloc fosdoswrite fosbioswrite foscoldreboot foswarmreboot fossetwatchdog fosgetinfo fosgetoutleft fosgetinleft fosgetinsize fosgetoutsize fosgetbaud fosgetversion fosgetswidth fosgetsheight fosgetnameptr fosinoverrun fosspaceinoutbuf fosoutbufempty mx5init mx5getinfo mx5setmnplvl mx5getmnplvl mx5getmnpansorgmode mx5setmnpansorgmode mx5getmnpwaittck mx5setmnpwaittck mx5getmnpconnectsndlvl mx5setmnpconnectsndlvl - 234 - mx5uninstall mx5waitticks mx5getactiveflag mx5getid mx5getpacketssend mx5getmaxsndspeed mx5gettotalpacketrecv mx5getduppacketrecv mx5getduppackets mx5getmaxrcvspeed x00init x00done x00getrts x00getout1 x00getout2 x00getlooptest x00setrts x00setout1 x00setout2 x00setlooptest x00writein x00peek x00extinit fmaxcom (unit MGFOSSIL) ____________________________________________________________ Synopsis: Const mgfossil.fmaxcom: byte = 8; Description: This constant can be modified as you want, it is used to check the validity of comport when comport is open. Maxcom is the highest port number that can be opened. See Also: fmincom fmincom (unit MGFOSSIL) ____________________________________________________________ Synopsis: Const mgfossil.fmincom: byte = 1; Description: This constant can be modified as you want, it is used to check the validity of comport when function or procedure are called. Mincom is the lowest port number - 235 - that can be opened. See Also: fmaxcom bauds300 (unit MGFOSSIL) ____________________________________________________________ Synopsis: Const mgfossil.bauds300 = $40; Description: Baud rate: used to define baud rate in fossetparams bauds600 (unit MGFOSSIL) ____________________________________________________________ Synopsis: Const mgfossil.bauds600 = $60; Description: Baud rate: used to define baud rate in fossetparams baud1200 (unit MGFOSSIL) ____________________________________________________________ Synopsis: Const mgfossil.bauds1200 = $80; Description: Baud rate: used to define baud rate in fossetparams - 236 - baud2400 (unit MGFOSSIL) ____________________________________________________________ Synopsis: Const mgfossil.bauds2400 = $a0; Description: Baud rate: used to define baud rate in fossetparams bauds4800 (unit MGFOSSIL) ____________________________________________________________ Synopsis: Const mgfossil.bauds4800 = $c0; Description: Baud rate: used to define baud rate in fossetparams bauds9600 (unit MGFOSSIL) ____________________________________________________________ Synopsis: Const mgfossil.bauds9600 = $e0; Description: Baud rate: used to define baud rate in fossetparams bauds19200 (unit MGFOSSIL) ____________________________________________________________ Synopsis: Const mgfossil.bauds19200 = $00; Description: Baud rate: used to define baud rate in fossetparams - 237 - bauds38400 (unit MGFOSSIL) ____________________________________________________________ Synopsis: Const mgfossil.bauds38400 = $20; Description: Baud rate: used to define baud rate in fossetparams paritynone (unit MGFOSSIL) ____________________________________________________________ Synopsis: Const mgfossil.paritynone = $00; Description: Parity: used to define parity in fossetparams parityodd (unit MGFOSSIL) ____________________________________________________________ Synopsis: Const mgfossil.parityodd = $08; Description: Parity: used to define parity in fossetparams parityeven (unit MGFOSSIL) ____________________________________________________________ Synopsis: Const mgfossil.parityeven = $0c; Description: Parity: used to define parity in fossetparams - 238 - stopbitone (unit MGFOSSIL) ____________________________________________________________ Synopsis: Const mgfossil.stopbitone = $00; Description: Stop Bit: used to define stop bit in fossetparams stopbitstwo (unit MGFOSSIL) ____________________________________________________________ Synopsis: Const mgfossil.stopbittwo = $04; Description: Stop Bit: used to define stop bit in fossetparams datalen5 (unit MGFOSSIL) ____________________________________________________________ Synopsis: Const mgfossil.datalen5 = $00; Description: Data length: used to define data length in fossetparams datalen6 (unit MGFOSSIL) ____________________________________________________________ Synopsis: Const mgfossil.datalen6 = $01; Description: Data length: used to define data length in fossetparams - 239 - datelen7 (unit MGFOSSIL) ____________________________________________________________ Synopsis: Const mgfossil.datalen7 = $02; Description: Data length: used to define data length in fossetparams datalen8 (unit MGFOSSIL) ____________________________________________________________ Synopsis: Const mgfossil.datalen8 = $03; Description: Data length: used to define data length in fossetparams fosstructptr (unit MGFOSSIL) ____________________________________________________________ Synopsis: mgfossil.fosstructptr = ^fosstruct; Description: A pointer of fosstruct. fosstruct (unit MGFOSSIL) ____________________________________________________________ Synopsis: mgfossil.fosstruct = record Description: this type is use to get LEVEL5 fossil driver information. Fields: - 240 - strsiz: word; majver: byte; minver: byte; ident: pointer; ibufr: word; ifree: word; obufr: word; ofree: word; swidth: byte; sheight: byte; baud: byte; fosstruct.strsiz: word; buffer size. fosstruct.majver: byte; fossil major version number. fosstruct.minver: byte; fossil minor version number. fosstruct.ident: pointer; address of string identification ASCIIZ string. fosstruct.ibufr: word; input buffer size. fosstruct.ifree: word; input buffer size left. fosstruct.obufr: word; output buffer size. fosstruct.ofree: word; output buffer size left. fosstruct.swidth: byte; screen width. fosstruct.sheight: byte; screen height. fosstruct.baud: byte; current baud rate. mx5structptr (unit MGFOSSIL) ____________________________________________________________ Synopsis: mgfossil.mx5structptr = ^mx5struct; Description: A pointer of mx5struct. - 241 - mx5struct (unit MGFOSSIL) ____________________________________________________________ Synopsis: mgfossil.mx5struct = record Description: this type is use to get MX5 fossil driver information. Fields: activeflag: boolean; mnplvl: byte; id: byte; packetssend: longint; duppackets: longint; maxsndspeed: longint; totalpacketrecv: longint; duppacketrecv: longint; maxrcvspeed: longint; mx5struct.activeflag: boolean; mnp active. mx5struct.mnplvl: byte; mnp level (2,4,5) mx5struct.id: byte; mnp id from other MNP entity. mx5struct.packetssend: longint; total packets send. mx5struct.duppackets: longint; number of duplicates send. mx5struct.maxsndspeed: longint; max speed send. mx5struct.totalpacketrecv: longint; total packets received. mx5struct.duppacketrecv: longint; number of duplicates received. mx5struct.maxrcvspeed: longint; max speed received. fosinit (unit MGFOSSIL) ____________________________________________________________ Synopsis: function mgfossil.fosinit(com: word): boolean; Description: This function is used to tell the driver to begin operations, and to check that the driver is installed. - 242 - This function should be called before any other communications calls are made. Note: Should an additional call to this service occur (2 Inits or Init, Read,Init, etc.) the driver should reset all buffers, flow control, etc. to the INIT state and return SUCCESS. Input: com: comport to use. Output: function result = true if comport initialized. See Also: fosdeinit fosdeinit (unit MGFOSSIL) ____________________________________________________________ Synopsis: procedure mgfossil.fosdeinit(com: word); Description: This is used to tell the driver that comm port operations are ended. The function should be called when no more comm port functions will be used on the port specified in com. DTR is NOT affected by this call. Input: com: comport to use. Output: nothing. See Also: fosinit fossetparams (unit MGFOSSIL) ____________________________________________________________ Synopsis: procedure mgfossil.fossetparams(com: word; params: byte); Description: This procedure allow you to change the communication parameters like baud rate, wordlength etc. Input: com: comport to use. params: - 243 - high order 3 bits: 010 = 300 baud 011 = 600 '' 100 = 1200 '' 101 = 2400 '' 110 = 4800 '' 111 = 9600 '' 000 = 19200 '' (Replaces old 110 baud mask) 001 = 38400 '' (Replaces old 150 baud mask) The low order 5 bits can be implemented or not by the FOSSIL, but in all cases, if the low order bits of AL are 00011, the result should be that the communications device should be set to eight data bits, one stop bit and no parity. This setting is a MINIMUM REQUIREMENT of Fido, Opus and SEAdog. For purposes of completeness, here are the IBM PC "compatible" bit settings: Bits 4-3 define parity: 0 0 no parity 1 0 no parity 0 1 odd parity 1 1 even parity Bit 2 defines stop bits: 0 1 stop bit; 1 1.5 bits for 5-bit char; 2 for others Bits 1-0 character length: fosreadw (unit MGFOSSIL) ____________________________________________________________ Synopsis: function mgfossil.fosreadw(com: word): byte; Description: If there is a character available in the receive buffer, returns it, else wait until a character is received if none is available. Input: com: comport to use. Output: function result = character received. - 244 - See Also: fosread fosread (unit MGFOSSIL) ____________________________________________________________ Synopsis: function mgfossil.fosread(com: word): integer; Description: This function will get a character from port, if no character is waiting this function WON'T wait and return -1. Input: com: comport to use. Output: function result = character received or -1. See Also: fosreadw fosgetstatus (unit MGFOSSIL) ____________________________________________________________ Synopsis: function mgfossil.fosgetstatus(com: word): word; Description: This function report the status for a comport, bit-map is describe bellow. Input: nothing. Output: high byte order of function result: Bit 0 = RDA - input data is available in buffer Bit 1 = OVRN - the input buffer has been overrun. Bit 5 = THRE - room is available in output buffer Bit 6 = TSRE - output buffer is empty low byte order of function result: Bit 3 = Always 1 (always return with this bit set to 1) Bit 7 = DCD - carrier detect This can be used by the application to determine whether - 245 - carrier detect (CD) is set, signifying the presence/absence of a remote connection, as well as monitoring both the input and output buffer status. Bit 3 of low byte is always returned set to enable programs to use it as a carrier detect bit on hardwired (null modem) links. fosflushout (unit MGFOSSIL) ____________________________________________________________ Synopsis: procedure mgfossil.fosflushout(com: word); Description: This is used to force any pending output. It does not return until all pending output has been sent. You should use this call with care. Flow control (documented below) can make your system hang on this call in a tight uninterruptible loop under the right circumstances. Input: com: comport to use. Output: nothing. fospurgeout (unit MGFOSSIL) ____________________________________________________________ Synopsis: procedure mgfossil.fospurgeout(com: word); Description: This is used to purge any pending output. Any output data remaining in the output buffer (not transmitted yet) is discarded. Input: com: comport to use. Output: nothing. See Also: fospurgein - 246 - fospurgein (unit MGFOSSIL) ____________________________________________________________ Synopsis: procedure mgfossil.fospurgein(com: word); Description: This is used to purge any pending input. Any input data which is still in the buffer is discarded. Input: com: comport to use. Output: nothing. See Also: fospurgeout foswriteblk (unit MGFOSSIL) ____________________________________________________________ Synopsis: function mgfossil.foswriteblk(com, bufmax: word; bufptr: pointer): word; Description: A "no-wait" block move of 0 to FFFFh characters from the calling program's buffer into the FOSSIL outbound ring buffer. Input: com: comport to use. bufmax: maximum number of bytes to transfer. bufptr: address of user buffer. Output: function result = number of bytes transfer. See Also: fosreadblk - 247 - fosreadblk (unit MGFOSSIL) ____________________________________________________________ Synopsis: function mgfossil.fosreadblk(com, bufmax: word; bufptr: pointer): word; Description: A "no-wait" block read of 0 to FFFFh characters from the FOSSIL inbound ring buffer to the calling routine's buffer. Input: com: comport to use. bufmax: maximum number of bytes to transfer. bufptr: address of user buffer. Output: function result = number of bytes transfer. See Also: foswriteblk foscdstatus (unit MGFOSSIL) ____________________________________________________________ Synopsis: function mgfossil.foscdstatus(com: word): boolean; Description: This function test the status of carrier detect line, if CD is activated this function will return true, if it dropped this function return false. Input: com: comport to use. Output: function result = true if CD is enable, else disable. - 248 - fossetdtr (unit MGFOSSIL) ____________________________________________________________ Synopsis: procedure mgfossil.fossetdtr(com: word; mode: boolean); Description: This function is used to control the DTR line to the modem. No other function (except Init) should alter DTR. Input: com: comport to use. mode: true to enable, false to disable. Output: nothing. fossetflowctrl (unit MGFOSSIL) ____________________________________________________________ Synopsis: procedure mgfossil.fossetflowctrl(com: word; status: byte); Description: Transmit flow control allows the "other end" to restrain the transmitter when you are over-running it. Receive flow control tells the FOSSIL to attempt to do just that if it is being overwhelmed. Two kinds of basic flow control are supported: Bit 0 = 1 Xon/Xoff on transmit Bit 1 = 1 CTS/RTS (CTS on transmit, RTS on receive) Bit 2 Reserved Bit 3 = 1 Xon/Xoff on Receive Flow control is enabled, or disabled, by setting the appropriate bits in status for the types of flow control we want to ENABLE (value = 1), and/or DISABLE (value = 0), and calling this function. Bit 2 is reserved for DSR/DTR, but is not currently supported in any implementation. Enabling transmit Xon/Xoff will cause the FOSSIL to stop transmitting upon receiving an Xoff. The FOSSIL will resume transmitting when an Xon is received. - 249 - Enabling CTS/RTS will cause the FOSSIL to cease transmitting when CTS is lowered. Transmission will resume when CTS is raised. The FOSSIL will drop RTS when the receive buffer reaches a predetermined percentage full The FOSSIL will raise RTS when the receive buffer empties below the predetermined percentage full. The point(s) at which this occurs is left to the individual FOSSIL implementor. Enabling receive Xon/Xoff will cause the FOSSIL to send a Xoff when the receive buffer reaches a pre-determined percentage full. An Xon will be sent when the receive buffer empties below the pre-determined percentage full. The point(s) at which this occurs is left to the individual FOSSIL implementor. Applications using this function should set all bits ON in the high nibble of AL as well. There is a compatible (but not identical) FOSSIL driver implementation that uses the high nibble as a control mask. If your application sets the high nibble to all ones, it will always work, regardless of the method used by any given driver. foswritew (unit MGFOSSIL) ____________________________________________________________ Synopsis: procedure mgfossil.foswritew(com: word; b: byte); Description: Character contains the character to be sent. If there is room in the transmit buffer the return will be immediate, otherwise it will wait until there is room to store the character in the transmit buffer. Input: com: comport to use. b: byte to send. Output: nothing. See Also: foswrite - 250 - foswrite (unit MGFOSSIL) ____________________________________________________________ Synopsis: function mgfossil.foswrite(com: word; b: byte): boolean; Description: This is exactly the same as foswritew transmit call, except that if the driver is unable to buffer the character (the buffer is full), function return false. Input: com: comport to use. b: byte to send. Output: function result = true if char send, else false. See Also: foswritew fospeek (unit MGFOSSIL) ____________________________________________________________ Synopsis: function mgfossil.fospeek(com: word): integer; Description: Get the next character in the receive buffer. If the receive buffer is empty, return FFFFh. The character returned remains in the receive buffer. Input: com: comport to use. Output: function result = character received or $FFFF. fosstartbreak (unit MGFOSSIL) ____________________________________________________________ Synopsis: procedure mgfossil.fosstartbreak(com: word); Description: Start sending a break signal to the modem. This is useful - 251 - for communications with devices that can only go into 'command mode' when a BREAK is received. Note: the application is responsible for the timing of the BREAK. Also, if the FOSSIL has been restrained by an Xoff received from the modem, the flag will be cleared. An Init or Un- Init will stop an in-progress BREAK. Input: com: comport to use. Output: nothing. See Also: fossendbreak fosstopbreak fosstopbreak (unit MGFOSSIL) ____________________________________________________________ Synopsis: procedure mgfossil.fosstopbreak(com: word); Description: This function stop sending break that as been start by fosstartbreak. For information on break refer to fosstartbreak procedure. Input: com: comport to use. Output: nothing. See Also: fossendbreak fosstartbreak fossendbreak (unit MGFOSSIL) ____________________________________________________________ Synopsis: procedure mgfossil.fossendbreak(com, ms: word); Description: This function is a complement of start and stop fossil break, it allow you send a break for a specific number of milliseconds. Input: - 252 - com: comport to use. ms: length of break time in milliseconds Output: nothing. See Also: fosstartbreak fosstopbreak fosctrlck (unit MGFOSSIL) ____________________________________________________________ Synopsis: function mgfossil.fosctrlck(com: word; ctrlchk, transmit: boolean): boolean; Description: Get fossil break state, and set transmitter on/off. The Enable and Disable Control-C/Control-K check function is meant primarily for BBS use. When the checking is enabled, a Control-C or Control-K received from the communications port will set a flag internal to the FOSSIL driver, but will not be stored in the input buffer. The next use of this function will return the value of this flag then clear the flag for the next occurrence. The returned value is used by the BBS software to determine whether output should be halted or not. Input: com: comport to use. transmit: true to enable, false to disable. ctrlchk: true to enable checking, false to disable. Output: function result = true is ctrl-c detect. fosdataavail (unit MGFOSSIL) ____________________________________________________________ Synopsis: function mgfossil.fosdataavail(com: word): boolean; Description: This function return true if there is data available in input buffer. - 253 - Input: com: comport to use. Output: function result = true if input buffer not empty. fospeekkey (unit MGFOSSIL) ____________________________________________________________ Synopsis: function mgfossil.fospeekkey: integer; Description: Get next key from keyboard, but key is not removed from keyboard buffer. Return ffffh if no key waiting. Input: nothing. Output: function result = key read or $FFFF. fosreadkey (unit MGFOSSIL) ____________________________________________________________ Synopsis: function mgfossil.fosreadkey: integer; Description: Return the next character (non-destructive read ahead) from the keyboard; if nothing is currently in the keyboard buffer, return FFFFh. Use IBM-style function key mapping in the high order byte. Scan codes for non-"function" keys are not specifically required, but may be included. Input: nothing. Output: function result = key read or $FFFF See Also: fosreadkeyw - 254 - fosreadkeyw (unit MGFOSSIL) ____________________________________________________________ Synopsis: function mgfossil.fosreadkeyw: integer; Description: Return the next character from the keyboard; wait if no character is available. Input: nothing. Output: function result = key read. See Also: fosreadkey fossetcrsloc (unit MGFOSSIL) ____________________________________________________________ Synopsis: procedure mgfossil.fossetcrsloc(row, col: byte); Description: This function looks exactly like like INT 10h, subfunction 2, on the IBM PC. The function treats the screen as a coordinate system whose origin (0,0) is the upper left hand corner of the screen. Input: row,col: where to put cursor on screen. Output: nothing. See Also: fosgetcrsloc fosgetcrsloc (unit MGFOSSIL) ____________________________________________________________ Synopsis: procedure mgfossil.fosgetcrsloc(var row, col: byte); Description: - 255 - Looks exactly like INT 10h, subfunction 3, on the IBM PC. Get the current cursor location. Input: nothing. Output: row,col: where the cursor is currently. See Also: fossetcrsloc fosdoswrite (unit MGFOSSIL) ____________________________________________________________ Synopsis: procedure mgfossil.fosdoswrite(character: char); Description: Write a character using DOS functions. (ANSI.SYS) The character is sent to the screen by the fastest method possible that allows ANSI processing to occur (if available). This routine should not be used in such a way that DOS output (which is not re-entrant) can not be employed by some FOSSIL driver to perform the function (in fact, on the IBM PC that is likely to be how it's done). On some systems such as the DEC Rainbow this will be a very fast method of screen writing. Input: character: character to write on screen. Output: nothing. fosbioswrite (unit MGFOSSIL) ____________________________________________________________ Synopsis: procedure mgfossil.fosbioswrite(character: char); Description: The character is sent to the screen using BIOS-level Input/Output routines. This differs from fosdoswrite that DOS I/O CAN NOT be used, as this function might be called from driver level. Input: character: character to write on screen. - 256 - Output: nothing. foscoldreboot (unit MGFOSSIL) ____________________________________________________________ Synopsis: procedure mgfossil.foscoldreboot; Description: Used in extreme emergency by code that can't seem to find a "clean" way out of the trouble it has gotten itself into. Hopefully it won't happen while you're computing something in the other half of a DoubleDOS system. If your machine can make a distinction between a "cold" (power-up, self-test and boot) and a "warm" (just boot) bootstrap, your FOSSIL should support the flag in AL. Otherwise just do whatever bootstrap is possible. Input: nothing. Output: nothing. See Also: foswarmboot foswarmboot (unit MGFOSSIL) ____________________________________________________________ Synopsis: procedure mgfossil.foswarmreboot; Description: This procedure reboot the computer using warm format, warm format differ from cold; it won't do memory test. Input: nothing. Output: nothing. See Also: foscoldreboot - 257 - fossetwatchdog (unit MGFOSSIL) ____________________________________________________________ Synopsis: procedure mgfossil.fossetwatchdog(com: word; mode: boolean); Description: When watchdog is enabled, the state of the carrier detect (CD) line on the comm port specified in com should be constantly monitored. Should the state of that line become FALSE (carrier lost), the system should be re- booted, to enable the BBS (or other application) to start up again. This monitor is not affected by Init/Uninit etc. Input: com: comport to use. mode: true to enable, false to disable. Output: nothing. fosgetinfo (unit MGFOSSIL) ____________________________________________________________ Synopsis: procedure mgfossil.fosgetinfo(com: word; buffer: fosstructptr); Description: Transfer information about the driver and its current status to the user for use in determining, at the application level, limits of the driver. Designed to assist "generic" applications to adjust to "foreign" gear. The data structure: fosstruct The ident string should be null-terminated, and NOT contain a newline. The baud rate byte contains the bits that Function 00h would use to set the port to that speed. The fields related to a particular port (buffer size, space left in the buffer, baud rate) will be undefined if port FFh or an invalid port is contained in DX. - 258 - Additional information will always be passed after these, so that, for example, offset "sheight" will never change with FOSSIL revision changes. Input: com: comport to use. buffer: address of memory block where to stored information. Output: buffer: filled with information. fosgetoutleft (unit MGFOSSIL) ____________________________________________________________ Synopsis: function mgfossil.fosgetoutleft(com: word): word; Description: This function return space left in output buffer. Input: com: comport to use. Output: function result = space left in output buffer. See Also: fosgetinleft fosgetinleft (unit MGFOSSIL) ____________________________________________________________ Synopsis: function mgfossil.fosgetinleft(com: word): word; Description: This function return space left in input buffer. Input: com: comport to use. Output: function result = space left in input buffer. See Also: fosgetoutleft - 259 - fosgetinsize (unit MGFOSSIL) ____________________________________________________________ Synopsis: function mgfossil.fosgetinsize(com: word): word; Description: This function return input buffer size. Input: com: comport to use. Output: function result = input buffer size. See Also: fosgetoutsize fosgetoutsize (unit MGFOSSIL) ____________________________________________________________ Synopsis: function mgfossil.fosgetoutsize(com: word): word; Description: This function return output buffer size. Input: com: comport to use. Output: function result = output buffer size. See Also: fosgetinsize fosgetbaud (unit MGFOSSIL) ____________________________________________________________ Synopsis: function mgfossil.fosgetbaud(com: word): word; Description: This function return the current baud rate. Input: com: comport to use. - 260 - Output: function result = current baud rate. fosgetversion (unit MGFOSSIL) ____________________________________________________________ Synopsis: function mgfossil.fosgetversion(com: word): word; Description: This function return fossil version, minor version is in low byte order of return code will major version is in the high order byte of return code. Input: com: comport to use. Output: function result = fossil version. fosgetswidth (unit MGFOSSIL) ____________________________________________________________ Synopsis: function mgfossil.fosgetswidth(com: word): byte; Description: This function return screen width. Input: com: comport to use. Output: function result = screen width. See Also: fosgetsheight fosgetsheight (unit MGFOSSIL) ____________________________________________________________ Synopsis: function mgfossil.fosgetsheight(com: word): byte; Description: - 261 - This function return screen height. Input: com: comport to use. Output: function result = screen height. See Also: fosgetswidth fosgetnameptr (unit MGFOSSIL) ____________________________________________________________ Synopsis: function mgfossil.fosgetnameptr(com: word): pointer; Description: This function return a far pointer that point at address where you can find the fossil name. The ident string should be null-terminated, and NOT contain a newline. Input: com: comport to use. Output: function result = fossil name pointer. fosinoverrin (unit MGFOSSIL) ____________________________________________________________ Synopsis: function mgfossil.fosinoverrun(com: word): boolean; Description: This function return the state of input buffer overrun, if input buffer as overrun this function return true, else it return false. Input: com: comport to use. Output: function result = true if input buffer as overrun. - 262 - fosspaceinoutbuf (unit MGFOSSIL) ____________________________________________________________ Synopsis: function mgfossil.fosspaceinoutbuf(com: word): boolean; Description: This function check if there are space in output buffer, if space found this function return true, else it return false. Input: com: comport to use. Output: function result = true if output buffer not full. fosoutbufempty (unit MGFOSSIL) ____________________________________________________________ Synopsis: function mgfossil.fosoutbufempty(com: word): boolean; Description: This function check if output buffer is empty, if buffer is empty this function return true, else it return false. Input: com: comport to use. Output: function result = true if output buffer is empty. mx5init (unit MGFOSSIL) ____________________________________________________________ Synopsis: function mgfossil.mx5init(com: word): boolean; Description: This function initialize MX5 fossil driver, if fossil respond this function return true, else it return false. - 263 - Input: com: comport to use. Output: function result = true if mx5 init. See Also: mx5unstall mx5getinfo (unit MGFOSSIL) ____________________________________________________________ Synopsis: function mgfossil.mx5getinfo(com: word): mx5structptr; Description: This information return a pointer where you can find information about mx5 fossil. At this address you will find a record of type mx5struct. Input: com: comport to use. Output: function result = pointer at mx5 information block. mx5setmnplvl (unit MGFOSSIL) ____________________________________________________________ Synopsis: function mgfossil.mx5setmnplvl(com: word; level: byte): byte; Description: This function change the current mnp level of mx5 fossil and return the new mnp level. Input: com: comport to use. level: new level. Output: function result = new level. See Also: mx5getmnplvl - 264 - mx5getmnplvl (unit MGFOSSIL) ____________________________________________________________ Synopsis: function mgfossil.mx5getmnplvl(com: word): byte; Description: This function return the current mnp level of mx5 fossil. Input: com: comport to use. Output: function result = current mnp level. See Also: mx5setmnplvl mx5getmnpansordmode (unit MGFOSSIL) ____________________________________________________________ Synopsis: function mgfossil.mx5getmnpansorgmode(com: word): byte; Description: This function return the originate answer mode of mx5 fossil. Input: com: comport to use. Output: function result = originate answer mode. See Also: mx5setmnpansorgmode mx5setmnpansorgmode (unit MGFOSSIL) ____________________________________________________________ Synopsis: function mgfossil.mx5setmnpansorgmode(com: word; newmode: byte): byte; Description: - 265 - This function change the originate answer mode of mx5 fossil and return the new originate answer mode. Input: com: comport to use. newmode: new mode. Output: function result = new mode. See Also: mx5getmnpansorgmode mx5getmnpwaittck (unit MGFOSSIL) ____________________________________________________________ Synopsis: function mgfossil.mx5getmnpwaittck(com: word): byte; Description: This function return the number of ticks (55 msecs/tic) after Carrier Detect raises until an MNP connection is attempted. Input: com: comport to use. Output: function result = number of wait tick. See Also: mx5setmnpwaittck mx5getmnpwaittck (unit MGFOSSIL) ____________________________________________________________ Synopsis: function mgfossil.mx5setmnpwaittck(com: word; newvalue: byte): byte; Description: This function change the number of ticks (55 msecs/tic) after Carrier Detect raises until an MNP connection is attempted and return the new number. Input: com: comport to use. newvalue: new number of tick. - 266 - Output: function result = new number of tick. See Also: mx5getmnpwaittck mx5getmnpconnectsndlvl (unit MGFOSSIL) ____________________________________________________________ Synopsis: function mgfossil.mx5getmnpconnectsndlvl(com: word): byte; Description: Gets whether MX5 will "play" a tune after an MNP connection. If an MNP connection is successful, 3 high beeps are played. If the MNP connection is not successful, a high/low beep is played. Input: com: comport to use. Output: function result = sound connection level. See Also: mx5setmnpconnectsndlvl mx5setmnpconnectsndlvl (unit MGFOSSIL) ____________________________________________________________ Synopsis: function mgfossil.mx5setmnpconnectsndlvl(com: word; level: byte): byte; Description: Sets whether MX5 will "play" a tune after an MNP connection. If an MNP connection is successful, 3 high beeps are played. If the MNP connection is not successful, a high/low beep is played. Input: com: comport to use. level: new connection sound level. Output: function result = new connection sound level. - 267 - See Also: mx5getmnpconnectsndlvl mx5uninstall (unit MGFOSSIL) ____________________________________________________________ Synopsis: procedure mgfossil.mx5uninstall(remove: boolean); Description: Deinit mx5 fossil driver and optionally remove driver from memory. Input: remove: true = remove MX5 driver from memory. Output: nothing. mx5waitticks (unit MGFOSSIL) ____________________________________________________________ Synopsis: procedure mgfossil.mx5waitticks(numticks: word); Description: This procedure will pause for a specific number of tick. This function seem to be buggy, when i call this function on my computer it crash so use this function with care meaby there is a bug in MX5 fossil driver. Input: numticks: number of tick to pause. Output: nothing. mx5getactiveflag (unit MGFOSSIL) ____________________________________________________________ Synopsis: function mgfossil.mx5getactiveflag(com: word): boolean; Description: This function check if mnp is active, if mnp is - 268 - activated this function return true, else it return false. Input: com: comport to use. Output: function result = true if enable, false if disable. mx5getid (unit MGFOSSIL) ____________________________________________________________ Synopsis: function mgfossil.mx5getid(com: word): byte; Description: This function return the id byte of mx5 fossil. Input: com: comport to use. Output: function result = id. mx5getpacketssend (unit MGFOSSIL) ____________________________________________________________ Synopsis: function mgfossil.mx5getpacketssend(com: word): longint; Description: This function return the number of packet send. Input: com: comport to use. Output: function result = number of packets send. - 269 - mx5getmaxsndspeed (unit MGFOSSIL) ____________________________________________________________ Synopsis: function mgfossil.mx5getmaxsndspeed(com: word): longint; Description: This function return the max send speed. Input: com: comport to use. Output: function result = max transmit speed. mx5gettotalpacketrecv (unit MGFOSSIL) ____________________________________________________________ Synopsis: function mgfossil.mx5gettotalpacketrecv(com: word): longint; Description: This function return the number of total receive packets. Input: com: comport to use. Output: function result = number of packet received. mx5getduppacketrecv (unit MGFOSSIL) ____________________________________________________________ Synopsis: function mgfossil.mx5getduppacketrecv(com: word): longint; Description: This function return the number of packet send. Input: com: comport to use. - 270 - Output: function result = number of packets send. mx5getduppackets (unit MGFOSSIL) ____________________________________________________________ Synopsis: function mgfossil.mx5getduppackets(com: word): longint; Description: This function return the number of packet send. Input: com: comport number. Output: function result = number of packets send. mx5getmaxrcvspeed (unit MGFOSSIL) ____________________________________________________________ Synopsis: function mgfossil.mx5getmaxrcvspeed(com: word): longint; Description: This function return the number of packet send. Input: com: comport number. Output: function result = number of packets send. x00init (unit MGFOSSIL) ____________________________________________________________ Synopsis: function mgfossil.x00init(com: word): boolean; Description: This function initialize comport, this function do the same job done by fosinit but it maybe only support by X00 driver. - 271 - Input: com: comport number. Output: function result = true if comport initialized. x00done (unit MGFOSSIL) ____________________________________________________________ Synopsis: procedure mgfossil.x00done(com: word); Description: This function is similar to fosdeinit but this function maybe only support by X00 driver. Input: com: comport number. Output: nothing. x00getrts (unit MGFOSSIL) ____________________________________________________________ Synopsis: function mgfossil.x00getrts(com: word): boolean; Description: This function return the RTS status if driver is X00. Input: com: comport number. Output: function result = true if RTS enable. x00getout1 (unit MGFOSSIL) ____________________________________________________________ Synopsis: function mgfossil.x00getout1(com: word): boolean; Description: - 272 - This function return the OUT1 status if driver is X00. Input: com: comport number. Output: function result = true if OUT1 enable. x00getout2 (unit MGFOSSIL) ____________________________________________________________ Synopsis: function mgfossil.x00getout2(com: word): boolean; Description: This function return the OUT2 status if driver is X00. Input: com: comport number. Output: function result = true if OUT2 enable. x00getlooptest (unit MGFOSSIL) ____________________________________________________________ Synopsis: function mgfossil.x00getlooptest(com: word): boolean; Description: This function return the LOOP BACK TEST status if driver is X00. Input: com: comport number. Output: function result = true if looptest enable. - 273 - x00setrts (unit MGFOSSIL) ____________________________________________________________ Synopsis: procedure mgfossil.x00setrts(com: word; newvalue: boolean); Description: This function set the status of RTS line if driver is X00. Input: com: comport number. newvalue: new RTS value. Output: function result = true if RTS set. x00setout1 (unit MGFOSSIL) ____________________________________________________________ Synopsis: procedure mgfossil.x00setout1(com: word; newvalue: boolean); Description: This function set the status of OUT1 line if driver is X00. Input: com: comport number. newvalue: new OUT1 value. Output: function result = true if OUT1 set. x00setout2 (unit MGFOSSIL) ____________________________________________________________ Synopsis: procedure mgfossil.x00setout2(com: word; newvalue: boolean); - 274 - Description: This function set the status of OUT2 line if driver is X00. Input: com: comport number. newvalue: new OUT2 value. Output: function result = true if OUT2 set. x00setlooptest (unit MGFOSSIL) ____________________________________________________________ Synopsis: function mgfossil.x00setlooptest(com: word; newvalue: boolean): boolean; Description: This function set the status of LOOP BACK TEST if driver is X00. Input: com: comport number. newvalue: new looptest value. Output: function result = true if looptest set. x00writein (unit MGFOSSIL) ____________________________________________________________ Synopsis: function mgfossil.x00writein(com: word; character: byte): boolean; Description: This function will insert the passed character into the receive buffer (at the end). Subsequent reading of the serial input will read the character. The character is inserted at the end of the buffer (as though it were just received). The character is inserted into the receive buffer by calling the receive interrupt routine. All normal - 275 - receive checking is performed on the character. Some things to note are: If receiving of Xon/Xoff is enabled and an Xoff is stuffed/poked into the buffer, the transmitter will stop until a an Xon is received or stuffed/poked. If Control C/K checking is enabled and a Control C/K is stuffed/poked, then the character is not put in the buffer and the internal flags is set. The above should give you a little to think about when using this function. This function is intended to be fully re-entrant. Thus, it should be callable from timer tick processing etc. Input: com: comport number. character: character to stored. Output: function result = true if character stored. x00peek (unit MGFOSSIL) ____________________________________________________________ Synopsis: function mgfossil.x00peek(com: word; var c: char): boolean; Description: Not destructive read with no wait. return false if comport is invalid, or cannot't be close. Input: com: comport number. Output: c: character read. function result = true if character read. - 276 - x00extinit (unit MGFOSSIL) ____________________________________________________________ Synopsis: procedure mgfossil.x00extinit(com: word; brkstatus, speed, data, parity, stopbits: byte); Description: This procedure change the line parameters. Notes: this function is intended to exactly emulate the PS/2 BIOS AH=04h call if the port was locked at X00 load time, the appropriate parameters are ignored. Input: com: comport number. brkstatus: break = 01, no break = 00. speed: baud rate. parity: parity type stopbit: number of stop bit. Output: nothing. - 277 - MGGRAPH.TPU ____________________________________________________________ Description: This unit contain miscellaneous GRAPHX function, like line, put and get pixel, fade etc. This module only support display mode $13, MCGA 320x200x256 display. Language Used: coded in PASCAL and ASSEMBLER. Linked With: MGGLOBAL, MGMEM, MGMISC, MGFILHDL. Example File: 'MGPAS014.PAS' this file give you an example that use all functions and procedures of this unit. Constants: videoseg Types: pcxheaderptr pcxheader Functions And Procedures: fillbox getcol setcol initcol setbrightness fadeout fadein setvideomode getpixel setpixel line getimage putimage trsputimage viewpcx waitforretrace clearscr - 278 - videoseg (unit MGGRAPH) ____________________________________________________________ Synopsis: Const mggraph.videoseg: word = $a000; Description: This constant old the segment of video buffer, offset is always zero. pcxheaderptr (unit MGGRAPH) ____________________________________________________________ Synopsis: mggraph.pcxheaderptr = ^pcxheader; Description: A pointer of pcx header. pcxheader (unit MGGRAPH) ____________________________________________________________ Synopsis: mggraph.pcxheader = record Description: This type is used to declare a variable to get pcx file header. Fields: manufacturer: byte; version: byte; encoding: byte; bitsperpixel: byte; windowxmin: integer; windowymin: integer; windowxmax: integer; windowymax: integer; hres: integer; vres: integer; colormap: array... - 279 - reserved: byte; nplanes: byte; bytesperline: integer; paletteinfo: integer; reserved_2: array... pcxheader.manufacturer: byte; Constant Flag 10 = ZSoft .PCX. pcxheader.version: byte; Version information: - 0 = Version 2.5 - 2 = Version 2.8 w/palette information - 3 = Version 2.8 w/o palette information - 5 = Version 3.0 pcxheader.encoding: byte; 1 = .PCX run length encoding. pcxheader.bitsperpixel: byte; Number of bits/pixel per plane. pcxheader.windowxmin: integer; Picture Dimensions. pcxheader.windowymin: integer; Picture Dimensions. pcxheader.windowxmax: integer; Picture Dimensions. pcxheader.windowymax: integer; Picture Dimensions (Xmin, Ymin) - (Xmax - Ymax) pcxheader.hres: integer; Horizontal Resolution of creating device. pcxheader.vres: integer; Vertical Resolution of creating device. pcxheader.colormap: array[1..48] of byte; Color palette setting, see text. pcxheader.nplanes: byte; Number of color planes. pcxheader.bytesperline: integer; Number of bytes per scan line per color plane (always even for .PCX files) pcxheader.paletteinfo: integer; How to interpret palette - 1 = color/BW, - 2 = grayscale fillbox (unit MGGRAPH) ____________________________________________________________ Synopsis: procedure mggraph.fillbox(x1, y1, x2, y2: integer; c: byte); Description: This procedure draw a full box on screen. - 280 - Input: x1,y1: upper left corner. x2,y2: bottom right corner. c: color to use. Output: nothing. getcol (unit MGGRAPH) ____________________________________________________________ Synopsis: procedure mggraph.getcol(col: byte; var r, g, b: byte); Description: This procedure allow you to get RGB value for a specific color of current palette. Input: col: color number. Output: r: red color value. g: green color value. b: blue color value. See Also: setcol setcol (unit MGGRAPH) ____________________________________________________________ Synopsis: procedure mggraph.setcol(col, r, g, b: byte); Description: This procedure allow you to set the RGB value for a specific color of current palette. Input: col: color number. r: red color value. g: green color value. b: blue color value. Output: nothing. - 281 - See Also: getcol initcol (unit MGGRAPH) ____________________________________________________________ Synopsis: procedure mggraph.initcol; Description: This procedure store palette into global variable. This procedure must be call before fadeout, fadein and setbrightness can work. Input: nothing. Output: nothing. See Also: fadein fadeout setbrightness setbrightness (unit MGGRAPH) ____________________________________________________________ Synopsis: procedure mggraph.setbrightness(brightness: byte); Description: This procedure change the brightness of current palette. Input: Brightness: number from 0 to 63 where 0 is darker. Output: nothing. fadeout (unit MGGRAPH) ____________________________________________________________ Synopsis: procedure mggraph.fadeout(duration: word); Description: - 282 - This procedure will do a fadeout of current palette with a specific number of milliseconds of delay between each palette change. Input: duration: delay between each palette change. Output: nothing. See Also: fadein fadein (unit MGGRAPH) ____________________________________________________________ Synopsis: procedure mggraph.fadein(duration: word); Description: This procedure will do a fadein of current palette with a specific number of milliseconds of delay between each palette change. Input: duration: delay between each palette change. Output: nothing. See Also: fadeout setvideomode (unit MGGRAPH) ____________________________________________________________ Synopsis: procedure mggraph.setvideomode(mode: byte); Description: This procedure change the current video mode. Remember that this unit only support mode $13, this procedure is implemented to change from mode $13 to text mode $3. Input: mode: new video mode. Output: nothing. - 283 - getpixel (unit MGGRAPH) ____________________________________________________________ Synopsis: function mggraph.getpixel(x, y: word): byte; inline; Description: This function return the color of one pixel at a specific position (x,y). Input: x,y: coordinates of pixel. Output: function result = pixel color. See Also: setpixel setpixel (unit MGGRAPH) ____________________________________________________________ Synopsis: procedure mggraph.setpixel(x, y: word; c: byte); inline; Description: This procedure set the color of one pixel at a specific position (x,y) on screen. Input: x,y: coordinate of pixel to plot. c: set pixel to this color. Output: nothing. See Also: getpixel line (unit MGGRAPH) ____________________________________________________________ Synopsis: procedure mggraph.line(x, y, x2, y2, c: word); Description: - 284 - This procedure draw a line from a specific point to another point with a certain color. Input: x,y: coordinates for first point. x2,y2: coordinates for second point. c: color to use. Output: nothing. getimage (unit MGGRAPH) ____________________________________________________________ Synopsis: procedure mggraph.getimage(x, y, xlen, ylen: word; buffer: pointer); Description: This procedure will get a part of screen and saved it in user buffer. Input: x,y: upper left corner of box to get from screen. xlen, ylen: box width and height. buffer: memory address where to stored pixels. Output: nothing. See Also: putimage trsputimage putimage (unit MGGRAPH) ____________________________________________________________ Synopsis: procedure mggraph.putimage(x, y, xlen, ylen: word; buffer: pointer); Description: This procedure restore an image saved by getimage. Input: - 285 - x,y: upper left corner of box to put on screen. xlen: box width. ylen: box height. buffer: address of pixels. Output: nothing. See Also: getimage trsputimage trsputimage (unit MGGRAPH) ____________________________________________________________ Synopsis: procedure mggraph.trsputimage(x, y, xlen, ylen: word; col: byte; buffer: pointer); Description: This function is similar to putimage except this one allow you to skip a certain color. If parameter col is set to zero for example, then all pixel in buffer equal to zero won't be printed on screen. Some people call this function a transparent put image. Input: x,y: upper left corner of box to put on screen. xlen: box width. ylen: box height. col: color to skip. buffer: address of pixels. Output: nothing. See Also: getimage putimage viewpcx (unit MGGRAPH) ____________________________________________________________ Synopsis: function mggraph.viewpcx(header: pcxheaderptr; setpalette: boolean; max, x, y: word; vaddr: pointer; name: string): word; Description: - 286 - This function will display a .PCX file (320x200x256) at a specific position in a specific destination pointer. To display PCX on screen set parameter vaddr to $A000:0. Input: setpalette: if this is set to true pallette is read at end of pcx file and set, else we ignore the pallette. max: maximum number of bytes to transfert if we reatch this count decompression of pcx is stoped but will pallette still be set if request. x,y: upper left corner of screen where to start. vaddr: video address where PCX is uncompressed, this address can be ($A000:0) do display it directly on screen or any buffer if you don't want to display imediatelly. name: filename (.PCX) to display. Output: header: header of pcx file. function result = number of bytes transfer if error occur function return 0 bytes transfer. waitforretrace (unit MGGRAPH) ____________________________________________________________ Synopsis: procedure mggraph.waitforretrace; Description: This procedure wait for vertical retrace. Input: nothing. Output: nothing. clearscr (unit MGGRAPH) ____________________________________________________________ Synopsis: procedure mggraph.clearscr; Description: - 287 - This procedure clear screen using color 0. Input: nothing. Output: nothing. MGLIST.TPU ____________________________________________________________ Description: This unit implemented linked list functions. These routines allow the creation of multiple linked list of any size in heap memory (640k). Language Used: coded in PASCAL. Linked With: MGMEM. Example File: 'MGPAS016.PAS' this file give you an example that use all functions and procedures of this unit. Types: itemrecptr itemrec lstptr lst Functions And Procedures: lstseekprev lstseeknext lstaddafter lstaddbefore lstchangesize lstaddend lstaddstart lstdone lstdelete lstempty lstinit - 288 - itemrecptr (unit MGLIST) ____________________________________________________________ Synopsis: mglist.itemrecptr = ^itemrec; Description: Pointer of itemrec. itemrec (unit MGLIST) ____________________________________________________________ Synopsis: mglist.itemrec = record Description: This record defined information for each item in list. Fields: serial: longint; size: word; address: pointer; next: itemrecptr; prev: itemrecptr; itemrec.serial: longint; item serial number for user usage only. itemrec.size: word; size of memory allocate. itemrec.address: pointer; address of memory. itemrec.next: itemrecptr; address of next element. itemrec.prev: itemrecptr; address of prev element. lstptr (unit MGLIST) ____________________________________________________________ Synopsis: mglist.lstptr = ^lst; Description: - 289 - Pointer of lst. lst (unit MGLIST) ____________________________________________________________ Synopsis: mglist.lst = record Description: This record is use to create a list. Fields: first: itemrecptr; last: itemrecptr; totalobj: longint; curentobj: itemrecptr; lst.first: itemrecptr; address of first element in list. lst.last: itemrecptr; address of last element in list. lst.totalobj: longint; total items allocate. lst.curentobj: itemrecptr; address of current item. lstseekprev (unit MGLIST) ____________________________________________________________ Synopsis: function mglist.lstseekprev(l: lstptr): boolean; Description: This function seek to previous element in list. If currently at end of list this function return false, else it return true. Input: l: list variable. Output: function result = false if at end of list. See Also: lstseeknext - 290 - lstseeknext (unit MGLIST) ____________________________________________________________ Synopsis: function mglist.lstseeknext(l: lstptr): boolean; Description: This function seek to next element in list. If currently at end of list this function return false, else it return true. Input: l: list variable. Output: function result = false if at end of list. See Also: lstseekprev lstaddafter (unit MGLIST) ____________________________________________________________ Synopsis: function mglist.lstaddafter(l: lstptr; itemsize: word; element: pointer; chgcurrent: boolean): boolean; Description: This function insert an element after the current element. This function return true if element added, else it return false. Input: l: list variable. itemsize: size of item to stored. iteddata: address of data to stored. chgcurrent: true to make (current) point on this new object. Output: function result = true if element added to list. See Also: lstaddend lstaddstart lstinsertbefore - 291 - lstaddbefore (unit MGLIST) ____________________________________________________________ Synopsis: function mglist.lstaddbefore(l: lstptr; itemsize: word; element: pointer; chgcurrent: boolean): boolean; Description: This function insert an element before the current element. This function return true if element added, else it return false. Input: l: list variable. itemsize: size of item to stored. iteddata: address of data to stored. chgcurrent: true to make (current) point on this new object. Output: function result = true if element added to list. See Also: lstaddafter lstaddend lstaddstart lstchangesize (unit MGLIST) ____________________________________________________________ Synopsis: function mglist.lstchangesize(l: lstptr; newsize: word): boolean; Description: This function change size of memory allocate for one item. This function save data in element but if you set a new size smaller than previous size you will loose part of previous data. This function return true if size of item as been changed. Input: l: list variable. newsize: new size of current item. Output: function result = true if size changed. - 292 - lstaddend (unit MGLIST) ____________________________________________________________ Synopsis: function mglist.lstaddend(l: lstptr; itemsize: word; element: pointer; chgcurrent: boolean): boolean; Description: This function add one element to the end of list. This function return true if element as been added, else it return false. Input: l: list variable. itemsize: size of item to stored. iteddata: address of data to stored. chgcurrent: true to make (current) point on this new object. Output: function result = true if element added to list. See Also: lstaddafter lstaddbefore lstaddstart lstaddstart (unit MGLIST) ____________________________________________________________ Synopsis: function mglist.lstaddstart(l: lstptr; itemsize: word; element: pointer; chgcurrent: boolean): boolean; Description: This function add one element to the beginning of list. This function return true if element as been added, else it return false. Input: l: list variable. itemsize: size of item to stored. iteddata: address of data to stored. chgcurrent: true to make (current) point on this new object. Output: function result = true if element added to list. - 293 - See Also: lstaddafter lstaddbefore lstaddend lstdone (unit MGLIST) ____________________________________________________________ Synopsis: procedure mglist.lstdone(var l: lstptr); Description: This procedure must be call when you don't need anymore a list, it deinitialize memory previously allocate by the list. Input: l: list variable. Output: nothing. See Also: lstinit lstdelete (unit MGLIST) ____________________________________________________________ Synopsis: procedure mglist.lstdelete(l: lstptr); Description: This procedure delete current record of list. If list is empty, the procedure do nothing. Input: l: list variable. Output: nothing. - 294 - lstempty (unit MGLIST) ____________________________________________________________ Synopsis: function mglist.lstempty(l: lstptr): boolean; Description: This function check if list is empty, it will return true if list is empty, else it return false. Input: l: list variable. Output: function result = true if list is empty. lstinit (unit MGLIST) ____________________________________________________________ Synopsis: function mglist.lstinit(var l: lstptr): boolean; Description: This function must be call to initialize list variables. Input: l: list variable. Output: function result = true if initialized. See Also: lstdone - 295 - MGLZH.TPU ____________________________________________________________ Description: Data compression functions. LZH compression is similar to PKZIP compression, but these routine are not as fast as PKZIP and do not obtain smallest compressed file. Note: LZH algorythme as been done by Haruyasu Yoshizaki. many source (Freeware and public domain) are available to help you understand this algorythme. (similar to PKZIP,ARJ) Language Used: coded in PASCAL. Linked With: MGGLOBAL, MGMEM. Example File: 'MGPAS017.PAS' this file give you an example that use all functions and procedures of this unit. Constants: lzhgetc lzhputc Functions And Procedures: compresslzh expandlzh lzhgetc (unit MGLZH) ____________________________________________________________ Synopsis: Const mglzh.lzhgetc: getctype = nil; Description: Lzhgetc is a const that point over a function. This function is use by compression and expansion routine to input the next byte. When there is no byte left to be compressed, lzhgetc must receive -1. Remember this function wait for an integer NOT A BYTE!! - 296 - See Also: mgglobal.getctype lzhputc (unit MGLZH) ____________________________________________________________ Synopsis: Const mglzh.lzhputc: putctype = nil; Description: Lzhputc is a const that point over a procedure. This procedure is use by compression and expansion routine to output the next byte. If this procedure send -1 this mean error occur in the MGLIBS functions and you must stop compression or decompression by sending -1 into the next request made by lzhgetc. See Also: mgglobal.putctype compresslzh (unit MGLZH) ____________________________________________________________ Synopsis: procedure mglzh.compresslzh(var size: longint); Description: This procedure start LZH compression, I/O are get from lzhgetc and lzhputc and compression stop when received -1 from lzhgetc or reatch the size number. Input: Size: number of bytes to be compressed. Output: nothing. See Also: expandlzh expandlzh (unit MGLZH) ____________________________________________________________ Synopsis: procedure mglzh.expandlzh(size: longint); Description: - 297 - This procedure start LZH decompression, I/O are get from lzhgetc and lzhputc and decompression stop when received -1 from lzhgetc. Input: size: size of compress data. Output: nothing. See Also: compresslzh - 298 - MGMENUS.TPU ____________________________________________________________ Description: This unit implement pop-menus functions. Language Used: coded in PASCAL. Linked With: MGWINDOW, MGSCREEN, MGKEYB, and MGSTRING. Example File: 'MGPAS026.PAS' this file give you an example that use all functions and procedures of this unit. Constants: maxexitkey maxbars minbars popmnutop popmnucount Types: exitkeytype itemlstptr itemlst itemarrayptr itemarray popmnuptr popmnutype Functions And Procedures: popmnuaddexitkey popmnuset popmnualloc popmnumove popmnuclose popmnuactive popmnucreate - 299 - MGWINDOW.TPU ____________________________________________________________ Description: This unit implement miscellaneous function to create and use windows in your program. This unit have it own write character function, but you can continue using gotoxy, write, writeln to access window. Because this module use fastxxx functions from MGSCREEN module, this module also automatically support multitaskers. Language Used: coded in PASCAL AND BASM. Linked With: MGTASKER, MGMEM, MGGLOBAL, MGSCREEN, MGMISC. Example File: 'MGPAS008.PAS' this file give you an example that use all functions and procedures of this unit. Constants: wininit wintop wincount fnone fsingle fsingledouble fdouble fdoublesingle fbar Types: ptitlestr titlestr pframe charsframe pwinrec twinrec Functions And Procedures: wingotoxy winwrite winwriteln winnext winprev winchxy wincls - 300 - winopen winclose winmove winactive winrefresh winredrawall winch winchattr winscrollup winscrolldown wingetscreen winputscreen winclreol winblink winforeground winbackground wingetca winhomecrs wincursordown wincursorup wincursorleft wincursorright ptitlestr (unit MGWINDOW) ____________________________________________________________ Synopsis: mgwindow.ptitlestr = ^titlestr; Description: Pointer of titlestr. titlestr (unit MGWINDOW) ____________________________________________________________ Synopsis: mgwindow.titlestr = string[80] ; Description: This type is use to pass title as parameter. See Also: ptitlestr - 301 - pframe (unit MGWINDOW) ____________________________________________________________ Synopsis: mgwindow.pframe = ^charsframe; Description: Pointer of charsframe. charsframe (unit MGWINDOW) ____________________________________________________________ Synopsis: mgwindow.charsframe = array[1..8] of char; Description: This type is use to handle horizontal frame characters. See Also: Pframe pwinrec (unit MGWINDOW) ____________________________________________________________ Synopsis: mgwindow.pwinrec = ^twinrec; Description: Pointer of twinrec. twinrec (unit MGWINDOW) ____________________________________________________________ Synopsis: mgwindow.twinrec = record Description: Type use to create a window. - 302 - Fields: next: pwinrec; prev: pwinrec; winmin: word; winmax: word; width: byte; height: byte; size: word; buffer: pointer; availofs: word; availsize: word; title: ptitlestr; titlecolor: byte; framecolor: byte; shadow: boolean; shadowattr: byte; left: byte; top: byte; right: byte; bottom: byte; frame: byte; delay: byte; x: byte; y: byte; textattr: byte; twinrec.next: pwinrec; pointer to next window. twinrec.prev: pwinrec; pointer to previous window. twinrec.winmin: word; physical state: winmin as defined in CRT.TPU. twinrec.winmax: word; physical state: winmax as defined in CRT.TPU. twinrec.width: byte; window width. twinrec.height: byte; window height. twinrec.size: word; window size. twinrec.buffer: pointer; address of buffer allocate at opening. twinrec.availofs: word; Theses avail... variables are use to determ- twinrec.availsize: word; ine wich character can and cannot't be print. - 303 - twinrec.title: ptitlestr; current title. twinrec.titlecolor: byte; title color. twinrec.framecolor: byte; frame color. twinrec.shadow: boolean; if window is shadowed. twinrec.shadowattr: byte; attribute for shadow (ANDed) twinrec.left: byte; minimum window column for user text. twinrec.top: byte; maximum window row for user text. twinrec.right: byte; maximum window column for user text. twinrec.bottom: byte; minimum window row for user text. twinrec.frame: byte; frame of window. twinrec.delay: byte; delay at open. twinrec.x: byte; current x position in window. twinrec.y: byte; current y position in window. twinrec.textattr: byte; This constant hold the current text attribute for Winxxxxx functions. Bit map is: 7 6 5 4 3 2 1 0 ³ ³ ³ ³ ÀÄÁÄÁÄÁÄÄ Foreground color. (0..15) ³ ÀÄÁÄÁÄÄÄÄÄÄÄÄÄÄ Background color. (0..7) ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ Blink status. 1 = enable, 0 = disable. wininit (unit MGWINDOW) ____________________________________________________________ Synopsis: Const mgwindow.wininit: boolean = false; Description: This constant is set at initialization time and hold the status of this module: if this constant = false this modulen CANNOT be use. - 304 - wintop (unit MGWINDOW) ____________________________________________________________ Synopsis: Const mgwindow.wintop: pwinrec = nil; Description: This variable hold the current display window variables. wincount (unit MGWINDOW) ____________________________________________________________ Synopsis: Const mgwindow.wincount: word = 0; Description: This variable hold the number of windows open. fnone (unit MGWINDOW) ____________________________________________________________ Synopsis: Const mgwindow.fnone = 0; Description: Frame type: no frame. fsingle (unit MGWINDOW) ____________________________________________________________ Synopsis: Const mgwindow.fsingle = 1; Description: Frame type: single frame. - 305 - fsingledouble (unit MGWINDOW) ____________________________________________________________ Synopsis: Const mgwindow.fsingledouble = 2; Description: Frame type: single (horiz) and double (vert) frames. fdouble (unit MGWINDOW) ____________________________________________________________ Synopsis: Const mgwindow.fdouble = 3; Description: Frame type: double frame. fdoublesingle (unit MGWINDOW) ____________________________________________________________ Synopsis: Const mgwindow.fdoublesingle = 4; Description: Frame type: double (horiz) and single (vert) frames. fbar (unit MGWINDOW) ____________________________________________________________ Synopsis: Const mgwindow.fbar = 5; Description: Frame type: rectangular bar frame. - 306 - wingotoxy (unit MGSCREEN) ____________________________________________________________ Synopsis: procedure mgwindow.wingotoxy(window: pwinrec; x, y: byte); Description: This function move the cursor at a specific position relative to winmin and winmax. Input: window: window to use. x,y: cursor position. Output: nothing. winwrite (unit MGSCREEN) ____________________________________________________________ Synopsis: procedure mgwindow.winwrite(window: pwinrec; s: string); Description: This function write one string in window define by winmin and winmax. If string is to long it will be wrap and screen will be scroll if this is needed. Input: s: string to write. window: window to use. Output: nothing. See Also: WinWriteLn winwriteln (unit MGSCREEN) ____________________________________________________________ Synopsis: procedure mgwindow.winwriteln(window: pwinrec; s: string); - 307 - Description: This function write one string in window define by winmin and winmax, and jump on next line. If string is to long it will be wrap and screen will be scroll if this is needed. Input: s: string to write. window: window to use. Output: nothing. See Also: WinWrite winnext (unit MGWINDOW) ____________________________________________________________ Synopsis: procedure mgwindow.winnext; Description: This function switch to next window. Input: nothing. Output: nothing. See Also: winprev winprev (unit MGWINDOW) ____________________________________________________________ Synopsis: procedure mgwindow.winprev; Description: This function switch to previous window. Input: nothing. Output: nothing. - 308 - See Also: winnext winwritech (unit MGWINDOW) ____________________________________________________________ Synopsis: procedure mgwindow.winchxy(window: pwinrec; c: char; x, y, attr: byte); Description: This procedure write one character at specific position with a specific color. This procedure do not update cursor. Input: window: window to use. x,y: position in window. count: number of times to write character. ch: character to write. color: color attribute to use for fill. Output: nothing. wincls (unit MGWINDOW) ____________________________________________________________ Synopsis: procedure mgwindow.wincls(window: pwinrec; ch: char; color: byte); Description: This procedure Fill window with specific character and a specific color attribute. Input: window: window to use. ch: character to use for fill. color: color attribute to use for fill. Output: nothing. See Also: winclear - 309 - winopen (unit MGWINDOW) ____________________________________________________________ Synopsis: function mgwindow.winopen(x1, y1, x2, y2, titlecolor, textcolor, framecolor, frame, delay: byte; shadow: boolean; shadowattr: byte; title: titlestr): pwinrec; Description: This function is the main function of this unit, it open a window allocate memory and store window on top of window list. Window is immediately display and active. If this function return true window as been allocate and activated, else window as NOT been open probably because there not enough memory available, or window is out of bound. Input: x1,y1: top left corner of window. x2,y2: bottom right corner of window. Titlecolor: title color attribute. Textcolor: text color attribute. Framecolor: frame color attribute. Frame: Frame type. Delay: Open window with a specific delay. Shadow: This constant old the status of shadow. If this constant is true all next window will get a shadow. Shadowattr: if shadow then all character under shadow are ANDed with this value. Title: Title to insert at right top corner. Output: function result = <> nil if window opened. See Also: winclose winclose (unit MGWINDOW) ____________________________________________________________ Synopsis: function mgwindow.winclose(window: pwinrec): boolean; Description: This function free memory, remove current window from window chain, and restore previous window on screen. If this function return false window as not been removed - 310 - and error occur, else if it return true window as been remove and previous window activated. Input: nothing. Output: function result = true if window closed. See Also: winopen winmove (unit MGWINDOW) ____________________________________________________________ Synopsis: function mgwindow.winmove(window: pwinrec; left, top: byte): boolean; Description: This function move current window at specific position on screen, if window as been moved this function return true else window as not been move. Input: left, top: top left corner position to move window to. Output: function result = true if window moved. winactive (unit MGWINDOW) ____________________________________________________________ Synopsis: procedure mgwindow.winactive(window: pwinrec); Description: This function activated a specific window, this window is store on top of all other window. You always can write to window so this function is only to see entire window. Input: window: window to be activated. Output: nothing. - 311 - winrefresh (unit MGWINDOW) ____________________________________________________________ Synopsis: procedure mgwindow.winrefresh(window: pwinrec); Description: This function redraw a specific window. Input: window: window to be redraw. Output: nothing. winredrawall (unit MGWINDOW) ____________________________________________________________ Synopsis: procedure mgwindow.winredrawall; Description: This function redraw all window actually open. Input: nothing. Output: nothing. winchattr (unit MGWINDOW) ____________________________________________________________ Synopsis: procedure mgwindow.winch(window: pwinrec; c: char); Description: This procedure write one character in a specific window and scroll it if at end of screen. Character is write at cursor position and attribute is textattr of window. Input: window: window where to write. c: character to write. - 312 - Output: nothing. See Also: winchattr winch (unit MGWINDOW) ____________________________________________________________ Synopsis: procedure mgwindow.winchattr(window: pwinrec; c: char; attr: byte); Description: Same as winch but this procedure use a specific attribute instead of textattr from window. Input: window: window where to write. c: character to write. attr: attribute to use. Output: nothing. See Also: winch winscrollup (unit MGWINDOW) ____________________________________________________________ Synopsis: procedure mgwindow.winscrollup(window: pwinrec; times: word); Description: This procedure scroll up window a specific number of times. Input: window: window where to scroll. times: number of scroll. Output: nothing. See Also: winscrolldown - 313 - winscrolldown (unit MGWINDOW) ____________________________________________________________ Synopsis: procedure mgwindow.winscrolldown(window: pwinrec; times: word); Description: This procedure scroll down window a specific number of times. Input: window: window where to scroll. times: number of scroll. Output: nothing. See Also: winscrollup wingetscreen (unit MGWINDOW) ____________________________________________________________ Synopsis: procedure mgwindow.wingetscreen(window: pwinrec; x1, y1, xlen, ylen: byte; buffer: pointer); Description: This procedure get a portion of window and save it into user buffer. Input: window: window source. x1,y1: upper left corner. xlen: width. ylen: height. buffer: address of user buffer. Output: nothing. See Also: winputscreen - 314 - winputscreen (unit MGWINDOW) ____________________________________________________________ Synopsis: procedure mgwindow.winputscreen(window: pwinrec; x1, y1: byte; buffer: pointer); Description: This procedure restore part of window previously save by wingetscreen. Input: window: window source. x1,y1: upper left corner. buffer: address of user buffer. Output: nothing. See Also: wingetscreen winclreol (unit MGWINDOW) ____________________________________________________________ Synopsis: procedure mgwindow.winclreol(window: pwinrec; c: char; attr: byte); Description: This procedure clear window line from cursor to end of line with a specific character and attribute. Input: window: window source. c: character to stamp. attr: attribute to use. Output: nothing. - 315 - winblink (unit MGWINDOW) ____________________________________________________________ Synopsis: procedure mgwindow.winblink(window: pwinrec; assert: boolean); Description: This procedure change the value of blink in window textattr. Input: window: window source. assert: true = blink on, false = blink off. Output: nothing. winforeground (unit MGWINDOW) ____________________________________________________________ Synopsis: procedure mgwindow.winforeground(window: pwinrec; color: byte); Description: This procedure change the value of foreground for a specific window. Input: window: window source. color: new foreground color. Output: nothing. See Also: winbackground - 316 - winbackground (unit MGWINDOW) ____________________________________________________________ Synopsis: procedure mgwindow.winbackground(window: pwinrec; color: byte); Description: This procedure change the value of background for a specific window. Input: window: window source. color: new background color. Output: nothing. See Also: winforeground wingetca (unit MGWINDOW) ____________________________________________________________ Synopsis: function mgwindow.wingetca(window: pwinrec): word; Description: This function return attribute and character at cursor position in a specific window. Input: window: window source. Output: function result = lo = character, hi = attribute. winhomecrs (unit MGWINDOW) ____________________________________________________________ Synopsis: procedure mgwindow.winhomecrs(window: pwinrec); Description: This procedure move the cursor to 1,1 in a specific - 317 - window. Input: window: window source. Output: nothing. wincursordown (unit MGWINDOW) ____________________________________________________________ Synopsis: procedure mgwindow.wincursordown(window: pwinrec); Description: This procedure move the cursor down for a specific window. Input: window: window source. Output: nothing. See Also: wincursorup wincursorup (unit MGWINDOW) ____________________________________________________________ Synopsis: procedure mgwindow.wincursorup(window: pwinrec); Description: This procedure move the cursor up for a specific window. Input: window: window source. Output: nothing. See Also: wincursordown - 318 - wincursorleft (unit MGWINDOW) ____________________________________________________________ Synopsis: procedure mgwindow.wincursorleft(window: pwinrec); Description: This procedure move the cursor left for a specific window. Input: window: window source. Output: nothing. See Also: wincursorright wincursorright (unit MGWINDOW) ____________________________________________________________ Synopsis: procedure mgwindow.wincursorright(window: pwinrec); Description: This procedure move the cursor right for a specific window. Input: window: window source. Output: nothing. See Also: wincursorleft maxexitkey (unit MGMENUS) ____________________________________________________________ Synopsis: Const mgmenus.maxexitkey = 20; Description: This constant hold the maximum number of exit keys per menu. - 319 - maxbars (unit MGMENUS) ____________________________________________________________ Synopsis: Const mgmenus.maxbars = 20; Description: This constant hold the maximum number of bar for each menu. See Also: minbars minbars (unit MGMENUS) ____________________________________________________________ Synopsis: Const mgmenus.minbars = 2; Description: This constant hold the minimum number of bar for each menu. See Also: maxbars exitkeytype (unit MGMENUS) ____________________________________________________________ Synopsis: mgmenus.exitkeytype = array[1..maxexitkey] of word; Description: This type is use to declare an array of exit key for one menu. - 320 - itemlstptr (unit MGMENUS) ____________________________________________________________ Synopsis: mgmenus.itemlstptr = ^itemlst; Description: A pointer of itemlst. itemlst (unit MGMENUS) ____________________________________________________________ Synopsis: mgmenus.itemlst = record Description: This type is use to declare items of one menu. Fields: name: string; definition: string; defpresent: boolean; hotkey: word; enable: boolean; center: boolean; itemlst.name: string; item name. itemlst.definition: string; definition. itemlst.defpresent: boolean; definition actived? itemlst.hotkey: word; hot key from mgkeyb list. itemlst.enable: boolean; item enable status. itemlst.center: boolean; must center name in menu? - 321 - itemarrayptr (unit MGMENUS) ____________________________________________________________ Synopsis: mgmenus.itemarrayptr = ^itemarray; Description: A pointer of itemarray. itemarray (unit MGMENUS) ____________________________________________________________ Synopsis: mgmenus.itemarray = array[1..$FFF0 div sizeof(itemlst)] of itemlst; Description: An array of items: use to hold item of one menu. popmnuptr (unit MGMENUS) ____________________________________________________________ Synopsis: mgmenus.popmnuptr = ^popmnutype; Description: A pointer of popmnutype use by functions to pass menu as parameter. popmnutype (unit MGMENUS) ____________________________________________________________ Synopsis: mgmenus.popmnutype = record Description: This type is use to declare a menu. - 322 - Fields: allocitems: byte; numitems: byte; current: byte; selectcolor: byte; disablecolor: byte; highlight: byte; wide: byte; items: itemarrayptr; defx: byte; defy: byte; defattr: byte; deflen: byte; w: pwinrec; exitkeys: exitkeytype; numexitkeys: byte; next: popmnuptr; prev: popmnuptr; popmnutype.allocitems: byte; number of items allocate. popmnutype.numitems: byte; number of items in menu. popmnutype.current: byte; current menu. popmnutype.selectcolor: byte; attribut if select. popmnutype.disablecolor: byte; attribut if disable. popmnutype.highlight: byte; attribut if ~a~ is found in string. popmnutype.wide: byte; menu wide. popmnutype.items: itemarrayptr; list of items. popmnutype.defx: byte; definition x position. popmnutype.defy: byte; definition y position. popmnutype.defattr: byte; definition attribute. popmnutype.deflen: byte; definition length. popmnutype.w: pwinrec; window (from mgwindow) - 323 - popmnutype.exitkeys: exitkeytype; list of exit keys. popmnutype.numexitkeys: byte; number of exit keys. popmnutype.next: popmnuptr; next pop-menu. popmnutype.prev: popmnuptr; previous pop-menu. popmnutop (unit MGMENUS) ____________________________________________________________ Synopsis: Const mgmenus.popmnutop: popmnuptr = nil; Description: Address of first menu of nil, if no menu create. popmnucount (unit MGMENUS) ____________________________________________________________ Synopsis: Const mgmenus.popmnucount: word = 0; Description: This constant hold the number of menu create. popmnuaddexitkey (unit MGMENUS) ____________________________________________________________ Synopsis: function mgmenus.popmnuaddexitkey(menu: popmnuptr; key: word): boolean; Description: This function is use to add one key into the list of exit key of one menu. Input: menu: menu in wich an exit key is to be add. key: keycode of exit key. - 324 - Output: function result = true if key as been added. popmnuset (unit MGMENUS) ____________________________________________________________ Synopsis: function mgmenus.popmnuset(menu: popmnuptr; item: byte; const name, definition: string; hotkey: word; center, defpresent, enable: boolean): boolean; Description: This function set a specific item in a specific menu. Input: menu: menu in wich item should be set. item: item number. name: name of item example: 'first choice' definition: definition of this item. hotkey: if this key is pressed this item is select. center: name should be center? defpresent: use definition? enable: this item should be enable or disable? Output: function result = true if item of menu as been set. popmnualloc (unit MGMENUS) ____________________________________________________________ Synopsis: function mgmenus.popmnualloc(numitems: byte): popmnuptr; Description: This function allocate memory for a menu of specific number of items. Input: numitems: number of item to be allocate for this new menu. Output: function result = nil if error, else it return address of menu allocate in heap. - 325 - popmnumove (unit MGMENUS) ____________________________________________________________ Synopsis: function mgmenus.popmnumove(menu: popmnuptr; x, y: byte): boolean; Description: This function is use to move a specific menu actually on screen into another place in screen. If menu doesn't fit in screen it is not move: example menu of wide 10 place at position x=75 can't fit in 80 column screen so in this specific case popmnumove will return false. Input: menu: menu to be move. x, y: upper left corner of destination. Output: function result = true if menu as been move. popmnuclose (unit MGMENUS) ____________________________________________________________ Synopsis: function mgmenus.popmnuclose(menu: popmnuptr): boolean; Description: This procedure close and deallocate memory for a specific menu. Input: menu: menu to be close. Output: function result = true if menu as been close. popmnuactive (unit MGMENUS) ____________________________________________________________ Synopsis: function mgmenus.popmnuactive(menu: popmnuptr): integer; Description: - 326 - This function active one menu and request a selection from user. Input: menu: menu to be activate. Output: function result = selection or -1 if escape as been pressed or keycode if exitkey as been pressed. popmnucreate (unit MGMENUS) ____________________________________________________________ Synopsis: function mgmenus.popmnucreate(menu: popmnuptr; numitems, x, y, titlecolor, textcolor, selectcolor, disablecolor, framecolor, frame, defx, defy, defattr, deflen, delay: byte; shadow: boolean; shadowattr: byte; title: string; highlight: byte): Description: This function must be call after the menu as been allocate. This one open menu on screen and reset variable then the menu is ready to be activated. Input: menu: menu to be open. numitems: number of items in this menus. x, y: upper left corner. titlecolor: title attribute. textcolor: normal attribute. selectcolor: selected item attribute disablecolor: disable attribute. framecolor: attribute of frame. frame: frame type (see mgwindow) defx,defy: position of definition on screen. defattr: definition attribute. deflen: definition length. delay: delay at open. shadow: menu must be shadow? shadowattr: shadow attribute (ANDed) title: menu title. highlight: attribute of character insert into ~~. Output: function result = true if menu as been open and create. - 327 - MGMOUSE.TPU ____________________________________________________________ Description: This unit implement mouse functions. These function are used to get/set mouse information. Language Used: coded in ASSEMBLER. Linked With: nothing. Example File: 'MGPAS021.PAS' this file give you an example that use all functions and procedures of this unit. Constants: bleft bright bmiddle ecursormove eleftpressed eleftreleased erightpressed erigthreleased emiddlepressed emiddlereleased lastmask lasthandler Types: buttonstate Functions And Procedures: minit msetlcdlargep mgetlcdlargep mshow mhide mgetx mgety mgetbutton mbuttonpressed mbuttonreleased msetcursor mlastxpress mlastypress - 328 - mbuttonpresses mlastxrelease mlastyrelease mbuttonreleases mbox mhardwaretextcursor msoftwaretextcursor mrecentxmovement mrecentymovement menablelightpenemulation mdisablelightpenemulation mdefinesensetivity msethidecursorbox mdefinedoublespeedtreshhold mdisabletreshhold mdefaulttreshhold msave mrestore mtextmode mseteventhandler mswapeventhandler mgetlastevent minstalldefaulthandler msetintrrate msetpage mgetpage msetlanguage mgetlanguage mgetinfo mgetdrvinfo buttonstate (unit MGMOUSE) ____________________________________________________________ Synopsis: mgmouse.buttonstate = (down, up); Description: This type is used to declared states that button can have. Const mgmouse.bleft = $01; left button value. - 329 - Const mgmouse.bright = $02; right button value. Const mgmouse.bmiddle = $04; middle button value. ecursormove (unit MGMOUSE) ____________________________________________________________ Synopsis: Const mgmouse.ecursormove = $01; Description: Mouse event: cursor move. eleftpressed (unit MGMOUSE) ____________________________________________________________ Synopsis: Const mgmouse.eleftpressed = $02; Description: Mouse event: left button pressed. eleftreleased (unit MGMOUSE) ____________________________________________________________ Synopsis: Const mgmouse.eleftreleased = $04; Description: Mouse event: left button released. erightpressed (unit MGMOUSE) ____________________________________________________________ Synopsis: Const mgmouse.erightpressed = $08; Description: - 330 - Mouse event: right button pressed. erightreleased (unit MGMOUSE) ____________________________________________________________ Synopsis: Const mgmouse.erigthreleased = $10; Description: Mouse event: right button released. emiddlepressed (unit MGMOUSE) ____________________________________________________________ Synopsis: Const mgmouse.emiddlepressed = $20; Description: Mouse event: middle button pressed. emiddlereleased (unit MGMOUSE) ____________________________________________________________ Synopsis: Const mgmouse.emiddlereleased = $40; Description: Mouse event: middle button released. lastmask (unit MGMOUSE) ____________________________________________________________ Synopsis: Const mgmouse.lastmask: word = 0; Description: - 331 - This constant hold: last mask value. lasthandler (unit MGMOUSE) ____________________________________________________________ Synopsis: Const mgmouse.lasthandler: pointer = nil; Description: Address of last handler, this is use by swaphandler function. minit (unit MGMOUSE) ____________________________________________________________ Synopsis: function mgmouse.minit: boolean; Description: This function initialize mouse and set number of buttons variables. This function return true if mouse driver respond, else it return false. Input: nothing. Output: function result = true if mouse initialized. msetlcdlargep (unit MGMOUSE) ____________________________________________________________ Synopsis: procedure mgmouse.msetlcdlargep(style: byte; size: byte; thres: byte; activeflg: boolean; delay: word); Description: This procedure set lcd screen large pointer. Input: - 332 - style: 00h normal, 01h reverse, 02h transparent. size: 00h small "1", 01h medium "1.5", 02h large "2" thres: 0-$64. activeflg: false = disable size change, true = enable. delay: 0-$64 Output: nothing. See Also: mgetlcdlargep mgetlcdlargep (unit MGMOUSE) ____________________________________________________________ Synopsis: procedure mgmouse.mgetlcdlargep(var style: byte; size: byte; thres: byte; activeflg: boolean; delay: word); Description: This function return lcd screen large pointer. Input: nothing. Output: style: 00h normal, 01h reverse, 02h transparent. size: 00h small "1", 01h medium "1.5", 02h large "2" thres: 0-$64. activeflg: false = disable size change, true = enable. delay: 0-$64 See Also: msetlcdlargep mshow (unit MGMOUSE) ____________________________________________________________ Synopsis: procedure mgmouse.mshow; Description: This procedure show mouse cursor. Input: nothing. Output: nothing. - 333 - See Also: mhide mhide (unit MGMOUSE) ____________________________________________________________ Synopsis: procedure mgmouse.mhide; Description: This procedure hide mouse cursor. Multiple calls to hide the cursor will require multiple calls of mshow to unhide it. Input: nothing. Output: nothing. See Also: mshow mgetx (unit MGMOUSE) ____________________________________________________________ Synopsis: function mgmouse.mgetx: word; Description: This function return mouse cursor X position. Input: nothing. Output: function result = X position. See Also: mgety - 334 - mgety (unit MGMOUSE) ____________________________________________________________ Synopsis: function mgmouse.mgety: word; Description: This function return mouse cursor Y position. Input: nothing. Output: function result = Y position. See Also: mgetx mgetbutton (unit MGMOUSE) ____________________________________________________________ Synopsis: function mgmouse.mgetbutton(button: byte): buttonstate; Description: This function return status of a specific buttons. You may choose to scan only one or more buttons at same time. For example to test left and right buttons call procedure with bit 0 and 1 set = $3. Input: button: buttons to scan. bit 0 test left button pressed. bit 1 test right button pressed. bit 2 test middle button pressed. Output: function result = button status. See Also: mgetbuttonpressed - 335 - mbuttonpressed (unit MGMOUSE) ____________________________________________________________ Synopsis: function mgmouse.mbuttonpressed: boolean; Description: This function test all button and return true if one button is pressed. Input: nothing. Output: function result = true if button as been pushed. See Also: mgetbutton mbuttonreleased (unit MGMOUSE) ____________________________________________________________ Synopsis: function mgmouse.mbuttonreleased: boolean; Description: This function test all buttons and return true if one button as been release. Input: nothing. Output: function result = true if button as been release. msetcursor (unit MGMOUSE) ____________________________________________________________ Synopsis: procedure mgmouse.msetcursor(x, y: word); Description: This procedure move the mouse cursor to a specific position. Input: - 336 - x,y: new mouse position. Output: nothing. See Also: mgetx mgety mblastxpress (unit MGMOUSE) ____________________________________________________________ Synopsis: function mgmouse.mlastxpress(button: byte): word; Description: This function return position of X last time a specific button was pressed. Input: button: button number to use. Output: function result = X last time button pressed. See Also: mlastypress mblastypress (unit MGMOUSE) ____________________________________________________________ Synopsis: function mgmouse.mlastypress(button: byte): word; Description: This function return position of Y last time a specific button was pressed. Input: button: button number to use. Output: function result = Y last time button pressed. See Also: mlastxpress - 337 - mbuttonpresses (unit MGMOUSE) ____________________________________________________________ Synopsis: function mgmouse.mbuttonpresses(button: byte): word; Description: This function return the number of times specified button has been pressed since last call. Input: button: button number to use. (bleft,bright,bmiddle) Output: function result = times pressed. mlastxrelease (unit MGMOUSE) ____________________________________________________________ Synopsis: function mgmouse.mlastxrelease(button: byte): word; Description: This function return the position of X when a specific button was release. Input: button: button number to use. (bleft,bright,bmiddle) Output: function result = last x at last release. See Also: mlastyrelease mlastyrelease (unit MGMOUSE) ____________________________________________________________ Synopsis: function mgmouse.mlastyrelease(button: byte): word; Description: This function return the position of Y when a specific button was release. Input: - 338 - button: button number to use. (bleft,bright,bmiddle) Output: function result = last y at last release. See Also: mlastxrelease mbuttonreleases (unit MGMOUSE) ____________________________________________________________ Synopsis: function mgmouse.mbuttonreleases(button: byte): word; Description: This function return the number of times specified button has been released since last call. Input: button: button number to test. (bleft,bright,bmiddle) Output: function result = times released. mbox (unit MGMOUSE) ____________________________________________________________ Synopsis: procedure mgmouse.mbox(left, top, right, bottom: word); Description: This procedure defined limits of mouse movement. Input: left: left most column. right: right most column. top: top most row. bottom: bottom most row. Output: nothing. - 339 - mhardwaretextcursor (unit MGMOUSE) ____________________________________________________________ Synopsis: procedure mgmouse.mhardwaretextcursor(fromline, toline: byte); Description: This procedure change the cursor size. Input: fromline: start line. toline: end line. Output: nothing. See Also: msoftwaretextcursor msoftwaretextcursor (unit MGMOUSE) ____________________________________________________________ Synopsis: procedure mgmouse.msoftwaretextcursor(screenmask, cursormask: word); Description: This procedure change the cursor mask. When the software cursor is selected, the char/attribute data at the current screen position is ANDed with the screen mask and then XORed with the cursor mask Input: screenmask: screen mask. cursormask: cursor mask. Output: nothing. See Also: mhardwaretextcursor - 340 - mrecentxmovement (unit MGMOUSE) ____________________________________________________________ Synopsis: function mgmouse.mrecentxmovement: integer; Description: This function return the number of mickeys mouse moved horizontally since last call. Notes: a mickey is the smallest increment the mouse can sense positive values indicate down/right. Input: nothing. Output: function result = number of mickeys move. See Also: mrecentymovement mrecentymovement (unit MGMOUSE) ____________________________________________________________ Synopsis: function mgmouse.mrecentymovement: integer; Description: This function return the number of mickeys mouse moved vertically since last call. Notes: a mickey is the smallest increment the mouse can sense positive values indicate down/right. Input: nothing. Output: function result = number of mickeys move. See Also: mrecentxmovement - 341 - menablelightpenemulation (unit MGMOUSE) ____________________________________________________________ Synopsis: procedure mgmouse.menablelightpenemulation; Description: This procedure enable light pen emulation. Input: nothing. Output: nothing. See Also: mdisablelightpenemulation mdisablelightpenemulation (unit MGMOUSE) ____________________________________________________________ Synopsis: procedure mgmouse.mdisablelightpenemulation; Description: This procedure disable light pen emulation. Input: nothing. Output: nothing. See Also: menablelightpenemulation mdefinesensetivity (unit MGMOUSE) ____________________________________________________________ Synopsis: procedure mgmouse.mdefinesensetivity(x, y: word); Description: This procedure define the sensitivity of mouse in mickeys per 8 pixels horizontally (default 8) and in mickeys per 8 pixels vertically (default 16). - 342 - Input: x: x sensitivity. y: y sensitivity. Output: nothing. msethidecursorbox (unit MGMOUSE) ____________________________________________________________ Synopsis: procedure mgmouse.msethidecursorbox(left, top, right, bottom: word); Description: This procedure created an hide box, if the cursor come in the specified region, cursor is hide and needs to be explicitly turned on again using mshow. Input: left: most left column. top: most top row. right: most right column. bottom: most bottom row. Output: nothing. mdefinedoublespeedtreshhold (unit MGMOUSE) ____________________________________________________________ Synopsis: procedure mgmouse.mdefinedoublespeedtreshhold(treshhold: word); Description: This procedure define doublespeed treshhold. If speed exceeds threshold, the cursor's on-screen motion is doubled. Input: treshhold: new value. Output: nothing. - 343 - See Also: mdefinedoublespeedtreshhold mdisabletreshhold (unit MGMOUSE) ____________________________________________________________ Synopsis: procedure mgmouse.mdisabletreshhold; Description: This procedure disable double speed. Input: nothing. Output: nothing. See Also: mdefinedoublespeedtreshhold mdefaulttreshhold (unit MGMOUSE) ____________________________________________________________ Synopsis: procedure mgmouse.mdefaulttreshhold; Description: This procedure set double speed to default value 0.64/sec. Input: nothing. Output: nothing. See Also: mdefinedoublespeedtreshhold msave (unit MGMOUSE) ____________________________________________________________ Synopsis: procedure mgmouse.msave; Description: - 344 - This procedure save current mouse state. Input: nothing. Output: nothing. See Also: mrestore mrestore (unit MGMOUSE) ____________________________________________________________ Synopsis: procedure mgmouse.mrestore; Description: This procedure restore previous save mouse state. Input: nothing. Output: nothing. See Also: msave mtextmode (unit MGMOUSE) ____________________________________________________________ Synopsis: procedure mgmouse.mtextmode; Description: This procedure reset mouse and switch back to text mode. Input: nothing. Output: nothing. - 345 - mseteventhandler (unit MGMOUSE) ____________________________________________________________ Synopsis: procedure mgmouse.mseteventhandler(mask: word; handler: pointer); Description: This procedure define interrupt subroutine mask. Input: mask: bit 0 call if mouse moves bit 1 call if left button pressed bit 2 call if left button released bit 3 call if right button pressed bit 4 call if right button released bit 5 call if middle button pressed (Mouse Systems/Logitech mouse) bit 6 call if middle button released (Mouse Sys/Logitech mouse) handler: address of handler to install. Output: nothing. mswapeventhandler (unit MGMOUSE) ____________________________________________________________ Synopsis: procedure mgmouse.mswapeventhandler(mask: word; handler: pointer); Description: This procedure install a new handler and save current handler address in lasthandler. Input: mask: new mask defined in minstalldefaulthandler handler: new handler address. Output: nothing. - 346 - mgetlastevent (unit MGMOUSE) ____________________________________________________________ Synopsis: procedure mgmouse.mgetlastevent(var x, y: word; var left_button, right_button, middle_button: byte); Description: This procedure get information on last event. Input: nothing. Output: x,y: mouse position at event. left_button: left button status. right_button: right button status. middle_button: middle button status. minstalldefaulthandler (unit MGMOUSE) ____________________________________________________________ Synopsis: procedure mgmouse.minstalldefaulthandler(mask: word); Description: This procedure get only event mask, and set event handler to defaulthandler interrupt routine is called with: Input: mask: bit(s) description 0 call if m moves 1 call if left button pressed 2 call if left button released 3 call if right button pressed 4 call if right button released 5 call if middle button pressed (m systems/logitech/genius m) 6 call if middle button released (m systems/logitech/genius m) 7-15 unused note: some versions of the microsoft documentation incorrectly state that bit 0 means call if m cursor moves Output: nothing. - 347 - msetintrrate (unit MGMOUSE) ____________________________________________________________ Synopsis: procedure mgmouse.msetintrrate(rate: word); Description: This procedure set the mouse interrupt rate, this is only available on inport mouse. Input: rate: 00h no interrupts allowed 01h 30 per second 02h 50 per second 03h 100 per second 04h 200 per second values greater than 4 may cause unpredictable driver behavior Output: nothing. msetpage (unit MGMOUSE) ____________________________________________________________ Synopsis: procedure mgmouse.msetpage(page: byte); Description: This procedure define display page number. note: the cursor will be displayed on the specified page Input: page: set page value. Output: nothing. See Also: mgetpage - 348 - mgetpage (unit MGMOUSE) ____________________________________________________________ Synopsis: function mgmouse.mgetpage: byte; Description: This function return the current display page number. Input: nothing. Output: function result = display page number. See Also: msetpage msetlanguage (unit MGMOUSE) ____________________________________________________________ Synopsis: procedure mgmouse.msetlanguage(langue: word); Description: This procedure change the mouse language. Only available on international versions of the driver; us. versions ignore this procedure. Input: langue: 00h english 01h french 02h dutch 03h german 04h swedish 05h finnish 06h spanish 07h portugese 08h italian Output: nothing. See Also: mgetlanguage - 349 - mgetlanguage (unit MGMOUSE) ____________________________________________________________ Synopsis: function mgmouse.mgetlanguage: word; Description: This function return the current mouse language. note: the US version of the driver always returns zero. Input: nothing. Output: function result = mouse driver language. See Also: msetlanguage mgetinfo (unit MGMOUSE) ____________________________________________________________ Synopsis: procedure mgmouse.mgetinfo(var version: word; var mtype, interup: byte); Description: This procedure return information about the mouse. Input: nothing. Output: version: mouse driver version. mtype: mouse type 1=bus, 2=serial, 3=inport, 4=PS/2, 5=HP interup: 0=PS/2, 2=IRQ2, 3=IRQ3, ...,7=IRQ7 See Also: mgetdrvinfo mgetdrvinfo (unit MGMOUSE) ____________________________________________________________ Synopsis: function mgmouse.mgetdrvinfo: word; Description: - 350 - This function return information about the mouse driver. Input: nothing. Output: function result = bit(s) description 15 driver loaded as device driver rather than tsr 14 driver is newer integrated type 13,12 current cursor type 00 software text cursor 01 hardware text cursor (crt controller's cursor) 1x graphics cursor 11-8 interrupt rate (see ax=001ch) 7-0 count of currently-active m display drivers (mdd), the newer integrated driver type See Also: mgetinfo - 351 - MGNSTRG.TPU ____________________________________________________________ Description: This unit implement functions to handle ASCIIZ strings, string terminate by #0 (also call Null terminated string: use by C compiler). Language Used: coded in ASSEMBLER. Linked With: MGGLOBAL. Example File: 'MGPAS022.PAS' this file give you an example that use all functions and procedures of this unit. Functions And Procedures: nnamecase nlowercase nlowercasen nuppercase nuppercasen ncompare nicompare nstrcat nstrchrch nstrlen nnamecase (unit MGNSTRG) ____________________________________________________________ Synopsis: procedure mgnstrg.nnamecase(var s); Description: This procedure convert first letters of each words into uppercase. For example 'mark Gauthier' goes to 'Mark Gauthier'. Input: s: string. Output: function result = string name case. - 352 - nlowercase (unit MGNSTRG) ____________________________________________________________ Synopsis: procedure mgnstrg.nlowercase(var s); Description: This procedure convert all characters into string 's' into lower case character. Input: s: string. Output: function result = string in lower case. See Also: nlowercasen nuppercase nlowercasen (unit MGNSTRG) ____________________________________________________________ Synopsis: procedure mgnstrg.nlowercasen(var s; len: word); Description: This procedure convert a maximum number of character from 's' from first to last chars. Input: s: string. len: number of character to convert. Output: function result = string in lower case. See Also: nlowercase nuppercase - 353 - nuppercase (unit MGNSTRG) ____________________________________________________________ Synopsis: procedure mgnstrg.nuppercase(var s); Description: This procedure convert all characters of string 's' into upper case character. Input: s: string. Output: function result = string upcase. See Also: nlowercase nuppercasen nuppercasen (unit MGNSTRG) ____________________________________________________________ Synopsis: procedure mgnstrg.nuppercasen(var s; len: word); Description: This procedure convert a maximum number of character from 's' from first to last chars. Input: s: string. len: number of character to convert. Output: function result = string upcase. See Also: nlowercase nuppercase ncompare (unit MGNSTRG) ____________________________________________________________ Synopsis: function mgnstrg.ncompare(var s1, s2): boolean; Description: - 354 - This function compare to strings and return true if both are same, else function return false. Input: s1: first string. s2: second string. Output: function result = true if string are equal. See Also: nicompare nicompare (unit MGNSTRG) ____________________________________________________________ Synopsis: function mgnstrg.nicompare(var s1, s2): boolean; Description: This function is similar to ncompare, but this function doesn't care about case-character. ('a'='A'). Input: s1: first string. s2: second string. Output: function result = true if string are equal. See Also: ncompare nstrcat (unit MGNSTRG) ____________________________________________________________ Synopsis: procedure mgnstrg.nstrcat(var s1, s2); Description: This procedure append string2 into string1. Input: s1: first string. s2: second string. Output: function result = s1+s2 - 355 - nstrchrch (unit MGNSTRG) ____________________________________________________________ Synopsis: function mgnstrg.nstrchrch(var s; c: char): word; Description: This function search for a character into a string and return it position in string. This function return zero if character not found. Input: s: string c: character to search. Output: function result = first position of c into s or 0. nstrlen (unit MGNSTRG) ____________________________________________________________ Synopsis: function mgnstrg.nstrlen(var s): word; Description: This function return the length of string. Input: s: string Output: function result = string length. - 356 - MGNUMBER.TPU ____________________________________________________________ Description: This unit implement function to play with number such as sort, swap, get/set bits, etc. Language Used: coded in PASCAL AND ASSEMBLER. Linked With: nothing. Example File: 'MGPAS023.PAS' this file give you an example that use all functions and procedures of this unit. Functions And Procedures: sortword sortint sortbyte sortshort sortlong basechange swapb swapw swapl getbit setbit getbitarray setbitarray nrandom rotlongleft rotlongright rotwordleft rotwordright rotbyteright rotbyteleft maxs mins maxb minb maxi mini maxw minw maxl minl longodd wordodd - 357 - byteodd longsign intsign lolong hilong loint hiint sortword (unit MGNUMBER) ____________________________________________________________ Synopsis: procedure mgnumber.sortword(buffer: pointer; n: word); Description: This procedure sort an array of word, using the shell type sort. Input: buffer: address of array. n: number of word to sort. Output: nothing. See Also: sortbyte sortint sortlong sortshort sortint (unit MGNUMBER) ____________________________________________________________ Synopsis: procedure mgnumber.sortint(buffer: pointer; n: word); Description: This procedure sort an array of integer, using the shell type sort. Input: buffer: address of array. n: number of integer to sort. Output: nothing. See Also: - 358 - sortbyte sortlong sortshort sortword sortbyte (unit MGNUMBER) ____________________________________________________________ Synopsis: procedure mgnumber.sortbyte(buffer: pointer; n: word); Description: This procedure sort an array of byte, using the shell type sort. Input: buffer: address of array. n: number of byte to sort. Output: nothing. See Also: sortint sortlong sortshort sortword sortshort (unit MGNUMBER) ____________________________________________________________ Synopsis: procedure mgnumber.sortshort(buffer: pointer; n: word); Description: This procedure sort an array of shortint, using the shell type sort. Input: buffer: address of array. n: number of shortint to sort. Output: nothing. See Also: sortbyte sortint sortlong sortword - 359 - sortlong (unit MGNUMBER) ____________________________________________________________ Synopsis: procedure mgnumber.sortlong(buffer: pointer; n: word); Description: This procedure sort an array of longint, using the shell type sort. Input: buffer: address of array. n: number of longint to sort. Output: nothing. See Also: sortbyte sortint sortshort sortword basechange (unit MGNUMBER) ____________________________________________________________ Synopsis: function mgnumber.basechange(num, newbase: word): string; Description: This function return the conversion of one number into base 10 to any base 2-36. Input: num: number in base 10. newbase: new base to change to. Output: function result = num in base newbase. swapb (unit MGNUMBER) ____________________________________________________________ Synopsis: procedure mgnumber.swapb(var a, b: byte); Description: - 360 - This procedure swap two byte or two shortint. Input: a,b: number to swap. Output: a <--> b. See Also: swapl swapw swapw (unit MGNUMBER) ____________________________________________________________ Synopsis: procedure mgnumber.swapw(var a, b: word); Description: This procedure swap two word or two integer. Input: a,b: number to swap. Output: a <--> b. See Also: swapb swapl swapl (unit MGNUMBER) ____________________________________________________________ Synopsis: procedure mgnumber.swapl(var a, b: longint); Description: This procedure swap two longint. Input: a,b: number to swap. Output: a <--> b. See Also: swapb swapw - 361 - getbit (unit MGNUMBER) ____________________________________________________________ Synopsis: function mgnumber.getbit(data, bitnum: byte): boolean; Description: This function return the status of one bit into a byte. Input: data: data byte. bitnum: bit number to test from 0-7. Output: function result = true if bit on. See Also: getbitarray setbit setbitarray setbit (unit MGNUMBER) ____________________________________________________________ Synopsis: procedure mgnumber.setbit(var data: byte; bitnum: byte; assert: boolean); Description: This procedure change the status of one bit into a byte. Input: data: data byte. bitnum: bit number to test from 0-7. assert: set bit on or off. Output: nothing. See Also: getbit getbitarray setbitarray - 362 - getbitarray (unit MGNUMBER) ____________________________________________________________ Synopsis: function mgnumber.getbitarray(buffer: pointer; bitsnum: word): boolean; Description: This function return the status of one bit into a buffer of byte. Input: buffer: buffer of byte. (bits) bitnum: bit number to test from 0..$FFFF Output: function result = true if bit is on. See Also: getbit setbit setbitarray setbitarray (unit MGNUMBER) ____________________________________________________________ Synopsis: procedure mgnumber.setbitarray(buffer: pointer; bitsnum: word; assert: boolean); Description: This procedure change the status of one bit into a buffer of byte. Input: buffer: buffer of byte. (bits) bitnum: bit number to test from 0..$FFFF assert: set bit on or off. Output: nothing. See Also: getbit getbitarray setbit - 363 - nrandom (unit MGNUMBER) ____________________________________________________________ Synopsis: function mgnumber.nrandom(min, max: integer): integer; Description: This function return a random number in a specific range. Input: min: minimum range number. max: maximum range number. Output: randomize number. rotlongleft (unit MGNUMBER) ____________________________________________________________ Synopsis: procedure mgnumber.rotlongleft(var data: longint; numbits: byte); Description: This procedure rotate bits in a longint thrue left. Input: data: longint to rotate. numbits: number of rotations. Output: data rotated. See Also: rotbyteleft rotlongright rotwordleft rotlongright (unit MGNUMBER) ____________________________________________________________ Synopsis: procedure mgnumber.rotlongright(var data: longint; numbits: byte); - 364 - Description: This procedure rotate bits in longint thrue right. Input: data: longint to rotate. numbits: number of rotations. Output: data rotated. See Also: rotbyteleft rotlongleft rotwordleft rotwordleft (unit MGNUMBER) ____________________________________________________________ Synopsis: procedure mgnumber.rotwordleft(var data: word; numbits: byte); Description: This procedure rotate bits in word or integer thrue left. Input: data: word to rotate. numbits: number of rotations. Output: data rotated. See Also: rotbyteleft rotlongleft rotwordright rotwordright (unit MGNUMBER) ____________________________________________________________ Synopsis: procedure mgnumber.rotwordright(var data: word; numbits: byte); Description: This procedure rotate bits in word or integer thrue right. - 365 - Input: data: word to rotate. numbits: number of rotations. Output: data rotated. See Also: rotlongleft rotwordleft rotwordright rotbyteright (unit MGNUMBER) ____________________________________________________________ Synopsis: procedure mgnumber.rotbyteright(var data: byte; numbits: byte); Description: This procedure rotate bits in byte or short integer thrue left. Input: data: byte to rotate. numbits: number of rotations. Output: data rotated. See Also: rotbyteleft rotlongleft rotwordleft rotbyteleft (unit MGNUMBER) ____________________________________________________________ Synopsis: procedure mgnumber.rotbyteleft(var data: byte; numbits: byte); Description: This procedure rotate bits in byte or short integer thrue right. Input: - 366 - data: byte to rotate. numbits: number of rotations. Output: data rotated. See Also: rotbyteright rotlongleft rotwordleft maxs (unit MGNUMBER) ____________________________________________________________ Synopsis: function mgnumber.maxs(a, b: shortint): shortint; Description: This function return the greatest number between two shortint. Input: a,b: two number. Output: greatest number between a and b. See Also: maxb maxi maxl maxw minb mini minl mins minw mins (unit MGNUMBER) ____________________________________________________________ Synopsis: function mgnumber.mins(a, b: shortint): shortint; Description: This function return the smallest number between two shortint. Input: a,b: two number. - 367 - Output: smallest number between a and b. See Also: maxb maxi maxl maxs maxw minb mini minl minw maxb (unit MGNUMBER) ____________________________________________________________ Synopsis: function mgnumber.maxb(a, b: byte): byte; Description: This function return the greatest number between two byte. Input: a,b: two number. Output: greatest number between a and b. See Also: maxi maxl maxs maxw minb mini minl mins minw mini (unit MGNUMBER) ____________________________________________________________ Synopsis: function mgnumber.minb(a, b: byte): byte; Description: This function return the smallest number between two - 368 - byte. Input: a,b: two number. Output: smallest number between a and b. See Also: maxb maxi maxl maxs maxw mini minl mins minw maxi (unit MGNUMBER) ____________________________________________________________ Synopsis: function mgnumber.maxi(a, b: integer): integer; Description: This function return the greatest number between two integer. Input: a,b: two number. Output: greatest number between a and b. See Also: maxb maxl maxs maxw minb mini minl mins minw - 369 - mini (unit MGNUMBER) ____________________________________________________________ Synopsis: function mgnumber.mini(a, b: integer): integer; Description: This function return the smallest number between two integer. Input: a,b: two number. Output: smallest number between a and b. See Also: maxb maxi maxl maxs maxw minb minl mins minw maxw (unit MGNUMBER) ____________________________________________________________ Synopsis: function mgnumber.maxw(a, b: word): word; Description: This function return the greatest number between two word. Input: a,b: two number. Output: greatest number between a and b. See Also: maxb maxi maxl maxs minb mini - 370 - minl mins minw minw (unit MGNUMBER) ____________________________________________________________ Synopsis: function mgnumber.minw(a, b: word): word; Description: This function return the smallest number between two word. Input: a,b: two number. Output: smallest number between a and b. See Also: maxb maxi maxl maxs maxw minb mini minl mins maxl (unit MGNUMBER) ____________________________________________________________ Synopsis: function mgnumber.maxl(a, b: longint): longint; Description: This function return the greatest number between two longint. Input: a,b: two number. Output: greatest number between a and b. See Also: maxb maxi - 371 - maxs maxw minb mini minl mins minw minl (unit MGNUMBER) ____________________________________________________________ Synopsis: function mgnumber.minl(a, b: longint): longint; Description: This function return the smallest number between two longint. Input: a,b: two number. Output: smallest number between a and b. See Also: maxb maxi maxl maxs maxw minb mini mins minw longodd (unit MGNUMBER) ____________________________________________________________ Synopsis: function mgnumber.longodd(l: longint): boolean; Description: This function test a longint to see if this number is odd. This function return true if number is odd. Input: l: longint to test. Output: - 372 - function result = true if number is odd. See Also: byteodd wordodd wordodd (unit MGNUMBER) ____________________________________________________________ Synopsis: function mgnumber.wordodd(w: word): boolean; Description: This function test a word or integer to see if this number is odd. This function return true if number is odd. To test integer use integer() cast. Input: w: word or integer to test. Output: function result = true if number is odd. See Also: byteodd longodd byteodd (unit MGNUMBER) ____________________________________________________________ Synopsis: function mgnumber.byteodd(b: byte): boolean; Description: This function test a byte or shortint to see if this number is odd. This function return true if number is odd. To test shortint use byte() cast. Input: b: byte or shortint to test. Output: function result = true if number is odd. See Also: longodd wordodd - 373 - longsign (unit MGNUMBER) ____________________________________________________________ Synopsis: function mgnumber.longsign(l: longint): boolean; Description: This function test a longint to see if it smaller than zero. If number is negative this function return true. Input: l: longint to test. Output: function result = true if number is < 0. See Also: intsign intsign (unit MGNUMBER) ____________________________________________________________ Synopsis: function mgnumber.intsign(i: integer): boolean; Description: This function test an integer to see if it smaller than zero. If number is negative this function return true. Input: i: integer to test. Output: function result = true if number is < 0. See Also: longsign lolong (unit MGNUMBER) ____________________________________________________________ Synopsis: function mgnumber.lolong(l: longint): word; Description: This function return the low part of one longint. - 374 - Input: l: longint to use. Output: function result = low part of l. See Also: hilong hilong (unit MGNUMBER) ____________________________________________________________ Synopsis: function mgnumber.hilong(l: longint): word; Description: This function return the high part of one longint. Input: l: longint to use. Output: function result = high part of l. See Also: lolong loint (unit MGNUMBER) ____________________________________________________________ Synopsis: function mgnumber.loint(i: integer): byte; Description: This function return the low part of one integer or word. Input: i: integer to use. Output: function result = high part of i. See Also: hiint - 375 - hiint (unit MGNUMBER) ____________________________________________________________ Synopsis: function mgnumber.hiint(i: integer): byte; Description: This function return the high part of one integer or word. Input: i: integer to use. Output: function result = high part of i. See Also: loint - 376 - MGPARSE.TPU ____________________________________________________________ Description: This unit implement a parsing function use to parse command-line. Language Used: coded in ASSEMBLER. Linked With: Nothing. Example File: 'MGPAS024.PAS' this file give you an example that use all functions and procedures of this unit. Constants: parseend slashsalpha slashsnumeric slashfstring slashfnumeric slashstring slashnumeric flatstring flatnumeric Functions And Procedures: parsenext parseend (unit MGPARSE) ____________________________________________________________ Synopsis: Const mgparse.parseend = 0; Description: If parsenext return this code this mean there nothing left to be parse in command line. See Also: flatnumeric flatstring - 377 - slashfnumeric slashfstring slashnumeric slashSalpha slashSnumeric slashstring slashSalpha (unit MGPARSE) ____________________________________________________________ Synopsis: Const mgparse.slashsalpha = 1; Description: If parsenext return this code this mean /c as been found example: "/m" See Also: flatnumeric flatstring parseend slashfnumeric slashfstring slashnumeric slashSnumeric slashstring slashSnumeric (unit MGPARSE) ____________________________________________________________ Synopsis: Const mgparse.slashsnumeric = 2; Description: If parsenext return this code this mean /n as been found example: "/0" See Also: flatnumeric flatstring parseend slashfnumeric slashfstring slashnumeric slashSalpha slashstring - 378 - slashfstring (unit MGPARSE) ____________________________________________________________ Synopsis: Const mgparse.slashfstring = 3; Description: If parsenext return this code this mean /c:cccc as been found example: "/n:mark" See Also: flatnumeric flatstring parseend slashfnumeric slashnumeric slashSalpha slashSnumeric slashstring slashfnumeric (unit MGPARSE) ____________________________________________________________ Synopsis: Const mgparse.slashfnumeric = 4; Description: If parsenext return this code this mean /n:cccc as been found example: "/0:mark" See Also: flatnumeric flatstring parseend slashfstring slashnumeric slashSalpha slashSnumeric slashstring - 379 - slashstring (unit MGPARSE) ____________________________________________________________ Synopsis: Const mgparse.slashstring = 5; Description: If parsenext return this code this mean /cccccc as been found example: "/mark" See Also: flatnumeric flatstring parseend slashfnumeric slashfstring slashnumeric slashSalpha slashSnumeric slashnumeric (unit MGPARSE) ____________________________________________________________ Synopsis: Const mgparse.slashnumeric = 6; Description: If parsenext return this code this mean /nnnnnn as been found example: "/0543" See Also: flatnumeric flatstring parseend slashfnumeric slashfstring slashSalpha slashSnumeric slashstring - 380 - flatstring (unit MGPARSE) ____________________________________________________________ Synopsis: Const mgparse.flatstring = 7; Description: If parsenext return this code this mean ccccccc as been found example: "mark" See Also: flatnumeric parseend slashfnumeric slashfstring slashnumeric slashSalpha slashSnumeric slashstring flatnumeric (unit MGPARSE) ____________________________________________________________ Synopsis: Const mgparse.flatnumeric = 8; Description: If parsenext return this code this mean nnnnnnn as been found example: "1000" See Also: flatstring parseend slashfnumeric slashfstring slashnumeric slashSalpha slashSnumeric slashstring - 381 - parsenext (unit MGPARSE) ____________________________________________________________ Synopsis: function mgparse.parsenext(var s: string; var num: longint; var c: char): byte; Description: Return the next element of command line if there is still elements to be treated. Input: nothing. Output: function result are : parseend slashSalpha slashSnumeric slashfstring slashfnumeric slashstring slashnumeric flatstring flatnumeric These three variables are set depending on the result code. See result code or example file for more information. s: exit string. num: exit value. c: exit char. - 382 - MGPLAY.TPU ____________________________________________________________ Description: This module allow you to play .VOC file with a sound blaster card "without" driver. Language Used: coded in PASCAL. Linked With: MGFILHDL, MGMISC. Example File: 'MGPAS025.PAS' this file give you an example that use all functions and procedures of this unit. Constants: soundpresent getheader Types: vocptr vocrec vocdataptr vocdatarec playprocvar Functions And Procedures: vocplay pause continue isplaying vocptr (unit MGPLAY) ____________________________________________________________ Synopsis: mgplay.vocptr = ^vocrec; Description: Pointer of vocrec. - 383 - vocrec (unit MGPLAY) ____________________________________________________________ Synopsis: mgplay.vocrec = record Description: This record old information about .VOC file. Fields: signature: array... data_start: word; version: integer; id: integer; vocrec.signature: array[1..20] of char; vendor's name. vocrec.data_start: word; start of data in file. vocrec.version: integer; min. driver version required. vocrec.id: integer; 1 - complement of version field+$1234. vocdataptr (unit MGPLAY) ____________________________________________________________ Synopsis: mgplay.vocdataptr = ^vocdatarec; Description: Pointer of vocdatarec. vocdatarec (unit MGPLAY) ____________________________________________________________ Synopsis: mgplay.vocdatarec = record Description: This record old data from .VOC file. - 384 - Fields: id: byte; len: array... sr: byte; pack: byte; vocdatarec.id: byte; = 1. vocdatarec.len: array[1..3] of byte; length of voice data (len data + 2) vocdatarec.sr: byte; sr = 256 - (1,000,000 / sampling rate) vocdatarec.pack: byte; 0 : unpacked, 1 : 4-bit, 2 : 2.6 bit, 3: 2 bit packed. playprocvar (unit MGPLAY) ____________________________________________________________ Synopsis: mgplay.playprocvar = procedure (v: vocptr; d: vocdataptr; len, freq: word); Description: This type is use to create a hook to send file information. soundpresent (unit MGPLAY) ____________________________________________________________ Synopsis: Const mgplay.soundpresent: boolean = false; Description: This constant is set to true if sound blaster card as been found else set to false. - 385 - getheader (unit MGPLAY) ____________________________________________________________ Synopsis: Const mgplay.getheader: playprocvar = nil; Description: This constant point at procedure to be call to send sound file information. vocplay (unit MGPLAY) ____________________________________________________________ Synopsis: procedure mgplay.vocplay(filename: string; buf: pointer); Description: Play a .VOC file, file must be smaller than 64k. Input: filename: .VOC filename to play. buf: buffer to used. Output: nothing. pause (unit MGPLAY) ____________________________________________________________ Synopsis: procedure mgplay.pause; Description: This procedure temporary stop playing until you call continue. Input: nothing. Output: nothing. See Also: continue - 386 - continue (unit MGPLAY) ____________________________________________________________ Synopsis: procedure mgplay.continue; Description: This procedure resume play after a pause. Input: nothing. Output: nothing. See Also: pause isplaying (unit MGPLAY) ____________________________________________________________ Synopsis: function mgplay.isplaying: boolean; Description: This function check if .VOC is currently playing, this function return true if .VOC is playing else it return false. Input: nothing. Output: function result = true if currently playing. - 387 - MGQCII.TPU ____________________________________________________________ Description: This unit implement functions to support QuickCache II program. QuickCache II is a shareware disk cache by P.R. Glassel and Associates, Inc. Language Used: coded in ASSEMBLER. Linked With: nothing. Example File: 'MGPAS028.PAS' this file give you an example that use all functions and procedures of this unit. Types: qcii_systeminfo qcii_driveinfo Functions And Procedures: qciidismount qciiflush qciicachestatus qciisetsectors qciisetflushinterval qciiuninstall qciiinstallchk qciiautodismount qciisetbufsz qciisetbufedwrites qciisetbufedread qciisetflushcnt qciiforceimincflush qciigetinfo qciienablecache qciidisablecache qciisectlock qciisetlockpoolsize qciisetbuffedreaddrv qciisetbuffedwrtdrv qciisetrdbufszdrv qciisetwrbufszdrv - 388 - qcii_systeminfo (unit MGQCII) ____________________________________________________________ Synopsis: mgqcii.qcii_systeminfo = record Description: This record is used to old system information from QCII Fields: cacheenable: byte; bufedwrites: byte; bufedread: byte; sndenable: byte; autodismnt: byte; reserved: array... em_assigned: byte; emulateems: byte; sngsectbonus: byte; stickymax: byte; wrtsectbonus: byte; bonusthres: byte; flushinter: word; flushcount: word; poolsize: word; poolfree: word; requiredfreemem: word; totcachesects: word; dirtycachesects: word; trcbufsz: byte; reservedbyte: byte; qcii_systeminfo.cacheenable: byte; cache is enable. qcii_systeminfo.bufedwrites: byte; buffered writes enabled. qcii_systeminfo.bufedread: byte; buffered reads enabled. qcii_systeminfo.sndenable: byte; sounds enabled. qcii_systeminfo.autodismnt: byte; autodismount enabled. - 389 - qcii_systeminfo.em_assigned: byte; "em_assigned" qcii_systeminfo.emulateems: byte; flag: emulated ems. qcii_systeminfo.sngsectbonus: byte; single sector bonus. qcii_systeminfo.stickymax: byte; "sticky_max" qcii_systeminfo.wrtsectbonus: byte; write sector bonus. qcii_systeminfo.bonusthres: byte; bonus threshold. qcii_systeminfo.flushinter: word; flush interval. qcii_systeminfo.flushcount: word; flush count. qcii_systeminfo.poolsize: word; reserve pool size. qcii_systeminfo.poolfree: word; remaining space in reserve pool. qcii_systeminfo.requiredfreemem: word; required free memory. qcii_systeminfo.totcachesects: word; total cache sectors. qcii_systeminfo.dirtycachesects: word; dirty cache sectors. qcii_systeminfo.trcbufsz: byte; trace buffer size. qcii_systeminfo.reservedbyte: byte; reserved. mgqcii.qcii_driveinfo = record qcii_driveinfo (unit MGQCII) ____________________________________________________________ Description: This record is used to old drive information from QCII Fields: dosdrvnum: byte; biosdrvnum: byte; maxsects: byte; maxhds: byte; readbfsz: byte; writebfsz: byte; laststatus: byte; enable: byte; bufedwrite: byte; bufedread: byte; inuse: byte; cylnflush: byte; - 390 - reserved: byte; sectpertrck: byte; sectsz: word; sectsassng: word; dirtysects: word; resvsetcs: word; numreadsects: word; numwritesects: word; riocnt: longint; numcachemiss: longint; wiocnt: longint; diocnt: longint; qcii_driveinfo.dosdrvnum: byte; dos drive number. qcii_driveinfo.biosdrvnum: byte; bios drive number. qcii_driveinfo.maxsects: byte; maximum sector number. qcii_driveinfo.maxhds: byte; maximum head number. qcii_driveinfo.readbfsz: byte; read buffer size. qcii_driveinfo.writebfsz: byte; write buffer size. qcii_driveinfo.laststatus: byte; last status. qcii_driveinfo.enable: byte; flag: enabled. qcii_driveinfo.bufedwrite: byte; flag: buffered write enabled. qcii_driveinfo.bufedread: byte; flag: buffered read enabled. qcii_driveinfo.inuse: byte; flag: in use drive info is valid. qcii_driveinfo.cylnflush: byte; flag: cylinderflush. qcii_driveinfo.reserved: byte; reserved. qcii_driveinfo.sectpertrck: byte; sectors per track. qcii_driveinfo.sectsz: word; sector size. qcii_driveinfo.sectsassng: word; sectors assigned. qcii_driveinfo.dirtysects: word; dirty sectors. - 391 - qcii_driveinfo.resvsetcs: word; reserved sectors. qcii_driveinfo.numreadsects: word; number of read errors. qcii_driveinfo.numwritesects: word; number of write errors. qcii_driveinfo.riocnt: longint; "rio_count" qcii_driveinfo.numcachemiss: longint; number of cache misses. qcii_driveinfo.wiocnt: longint; "wio_count" qcii_driveinfo.diocnt: longint; "dio_count" qciiflush (unit MGQCII) ____________________________________________________________ Synopsis: function mgqcii.qciidismount(drive: byte): word; Description: This function flush any dirty buffers for the specified drive(s) and then discard those sector buffers. Input: drive: drive to use. Output: function result = 0 if successful qciiflush (unit MGQCII) ____________________________________________________________ Synopsis: function mgqcii.qciiflush: word; Description: This function immediately write all dirty sectors back to disk Input: nothing. Output: function result = 0 if successful - 392 - qciicachestatus (unit MGQCII) ____________________________________________________________ Synopsis: function mgqcii.qciicachestatus(assert: boolean): word; Description: This function enables or disables caching of all drives. Input: assert: true = enable, false = disable. Output: function result = 0 if successful qciisetsectors (unit MGQCII) ____________________________________________________________ Synopsis: function mgqcii.qciisetsectors(newnum: word): word; Description: This function set new number of sector buffers in cache. Input: newnum: number of sectors. Output: function result = 0000h successful 0001h failed--size adjusted 8000h cache cannot be resized while enabled qciisetflushinterval (unit MGQCII) ____________________________________________________________ Synopsis: function mgqcii.qciisetflushinterval(newinter: word): word; Description: This function specify how often the cache should write dirty buffers to disk when buffered writes are enabled. - 393 - Input: newinter: new interval. Output: function result = 0 if successful qciiuninstall (unit MGQCII) ____________________________________________________________ Synopsis: function mgqcii.qciiuninstall: word; Description: This function uninstall quick cache ii. Input: nothing. Output: function result = 0000h successful or 0001h-00FFh interrupt vector which was hooked by another TSR qciiinstallchk (unit MGQCII) ____________________________________________________________ Synopsis: function mgqcii.qciiinstallchk(var maj, min: byte): boolean; Description: This function return true if Quick cache II is installed. It also return version number if result is true. Input: nothing. Output: maj: major version number. min: minor version number. function result = true if quick cache install. - 394 - qciiautodismount (unit MGQCII) ____________________________________________________________ Synopsis: function mgqcii.qciiautodismount(newstatus: boolean): word; Description: This function enable or disable auto dismount. Input: newstatus: true = enable, false = disable. Output: function result = 0 if successful qciisetbufsz (unit MGQCII) ____________________________________________________________ Synopsis: function mgqcii.qciisetbufsz(bufsz: byte): word; Description: This function specify the number of cache sector buffers to dedicate to buffered read and write operations. Input: bufsz: number of cache sectors. Output: function result = 0 if successful qciisetbufedwrites (unit MGQCII) ____________________________________________________________ Synopsis: function mgqcii.qciisetbufedwrites(assert: boolean): word; Description: This function specify whether the cache should delay disk writes. Note: this procedure enables or disables delayed writes - 395 - for all drives. Input: assert: true = enable read-ahead, false = disable. Output: function result = 0 if successful See Also: qciisetbufedread qciisetbufedread (unit MGQCII) ____________________________________________________________ Synopsis: function mgqcii.qciisetbufedread(assert: boolean): word; Description: This function specify whether the cache should attempt to read ahead of actual requests. Note: this procedure enables or disables read-ahead for all drives. Input: assert: true = enable read-ahead, false = disable. Output: function result = 0 if successful See Also: qciisetbufedwrites qciisetflushcnt (unit MGQCII) ____________________________________________________________ Synopsis: function mgqcii.qciisetflushcnt(newcnt: word): word; Description: This function specify how many dirty sectors the cache should write after each flush interval (see ah=25h) when buffered writes are enabled. Input: newcnt: number of sectors. Output: function result = 0 if successful - 396 - qciiforceimincflush (unit MGQCII) ____________________________________________________________ Synopsis: function mgqcii.qciiforceimincflush: word; Description: This function immediately flush up to flushcount dirty sectors to disk as if the flush interval had expired. Input: nothing. Output: function result = 0 if successful qciigetinfo (unit MGQCII) ____________________________________________________________ Synopsis: function mgqcii.qciigetinfo(infokind: byte; buffer: pointer): word; Description: This function return information about QCii. Input: infokind: 00h system info 01h drive info 02h access frequency (array of 30 words) 03h drive index (array of 32 bytes indicating bios drive for dos drive) buffer: address of memory block where to store information. Output: function result = 0 if successful - 397 - qciienablecache (unit MGQCII) ____________________________________________________________ Synopsis: function mgqcii.qciienablecache(drive: byte): word; Description: This function enable cache for specific drive. Input: drive: drive to use. Output: function result = 0 if successful See Also: qciidisablecache qciidisablecache (unit MGQCII) ____________________________________________________________ Synopsis: function mgqcii.qciidisablecache(drive: byte): word; Description: This function disable cache for specific drive. Input: drive: drive to use. Output: function result = 0 if successful See Also: qciienablecache qciisectlock (unit MGQCII) ____________________________________________________________ Synopsis: function mgqcii.qciisectlock(fnc: byte): word; Description: This function lock or unlock sectors. Input: fnc: 00h end sector locking/unlocking - 398 - 01h lock all accessed sectors into cache 02h unlock all accessed sectors and discard from cache Output: function result = 0 if successful qciisetlockpoolsize (unit MGQCII) ____________________________________________________________ Synopsis: function mgqcii.qciisetlockpoolsize(numsect: word): word; Description: This function specify the number of cache sector buffers which may be dedicated to data locked into the cache. Input: numsect: number of sector dedicated to data locked. Output: function result = 0 if successful qciisetbuffedreaddrv (unit MGQCII) ____________________________________________________________ Synopsis: function mgqcii.qciisetbuffedreaddrv(assert: boolean; drive: byte): word; Description: This function enable or disable read cache for a specified drive. Input: assert: true = enable, false = disable. drive: drive to use. Output: function result = 0 if successful See Also: qciisetbuffedwrtdrv - 399 - qciisetbuffedwrtdrv (unit MGQCII) ____________________________________________________________ Synopsis: function mgqcii.qciisetbuffedwrtdrv(assert: boolean; drive: byte): word; Description: This function enable or disable write cache for a specified drive. Input: assert: true = enable, false = disable. drive: drive to use. Output: function result = 0 if successful See Also: qciisetbuffedreaddrv qciisetrdbufszdrv (unit MGQCII) ____________________________________________________________ Synopsis: function mgqcii.qciisetrdbufszdrv(size: byte; drive: byte): word; Description: This function set read buffer size for specific drive. Input: size: new size buffer. drive: drive to set buffer size. Output: function result = 0 if successful See Also: qciisetwrbufszdrv - 400 - qciisetwrbufszdrv (unit MGQCII) ____________________________________________________________ Synopsis: function mgqcii.qciisetwrbufszdrv(size: byte; drive: byte): word; Description: This function set write buffer size for specific drive. Input: size: new size buffer. drive: drive to set buffer size. Output: function result = 0 if successful See Also: qciisetrdbufszdrv - 401 - MGRLE.TPU ____________________________________________________________ Description: This unit implement RLE compression and decompression. This compression is very simple it crunch similar characters. For example: 'AAAAAAA' can be crunch in something like '7A'. Language Used: coded in C. Linked With: MGGLOBAL. Example File: 'MGPAS029.PAS' this file give you an example that use all functions and procedures of this unit. Constants: rlegetc rleputc Functions And Procedures: compressrle expandrle rlegetc (unit MGRLE) ____________________________________________________________ Synopsis: Const mgrle.rlegetc: getctype = nil; Description: rlegetc is a const that point over a function. This function is use by compression and expansion routine to input the next byte. When there is no by left to be compressed, rlegetc must receive -1. remember this function wait for an integer NOT A BYTE!! See Also: mgglobal.getctype - 402 - rleputc (unit MGRLE) ____________________________________________________________ Synopsis: Const mgrle.rleputc: putctype = nil; Description: rleputc is a const that point over a procedure. This procedure is use by compression and expansion routine to output the next byte. If this procedure send -1 this mean error occur in the MGLIBS functions and you must stop compression or decompression by sending -1 thrue next request of rlegetc. See Also: mgglobal.putctype compressrle (unit MGRLE) ____________________________________________________________ Synopsis: procedure mgrle.compressrle; Description: This procedure start RLE compression, I/O are get from rlegetc and rleputc and compression stop when received -1 from rlegetc. Input: nothing. Output: nothing. See Also: expandrle expandrle (unit MGRLE) ____________________________________________________________ Synopsis: procedure mgrle.expandrle; Description: This procedure start RLE decompression, I/O are get from rlegetc and rleputc and decompression stop when - 403 - received -1 from rlegetc. Input: nothing. Output: nothing. See Also: compressrle - 404 - MGSMTDRV.TPU ____________________________________________________________ Description: This module implemented function to support SmartDrive software. Language Used: coded in ASSEMBLER. Linked With: nothing. Example File: 'MGPAS031.PAS' this file give you an example that use all functions and procedures of this unit. Functions And Procedures: smdrvinstcheck smdrvflushbuf smdrvresetcache smdrvgetsetstatus smdrvchkdrvcacheable smdrvinstcheck (unit MGSMTDRV) ____________________________________________________________ Synopsis: function mgsmtdrv.smdrvinstcheck: boolean; Description: This function check if smartdrive is install. It return true if smartdrive is install else it return false. Input: nothing. Output: function result = true if smartdrive present. - 405 - smdrvflushbuf (unit MGSMTDRV) ____________________________________________________________ Synopsis: procedure mgsmtdrv.smdrvflushbuf; Description: This procedure cause smart drive to write dirty buffer to file. Input: nothing. Output: nothing. smdrvresetcache (unit MGSMTDRV) ____________________________________________________________ Synopsis: procedure mgsmtdrv.smdrvresetcache; Description: This procedure reset the cache buffer. Input: nothing. Output: nothing. smdrvgetsetstatus (unit MGSMTDRV) ____________________________________________________________ Synopsis: function mgsmtdrv.smdrvgetsetstatus(var status: byte; drive: byte): boolean; Description: This function return or change then cache status. Notes: If the read cache is off, reads will not be cached, but writes will continue to be cached if the write-cache is enabled. If error occur function return false. - 406 - Input: drive: drive number to check. status: 00h only get information 01h turn on read cache 02h turn off read cache 03h turn on write cache 04h turn off write cache) Output: status: bit 7 not cached bit 6 write-through(not write-cached) bits 0-5 real drive number(0=a, 1=b...) ffh if drive does not exist function result = true if no error occur. smdrvchkdrvcacheable (unit MGSMTDRV) ____________________________________________________________ Synopsis: function mgsmtdrv.smdrvchkdrvcacheable(drive: byte): word; Description: This function check if drive is cacheable. It return true if drive is cacheable, else it return false. Input: drive: drive number to check. Output: function result = 0006h if drive should not be cached. - 407 - MGSOUND.TPU ____________________________________________________________ Description: This unit allow programmer to send play to a pc speacker. Language Used: coded in PASCAL. Linked With: Nothing. Example File: 'MGPAS032.PAS' this file give you an example that use all functions and procedures of this unit. Functions And Procedures: tone notone tone (unit MGSOUND) ____________________________________________________________ Synopsis: procedure mgsound.tone(freq: word); Description: This procedure open the pc speacker "mouth" so it "crash" something we use to call sound. Input: freq: frequency number. Output: nothing. See Also: notone - 408 - notone (unit MGSOUND) ____________________________________________________________ Synopsis: procedure mgsound.notone; Description: This procedure close the "mouth" of pc speaker, this mean it stop pc speaker from making NOISE! Input: nothing. Output: nothing. See Also: tone - 409 - MGSTACKD.TPU ____________________________________________________________ Description: This unit implement function to create a dynamic stack into Turbo Pascal heap memory. The stack created will only be limited by available memory. Language Used: coded in PASCAL. Linked With: MGMEM. Example File: 'MGPAS033.PAS' this file give you an example that use all functions and procedures of this unit. Types: nodeptr nodetype stackdtype stackdptr Functions And Procedures: stackddone stackdinit stackdempty stackdpush stackdpop stackdpeek stackdclear nodeptr (unit MGSTACKD) ____________________________________________________________ Synopsis: mgstackd.nodeptr = ^nodetype; Description: Pointer of nodetype. - 410 - nodetype (unit MGSTACKD) ____________________________________________________________ Synopsis: mgstackd.nodetype = record Description: This type is used to declare one element of stack. Fields: info: pointer; prev: nodeptr; nodetype.info: pointer; address of data for this element. nodetype.prev: nodeptr; address of previous element. stackdtype (unit MGSTACKD) ____________________________________________________________ Synopsis: mgstackd.stackdtype = record Description: This is the main type use to declare a dynamic stack. Fields: s: nodeptr; recordsz: word; error: byte; stackdtype.s: nodeptr; pointer on previous element. stackdtype.recordsz: word; size of each element. stackdtype.error: byte; error variable. - 411 - stackdptr (unit MGSTACKD) ____________________________________________________________ Synopsis: mgstackd.stackdptr = ^stackdtype; Description: A pointer of stackdtype. stackddone (unit MGSTACKD) ____________________________________________________________ Synopsis: procedure mgstackd.stackddone(stack: stackdptr); Description: This procedure release memory use by stack global variable. This procedure is call when you don't need anymore one stack. Input: stack: stack variable to deinitialize. Output: nothing. See Also: stackdinit stackdinit (unit MGSTACKD) ____________________________________________________________ Synopsis: procedure mgstackd.stackdinit(stack: stackdptr; recsize: word); Description: This procedure initialize all variables of specific stack. Input: stack: stack variable to initialize. recsize: size of each element. - 412 - Output: nothing. See Also: stackddone stackdempty (unit MGSTACKD) ____________________________________________________________ Synopsis: function mgstackd.stackdempty(stack: stackdptr): boolean; Description: This function test stack to see if the stack is empty. This function return true if stack is empty, else it return false. Input: stack: stack variable. Output: function result = true if stack is empty. stackdpush (unit MGSTACKD) ____________________________________________________________ Synopsis: procedure mgstackd.stackdpush(stack: stackdptr; newelem: pointer); Description: This is the main procedure with stackdpop. This procedure send one element on the top of the stack. Input: stack: stack variable. Output: newelement: element to store on top of stack. See Also: stackdpop - 413 - stackdpop (unit MGSTACKD) ____________________________________________________________ Synopsis: procedure mgstackd.stackdpop(stack: stackdptr; element: pointer); Description: This is the main procedure with stackdpush. This procedure restore last element that was pushed on stack and remove it from stack. Input: stack: stack variable. Output: element: element get from top of stack. See Also: stackdpush stackdpeek (unit MGSTACKD) ____________________________________________________________ Synopsis: procedure mgstackd.stackdpeek(stack: stackdptr; element: pointer); Description: This procedure is similar to stackdpop but this procedure won't remove element from stack. Input: stack: stack variable. Output: element: element get from top of stack. stackdclear (unit MGSTACKD) ____________________________________________________________ Synopsis: procedure mgstackd.stackdclear(stack: stackdptr); Description: - 414 - This procedure clear any element currently in stack. After calling this procedure stack is empty, and memory released. Input: stack: stack variable. Output: nothing. - 415 - MGSTACKS.TPU ____________________________________________________________ Description: This unit implement functions to create a stack of integer the stack is static, and is limited to 64k. Language Used: coded in PASCAL. Linked With: MGMEM. Example File: 'MGPAS034.PAS' this file give you an example that use all functions and procedures of this unit. Types: stacktype stackptr Functions And Procedures: stackinit stackempty stackpush stackpop stackpeek stackclear stacktype (unit MGSTACKS) ____________________________________________________________ Synopsis: mgstacks.stacktype = record Description: This is the main type use to declare a static stack. Fields: data: pointer; recordsz: word; numelements: word; maxelements: word; - 416 - error: byte; stacktype.data: pointer; address of array of elements. stacktype.recordsz: word; size of element. stacktype.numelements: word; number of elements in stack. stacktype.maxelements: word; maximum number of elements. stacktype.error: byte; error code. stackptr (unit MGSTACKS) ____________________________________________________________ Synopsis: mgstacks.stackptr = ^stacktype; Description: A pointer of stacktype. stackinit (unit MGSTACKS) ____________________________________________________________ Synopsis: procedure mgstacks.stackinit(stack: stackptr; data: pointer; recsize, maxrec: word); Description: This procedure initialize all stack variables. Input: stack: stack variable to initialize. data: address of stack array. recsize: size of each element. maxrec: maximum number of elements to store in stack. Output: nothing. - 417 - stackempty (unit MGSTACKS) ____________________________________________________________ Synopsis: function mgstacks.stackempty(stack: stackptr): boolean; Description: This function test stack to see if the stack is empty. This function return true if stack is empty, else it return false. Input: stack: stack variable. Output: function result = true if stack is empty. stackpush (unit MGSTACKS) ____________________________________________________________ Synopsis: procedure mgstacks.stackpush(stack: stackptr; newelem: pointer); Description: This procedure stored one element on the stop of stack. Input: stack: stack variable. Output: newelement: element to store on top of stack. See Also: stackpop stackpop (unit MGSTACKS) ____________________________________________________________ Synopsis: procedure mgstacks.stackpop(stack: stackptr; element: pointer); Description: - 418 - This procedure restore last element stored on stack and element is clear from stack. Input: stack: stack variable. Output: element: element get from top of stack. See Also: stackpush stackpeek (unit MGSTACKS) ____________________________________________________________ Synopsis: procedure mgstacks.stackpeek(stack: stackptr; element: pointer); Description: This procedure is similar to stackpop but this procedure doesn't remove element from stack. Input: stack: stack variable. Output: element: element get from top of stack. stackclear (unit MGSTACKS) ____________________________________________________________ Synopsis: procedure mgstacks.stackclear(stack: stackptr); Description: This procedure clear any data currently in stack. Input: stack: stack variable. Output: nothing. - 419 - MGTASKER.TPU ____________________________________________________________ Description: This unit implement functions to support multitaskers like Deskview, Topview, Window, Doubledos, etc. Language Used: coded in ASSEMBLER. Linked With: MGGLOBAL. Example File: 'MGPAS036.PAS' this file give you an example that use all functions and procedures of this unit. Variables: taskmin taskmaj windowmode multitask Functions And Procedures: giveslice winbegincritic winendcritic wininstall wingiveslice dpmiinstall dpmigiveslice detectos2 os2giveslice dos5giveslice tvgetver dvgetver tvdvgetshadowbuf tvdvgiveslice tvdvbegincritic tvdvendcritic dvscrninfo ddinstall ddmenucontrol ddsendch2otherjob ddaddch2buf ddotherprgstatus ddsettimesharing ddtaskswitchoff ddtaskswitchon - 420 - ddgetvideoaddr ddgivetimeslice ddclrkeybuffer ddkeysflags taskmin (unit MGTASKER) ____________________________________________________________ Synopsis: mgtasker.taskmin: byte; Description: This variable hold the minor software version of multitasker if one of theses tasker are detect: window, TopView, DeskView or DPMI. taskmaj (unit MGTASKER) ____________________________________________________________ Synopsis: mgtasker.taskmaj: byte; Description: This variable hold the major software version of multitasker if one of theses tasker are detect: window, TopView, DeskView or DPMI. windowmode (unit MGTASKER) ____________________________________________________________ Synopsis: mgtasker.windowmode: byte; Description: This variable hold the window mode if window is detect. - 421 - multitask (unit MGTASKER) ____________________________________________________________ Synopsis: mgtasker.multitask: byte; Description: This variable hold the multi-tasker currently in use. 0 = none 1 = window_standard 2 = window_enhanced 3 = dmpi 4 = os2 5 = dos5+ 6 = topview 7 = deskview 8 = doubledos giveslice (unit MGTASKER) ____________________________________________________________ Synopsis: procedure mgtasker.giveslice; Description: This procedure check if multi-tasker as been detect and if yes, it give slice time. All tasker are support by this call. Input: nothing. Output: nothing. winbegincritic (unit MGTASKER) ____________________________________________________________ Synopsis: procedure mgtasker.winbegincritic; Description: MS Windows 3.0+, begin critical session. - 422 - Notes: used to prevent a task switch from occurring should be followed by an END CRITICAL call as soon as possible nested calls are allowed, and must be followed by an appropriate number of "end critical section" calls not supported in Windows/386 2.x. Input: nothing. Output: function result = true if OS/2 running. See Also: winendcritic winendcritic (unit MGTASKER) ____________________________________________________________ Synopsis: procedure mgtasker.winendcritic; Description: MS Windows 3.0+, end critical session. Notes: not supported in Windows/386 2.x. Input: nothing. Output: function result = true if OS/2 running. See Also: winstartcritic wininstall (unit MGTASKER) ____________________________________________________________ Synopsis: function mgtasker.wininstall(var min, maj, mode: byte): boolean; Description: MS Windows installation check. This function return true if MS Windows as been installed. If return true, min, maj contain version number and mode current operation mode. Input: nothing. - 423 - Output: function result = true if MS Windows installed. if true: min: MS Windows minor version. maj: MS Windows major version. mode: MS Windows mode, 2 = standard, 3 = enhanced. wingiveslice (unit MGTASKER) ____________________________________________________________ Synopsis: procedure mgtasker.wingiveslice; Description: This procedure give time slice to WINDOW 3.0+ when running under DOS window. Give Time slice when you don't need CPU for example when you are waiting for a key stroke. Input: nothing. Output: nothing. dpmiinstall (unit MGTASKER) ____________________________________________________________ Synopsis: function mgtasker.dpmiinstall(var min, maj: byte): boolean; Description: DOS Protected-Mode Interface (DPMI) installation check. This function return true if DPMI as been installed, if return true min and maj contain DPMI version number. Input: nothing. Output: function result = true if DPMI installed. if true: min = DPMI minor version. maj = DPMI major version. - 424 - dpmigiveslice (unit MGTASKER) ____________________________________________________________ Synopsis: procedure mgtasker.dpmigiveslice; Description: This procedure give time slice to DPMI 1.0+. Give Time slice when you don't need CPU for example when you are waiting for a key stroke. Input: nothing. Output: nothing. detectos2 (unit MGTASKER) ____________________________________________________________ Synopsis: function mgtasker.detectos2: boolean; Description: This function is used to check if OS2 is installed. This function return true if OS2 is installed else it return false. Input: nothing. Output: function result = true if OS/2 running. os2giveslice (unit MGTASKER) ____________________________________________________________ Synopsis: procedure mgtasker.os2giveslice; Description: This procedure give time slice to OS2 2.0+ when running under DOS window. Give Time slice when you don't need CPU for example when you are waiting for a key stroke. - 425 - Input: nothing. Output: nothing. dos5giveslice (unit MGTASKER) ____________________________________________________________ Synopsis: procedure mgtasker.dos5giveslice; Description: This procedure give time slice to DOS 5.0+. Give Time slice when you don't need CPU for example when you are waiting for a key stroke. Input: nothing. Output: nothing. tvgetver (unit MGTASKER) ____________________________________________________________ Synopsis: function mgtasker.tvgetver(var maj, min: byte): boolean; Description: This function return Topview version number. Input: nothing. Output: function result = true if Topview detect. if function result = true then maj and min contain major and minor version number of current TopView. - 426 - dvgetver (unit MGTASKER) ____________________________________________________________ Synopsis: function mgtasker.dvgetver(var maj, min: byte): boolean; Description: This function return Deskview version. Input: nothing. Output: function result = true if Deskview is detect. if function result = true maj and min contain major and minor version number. tvdvgetshadowbuf (unit MGTASKER) ____________________________________________________________ Synopsis: function mgtasker.tvdvgetshadowbuf: pointer; Description: This function return address of shadow buffer for Deskview, or Topview. Input: nothing. Output: function result = shadow buffer address. tvdvgiveslice (unit MGTASKER) ____________________________________________________________ Synopsis: procedure mgtasker.tvdvgiveslice; Description: This procedure give time slice to DesckView or TopView. Give Time slice when you don't need CPU for example when you are waiting for a key stroke. Input: - 427 - nothing. Output: nothing. tvdvbegincritic (unit MGTASKER) ____________________________________________________________ Synopsis: procedure mgtasker.tvdvbegincritic; Description: This procedure begin a critical procedure for Deskview or Topview. This procedure allocate more time to current window, this function request more power from multi-tasker this mean other window speed drop! So use this with care don't stay to long in critical mode. Input: nothing. Output: nothing. See Also: tvdvendcritic tvdvendcritic (unit MGTASKER) ____________________________________________________________ Synopsis: procedure mgtasker.tvdvendcritic; Description: This procedure is a complement to tvtdbegincritic. This procedure restore normal mode after requesting a critical procedure mode. Input: nothing. Output: nothing. See Also: tvdvendcritic - 428 - dvscrninfo (unit MGTASKER) ____________________________________________________________ Synopsis: procedure mgtasker.dvscrninfo(var row, column, videomode: byte); Description: This procedure return Deskview screen information. Input: nothing. Output: row: number of row. column: number of column. videomode: current videomode. ddinstall (unit MGTASKER) ____________________________________________________________ Synopsis: function mgtasker.ddinstall: boolean; Description: This function check if Doubledos is installed. If Doubledos is installed this function return true, else it return false. Input: nothing. Output: function result = true if double dos installed. ddmenucontrol (unit MGTASKER) ____________________________________________________________ Synopsis: procedure mgtasker.ddmenucontrol(fnc: byte); Description: This procedure give commands to Doubledos. - 429 - Input: fnc: 01h exchange tasks 73h resume invisible job if suspended 74h kill other job 75h suspend invisible job Output: nothing. ddsendch2otherjob (unit MGTASKER) ____________________________________________________________ Synopsis: function mgtasker.ddsendch2otherjob(c: char): boolean; Description: This function add one key to keyboard buffer of other job. It return true if key was accepted, else it return false. Input: c: key to add. Output: function result = true if key added. ddaddch2buf (unit MGTASKER) ____________________________________________________________ Synopsis: function mgtasker.ddaddch2buf(c: char): boolean; Description: This function add one key to keyboard buffer. This function return true if character was accepted, else it return false. Input: c: key to add. Output: function result = true if key added. - 430 - ddotherprgstatus (unit MGTASKER) ____________________________________________________________ Synopsis: function mgtasker.ddotherprgstatus: byte; Description: This function return other task status in Doubledos. Input: nothing. Output: function result = 00h no program in other partition 01h program in other partition is running 02h program in other partition is suspended ddsettimesharing (unit MGTASKER) ____________________________________________________________ Synopsis: function mgtasker.ddsettimesharing(mode: byte): byte; Description: This function change the time sharing between the two task, in Doubledos. Input: mode: 00h visible program gets 70%, invisible gets 30% (default) 01h visible program gets 50%, invisible gets 50% 02h visible program gets 30%, invisible gets 70% 03h top program gets 70%,bottom program gets 30% 04h top program gets 30%,bottom program gets 70% 05h get current priority Output: function result = new mode. - 431 - ddtaskswitchoff (unit MGTASKER) ____________________________________________________________ Synopsis: procedure mgtasker.ddtaskswitchoff; Description: This procedure turn off task switching of Doubledos. Input: nothing. Output: nothing. See Also: ddtaskswitchon ddtaskswitchon (unit MGTASKER) ____________________________________________________________ Synopsis: procedure mgtasker.ddtaskswitchon; Description: This procedure turn on task switching of Doubledos. Input: nothing. Output: nothing. See Also: ddtaskswitchoff ddgetvideoaddr (unit MGTASKER) ____________________________________________________________ Synopsis: function mgtasker.ddgetvideoaddr: word; Description: This function return video buffer segment of Doubledos, offset is always equal to zero. Input: - 432 - nothing. Output: function result = segment value. ddgivetimeslice (unit MGTASKER) ____________________________________________________________ Synopsis: procedure mgtasker.ddgivetimeslice(num: byte); Description: This procedure give time slice to Doubledos. Give Time slice when you don't need CPU for example when you are waiting for a key stroke. Input: num: number of tick to give. Output: nothing. ddclrkeybuffer (unit MGTASKER) ____________________________________________________________ Synopsis: procedure mgtasker.ddclrkeybuffer; Description: This procedure clear the keyboard buffer in Doubledos. Input: nothing. Output: nothing. ddkeysflags (unit MGTASKER) ____________________________________________________________ Synopsis: function mgtasker.ddkeysflags(mode: byte; flags: word): word; - 433 - Description: This function change keyboard flags for background or foreground program and return previous flags. Input: mode: 0 for current job, 1 for other job. flags: bit 0 menu bit 1 exchange bit 2 entire keyboard enable/disable bit 3 Ctrl-C bit 4 Ctrl-PrtSc bit 5 Alt/Erase bit 6 Ctrl-Break bit 7 Ctrl-NumLock bit 8 shift-PrtSc bit 9-13 undefined bit 14 cancel key (clear keyboard buffer) bit 15 suspend key Note: setting a bit enables the corresponding key or operation, clearing a bit disables it Output: function result = previous flags. - 434 - and .PAK MGVWZIP.TPU ____________________________________________________________ Description: This unit allow programmers to read .ARC and .PAK file so they can get all files information about files include in compressed file. Language Used: coded in PASCAL. Linked With: MGFILHDL. Example File: 'MGPAS038.PAS' this file give you an example that use all functions and procedures of this unit. Constants: nextarcfile Types: archdr arcptr arcprocvar Functions And Procedures: arcview archdr (unit MGVWARC) ____________________________________________________________ Synopsis: mgvwarc.archdr = record Description: This is the ARC header. Fields: arcid: byte; method: byte; filename: array... - 435 - cmpsize: longint; filedate: word; filetime: word; crc16: word; origsize: longint; archdr.arcid: byte; Arc ID must = $1A (26) archdr.method: byte; Stored 0 No compression used Packed 1 Repeated running length encoding (RLE) Squeezed 2 Huffman encoding Crunched 3 LZW with 4K buffer, 12 bits codes Crunched 4 First packing, then LZW 4K buffer with 12 bits Crunched 5 Packing, LZW, 4K buffer, vari len (9-12 bits) Squashed 6 LZW, 8K buffer, variable length (9-13 bits) Crushed 7 Packing, then LZW 8K buffer, 2-13 bits (PAK 1.0) Distill 8 Dynamic Huffman with 8K buffer (PAK 2.0) archdr.filename: array[1..13] of char; file name as ASCIIZ string (null terminate) archdr.cmpsize: longint; size of file compressed. archdr.filedate: word; date of file. archdr.filetime: word; time of file. archdr.crc16: word; crc of file in 16bits format. archdr.origsize: longint; original file size. arcptr (unit MGVWARC) ____________________________________________________________ Synopsis: mgvwarc.arcptr = ^archdr; Description: A pointer of ARC header. arcprocvar (unit MGVWARC) ____________________________________________________________ Synopsis: mgvwarc.arcprocvar = procedure (arc: arcptr); Description: - 436 - This type is use to declare hook procedure. nextarcfile (unit MGVWARC) ____________________________________________________________ Synopsis: Const mgvwarc.nextarcfile: arcprocvar = nil; Description: This procedure is call each time a file is found in .ZIP file. If you don't set this constant, program will not return any information or may crash. arcview (unit MGVWARC) ____________________________________________________________ Synopsis: function mgvwarc.arcview(arcfile: string): boolean; Description: This function search for a specific file, open it, and send all files information via your hook procedure. Input: arcfile: the name of .ARC or .PAK file you want to scan. Output: function result = true if everything is ok. - 437 - MGVWARJ.TPU ____________________________________________________________ Description: This unit allow programmers to read .ARJ file so they can get all files information about files include in compressed file. Language Used: coded in PASCAL. Linked With: MGMEM, MGFILHDL. Example File: 'MGPAS039.PAS' this file give you an example that use all functions and procedures of this unit. Constants: nextarjfile Types: afilerec afileptr arjvarproc Functions And Procedures: arjview afilerec (unit MGVWARJ) ____________________________________________________________ Synopsis: mgvwarj.afilerec = record Description: This is the ZIP header. You can find description of this file in technote.doc include with any ARJ kit. Fields: archiverver: byte; - 438 - minarchivenum: byte; hostos: byte; flags: byte; method: byte; filetype: byte; reserved: byte; datetime: longint; cmpsize: longint; origsize: longint; crc32: longint; fileaccessmode: word; filename: array... comment: array... afilerec.archiverver: byte; version of arj. afilerec.minarchivenum: byte; minimum version to decompress. afilerec.hostos: byte; OS type. afilerec.flags: byte; arj flags. afilerec.method: byte; compression method used. afilerec.filetype: byte; file type. afilerec.reserved: byte; reserved. afilerec.datetime: longint; file date and time. afilerec.cmpsize: longint; file size compressed. afilerec.origsize: longint; file size uncompressed. afilerec.crc32: longint; file CRC-32. afilerec.fileaccessmode: word; file access mode. afilerec.filename: array[0..128] of char; filename. afilerec.comment: array[0..128] of char; comment. afileptr (unit MGVWARJ) ____________________________________________________________ Synopsis: mgvwarj.afileptr = ^afilerec; Description: This type is a pointer of afilerec and is use to implemented the hook procedure. - 439 - arjvarproc (unit MGVWARJ) ____________________________________________________________ Synopsis: mgvwarj.arjvarproc = procedure (arjrec: afileptr); Description: This type is use to declare the hook procedure. nextarjfile (unit MGVWARJ) ____________________________________________________________ Synopsis: Const mgvwarj.nextarjfile: arjvarproc = nil; Description: This procedure is call each time a file is found in .ARJ file. If you don't set this constant, program will not return any information or may crash. arjview (unit MGVWARJ) ____________________________________________________________ Synopsis: function mgvwarj.arjview(const filename: string): boolean; Description: This function search for a specific file, open it, and send all files information via your hook procedure. Input: filename: the name of .ARJ file you want to scan. Output: function result = true if everything is ok. - 440 - MGVWLZH.TPU ____________________________________________________________ Description: This unit allow programmers to read .LZH file so they can get all files information about files include in compressed file. Language Used: coded in PASCAL. Linked With: MGFILHDL. Example File: 'MGPAS037.PAS' this file give you an example that use all functions and procedures of this unit. Constants: nextlzhfile Types: lzhhdrptr lzhheader lzhprocvar Functions And Procedures: lzhview lzhhdrptr (unit MGVWLZH) ____________________________________________________________ Synopsis: mgvwlzh.lzhhdrptr = ^lzhheader; Description: A pointer of lzhheader. - 441 - lzhheader (unit MGVWLZH) ____________________________________________________________ Synopsis: mgvwlzh.lzhheader = record Description: This is the LZH header. Fields: size: byte; checksum: byte; method: array... cmpsize: longint; origsize: longint; filetime: word; filedate: word; fileattr: word; filename: string... crc16: word; lzhheader.size: byte; size of this header. lzhheader.checksum: byte; checksum of header. lzhheader.method: array[1..5] of char; compression method. lzhheader.cmpsize: longint; size of file compress. lzhheader.origsize: longint; original file size. lzhheader.filetime: word; file time. lzhheader.filedate: word; file date. lzhheader.fileattr: word; file attribute. lzhheader.filename: string[11] ; file name. lzhheader.crc16: word; CRC 16 bits of file. lzhprocvar (unit MGVWLZH) ____________________________________________________________ Synopsis: mgvwlzh.lzhprocvar = procedure (lzh: lzhhdrptr); Description: - 442 - This type is use to declare hook procedure. nextlzhfile (unit MGVWLZH) ____________________________________________________________ Synopsis: Const mgvwlzh.nextlzhfile: lzhprocvar = nil; Description: This procedure is call each time a file is found in .LZH file. If you don't set this constant, program will not return any information or may crash. lzhview (unit MGVWLZH) ____________________________________________________________ Synopsis: function mgvwlzh.lzhview(lzhfile: string): boolean; Description: This function search for a specific file, open it, and send all files information via your hook procedure. Input: lzhfile: the name of .LZH file you want to scan. Output: function result = true if everything is ok. - 443 - MGVWZIP.TPU ____________________________________________________________ Description: This unit allow programmers to read .ZIP file so they can get all files information about files include in compressed file. Language Used: coded in PASCAL. Linked With: MGGLOBAL, MGMEM, MGFILHDL. Example File: 'MGPAS027.PAS' this file give you an example that use all functions and procedures of this unit. Constants: nextzipfile Types: zfheader zfheaderptr zipprocvar Functions And Procedures: zipview zfheader (unit MGVWZIP) ____________________________________________________________ Synopsis: mgvwzip.zfheader = record Description: This is the ZIP header. You can find description of this record in TECHNOTE.TXT include with any PKZIP kit. Fields: signature: longint; - 444 - version: word; gpbflag: word; method: word; date: word; time: word; crc32: longint; cmpsize: longint; origsize: longint; fnamelen: word; extrafield: word; zfheader.signature: longint; pkzip signature. zfheader.version: word; pkzip version number. zfheader.gpbflag: word; not defined. zfheader.method: word; compression type. zfheader.date: word; file date. zfheader.time: word; file time. zfheader.crc32: longint; file CRC-32. zfheader.cmpsize: longint; file size compressed. zfheader.origsize: longint; file size uncompressed. zfheader.fnamelen: word; length of filename. zfheader.extrafield: word; reserved. zfheaderptr (unit MGVWZIP) ____________________________________________________________ Synopsis: mgvwzip.zfheaderptr = ^zfheader; Description: This type is a pointer of zfheader and is use to implemented the hook procedure. - 445 - zfheader (unit MGVWZIP) ____________________________________________________________ Synopsis: mgvwzip.zipprocvar = procedure (b: zfheaderptr; filename: strptr); Description: This type is use to declare hook procedure. nextzipfile (unit MGVWZIP) ____________________________________________________________ Synopsis: Const mgvwzip.nextzipfile: zipprocvar = nil; Description: This procedure is call each time a file is found in .ZIP file. If you don't set this constant, program will not return any information or may crash. zipview (unit MGVWZIP) ____________________________________________________________ Synopsis: function mgvwzip.zipview(zipfile: string): boolean; Description: This function search for a specific file, open it, and send all files information via your hook procedure. Input: zipfile: the name of .ZIP file you want to scan. Output: function result = true if everything is ok. - 446 - MGVWZOO.TPU ____________________________________________________________ Description: This unit allow programmers to read .ZOO file so they can get all files information about files include in compressed file. Language Used: coded in PASCAL. Linked With: MGFILHDL. Example File: 'MGPAS025.PAS' this file give you an example that use all functions and procedures of this unit. Constants: nextzoofile Types: zoomainhdrptr zoomainhdr zoohdrptr zoohdr zooprocvar Functions And Procedures: zooview zoomainhdrptr (unit MGVWZOO) ____________________________________________________________ Synopsis: mgvwzoo.zoomainhdrptr = ^zoomainhdr; Description: A pointer of zoomainhdr. - 447 - zoomainhdr (unit MGVWZOO) ____________________________________________________________ Synopsis: mgvwzoo.zoomainhdr = record Description: This is the ZOO main (first) header. Fields: msg: array... signature: longint; firsthdr: longint; unknown: longint; mversion: byte; minversion: byte; zoomainhdr.msg: array[1..20] of char; This is generally equal to "ZOO 2.10 Archive" zoomainhdr.signature: longint; ZOO signature. zoomainhdr.firsthdr: longint; offset of first header in file. zoomainhdr.unknown: longint; this is currently unknown. zoomainhdr.mversion: byte; version of compiler that compile this file. zoomainhdr.minversion: byte; minimum version required to decompress the file. zoohdrptr (unit MGVWZOO) ____________________________________________________________ Synopsis: mgvwzoo.zoohdrptr = ^zoohdr; Description: A pointer of ZooHdr. - 448 - zoohdr (unit MGVWZOO) ____________________________________________________________ Synopsis: mgvwzoo.zoohdr = record Description: This is the header for each file in .ZOO. Fields: signature: longint; _type_: byte; method: byte; nexthdr: longint; curentofs: longint; lastmodedate: word; lastmodetime: word; crc16: word; origsize: longint; cmpsize: longint; majversion: byte; minversion: byte; delete: boolean; struc: byte; commentofs: longint; comentlen: word; filename: array... var_dir_len: integer; tz: byte; dir_crc: word; namlen: byte; dirlen: byte; lfname: array... dirname: array... system_id: word; fattr: longint; vflag: word; version_no: word; zoohdr.signature: longint; Zoo signature. zoohdr._type_: byte; Always 1 {Currently unused. - 449 - zoohdr.method: byte; Compression method used: . 0, Stored No compression used . 1, Crunched Packing, LZW, 4K buffer, var len (9-12 bits) zoohdr.nexthdr: longint; offset of next file header in file. zoohdr.curentofs: longint; offset of this header. zoohdr.lastmodedate: word; date of file. zoohdr.lastmodetime: word; time of file. zoohdr.crc16: word; crc-16 bits of file. zoohdr.origsize: longint; original file size. zoohdr.cmpsize: longint; compress file size. zoohdr.majversion: byte; minimum version (major) required to decompress this file. zoohdr.minversion: byte; minimum version (minor) required to decompress this file. zoohdr.delete: boolean; true if file as been deleted from archive. zoohdr.struc: byte; file structure if any. zoohdr.commentofs: longint; offset of comment in file, 0 = none. zoohdr.comentlen: word; length of comment. zoohdr.filename: array[1..13] of char; name of file in ASCIIZ string (null terminated) zoohdr.var_dir_len: integer; length of variable part of dir entry. zoohdr.tz: byte; timezone where file was archived. zoohdr.dir_crc: word; CRC of directory entry. zoohdr.namlen: byte; fields for variable part of directory: length of long filename. zoohdr.dirlen: byte; fields for variable part of directory: length of directory name. zoohdr.lfname: array[0..255] of char; fields for variable part of directory: long filename. zoohdr.dirname: array[0..255] of char; fields for variable part of directory: long dirname. - 450 - zoohdr.system_id: word; fields for variable part of directory: Filesystem ID. zoohdr.fattr: longint; fields for variable part of directory: File attributes -- 24 bits. zoohdr.vflag: word; fields for variable part of directory: version flag bits -- one byte in archive. zoohdr.version_no: word; fields for variable part of directory: file version number if any. zooprocvar (unit MGVWZOO) ____________________________________________________________ Synopsis: mgvwzoo.zooprocvar = procedure (main: zoomainhdrptr; f: zoohdrptr); Description: This type is use to declare hook procedure. nextzoofile (unit MGVWZOO) ____________________________________________________________ Synopsis: Const mgvwzoo.nextzoofile: zooprocvar = nil; Description: This procedure is call each time a file is found in .ZOO file. If you don't set this constant, program will not return any information or may crash. zooview (unit MGVWZOO) ____________________________________________________________ Synopsis: function mgvwzoo.zooview(zoofile: string): boolean; Description: This function search for a specific file, open it, and send all files information via your hook procedure. Input: - 451 - zoofile: the name of .ZOO file you want to scan. Output: function result = true if everything is ok.