A2osX/_Docs/KERNEL.md

607 lines
8.6 KiB
Markdown
Raw Normal View History

2016-10-22 20:52:00 +00:00
*** Auto generated by docgen.cmd ***
2016-10-22 20:59:49 +00:00
2016-10-23 16:27:20 +00:00
#GetArgC
2016-10-26 20:46:16 +00:00
Returns argument count in the process command line.
2016-10-23 16:27:20 +00:00
##In:
+ none.
##Out:
+ A = Command line Arg Count (Including /path/cmd)
#GetArgA
##In:
2016-10-26 20:46:16 +00:00
+ A = argument index.
2016-10-23 16:27:20 +00:00
##Out:
+ CC : success
+ Y,A = PStr To Arg[A]
+ CS : Out Of Bound
2017-01-12 17:43:45 +00:00
#FPutCAY
Print A (char) to File
##In:
+ A : char to print
+ Y = hFILE
##Out:
+ CC = success
#PutCA
Print A (char) to StdOut
##In:
+ A : char to print
##Out:
+ CC = success
#FGetCA
Get char from File
##In:
+ A = hFILE
##Out:
+ CC = success
+ A = char
#GetC
Get char from StdIn
##In:
+ none.
##Out:
+ CC = success
+ A = char
2017-01-12 17:49:55 +00:00
#FPutS
2017-01-12 17:43:45 +00:00
Print String to FILE
##In:
+ PUSHW : CPtr
+ PUSHB : hFILE
##Out:
+ CC = success
2017-01-12 17:49:55 +00:00
#PutSYA
2017-01-12 17:43:45 +00:00
Print String to StdOut
##In:
+ Y,A : CPtr
##Out:
+ CC = success
2016-10-24 20:57:59 +00:00
#SScanF
Scan a PStr (in progress)
##In:
+ PUSHW PTR to target buffer
2016-10-28 21:17:39 +00:00
+ PUSHW PSTR pattern (ex: "%d.%d.%d.%d")
2016-10-24 20:57:59 +00:00
+ %d : byte
2016-10-28 21:17:39 +00:00
+ PUSHW PSTR to scan (ex: "192.168.1.5")
2016-10-24 20:57:59 +00:00
##Out:
2016-11-03 16:21:36 +00:00
#PPrintFYA/CPrintFYA
2016-11-04 18:15:59 +00:00
Prints Pascal/C-Style String
2016-10-23 20:50:23 +00:00
##In:
2016-11-03 16:21:36 +00:00
+ Y,A = PTR to PStr/CStr
2016-10-23 20:50:23 +00:00
+ %a : pull 2 bytes to Print Access right String 'drwxrwxrwx'
+ %b : pull 1 byte to Print BIN
+ %B : pull 2 bytes to Print BIN
+ %d : pull 1 byte unsigned DEC 0..255
+ %D : pull 2 bytes unsigned DEC 0..65535
+ %u : pull 2 bytes PTR to 4 bytes long unsigned DEC 0..4294967295
+ %e : pull 2 bytes PTR to 6 Bytes Real +1.23456789e+12
+ %f : pull 2 bytes PTR to 6 Bytes Real 3.1415
+ %h : pull 1 byte to Print HEX
+ %H : pull 2 bytes to Print HEX
+ %i : pull 1 byte to Print signed DEC -128..127
+ %I : pull 2 bytes to Print signed DEC -32768..32767
+ %L : pull 2 bytes PTR to 4 bytes signed DEC -2147483648..2147483647
+ %n : pull 1 byte to Print low Nibble HEX
+ %N : pull 1 byte to Print high Nibble HEX
+ %s : pull 2 bytes ptr to C-Style String
+ %S : pull 2 bytes ptr to P-Style String
2016-11-04 18:15:59 +00:00
+ \b : Print 'BS' (08)
2016-10-28 09:48:03 +00:00
+ \e : Print 'ESC' ($1B,27)
2016-11-04 18:15:59 +00:00
+ \f : Print 'FF' ($0C,12)
+ \n : Print 'LF' ($0A,10)
+ \r : Print 'CR' ($0D,13)
2016-11-04 18:15:59 +00:00
+ \\\\ : Print \
2016-10-28 09:48:03 +00:00
+ \% : Print %
2016-10-23 20:50:23 +00:00
+ Modifiers for len and padding :
2016-10-28 09:48:03 +00:00
+ %d : '9' '12'
+ %2d : ' 9' '12'
+ %02d : '09' '12'
+ %11s : 'ABCDEFGH '
+ %011s : 'ABCDEFGH000'
+ %2f : '3.14'
2016-10-23 20:50:23 +00:00
2016-10-24 20:57:59 +00:00
##Out:
2016-10-28 09:48:03 +00:00
+ CC : success
+ CS : I/O error from COut
2016-10-24 20:57:59 +00:00
2016-10-26 20:46:16 +00:00
#GetDevByIDA
##IN:
+ A = DevID
##OUT:
+ CC = OK, CS = ERROR
+ Y,A = DEVSLOT
2016-10-26 20:46:16 +00:00
+ note: X Unmodified
2017-01-12 17:43:45 +00:00
#GetDevByNameYA
2016-10-26 20:46:16 +00:00
##IN:
+ Y,A = Ptr to device name (PStr)
##OUT:
+ CC = OK, CS = ERROR
+ X = DEVID
+ Y,A = DEVSLOT
2016-10-26 20:46:16 +00:00
2017-01-12 17:43:45 +00:00
#GetDevStatusA
2016-10-26 20:46:16 +00:00
##IN:
+ A = DevID
##OUT:
+ CC = OK, CS = ERROR
+ Y,A = Ptr to S.DEVINFO
#MkNodYA
return a hFile for a given Device Name
##IN:
+ Y,A=DevName
##OUT:
+ CC = OK, CS = ERROR
+ A = hFILE
2017-01-12 17:49:55 +00:00
#MkNodA
return a hFile for a given Socket
2017-01-12 17:49:55 +00:00
##IN:
+ A=hSocket
##OUT:
+ CC = OK, CS = ERROR
+ A = hFILE
#MKFIFO
return a S.FILE to a new FIFO
##IN:
##OUT:
+ CC = OK, CS = ERROR
+ A = hFILE
#OpenDirYA
##In:
+ Y,A = PATH (PSTR)
2016-10-26 20:46:16 +00:00
##Out:
+ CC : success
2016-10-26 20:46:16 +00:00
+ A = hDIR
+ CS : error
+ A = EC
#ReadDirA
##In:
+ A = hDIR
2016-10-26 20:46:16 +00:00
##Out:
+ CC : success
+ X = hDIRENT
+ Y,A = PTR to S.DIRENT
+ CS : error
+ A = EC
+ note : A = 0 means no more entry
#CloseDirA
##In:
+ A = hDIR
##Out:
+ none, always succeed.
2016-10-26 20:46:16 +00:00
#MKDirYA
##In:
+ Y,A = DIR name
##Out:
+ CC : success
+ CS : error
+ A = EC
2016-10-28 21:17:39 +00:00
#ExpandPStrYA
##In:
+ Y,A = PTR to String to Expand (PSTR)
##Out:
+ X = hMem to Expanded String (PSTR)
+ Y,A = PTR to Expanded String
#PutEnvYA
##In:
+ Y,A = PTR to String NAME=VALUE (PSTR)
##Out:
#SetEnv
##In:
+ PUSHW = PTR To Value (PSTR)
+ PUSHW = PTR To Name (PSTR)
##Out:
#GetEnvYA
##In:
+ Y,A = PTR to NAME (PSTR)
##Out:
+ CC : Y,A = PTR to VALUE (PSTR)
+ CS : not found
#UnsetEnvYA
##In:
+ Y,A = PTR To Name (PSTR)
##Out:
2016-10-22 20:47:32 +00:00
#FOpen
2016-10-22 20:48:45 +00:00
Open a file
2016-10-22 20:58:29 +00:00
2016-10-22 20:47:32 +00:00
##In :
2016-10-22 20:48:45 +00:00
+ PUSHW = AUXTYPE
+ PUSHB = TYPE
+ PUSHB = MODE
2017-01-12 17:43:45 +00:00
+ SYS.FOpen.R : if R and exists -> ERROR
+ SYS.FOpen.W : if W and exists -> CREATE
+ SYS.FOpen.A : Append
+ SYS.FOpen.T : Open/Append in Text mode
+ SYS.FOpen.X : Create if not exists
2016-10-22 20:46:04 +00:00
+ PUSHW = PATH (PSTR)
2016-10-22 20:53:35 +00:00
2016-10-22 20:52:00 +00:00
##Out :
2016-10-22 20:48:45 +00:00
+ CC : A = hFILE
2016-10-22 20:45:19 +00:00
+ CS : A = EC
2016-10-22 20:59:49 +00:00
2016-10-22 20:48:45 +00:00
#FCloseA
Close a file
2016-10-22 20:58:29 +00:00
2016-10-22 20:48:45 +00:00
##In :
+ A = hFILE
2016-10-22 20:58:29 +00:00
2016-10-22 20:48:45 +00:00
##Out :
2016-10-22 20:59:49 +00:00
#FReadA
Read ONE byte from file
##In :
+ A = hFILE
##Out :
+ A = Byte Read
#FWriteAY
##In:
+ A = hFILE
+ Y = char
#Out:
+ Y,A = Bytes Written
2016-10-22 20:52:00 +00:00
#FRead
Read bytes from file
2016-10-22 20:58:29 +00:00
2016-10-22 20:52:00 +00:00
##In :
2016-10-28 21:17:39 +00:00
+ PUSHW = Dest Ptr
+ PUSHW = Bytes To Read
+ PUSHB = hFILE
2016-10-22 20:58:29 +00:00
2016-10-22 20:52:00 +00:00
##Out :
+ Y,A = Bytes Read
2016-10-22 20:59:49 +00:00
2016-10-22 20:52:00 +00:00
#FWrite
2016-10-22 20:58:29 +00:00
2016-10-23 16:27:20 +00:00
##In:
2016-10-28 21:17:39 +00:00
+ PUSHW = Src Ptr
+ PUSHW = Bytes To Write
+ PUSHB = hFILE
2016-10-22 20:59:49 +00:00
2016-10-23 16:27:20 +00:00
#Out:
2016-10-22 20:52:00 +00:00
+ Y,A = Bytes Written
2016-10-22 20:59:49 +00:00
2016-10-26 20:46:16 +00:00
#FFlushA
2016-10-23 16:27:20 +00:00
##In:
+ A = hFILE
2016-10-26 20:46:16 +00:00
#FSeek
2016-10-23 16:27:20 +00:00
##In:
+ PUSHW = OffsetHi
+ PUSHW = OffsetLo
+ PUSHB = From
+ PUSHB = hFILE
2016-10-26 20:46:16 +00:00
#FTellA
2016-10-23 16:27:20 +00:00
##In:
+ A = hFILE
##Out:
+ Y,A,X = Offset
#FEOFA
##In:
+ A = hFILE
##Out:
+ CC :
+ A=0 EOF
+ A =0 NOT EOF
+ CS :
2016-10-26 20:46:16 +00:00
#RemoveYA
2016-10-23 16:27:20 +00:00
2016-10-26 20:46:16 +00:00
#Rename
2016-10-23 16:27:20 +00:00
Rename a file
##In :
+ PUSHW = New Name
+ PUSHW = Old Name
##Out :
2016-10-26 20:46:16 +00:00
#Stat
2016-10-23 16:27:20 +00:00
Return information about a file
##In :
+ PUSHW = PTR to S.STAT buffer
+ PUSHW = PTR to Filename (PSTR)
##Out :
2016-10-26 20:46:16 +00:00
#FileSearch
2016-10-31 21:44:03 +00:00
Search a file in the provided PATH list
And return, if found, the full path to it.
2016-10-26 20:46:16 +00:00
##In:
2016-10-28 21:17:39 +00:00
+ PUSHW = Ptr to Search Path (PSTR) %LIB%;/SYS/SLIB
+ PUSHW = Ptr to File Name (PSTR)
2016-10-26 20:46:16 +00:00
2016-10-31 21:44:03 +00:00
##Out:
+ CC : success
+ Y,A = PSTR to FilePath (PSTR)
+ X = hMem to FilePath
2016-11-01 14:37:28 +00:00
+ CS : not found
2016-10-26 20:46:16 +00:00
#GetFullPathYA
##In :
2016-10-28 21:17:39 +00:00
+ Y,A = Filename (PSTR)
2016-10-26 20:46:16 +00:00
2016-11-01 14:37:28 +00:00
##Out :
+ CC : success
+ Y,A = FullPath (PSTR)
+ X = hMem of FullPath
+ CS : A = Error Code
2016-10-26 20:46:16 +00:00
#LoadFile
##In:
+ PUSHW = AUXTYPE (Handled by....
+ PUSHB = TYPE ...
+ PUSHB = MODE ...
2017-01-12 17:43:45 +00:00
+ PUSHW = PATH ...FOpen)
2016-10-26 20:46:16 +00:00
##Out:
+ Y,A = File Length
+ X = hMem of Loaded File
#SaveFile
##In:
+ PUSHW = SrcLen
+ PUSHW = SrcPtr
+ PUSHW = AUXTYPE (Handled by....
+ PUSHB = TYPE ...
+ PUSHB = MODE ...
2017-01-12 17:43:45 +00:00
+ PUSHW = PATH ...FOpen)
2016-10-26 20:46:16 +00:00
2016-10-24 20:57:59 +00:00
#GetMem
##In:
+ PUSHW = Size Requested
+ PUSHB = Options
+ S.MEM.F.INIT0 : init memory with 00
+ S.MEM.F.ALIGN : page aligned
##Out:
+ CC : success
+ YA = PTR to Mem
* X = hMem
+ CS :
+ A = EC
#FreeMemA
##In:
+ A = hMem To Free
##Out:
+ none.
+ (X,Y unmodified)
#GetMemPtrA
##In:
+ A = hMem
##Out:
+ Y,A = PTR to MemBlock
+ (X unmodified)
#GetMemByIDA
##In:
+ A = hMem
##Out:
+ Y,A = ZPMemMgrSPtr = PTR to S.MEM
+ X unmodified
2016-11-01 21:37:38 +00:00
#GetMemStatYA
##In:
+ Y,A = 24 bytes buffer
##Out:
+ Buffer filled with memory stats
#ExecProcessNewEnvYA
#ExecProcessYA (Blocking Parent PID)
#CreateProcessNewEnvYA
#CreateProcessYA (Non Blocking)
##In:
+ Y,A = PTR To Cmd Line
##Out:
+ A = Child PSID
#GetPSByIDA
##In :
+ A = PID
##Out :
+ Y,A = PTR to TSKSLOT
#Sleep
Make current process suspend until next RUN
##In :
+ (none)
##Out :
+ (none)
2016-10-22 20:52:00 +00:00
#NewPStrYA
Create a new copy of PSTR
2016-10-22 20:58:29 +00:00
2016-10-22 20:52:00 +00:00
##In:
+ Y,A = PTR to buffer
2016-10-22 20:58:29 +00:00
2016-10-22 20:52:00 +00:00
##Out:
+ CC : success
+ Y,A = PTR to String
2016-10-28 21:17:39 +00:00
+ X = hMem (PSTR)
2016-10-22 20:52:00 +00:00
+ CS : error
+ A = SYS error code
2016-10-22 20:59:49 +00:00
2016-10-29 09:18:48 +00:00
#PStrCpy
Copy string
##In:
+ PUSHW = Ptr to SRC (PSTR)
+ PUSHW = Ptr to DST (PSTR)
##Out:
+ DST = SRC (PSTR)
#PStrCat
Append SRC to DST
##In:
+ PUSHW = Ptr to SRC (PSTR)
+ PUSHW = Ptr to DST (PSTR)
##Out:
+ DST = DST+SRC (PSTR)
2016-10-22 20:52:00 +00:00
#PStrMatch
Compare a String against pattern
2016-10-22 20:58:29 +00:00
2016-10-22 20:52:00 +00:00
##In:
+ PUSHW = PTR to Pattern (e.g. '*test?.txt')
+ PUSHW = PTR to Src String
2016-10-22 20:58:29 +00:00
2016-10-22 20:52:00 +00:00
##Out:
+ CC : match
+ CS : no match
2016-10-22 20:59:49 +00:00
2016-10-22 20:52:00 +00:00
#PStrUprYA/PStrLwrYA
Convert string to UPPERCASE/lowercase
2016-10-22 20:58:29 +00:00
2016-10-22 20:52:00 +00:00
##In:
2016-10-28 21:17:39 +00:00
+ Y,A = PTR to String (PSTR)
2016-10-22 20:58:29 +00:00
2016-10-22 20:52:00 +00:00
##Out:
+ Uppercased/lowercased String in Buffer
2016-10-22 20:59:49 +00:00
2016-10-22 20:52:00 +00:00
#PStrFTime
Convert S.TIME struct to PSTR
2016-10-22 20:58:29 +00:00
2016-10-23 16:27:20 +00:00
##In:
2016-10-22 20:52:00 +00:00
+ PUSHW = Dst PTR To PSTR Buf
+ PUSHW = Src PTR To Format String
+ %a : Abbreviated weekday name : Thu
+ %A : Full weekday name : Thursday
+ %b : Abbreviated month name : Aug
+ %B : Full month name : August
+ %d : Day of the month, zero-padded (01-31)
+ %H : Hour in 24h format (00-23) 14
+ %I : Hour in 12h format (01-12) 02
+ %m : Month as a decimal number (01-12) 08
+ %M : Minute (00-59) 55
+ %p : AM or PM designation PM
+ %S : Second (00-61) 02
+ %w : Weekday as a decimal number with Sunday as 0 (0-6)
+ %y : Year, last two digits (00-99)
+ %Y : Year four digits 2001
+ PUSHW = Src PTR To S.Time
2016-10-22 20:58:29 +00:00
2016-10-23 16:27:20 +00:00
##Out:
2016-10-22 20:52:00 +00:00
+ none. always succeed.
2016-10-22 20:59:49 +00:00
2016-10-23 16:27:20 +00:00
#PStr2StrArrayYA
2016-10-22 20:52:00 +00:00
Convert a PSTR (e.g. : command Line) to a Array of PSTRs (Args[])
2016-10-22 20:58:29 +00:00
2016-10-23 16:27:20 +00:00
##In:
2016-10-22 20:52:00 +00:00
+ Y,A = PTR to String
2016-10-22 20:58:29 +00:00
2016-10-23 16:27:20 +00:00
##Out:
2016-10-22 20:52:00 +00:00
+ CC : success
+ Y,A = PTR to StrArray
+ X = hMem
+ CS : error
+ A = SYS error code