@DATABASE "OS_DevKit Extension" @INDEX "os_index.guide/main" @AUTHOR "Fromentin BRICE & Jens Vang Petersen" @node MAIN "OS_DevKit, dos support" @toc "os_Documentation.guide/main" ___________ ___________ / /\ / /\ OS-DevKit Extension / ___ / // _______/ / Additional power for AMOS Pro V2.00+ / /\_/ / // /\_____ \/ / / // / // /\ Written by: / / // / //______ / / Fromentin BRICE / /_// / /_\_____/ / / / / // / / /__________/ //__________/ / \__________\/ \__________\/ @{b}@{u}Dos Support@{uu}@{ub} @{" Path Controle " link "PATH"} @{" DOS Errors " link "ERRS"} @{" File access " link "FILE"} @{" Programes " link "PROG"} @{" Misc. " link "MISC"} @endnode @node PATH "OS_DevKit, dos-path support" @toc "MAIN" ___________ ___________ / /\ / /\ OS-DevKit Extension / ___ / // _______/ / Additional power for AMOS Pro V2.00+ / /\_/ / // /\_____ \/ / / // / // /\ Written by: / / // / //______ / / Fromentin BRICE / /_// / /_\_____/ / / / / // / / /__________/ //__________/ / \__________\/ \__________\/ @{b}@{u}Dos Support@{uu}@{ub} @{b}@{u}Path Controle@{uu}@{ub} A path is a tree of directories has to browse in order to arrive to a file. This section contains the instructions in order to handle the names of files, the names of paths without for all that verify their existences. @{u}Easy2use Commands (Using AMOS Strings):@{uu} @{" _file Part " link "_file Part"} @{" _path Part " link "_path Part"} @{" _path Add " link "_path Add"} @{u}Advanced Commands (Using DOS Strings):@{uu} @{" _dos File Part " Link "_dos file part"} @{" _dos Path Part " Link "_dos path part"} @{" _dos Add Part " Link "_dos add part" } @ENDNODE @NODE "_dos File Part" @toc "PATH" _dos File Part This function sends back the start pointer of the first character of file name in the transmitted string. For getting this last, you can '_str Get' directly. FTXT=_dos File Part(PTXT) PTXT -> Pointer of string. Example : A$="RAM:ENV/Sys/serial.prefs"+Chr$(0) ~~~~~~~~~ FTXT=_dos File Part(Varptr(A$)) Print _str Get(FTXT) Will display the text 'serial.prefs' in the screen. @ENDNODE @NODE "_dos Path Part" @toc "PATH" _dos Path Part This function sends back a pointer on the last character of path in the transmitted string. It will be necessary to make a few gym for get it. PTXT=_dos Path Part(PTXT0) PTXT -> Pointer of string. Example : A$="RAM:ENV/Sys/serial.prefs"+Chr$(0) ~~~~~~~~~ PTXT0=Varptr(A$) PTXT=_dos Path Part(PTXT0) Print Peek$(PTXT0,PTXT-PTXT0) Will display the text 'RAM:ENV/Sys' on the screen. @ENDNODE @NODE "_dos Add Part" @toc "PATH" _dos Add Part This function adds after a path transmitted, a name of file transmitted too. It sends back 0 in case of failure. OK=_dos Add Part(PTXT,FTXT,NB) PTXT -> Pointer of path string FTXT -> Pointer of file string NB -> Maximum lenght of buffer containing path string. @ENDNODE @node ERRS "OS_DevKit, dos-errors support" @toc "MAIN" ___________ ___________ / /\ / /\ OS-DevKit Extension / ___ / // _______/ / Additional power for AMOS Pro V2.00+ / /\_/ / // /\_____ \/ / / // / // /\ Written by: / / // / //______ / / Fromentin BRICE / /_// / /_\_____/ / / / / // / / /__________/ //__________/ / \__________\/ \__________\/ @{b}@{u}Dos Support@{uu}@{ub} @{b}@{u}DOS Errors@{uu}@{ub} The DOS mistakes are the mistakes to whiches you must have be the most often confronts. Who didn't see: 'Insert vulume XXXX' ? These functions are going to permit you know DOS errors. @{u}Commands:@{uu} @{" _dos Err " Link "_dos Err"} @{" _dos Set Err " Link "_dos set err"} @{" _dos Fault " Link "_dos Fault"} @ENDNODE @NODE "_dos Err" @toc "ERRS" _dos Err This function sends back the last DOS mistake. DOSERR=_dos Err @ENDNODE @NODE "_dos Set Err" @toc "ERRS" _dos Set Err This function sets the DOS mistake and sends back the older. OLDERR=_dos Set Err(NEWERR) NEWERR -> Number of new DOS mistake. @ENDNODE @NODE "_dos Fault" @toc "ERRS" _dos Fault This function translates a DOS mistake in an understandable string. The return doesn't mean anything of special currently. R=_dos Fault(DOSERR,PREVTXT,BUF,BUFLEN) DOSERR -> DOS Error. PREVTXT -> Pointer of message string that preceeds the error message. BUF -> Pointer of Buffer that will receive. BUFLEN -> Length of buffer. @ENDNODE @NODE "Pas Documenté" UnDocumented Features ~~~~~~~~~~~~~~~~~~~~~ OK=_dos Report(DOSERR,TYPE,ARG1,DEVICE) @ENDNODE @node FILE "OS_DevKit, dos-file support" @toc "MAIN" ___________ ___________ / /\ / /\ OS-DevKit Extension / ___ / // _______/ / Additional power for AMOS Pro V2.00+ / /\_/ / // /\_____ \/ / / // / // /\ Written by: / / // / //______ / / Fromentin BRICE / /_// / /_\_____/ / / / / // / / /__________/ //__________/ / \__________\/ \__________\/ @{b}@{u}Dos Support@{uu}@{ub} @{b}@{u}File Access@{uu}@{ub} These functions confer a biggest strength to the AMOSPro, but doesn't forgive the mistakes. However with these functions, you will be able to really control the files at every stages of their existences. @{u}Easy2use Commands:@{uu} @{" _dos Opin " link "_dos Opin"} @{" _dos Opout " link "_dos Opout"} @{" _dos Append " link "_dos Append"} @{" _dos Print " link "_dos Print"} @{" _dos Input " link "_dos input"} @{" _dos Eof " link "_dos Eof"} @{" _dos Lof " link "_dos lof"} @{" _dos What Dir$ " link "_dos What Dir$"} @{" _dos Rd Lock " link "_dos Rd Lock"} @{" _dos Wr Lock " link "_dos Wr Lock"} @{" _lock Name$ " link "_lock Name$"} @{" _dos Exist " link "_dos Exist"} @{" _dos Wr Lock " link "_dos Wr Lock"} @{" _fh Name$ " link "_fh Name$"} @{" _dos Set Dir$ " link "_dos Set Dir$"} @{u}Advanced Commands:@{uu} @{" _dos Open " Link "_dos Open"} @{" _dos Close " Link "_dos Close"} @{" _dos Read " Link "_dos Read"} @{" _dos Write " Link "_dos Write"} @{" _dos Seek " Link "_dos Seek"} @{" _dos Mode " Link "_dos Mode"} @{" _dos F Name " Link "_dos F Name"} @{" _dos F Getc " Link "_dos F Getc"} @{" _dos F Putc " Link "_dos F Putc"} @{" _dos F Gets " Link "_dos F Gets"} @{" _dos F Puts " Link "_dos F Puts"} @{" _dos F Ungetc " Link "_dos F Ungetc"} @{" _dos Lock " Link "_dos Lock"} @{" _dos Unlock " Link "_dos unlock"} @{" _dos L Open " Link "_dos L Open"} @{" _dos L Name " Link "_dos L Name"} @{" _dos Dir " Link "_dos Dir"} @{u}Notification Functions@{uu} These functions allow you to supervise some files or directories, if a program modifies them, you will be warned of it immediatly. @{" _dos Sig Notify " Link "_dos Sig Notify" } @{" _dos Msg Notify " Link "_dos Msg Notify" } @{" _dos End Notify " Link "_dos end notify"} @{" _nmsg What Nreq " Link "_nmsg What Nreq" } @{" _nr What User " Link "_nr What User" } @ENDNODE @NODE "_dos Open" @toc "FILE" _dos Open This function opens a file according to the selected mode. If you choose MODE_NEWFILE, the file will be create and if it existed, it will be to crush. This function sends back a handle for the file or 0 if failure. FH=_dos Open(NAME,FMODE) NAME -> Pointer of file name string. FMODE -> Open Mode. MODE_NEWFILE = 1006 MODE_OLDFILE = 1005 MODE_READWRITE = 1004 @ENDNODE @NODE "_dos Close" @toc "FILE" _dos Close This function closes a previously opened file. _dos Close FH FH -> File Handle. @ENDNODE @NODE "_dos Read" @toc "FILE" _dos Read This function reads some datas directly one file toward a buffer. It sends back the number of bytes read, or 0 if the end of file is reach, or -1 if an error occurs. BYTES=_dos Read(FH,BUF,BLEN) FH -> File Handle. BUF -> Pointer of target buffer. BLEN -> Length to read. @ENDNODE @NODE "_dos Write" @toc "FILE" _dos Write This function writes some datas directly from a buffer toward a file. It sends back the number of written bytes, if this result is different of number asks or a return of -1 : an error ocurred. BYTES=_dos Write(FH,BUF,BLEN) FH -> File Handle. BUF -> Pointer of source buffer. BLEN -> Length to write. @ENDNODE @NODE "_dos Seek" @toc "FILE" _dos Seek This function displaces the internal pointer of file in order to could read/write starting from an other place. It sends back the older position or -1 if an error occurs. OLDPOS=_dos Seek(FH,NEWPOS,OFFSET) FH -> File Handle. NEWPOS -> Position with regard to the offset. OFFSET -> Relative position in the file. OFFSET_BEGINNING = -1 OFFSET_CURRENT = 0 OFFSET_END = 1 @ENDNODE @NODE "_dos Mode" @toc "FILE" _dos Mode This function changes the access mode of a file. It sends back -1 in the case of success, otherwise 0. OK=_dos Mode(FILE,TYPE,NEWLOCK) FILE -> File or Lock Handle, chosen with TYPE. TYPE -> Sets if a Lock or File Handle is uses. CHANGE_LOCK = 0 CHANGE_FH = 1 NEWLOCK -> Sets the new mode of Lock. SHARED_LOCK = -2 EXCLUSIVE_LOCK = -1 @ENDNODE @NODE "_dos F Name" @toc "FILE" _dos F Name This function sends back the name of a file in a buffer. It sends back -1 in case of success, otherwise 0. OK=_dos F Name(FH,BUF,BLEN) FH -> File Handle. BUF -> Pointer of target buffer. BLEN -> Length of buffer. @ENDNODE @NODE "_dos F Getc" @toc "FILE" _dos F Getc This function loads a character (1 byte) since of file. It sends back -1 in case of mistake. Of more, it possesses caches. CHAR=_dos F Getc(FH) FH -> File Handle. @ENDNODE @NODE "_dos F Gets" @toc "FILE" _dos F Gets This function loads a string since of file in buffer. It sends back 0 in case of mistake. Of more, it possesses caches. The string is loaded until the buffer is replete or when a NULL character or LF is finds, in this case, the string loads will be finish by 0. OK=_dos F Gets(FH,BUF,BLEN) FH -> File Handle. BUF -> Pointer of target Buffer. BLEN -> Size of Buffer @ENDNODE @NODE "_dos F Putc" @toc "FILE" _dos F Putc This function writes a character (1 byte) since of file. It sends back -1 in case of mistake. Of more, it possesses caches. OK=_dos F Putc(FH,CHAR) FH -> File Handle. CHAR -> Ascii Value @ENDNODE @NODE "_dos F Puts" @toc "FILE" _dos F Puts This function writes a string in the file. It sends back -1 in case of mistake. Of more, It possesses caches. OK=_dos F Puts(FH,PTXT) FH -> File Handle. PTXT -> Pointer of string. @ENDNODE @NODE "_dos F Ungetc" @toc "FILE" _dos F Ungetc This function returns one character in rear in its caches. Don't take into account of Return under V37. Otherwise it sends back -1, in case of mistake. OK=_dos F Ungetc(FH,CHAR) FH -> File Handle. CHAR -> Character to read again, or -1 in order to return in rear. @ENDNODE @NODE "_dos Lock" @toc "FILE" _dos lock This function block a file or a directory for to forbid a possible change. It sends back the Handle of Lock or 0 in case of failure. LOCK=_dos Lock(NAME,ACCESS) NAME -> Pointer of name string (file or drawer) ACCESS -> Access mode of Lock. SHARED_LOCK = -2 EXCLUSIVE_LOCK = -1 @ENDNODE @NODE "_dos Unlock" @toc "FILE" _dos Unlock This function unlocks a file or a directory previously locked. _dos Unlock LOCK LOCK -> Lock Handle. @ENDNODE @NODE "_dos L Open" @toc "FILE" _dos L Open This function converted a Lock Handle in File Handle. It sends back a File Handle if it successful, otherwise it will send back 0. In case of success, you won't must '_dos Unlock' the converted Handle Lock for it will make with '_dos Close.' FH=_dos L Open(LOCK) LOCK -> Lock Handle. @ENDNODE @NODE "_dos L Name" @toc "FILE" _dos L Name This function sends back the name of one lock in a buffer. It sends back -1 in case of success, otherwise 0. OK=_dos L Name(LOCK,BUF,BLEN) LOCK -> Lock Handle. BUF -> Pointer of target Buffer. BLEN -> Size of buffer. @ENDNODE @NODE "_dos Dir" @toc "FILE" _dos Dir This function changes the current directory of the application and sends back the Lock of the older. WARNIG, the Lock of current directory liberates only, then manage your Lock during the changes correctly. OLDLOCK=_dos Dir(LOCK) LOCK -> Lock Handle. @ENDNODE @NODE "_dos Sig Notify" @toc "FILE" _dos Sig Notify This function starts a surveillance. It sends back a pointer on a @{NotifyRequest Link NotifyRequest} structure or 0 in case of failure. For you warn, It uses the signal directly that you transmit to him. NR=_dos Sig Notify(NAME,TASK,SIGNB,USRDATA) NAME -> Pointer of File or drawer name. TASK -> Pointer of Task that owns the signal. SIGNB -> Signal number to use. USRDATA -> User data. @ENDNODE @NODE "_dos Msg Notify" @toc "FILE" _dos Msg Notify This function starts a surveillance. It sends back a pointer on a @{NotifyRequest Link NotifyRequest} structure or 0 in case of failure. For you warn, it will send a message (@{NotifyMessage Link NotifyRequest}) to the messages port transmitted. NR=_dos Msg Notify(NAME,MSGPORT,USRDATA) NAME -> Pointer of file or drawer name. MSGPORT -> Pointer of MsgPort. USRDATA -> User data. @ENDNODE @NODE "_dos End Notify" @toc "FILE" _dos End Notify This function finishes a surveillance. It also liberates all the allocated ressources. _dos End Notify(NR) NR -> Pointer of NotifyRequest structure. @ENDNODE @NODE "_nr What User" @toc "FILE" _nr What User This function sends back the user data of the NotifyRequest structure. USRDATA=_nr What User(NR) NR -> Pointer of @{NotifyRequest Link NotifyRequest} structure. @ENDNODE @NODE "_nmsg What Nreq" @toc "FILE" _nmsg What Nreq This function sends back the pointer of the @{"NotifyRequest" Link NotifyRequest} structure transmitted by the @{"NotifyMessage Link" NotifyRequest} message. NR=_nmsg What Nreq(NMSG) NMSG -> Pointer of message @{NotifyMessage Link NotifyMessage}. @ENDNODE @NODE NotifyRequest "Structure NotifyRequest" @toc "FILE" Detail of the NotifyRequest structure. $0030 48 Taille de la structure $0000 0 4 nr_Name $0004 4 4 nr_FullName $0008 8 4 nr_UserData $000c 12 4 nr_Flags $0010 16 8 nr_stuff $0010 16 4 nr_stuff.nr_Msg $0010 16 4 nr_stuff.nr_Msg.nr_Port $0010 16 8 nr_stuff.nr_Signal $0010 16 4 nr_stuff.nr_Signal.nr_Task $0014 20 1 nr_stuff.nr_Signal.nr_SignalNum $0015 21 1 nr_stuff.nr_Signal.nr_pad[0] $0018 24 4 nr_Reserved[0] $0028 40 4 nr_MsgCount $002c 44 4 nr_Handler @ENDNODE @NODE NotifyMessage "Structure NotifyMessage" @toc "FILE" Detail of the NotifyMessage structure. $0026 38 sizeof(NotifyMessage) $0000 0 20 nm_ExecMessage $0014 20 4 nm_Class -> NOTIFY_CLASS = $40000000 $0018 24 2 nm_Code -> NOTIFY_CODE = $1234 $001a 26 4 nm_NReq $001e 30 4 nm_DoNotTouch $0022 34 4 nm_DoNotTouch2 Like you have surely notice, this message looks like a Intuition message. So, the following functions will help you: o _imsg What Class o _imsg What Code @ENDNODE @node PROG "OS_DevKit, dos-programes support" @toc "MAIN" ___________ ___________ / /\ / /\ OS-DevKit Extension / ___ / // _______/ / Additional power for AMOS Pro V2.00+ / /\_/ / // /\_____ \/ / / // / // /\ Written by: / / // / //______ / / Fromentin BRICE / /_// / /_\_____/ / / / / // / / /__________/ //__________/ / \__________\/ \__________\/ @{b}@{u}Dos Support@{uu}@{ub} @{b}@{u}Programs@{uu}@{ub} Here some functions whose allow you to load the programs in a more powerful way than AMOSPro (No ONE Segment limitation). And especially, you will be able to start some independent tasks starting from yours. @{u}Commands:@{uu} @{" _dos Seg Load " Link "_dos seg load"} @{" _dos Seg Unload " Link "_dos seg unload"} @{" _dos New Proc " Link "_dos new proc"} @ENDNODE @NODE "_dos Seg Load" @toc "PROG" _dos Seg Load This function loads a program and sends back its BCPL pointer, or 0 in case of failure. If you want directly make a 'Call,' you will must to multiply the pointer by 4 and add 4 to it. SEG=_dos Seg Load(NAME,TAGLIST) NAME -> Pointer of name string. TAGLIST -> Pointer of TAG List. Actually none. @ENDNODE @NODE "_dos Seg Unload" @toc "PROG" _dos Seg Unload This function liberates from the memory a program already loaded, verifies that this last is not in progress of execution. Don't take into account of return for currently. OK=_dos Seg Unload(SEG) SEG -> Pointer of Segment List (BCPL) @ENDNODE @NODE "_dos New Proc" @toc "PROG" _dos New Proc This function creates a task starting from a program loads. It sends back a pointer on a Process, otherwise 0 in case of failure. PRC=_dos New Proc(TAGLIST) TAGLIST -> Pointeur sur liste TAG. Note : it is counselor of having read the works regarding this ~~~~~~ type of action. You can refer to 'CreateNewProc' @ENDNODE @node MISC "OS_DevKit, dos-misc support" @toc "MAIN" ___________ ___________ / /\ / /\ OS-DevKit Extension / ___ / // _______/ / Additional power for AMOS Pro V2.00+ / /\_/ / // /\_____ \/ / / // / // /\ Written by: / / // / //______ / / Fromentin BRICE / /_// / /_\_____/ / / / / // / / /__________/ //__________/ / \__________\/ \__________\/ @{b}@{u}Dos Support@{uu}@{ub} @{b}@{u}Misc.@{uu}@{ub} @{u}Commands:@{uu} @{" _dos Var Value$ " link "_dos Var Value$"} @{" _dos Var Del " link "_dos Var Del"} @{" _dos Var Find " link "_dos Var Find"} @{" _prg Dir$ " link "_prg Dir$"} @{" _prg Name$ " link "_prg Name$"} @endnode @node "_dos Var Value$" V$=_@{b}_dos Var Value$@{ub} (NAME$,FLAGS)= V$ @endnode @node "_dos Var Del" SUCCES=@{b}_dos Var Del@{ub} (NAME$, FLAGS) @endnode @node "_dos Var Find" VAR=@{b}_dos Var Find@{ub} (NAME$,TYPE) @endnode @node "_dos Opin" @toc "FILE" FH=@{b}_dos Opin@{ub} (NOM$) @endnode @node "_dos Opout" @toc "FILE" FH=@{b}_dos Opout@{ub} (NOM$) @endnode @node "_fh Name$" @toc "FILE" A$=@{b}_fh Name$@{ub} (FH) @endnode @node "_dos Append" @toc "FILE" FH=@{b}_dos Append@{ub} (NOM$) @endnode @node "_dos Print" @toc "FILE" OK=@{b}_dos Print@{ub} (FH,A$) @endnode @node "_dos Input" @toc "FILE" A$=@{b}_dos Input@{ub} (FH) @endnode @node "_dos Eof" @toc "FILE" IS=@{b}_dos Eof@{ub} (FH) @endnode @node "_dos Lof" @toc "FILE" L=@{b}_dos Lof@{ub} (FH) @endnode @node "_file Part" @toc "PATH" F$=@{b}_file Part@{ub} (FULLPATHNAME$) @endnode @node "_path Part" @toc "PATH" P$=@{b}_path Part@{ub} (FULLPATHNAME$) @endnode @node "_dos What Dir$" @toc "FILE" D$=@{b}_dos What Dir$@{ub} @endnode @node "_dos Rd Lock" @toc "FILE" LK=@{b}_dos Rd Lock@{ub} (NOM$) @endnode @node "_dos Wr Lock" @toc "FILE" LK=@{b}_dos Wr Lock@{ub} (NOM$) @endnode @node "_lock Name$" @toc "FILE" A$=@{b}_lock Name$@{ub} (LK) @endnode @node "_dos Exist" @toc "FILE" IS=@{b}_dos Exist@{ub} (NAME$) @endnode @node "_dos Wr Lock" @toc "FILE" LOCK=_@{b}_dos Wr Lock@{ub} (NAME$) @endnode @node "_path Add" @toc "PATH" FULL$=_@{b}_path Add@{ub} (PATH$,FILE$) @endnode @node "_dos Set Dir$" @toc "FILE" @{b}_dos Set Dir$@{ub} NAME$ @endnode @node "_prg Dir$" @toc "PATH" N$=@{b}_prg Dir$@{ub} @endnode @node "_prg Name$" @toc "PATH" N$=@{b}_prg Name$@{ub} @endnode