A2osX/_Docs/KERNEL.md
2016-10-26 22:46:16 +02:00

6.0 KiB

*** Auto generated by docgen.cmd ***

#GetArgC Returns argument count in the process command line.

##In:

  • none.

##Out:

  • A = Command line Arg Count (Including /path/cmd)

#GetArgA

##In:

  • A = argument index.

##Out:

  • CC : success
  • Y,A = PStr To Arg[A]
  • CS : Out Of Bound

#SScanF Scan a PStr (in progress)

##In:

  • PUSHW PTR to target buffer
  • PUSHW PString pattern (ex: "%d.%d.%d.%d")
  • %d : byte
  • PUSHW PString to scan (ex: "192.168.1.5")

##Out:

#PrintFYA Prints C-Style String

##In:

  • Y,A = PTR to CStr
  • %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
  • \e Print 'ESC' ($1B,27)
  • \n Print CR=13
  • \ Print \
  • % Print %
  • Modifiers for len and padding :
  • %d '9' '12'
  • %2d ' 9' '12'
  • %02d '09' '12'
  • %11s 'ABCDEFGH '
  • %011s 'ABCDEFGH000'
  • %2f '3.14'

##Out:

#GetDevByIDA

##IN:

  • A = DevID

##OUT:

  • CC = OK, CS = ERROR
  • Y,A = devslot
  • note: X Unmodified

#GetDevIDByNameYA

##IN:

  • Y,A = Ptr to device name (PStr)

##OUT:

  • CC = OK, CS = ERROR
  • X = DEVID
  • Y,A = pDev

#GetDevInfoA

##IN:

  • A = DevID

##OUT:

  • CC = OK, CS = ERROR
  • Y,A = Ptr to S.DEVINFO

#OpenDirYA

##In:

  • Y,A = PATH (PSTR)

##Out:

  • CC : success
  • A = hDIR
  • CS : error
  • A = EC

#ReadDirA

##In:

  • A = hDIR

##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.

#MKDirYA

##In:

  • Y,A = DIR name

##Out:

  • CC : success
  • CS : error
  • A = EC

#FOpen Open a file

##In :

  • PUSHW = AUXTYPE
  • PUSHB = TYPE
  • PUSHB = MODE
  • 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
  • PUSHW = PATH (PSTR)

##Out :

  • CC : A = hFILE
  • CS : A = EC

#FCloseA Close a file

##In :

  • A = hFILE

##Out :

#FRead Read bytes from file

##In :

  • PULLB = hFILE
  • PULLW = Bytes To Read
  • PULLW = Dest Ptr

##Out :

  • Y,A = Bytes Read

#FWrite

##In:

  • PULLB = hFILE
  • PULLW = Bytes To Write
  • PULLW = Src Ptr

#Out:

  • Y,A = Bytes Written

#FFlushA

##In:

  • A = hFILE

#FSeek

##In:

  • PUSHW = OffsetHi
  • PUSHW = OffsetLo
  • PUSHB = From
  • PUSHB = hFILE

#FTellA

##In:

  • A = hFILE

##Out:

  • Y,A,X = Offset

#FEOFA

##In:

  • A = hFILE

##Out:

  • CC :
  • A=0 EOF
  • A =0 NOT EOF
  • CS :

#RemoveYA

#Rename Rename a file

##In :

  • PUSHW = New Name
  • PUSHW = Old Name

##Out :

#Stat Return information about a file

##In :

  • PUSHW = PTR to S.STAT buffer
  • PUSHW = PTR to Filename (PSTR)

##Out :

#FileSearch

##In:

  • PUSHW = PSTR to Search Path (PSTRING) %LIB%;/SYS/SLIB
  • PUSHW = PSTR to File Name (PSTRING)

#Out:

  • Y,A = PSTR to FilePath (PSTRING)
  • X = hMem to FilePath

#GetFullPathYA

##In :

  • Y,A = Filename (PSTRING)

#Out :

  • Y,A = FullPath (PSTRING)
  • X = hMem of FullPath

#LoadFile

##In:

  • PUSHW = AUXTYPE (Handled by....
  • PUSHB = TYPE ...
  • PUSHB = MODE ...
  • PUSHW = PATH ...FOPEN)

##Out:

  • Y,A = File Length
  • X = hMem of Loaded File

#SaveFile

##In:

  • PUSHW = SrcLen
  • PUSHW = SrcPtr
  • PUSHW = AUXTYPE (Handled by....
  • PUSHB = TYPE ...
  • PUSHB = MODE ...
  • PUSHW = PATH ...FOPEN)

#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

#NewPStrYA Create a new copy of PSTR

##In:

  • Y,A = PTR to buffer

##Out:

  • CC : success
  • Y,A = PTR to String
  • X = hMem (PSTRING)
  • CS : error
  • A = SYS error code

#PStrMatch Compare a String against pattern

##In:

  • PUSHW = PTR to Pattern (e.g. '*test?.txt')
  • PUSHW = PTR to Src String

##Out:

  • CC : match
  • CS : no match

#PStrUprYA/PStrLwrYA Convert string to UPPERCASE/lowercase

##In:

  • Y,A = PTR to String (PSTRING)

##Out:

  • Uppercased/lowercased String in Buffer

#PStrFTime Convert S.TIME struct to PSTR

##In:

  • 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

##Out:

  • none. always succeed.

#PStr2StrArrayYA Convert a PSTR (e.g. : command Line) to a Array of PSTRs (Args[])

##In:

  • Y,A = PTR to String

##Out:

  • CC : success
  • Y,A = PTR to StrArray
  • X = hMem
  • CS : error
  • A = SYS error code