Upload
walternampimadom
View
13
Download
5
Embed Size (px)
DESCRIPTION
DOS
Citation preview
DOSINT21hDOSFunctionCodesThefollowabridgedlistofDOSinterruptshasbeenextractedfromalargelistcompiledbyRalfBrown.TheseareavailableonanySimtelmirror(e.g.sunsite.anu.edu.au)underthedirectorymsdos/info/interNNp.zip
AH Description AH Description01 ReadcharacterfromSTDIN 02 WritecharactertoSTDOUT05 Writecharactertoprinter 06 ConsoleInput/Output07 Directcharread(STDIN),noecho 08 CharreadfromSTDIN,noecho09 WritestringtoSTDOUT 0A Bufferedinput0B GetSTDINstatus 0C FlushbufferforSTDIN0D Diskreset 0E Selectdefaultdrive19 Getcurrentdefaultdrive 25 Setinterruptvector2A Getsystemdate 2B Setsystemdate2C Getsystemtime 2D Setsystemtime2E Setverifyflag 30 GetDOSversion35 GetInterruptvector36 Getfreediskspace 39 Createsubdirectory3A Removesubdirectory 3B Setworkingdirectory3C Createfile 3D Openfile3E Closefile 3F Readfile40 Writefile 41 Deletefile42 Seekfile 43 Get/Setfileattributes47 Getcurrentdirectory 4C Exitprogram4D Getreturncode 54 Getverifyflag56 Renamefile 57 Get/Setfiledate
AH=01hREADCHARACTERFROMSTANDARDINPUT,WITHECHO
Return:AL=characterread
Notes:
^C/^Breakarechecked^PtogglestheDOSinternalechotoprinterflag^Zisnotinterpreted,thusnotcausinganEOFifinputisredirectedcharacterisechoedtostandardoutput
SeeAlso:AH=06h,AH=07h,AH=08h,AH=0Ah
AH=02hWRITECHARACTERTOSTANDARDOUTPUT
Entry:DL=charactertowrite
Return:AL=lastcharacteroutput
Notes:
^C/^BreakarecheckedthelastcharacteroutputwillbethecharacterinDLunlessDL=09honentry,inwhichcaseAL=20hastabsareexpandedtoblanksifstandardoutputisredirectedtoafile,noerrorchecks(writeprotected,fullmedia,etc.)areperformed
SeeAlso:AH=06h,AH=09h
AH=05hWRITECHARACTERTOPRINTER
Entry:DL=charactertoprint
Notes:
keyboardcheckedfor^C/^BreakSTDPRNisusuallythefirstparallelport,butmayberedirectedunderDOS2+iftheprinterisbusy,thisfunctionwillwait
SeeAlso:INT17/AH=00h
AH=06hDIRECTCONSOLEOUTPUT
Entry:DL=character(exceptFFh)
Return:AL=characteroutput
Notes:doesnotcheck^C/^Break
SeeAlso:AH=02h,AH=09h
AH=06hDIRECTCONSOLEINPUT
Entry:AH=06hDL=FFh
Return:
ZFsetifnocharacteravailableandAL=00hZFclearifcharacteravailableAL=characterread
Notes:
^C/^BreakareNOTcheckedifthereturnedcharacteris00h,theuserpressedakeywithanextendedkeycode,whichwillbereturnedbythenextcallofthisfunctionalthoughthereturnofAL=00hwhennocharactersareavailableisnotdocumented,someprogramsrelyonthisbehavior
SeeAlso:AH=0Bh
AH=07hDIRECTCHARACTERINPUT,WITHOUTECHO
Return:AL=characterreadfromstandardinput
Notes:doesnotcheck^C/^Break
SeeAlso:AH=01h,AH=06h,AH=08h,AH=0Ah
AH=08hCHARACTERINPUTWITHOUTECHO
Return:AL=characterreadfromstandardinput
Notes:^C/^Breakarechecked
SeeAlso:AH=01h,AH=06h,AH=07h,AH=0Ah,AH=64h
AH=09hWRITESTRINGTOSTANDARDOUTPUT
Entry:DS:DX>'$'terminatedstring
Return:AL=24h
Notes:^C/^Breakarechecked
SeeAlso:AH=02h,AH=06h"OUTPUT"
AH=0AhBUFFEREDINPUT
Entry:DS:DX>buffer(seebelow)
Return:bufferfilledwithuserinput
Notes:
^C/^Breakarecheckedreadsfromstandardinput
SeeAlso:AH=0Ch
FormatofDOSinputbuffer:
Offset Size Description00 1 maximumcharactersbuffercanhold
01 1 numberofcharsfromlastinputwhichmayberecalledORnumberofcharactersactuallyread,excludingCR02 n actualcharactersread,includingthefinalcarriagereturn
AH=0BhGETSTDINSTATUS
Return:
AL=00hifnocharacteravailableAL=FFhifcharacterisavailable
Notes:^C/^Breakarechecked
SeeAlso:AH=06h"INPUT"
AH=0ChFLUSHBUFFERANDREADSTANDARDINPUT
Entry:
AL=STDINinputfunctiontoexecuteafterflushingbufferotherregistersasappropriatefortheinputfunction
Return:asappropriateforthespecifiedinputfunction
Note:ifALisnotoneof01h,06h,07h,08h,or0Ah,thebufferisflushedbutnoinputisattempted
SeeAlso:AH=01h,AH=06h"INPUT",AH=07h,AH=08h,AH=0Ah
AH=0DhDISKRESET
Notes:Thisfunctionwritesallmodifieddiskbufferstodisk,butdoesnotupdatethedirectoryinformation
SeeAlso:AX=5D01h
AH=0EhSELECTDEFAULTDRIVE
Entry:DL=newdefaultdrive(0=A:,1=B:,etc)
Return:AL=numberofpotentiallyvaliddriveletters
Notes:thereturnvalueisthehighestdrivepresent
SeeAlso:AH=19h,AH=3Bh,AH=DBh
AH=19hGETCURRENTDEFAULTDRIVE
Return:AL=drive(0=A:,1=B:,etc)
SeeAlso:AH=0Eh,AH=47h,AH=BBh
AH=25hSETINTERRUPTVECTOR
Entry:
AL=interruptnumberDS:DX>newinterrupthandler
Notes:thisfunctionispreferredoverdirectmodificationoftheinterruptvectortable
SeeAlso:AX=2501h,AH=35h
AH=2AhGETSYSTEMDATE
Return:CX=year(19802099)DH=monthDL=dayAL=dayofweek(00h=Sunday)
SeeAlso:AH=2Bh"DOS",AH=2Ch,AH=E7h
AH=2BhSETSYSTEMDATE
Entry:CX=year(19802099)DH=monthDL=day
Return:
AL=00successfulFFhinvaliddate,systemdateunchanged
Note:DOS3.3+alsosetsCMOSclock
SeeAlso:AH=2Ah,AH=2Dh
AH=2ChGETSYSTEMTIME
Return:CH=hourCL=minuteDH=secondDL=1/100seconds
Note:onmostsystems,theresolutionofthesystemclockisabout5/100sec,soreturnedtimesgenerallydonotincrementby1onsomesystems,DLmayalwaysreturn00h
SeeAlso:AH=2Ah,AH=2Dh,AH=E7h
AH=2DhSETSYSTEMTIME
Entry:CH=hourCL=minuteDH=secondDL=1/100seconds
Return:
AL=00hsuccessfulFFhifinvalidtime,systemtimeunchanged
Note:DOS3.3+alsosetsCMOSclock
SeeAlso:AH=2Bh"DOS",AH=2Ch
AH=2EhSETVERIFYFLAG
Entry:AL=newstateofverifyflag(00off,01ho)
Notes:
defaultstateatsystembootisOFFwhenON,alldiskwritesareverifiedprovidedthedevicedriversupportsreadafterwriteverification
SeeAlso:AH=54h
AH=30hGETDOSVERSION
Entry:AL=whattoreturninBH(00hOEMnumber,01hversionflag)
Return:
AL=majorversionnumber(00hifDOS1.x)AH=minorversionnumberBL:CX=24bituserserialnumber(mostversionsdonotusethis)ifDOScurrentinterrupthandler
SeeAlso:AH=25h,AX=2503h
AH=36hGETFREEDISKSPACE
Entry:DL=drivenumber(0=default,1=A:,etc)
Return:
AX=FFFFhifinvaliddriveAX=sectorsperclusterBX=numberoffreeclustersCX=bytespersectorDX=totalclustersondrive
Notes:
freespaceondriveinbytesisAX*BX*CXtotalspaceondriveinbytesisAX*CX*DX"lostclusters"areconsideredtobeinusethisfunctiondoesnotreturnproperresultsonCDROMsuseAX=4402h"CDROM"instead
SeeAlso:AH=1Bh,AH=1Ch,AX=4402h"CDROM"
AH=39h"MKDIR"CREATESUBDIRECTORY
Entry:DS:DX>ASCIZpathname
Return:
CFclearifsuccessfulAXdestroyedCFsetonerrorAX=errorcode(03h,05h)
Notes:
alldirectoriesinthegivenpathexceptthelastmustexist
failsiftheparentdirectoryistherootandisfullDOS2.x3.3allowthecreationofadirectorysufficientlydeepthatitisnotpossibletomakethatdirectorythecurrentdirectorybecausethepathwouldexceed64characters
SeeAlso:AH=3Ah,AH=3Bh,AH=6Dh
AH=3Ah"RMDIR"REMOVESUBDIRECTORY
Entry:DS:DX>ASCIZpathnameofdirectorytoberemoved
Return:
CFclearifsuccessful,AXdestroyedCFsetonerrorAX=errorcode(03h,05h,06h,10h)
Notes:directorymustbeempty(containonly'.'and'..'entries)
SeeAlso:AH=39h,AH=3Bh
AH=3Bh"CHDIR"SETCURRENTDIRECTORY
Entry:DS:DX>ASCIZpathnametobecomecurrentdirectory(max64bytes)
Return:
CFclearifsuccessful,AXdestroyedCFsetonerrorAX=errorcode(03h)
Notes:ifnewdirectorynameincludesadriveletter,thedefaultdriveisnotchanged,onlythecurrentdirectoryonthatdrive
SeeAlso:AH=47h,AH=71h,INT2F/AX=1105h
AH=3Ch"CREAT"CREATEORTRUNCATEFILE
Entry:
CX=fileattributesDS:DX>ASCIZfilename
Return:
CFclearifsuccessful,AX=filehandleCFsetonerrorAX=errorcode(03h,04h,05h)
Notes:ifafilewiththegivennameexists,itistruncatedtozerolength
SeeAlso:AH=16h,AH=3Dh,AH=5Ah,AH=5Bh
AH=3Dh"OPEN"OPENEXISTINGFILE
Entry:
AL=accessandsharingmodes
DS:DX>ASCIZfilename
Return:
CFclearifsuccessful,AX=filehandleCFsetonerrorAX=errorcode(01h,02h,03h,04h,05h,0Ch,56h)
Notes:
filepointerissettostartoffilefilehandleswhichareinheritedfromaparentalsoinheritsharingandaccessrestrictionsfilesmaybeopenedevenifgiventhehiddenorsystemattributes
SeeAlso:AH=0Fh,AH=3Ch,AX=4301h,AX=5D00h
AH=3Eh"CLOSE"CLOSEFILE
Entry:BX=filehandle
Return:
CFclearifsuccessful,AXdestroyedCFsetonerror,AX=errorcode(06h)
Note:ifthefilewaswrittento,anypendingdiskwritesareperformed,thetimeanddatestampsaresettothecurrenttime,andthedirectoryentryisupdated
SeeAlso:AH=10h,AH=3Ch,AH=3Dh
AH=3Fh"READ"READFROMFILEORDEVICE
Entry:
BX=filehandleCX=numberofbytestoreadDS:DX>bufferfordata
Return:
CFclearifsuccessfulAX=numberofbytesactuallyread(0ifatEOFbeforecall)CFsetonerrorAX=errorcode(05h,06h)
Notes:
dataisreadbeginningatcurrentfileposition,andthefilepositionisupdatedafterasuccessfulreadthereturnedAXmaybesmallerthantherequestinCXifapartialreadoccurredifreadingfromCON,readstopsatfirstCR
SeeAlso:AH=27h,AH=40h,AH=93h
AH=40h"WRITE"WRITETOFILEORDEVICE
Entry:
BX=filehandleCX=numberofbytestowriteDS:DX>datatowrite
Return:
CFclearifsuccessfulAX=numberofbytesactuallywrittenCFsetonerrorAX=errorcode(05h,06h)
Notes:
ifCXiszero,nodataiswritten,andthefileistruncatedorextendedtothecurrentpositiondataiswrittenbeginningatthecurrentfileposition,andthefilepositionisupdatedafterasuccessfulwritetheusualcauseforAXASCIZfilename(nowildcards,butseenotes)CL=attributemaskfordeletion(servercallonly,seenotes)
Return:
CFclearifsuccessful,AXdestroyed(DOS3.3)ALseemstobedriveofdeletedfileCFsetonerrorAX=errorcode(02h,03h,05h)
Notes:
(DOS3.1+)wildcardsareallowedifinvokedviaAX=5D00h,inwhichcasethefilespecmustbecanonical(asreturnedbyAH=60h),andonlyfilesmatchingtheattributemaskinCLaredeletedDOSdoesnoterasethefile'sdataitmerelybecomesinaccessiblebecausetheFATchainforthefileiscleareddeletingafilewhichiscurrentlyopenmayleadtofilesystemcorruption.
SeeAlso:AH=13h,AX=4301h,AX=4380h,AX=5D00h,AH=60h,AH=71h
AH=42h"LSEEK"SETCURRENTFILEPOSITION
Entry:
AL=originofmove00hstartoffile01hcurrentfileposition02hendoffileBX=filehandleCX:DX=offsetfromoriginofnewfileposition
Return:
CFclearifsuccessful,DX:AX=newfilepositioninbytesfromstartoffileCFsetonerror,AX=errorcode(01h,06h)
Notes:
fororigins01hand02h,thepointermaybepositionedbeforethestartofthefilenoerrorisreturnedinthatcase,butsubsequentattemptsatI/Owillproduceerrorsifthenewpositionisbeyondthecurrentendoffile,thefilewillbeextendedbythenextwrite(seeAH=40h)
SeeAlso:AH=24h
AH=43GETFILEATTRIBUTES
Entry:
AL=00hDS:DX>ASCIZfilename
Return:
CFclearifsuccessfulCX=fileattributesCFsetonerror,AX=errorcode(01h,02h,03h,05h)
BUG:WindowsforWorkgroupsreturnserrorcode05h(accessdenied)insteadoferrorcode02h(filenotfound)whenattemptingtogettheattributesofanonexistentfile.
SeeAlso:AX=4301h,AX=4310h,AX=7143h,AH=B6h
AH=43"CHMOD"SETFILEATTRIBUTES
Entry:
AL=01hCX=newfileattributesDS:DX>ASCIZfilename
Return:
CFclearifsuccessful,AXdestroyedCFsetonerror,AX=errorcode(01h,02h,03h,05h)
Notes:
willnotchangevolumelabelordirectoryattributebits,butwillchangetheotherattributebitsofadirectoryMSDOS4.01reportedlyclosesthefileifitiscurrentlyopen
SeeAlso:AX=4300h,AX=4311h,AX=7143h,INT2F/AX=110Eh
Bitfieldsforfileattributes:
Bits 7 6 5 4 3 2 1 0Description shareable archive directory vol.label system hidden readonly
AH=47h"CWD"GETCURRENTDIRECTORY
Entry:
DL=drivenumber(00h=default,01h=A:,etc)DS:SI>64bytebufferforASCIZpathname
Return:
CFclearifsuccessfulCFsetonerror,AX=errorcode(0Fh)
Notes:
thereturnedpathdoesnotincludeadriveortheinitialbackslashmanyMicrosoftproductsforWindowsrelyonAXbeing0100honsuccess
SeeAlso:AH=19h,AH=3Bh,AH=71h
AH=4Ch"EXIT"TERMINATEWITHRETURNCODE
Entry:AL=returncode
Return:neverreturns
Notes:unlesstheprocessisitsownparent,allopenfilesareclosedandallmemorybelongingtotheprocessisfreed
SeeAlso:AH=00h,AH=26h,AH=4Bh,AH=4Dh
AH=4DhGETRETURNCODE(ERRORLEVEL)
Return:
AH=terminationtype(00=normal,01hcontrolCabort,02h=criticalerrorabort,03hterminateandstayresident)AL=returncode
Notes:
thewordinwhichDOSstoresthereturncodeisclearedafterbeingreadbythisfunction,sothereturncodecanonlyberetrievedonceCOMMAND.COMstoresthereturncodeofthelastexternalcommanditexecutedasERRORLEVEL
SeeAlso:AH=4Bh,AH=4Ch,AH=8Ah
AH=54hGETVERIFYFLAG
Return:AL=verifyflag(00h=off,01h=on,i.e.alldiskwritesverifiedafterwriting)
SeeAlso:AH=2Eh
AH=56h"RENAME"RENAMEFILE
Entry:
DS:DX>ASCIZfilenameofexistingfile(nowildcards,butseebelow)
ES:DI>ASCIZnewfilename(nowildcards)CL=attributemask(servercallonly,seebelow)
Return:
CFclearifsuccessfulCFsetonerror,AX=errorcode(02h,03h,05h,11h)
Notes:
allowsmovebetweendirectoriesonsamelogicalvolumethisfunctiondoesnotsetthearchiveattributeopenfilesshouldnotberenamed(DOS3.0+)allowsrenamingofdirectories
AH=57hGETFILE'SLASTWRITTENDATEANDTIME
Entry:
AL=00h(Getattribute)BX=filehandle
Return:
CFclearifsuccessful,CX=file'stimeDX=file'sdateCFsetonerror,AX=errorcode(01h,06h)
SeeAlso:AX=5701h
Bitfieldsforfiletime:
Bits 1511 105 40Description hours minutes seconds
Bitfieldsforfiledate:
Bits 159 85 40Description year(1980) month day
AH=57hSETFILE'SLASTWRITTENDATEANDTIME
Entry:
AL=01h(Setattributes)BX=filehandleCX=newtimeDX=newdate
Return:
CFclearifsuccessfulCFsetonerrorAX=errorcode(01h,06h)
SeeAlso:AX=5700h
ThispageismaintainedbyBarryWilks.