A2osX/.Docs/KERNEL.md

1720 lines
28 KiB
Markdown
Raw Normal View History

2016-10-22 20:52:00 +00:00
*** Auto generated by docgen.cmd ***
2018-06-18 08:44:02 +00:00
## Copyright
2020-01-15 09:51:24 +00:00
Copyright 2015 - 2020, Remy Gibert and the A2osX contributors.
2020-02-08 21:44:41 +00:00
# Shift
## ASM
A = argument index.
## RETURN VALUE
CC : success
Y,A = PTR To Arg[A]
CS : Out Of Bound
2018-10-16 15:48:03 +00:00
# ArgV
2018-06-18 08:44:02 +00:00
## ASM
A = argument index.
2018-10-11 15:23:06 +00:00
## RETURN VALUE
2018-06-18 08:44:02 +00:00
CC : success
Y,A = PTR To Arg[A]
CS : Out Of Bound
2020-02-08 21:44:41 +00:00
# Arg2ArgV
Expand String and convert to StrV List
## C
short int arg2argv(char* args, char* argv[])
## ASM
2020-02-16 20:45:16 +00:00
`>PUSHW args`
2020-02-08 21:44:41 +00:00
`>PUSHW argv`
`>SYSCALL Arg2ArgV`
## RETURN VALUE
A = Arg count
# ArgVDup
## ASM
Y,A = Src StrV
## RETURN VALUE
X = hMem of new StrV
A = Str Count
2018-06-28 15:26:34 +00:00
# LoadDrv
2018-06-18 08:44:02 +00:00
2018-07-20 05:43:11 +00:00
## ASM
2018-06-18 08:44:02 +00:00
**In:**
2018-06-28 15:26:34 +00:00
Y,A = PTR to "NAME.DRV [PARAM]" C-String
2018-10-11 15:23:06 +00:00
## RETURN VALUE
2018-06-28 15:26:34 +00:00
none
2018-06-18 08:44:02 +00:00
2018-07-20 05:43:11 +00:00
# InsDrv
2018-07-17 15:45:59 +00:00
2018-07-20 05:43:11 +00:00
## C
2019-07-26 14:23:36 +00:00
`void * insdrv (void * src, void * crvcsstart, void * drvcssize, void * drvend);`
2018-06-28 15:26:34 +00:00
2018-07-20 05:43:11 +00:00
## ASM
2018-06-28 15:26:34 +00:00
**In:**
2018-07-19 15:33:55 +00:00
`>PUSHW DRV.END`
2019-07-26 14:23:36 +00:00
`>PUSHW DRV.CS.SIZE`
2018-07-19 15:33:55 +00:00
`>PUSHW DRV.CS.START`
`>LDYA L.SRC`
2019-02-26 16:50:42 +00:00
`>SYSCALL insdrv`
2018-10-11 15:23:06 +00:00
## RETURN VALUE
2018-07-17 15:45:59 +00:00
Y,A = Ptr to installed driver
2018-06-28 15:26:34 +00:00
# GetDevByName
2018-06-18 08:44:02 +00:00
Y,A = Ptr to device name (C-String)
2018-10-11 15:23:06 +00:00
## RETURN VALUE
2018-08-08 15:13:37 +00:00
CC = OK, CS = ERROR
Y,A = FD
2021-07-26 13:45:29 +00:00
X = hFD
2018-06-18 08:44:02 +00:00
# MkFD
2018-07-19 15:33:55 +00:00
2020-12-15 13:23:22 +00:00
## C
`short int mkfd(short int type, );`
2018-07-19 15:33:55 +00:00
## ASM
2020-06-07 08:06:51 +00:00
`>PUSHB DevID`
2020-02-16 20:45:16 +00:00
`>PUSHW S.DIB`
`>SYSCALL MkFD`
2018-10-11 15:23:06 +00:00
## RETURN VALUE
2018-06-18 08:44:02 +00:00
2018-07-17 15:45:59 +00:00
# MKDev
2018-10-05 14:58:38 +00:00
Create a hDEV
## C
2020-02-16 20:45:16 +00:00
`hDEV mkdev (S.FD *fd, const char *devname)`
2018-10-05 14:58:38 +00:00
## ASM
2020-02-16 20:45:16 +00:00
`>PUSHW fd`
2018-12-17 15:21:32 +00:00
`>PUSHW devname`
2020-06-07 08:06:51 +00:00
`>SYSCALL mkdev`
2018-10-11 15:23:06 +00:00
## RETURN VALUE
2018-10-05 14:58:38 +00:00
A = hDEV
2018-06-18 08:44:02 +00:00
2020-02-16 20:45:16 +00:00
# IOCTL
## C
2021-07-26 13:45:29 +00:00
`int ioctl(short int hFD, short int request, void *param);`
2020-02-16 20:45:16 +00:00
## ASM
`>PUSHB hDEV`
`>PUSHB request`
`>PUSHW param`
`>SYSCALL IOCTL`
## RETURN VALUE
Y,A = ...
2018-06-28 15:26:34 +00:00
# OpenDir
2018-07-20 11:51:08 +00:00
## C
2021-05-04 17:31:21 +00:00
`short int hDIR opendir (const char * dirpath);`
2018-07-20 11:51:08 +00:00
## ASM
2020-06-07 08:06:51 +00:00
`>LDYA dirpath`
2020-07-20 15:19:32 +00:00
`>SYSCALL opendir`
2018-10-11 15:23:06 +00:00
2020-07-20 15:19:32 +00:00
## RETURN VALUE
2018-06-18 08:44:02 +00:00
CC : success
A = hDIR
CS : error
A = EC
2018-06-28 15:26:34 +00:00
# ReadDir
2018-07-20 11:51:08 +00:00
## C
`int readdir (int hDIR, S.DIRENT * dirent);`
## ASM
`>PUSHW dirent`
`lda hDIR`
`>SYSCALL readdir`
2018-10-11 15:23:06 +00:00
2020-07-20 15:19:32 +00:00
## RETURN VALUE
2018-06-18 08:44:02 +00:00
CC : success
X = hDIRENT
Y,A = PTR to S.DIRENT
CS : error
A = EC
note : A = 0 means no more entry
2018-06-28 15:26:34 +00:00
# CloseDir
2018-07-20 11:51:08 +00:00
## C
`void closedir(hDIR);`
## ASM
`lda hDIR`
`>SYSCALL closedir`
2018-10-11 15:23:06 +00:00
## RETURN VALUE
2020-07-20 15:19:32 +00:00
none, always succeed.
2018-06-18 08:44:02 +00:00
# SetEnv
2018-09-06 15:36:44 +00:00
Change or add an environment variable
2020-02-16 20:45:16 +00:00
## C / CSH
2018-09-06 15:36:44 +00:00
`int setenv(const char *name, const char *value);`
## ASM
2020-01-17 11:23:11 +00:00
`>PUSHW name`
2018-09-06 15:36:44 +00:00
`>PUSHW value`
`>SYSCALL setenv`
2018-10-11 15:23:06 +00:00
## RETURN VALUE
2018-06-18 08:44:02 +00:00
2018-06-28 15:26:34 +00:00
# GetEnv
2018-09-06 15:36:44 +00:00
searches the environment list to find the environment variable name,
and returns a pointer to the corresponding value string.
2020-02-16 20:45:16 +00:00
## C / CSH
2020-01-15 09:51:24 +00:00
`char *getenv(const char *name, char *value);`
2018-09-06 15:36:44 +00:00
## ASM
2020-01-15 09:51:24 +00:00
`>PUSHW name`
`>PUSHW value`
2018-10-11 15:23:06 +00:00
`>SYSCALL getenv`
## RETURN VALUE
2018-09-06 15:36:44 +00:00
CC : Y,A = PTR to VALUE (C-String)
2018-06-18 08:44:02 +00:00
CS : not found
2020-02-06 16:23:59 +00:00
# PutEnv
Change or add an environment variable, string is 'NAME=VALUE'
2020-02-16 20:45:16 +00:00
## C / CSH
2020-02-06 16:23:59 +00:00
`int putenv(char *string);`
## ASM
**In:**
`>PUSHW string`
`>SYSCALL putenv`
## RETURN VALUE
2018-06-28 15:26:34 +00:00
# UnsetEnv
2018-09-06 15:36:44 +00:00
Remove an environment variable
2020-02-16 20:45:16 +00:00
## C / CSH
2018-09-06 15:36:44 +00:00
`int unsetenv(const char *name);`
## ASM
2020-01-17 11:23:11 +00:00
`>PUSHW name`
2018-09-06 15:36:44 +00:00
`>SYSCALL unsetenv`
2018-10-11 15:23:06 +00:00
## RETURN VALUE
2018-06-18 08:44:02 +00:00
2019-11-25 07:05:07 +00:00
# Add32,Sub32,Mul32,IMul32,Div32,IDiv32,Mod32,IMod32,Cmp32,ICmp32
Return X+Y, X-Y, X*Y, X/Y, X mod Y....
## ASM
**In:**
2020-02-16 20:45:16 +00:00
`>PUSHL X (long)`
`>PUSHL Y (long)`
2019-11-25 07:05:07 +00:00
`>FPU add32`
`...`
## RETURN VALUE
On stack (long)
2021-05-04 17:31:21 +00:00
# FAdd,FSub,FMul,FDiv,FPwr
Return X*Y, X/Y, X+Y, X-Y
## C
`float pwr ( float x, float y);`
2019-07-26 14:23:36 +00:00
## ASM
**In:**
`>PUSHF X (float)`
`>PUSHF Y (float)`
2021-05-04 17:31:21 +00:00
`>FPU fmul`
`>FPU fdiv`
`>FPU fmod` TODO
2019-07-26 14:23:36 +00:00
`>FPU fadd`
`>FPU fsub`
`>FPU fpwr`
## RETURN VALUE
On stack (float)
# Log,Sqr,Exp,Cos,Sin,Tan,ATan
Return Log(x), Sqr(x), E^X, Cos(x), Sin(X), Tan(x), ATan(x)
## C
`float log ( float x);`
`float sqr ( float x);`
`float exp ( float x);`
`float cos ( float x);`
`float sin ( float x);`
`float tan ( float x);`
`float atan ( float x);`
## ASM
**In:**
`>PUSHF x (Float)`
`>FPU log`
## RETURN VALUE
On stack (Float)
# float
Return 'floated' long
## C
2019-11-25 07:05:07 +00:00
`float f = (float)l;
2019-07-26 14:23:36 +00:00
## ASM
**In:**
2019-11-25 07:05:07 +00:00
`>PUSHL l` (long)
`>FPU float`
2019-07-26 14:23:36 +00:00
## RETURN VALUE
On stack (float)
# lrintf
Return float rounded into a long
## C
`long int lrintf (float x);`
## ASM
**In:**
`>PUSHF x`
2019-11-25 07:05:07 +00:00
`>FPU lrintf`
2019-07-26 14:23:36 +00:00
## RETURN VALUE
On stack (long)
2020-01-20 07:23:51 +00:00
## MD5
Return MD5 Hash for input String
# C
`void md5 (const char* str, char* digest);`
# ASM
`>PUSHW str`
`>PUSHW digest`
`>SYSCALL md5`
## RETURN VALUE
CC
## MD5Init
Initialize a MD5 computation
# C
`short int md5init();`
2020-01-20 07:23:51 +00:00
# ASM
`>SYSCALL MD5Init`
## RETURN VALUE
A = hMem To S.MD5
## MD5Update
Add Data to MD5 computation
# C
2020-01-24 14:21:08 +00:00
`void md5update (short int md5, char* data, int len);`
2020-01-20 07:23:51 +00:00
# ASM
`>PUSHB md5`
`>PUSHW data`
`>PUSHW len`
`>SYSCALL MD5Update`
## RETURN VALUE
## MD5Finalize
# C
2020-01-24 14:21:08 +00:00
`void md5finalize (short int md5, char* digest);`
2020-01-20 07:23:51 +00:00
# ASM
`>PUSHB md5`
`>PUSHW digest`
`>SYSCALL MD5Finalize`
## RETURN VALUE
2020-02-06 16:23:59 +00:00
# Realloc
## C
`void *realloc(short int hMem, int size);`
## ASM
`>PUSHB hMem`
`>PUSHW size`
`>SYSCALL realloc`
2018-10-11 15:23:06 +00:00
## RETURN VALUE
2020-02-06 16:23:59 +00:00
YA = ptr
X = hMem
2018-06-18 08:44:02 +00:00
# GetMem
Y,A = Size Requested
2018-10-11 15:23:06 +00:00
## RETURN VALUE
2018-06-18 08:44:02 +00:00
CC : success
YA = PTR to Mem (Uninitialised)
* X = hMem
CS :
A = EC
# Free
Y,A = Ptr To Free
## RETURN VALUE
none.
(X unmodified)
2018-06-18 08:44:02 +00:00
# FreeMem
A = hMem To Free
2018-10-11 15:23:06 +00:00
## RETURN VALUE
2018-06-18 08:44:02 +00:00
none.
2018-08-21 13:12:47 +00:00
(X unmodified)
2018-06-18 08:44:02 +00:00
# GetMemPtr
2018-08-21 13:12:47 +00:00
A = hMem
2018-10-11 15:23:06 +00:00
## RETURN VALUE
2018-08-21 13:12:47 +00:00
Y,A = PTR to MemBlock
(X unmodified)
2018-06-18 08:44:02 +00:00
# NewStkObj
Y,A = Size Requested
2018-10-11 15:23:06 +00:00
## RETURN VALUE
2018-06-18 08:44:02 +00:00
CC : success
YA = PTR to Mem (Uninitialised)
* X = hMem
CS :
A = EC
2019-07-26 14:23:36 +00:00
# GetStkObjPtr
## ASM
`lda hStkObj`
`>SYSCALL GetStkObjPtr`
2019-03-15 16:20:28 +00:00
## RETURN VALUE
2019-07-26 14:23:36 +00:00
# FreeStkObj
A = hMem To Free (AUX Memory)
## RETURN VALUE
none.
(X,Y unmodified)
2019-03-15 16:20:28 +00:00
2022-03-18 17:59:39 +00:00
# Online
Get ProDOS Volume Info
## C
`int online(short int volid, void *buf);`
## ASM
`>PUSHB volid`
`>PUSHW buf`
`>SYSCALL Online`
## RETURN VALUE
# ChTyp
2022-03-18 17:59:39 +00:00
Change Type of a ProDOS File
## C
`int chtyp(const char *filepath, short int filetype);`
## ASM
`>PUSHW filepath`
`>PUSHB filetype`
`>SYSCALL ChTyp`
## RETURN VALUE
# ChAux
2022-03-18 17:59:39 +00:00
Change AuxType of a ProDOS File
## C
`int chaux(const char *filepath, int auxtype);`
## ASM
`>PUSHW filepath`
2022-03-18 17:59:39 +00:00
`>PUSHW auxtype`
`>SYSCALL ChAux`
## RETURN VALUE
# SetAttr
Change Attributes of a ProDOS File
## C
`int setattr(const char *filepath, short int attributes);`
## ASM
`>PUSHW filepath`
`>PUSHB attributes`
`>SYSCALL setattr`
## RETURN VALUE
2018-10-25 15:31:41 +00:00
# ExecL
2020-02-16 20:45:16 +00:00
## C / CSH
`short int execl(const char *cmdline, short int flags);`
2018-10-25 15:31:41 +00:00
## ASM
2020-01-24 14:21:08 +00:00
`>PUSHW cmdline`
2018-10-25 15:31:41 +00:00
`>PUSHB flags`
`>SYSCALL execl`
## RETURN VALUE
A = Child PSID
# ExecV
2018-10-15 15:39:21 +00:00
2020-02-16 20:45:16 +00:00
## C / CSH
`short int execv(const char* argv[], short int flags);`
2018-10-11 15:23:06 +00:00
## ASM
2020-02-16 20:45:16 +00:00
`>PUSHW argv`
2018-10-11 15:23:06 +00:00
`>PUSHB flags`
2018-10-15 15:39:21 +00:00
`>SYSCALL execv`
2018-10-11 15:23:06 +00:00
## RETURN VALUE
A = Child PSID
2020-02-08 21:44:41 +00:00
# Fork
## C
2020-02-16 20:45:16 +00:00
`short int fork();`
2020-02-08 21:44:41 +00:00
## ASM
`>SYSCALL fork`
## RETURN VALUE
A = Child PSID
2019-07-26 14:23:36 +00:00
# Kill
2018-12-04 13:20:35 +00:00
## C
`int kill(short int pid, short int sig);`
## ASM
2021-05-04 17:31:21 +00:00
`>PUSHB pid`
2018-12-04 13:20:35 +00:00
`>PUSHB sig`
`>SYSCALL kill`
## RETURN VALUE
2019-11-25 07:05:07 +00:00
# LoadTxtFile
Load TXT a file in memory (with ending 0)
## C
2020-12-15 13:23:22 +00:00
`int loadtxtfile ( const char * filename );`
2019-11-25 07:05:07 +00:00
## ASM
**In:**
2020-12-15 13:23:22 +00:00
`>LDYA filename`
2019-11-25 07:05:07 +00:00
`>SYSCALL loadtxtfile`
## RETURN VALUE
Y,A = File Length (without ending 0)
X = hMem of Loaded File
# LoadFile
Load a file in memory
## C
`int loadfile ( const char * filename, short int flags, short int ftype, int auxtype );`
## ASM
**In:**
2020-02-18 15:34:56 +00:00
`>PUSHW filename`
2019-11-25 07:05:07 +00:00
`>PUSHB flags`
2020-02-18 15:34:56 +00:00
`>PUSHB ftype`
`>PUSHW auxtype`
2019-11-25 07:05:07 +00:00
`>SYSCALL loadfile`
## RETURN VALUE
Y,A = File Length
X = hMem of Loaded File
2020-01-17 11:23:11 +00:00
# FileSearch
Search a file in the provided PATH list
And return, if found, the full path to it.
## C
2020-02-18 15:34:56 +00:00
`int filesearch( char *filename, char *searchpath, char *fullpath, stat *filestat);`
2020-01-17 11:23:11 +00:00
## ASM
**In:**
2020-02-18 15:34:56 +00:00
`>PUSHW filename`
`>PUSHW fullpath`
`>PUSHW searchpath`
`>PUSHW filestat`
`>SYSCALL filesearch`
2020-01-17 11:23:11 +00:00
## RETURN VALUE
CC : success
DstBuf = FilePath
DstStat = S.STAT
CS : not found
2019-11-25 07:05:07 +00:00
# GetMemStat
**In:**
Y,A = Ptr to 24 bytes buffer
## RETURN VALUE
Buffer filled with memory stats
2019-03-12 14:41:55 +00:00
# GetPWUID
## C
2020-02-17 16:55:02 +00:00
`int getpwuid(short int uid, S.PW *passwd);`
2019-03-12 14:41:55 +00:00
## ASM
2020-02-17 16:55:02 +00:00
`PUSHB uid`
2019-03-12 14:41:55 +00:00
`>PUSHW passwd`
`>SYSCALL getpwuid`
## RETURN VALUE
2020-06-07 08:06:51 +00:00
# GetGRGID
## C
`int getgrgid(short int gid, S.GRP *group);`
## ASM
`>PUSHB gid`
`>PUSHW group`
`>SYSCALL getpwname`
## RETURN VALUE
2020-08-25 10:56:00 +00:00
# CloseSession
## C
`int closesession(short int hSID);`
## ASM
`>PUSHB hSID`
`>SYSCALL CloseSession`
## RETURN VALUE
2020-07-20 15:19:32 +00:00
# OpenSession
## C
`short int hSID opensession(const char *name, const char *passwd);`
## ASM
`>PUSHW name`
`>PUSHW passwd`
`>SYSCALL OpenSession`
## RETURN VALUE
2019-03-12 14:41:55 +00:00
# GetPWName
## C
2020-02-17 16:55:02 +00:00
`int getpwname(const char* name, S.PW *passwd);`
2019-03-12 14:41:55 +00:00
## ASM
2020-02-17 16:55:02 +00:00
`>PUSHW name`
2019-03-12 14:41:55 +00:00
`>PUSHW passwd`
`>SYSCALL getpwname`
## RETURN VALUE
2020-06-07 08:06:51 +00:00
# GetGRName
## C
`int getgrgid(const char* name, S.GRP *group);`
## ASM
`>PUSHW name`
`>PUSHW group`
`>SYSCALL getpwname`
## RETURN VALUE
2019-03-12 14:41:55 +00:00
# PutPW
## C
2020-07-20 15:19:32 +00:00
`int putpw(S.PW* passwd);`
2019-03-12 14:41:55 +00:00
## ASM
2020-02-17 16:55:02 +00:00
`>PUSHW passwd`
2019-03-12 14:41:55 +00:00
`>SYSCALL putpw`
## RETURN VALUE
2020-06-07 08:06:51 +00:00
# PutGR
2020-02-17 16:55:02 +00:00
## C
2020-06-07 08:06:51 +00:00
`int putgr(S.GRP *group);`
2020-02-17 16:55:02 +00:00
## ASM
`>PUSHW group`
2020-06-07 08:06:51 +00:00
`>SYSCALL putgr`
2020-02-17 16:55:02 +00:00
## RETURN VALUE
2019-11-25 07:05:07 +00:00
# SListGetData
## ASM
2020-02-18 15:34:56 +00:00
`>PUSHB hSList`
`>PUSHW KeyID`
`>PUSHW DataPtr` (0 if KERNEL should allocate a buffer)
`>PUSHW DataLen` (Data bytes to return, 0 if String mode)
`>PUSHW DataOfs` (Start offset in Data)
2019-11-25 07:05:07 +00:00
`>SYSCALL SListGetData`
## RETURN VALUE
Y,A = Byte Count
X = hMem (if DataPtr = 0)
# SListAddData
## ASM
2020-02-18 15:34:56 +00:00
`>PUSHB hSList`
`>PUSHW KeyID`
`>PUSHW DataPtr`
`>PUSHW DataLen` (Data bytes to add, 0 if String mode)
2019-11-25 07:05:07 +00:00
`>SYSCALL SListAddData`
## RETURN VALUE
# SListSetData
## ASM
2020-02-18 15:34:56 +00:00
`>PUSHB hSList`
`>PUSHW KeyID`
`>PUSHW DataPtr`
`>PUSHW DataLen` (Data bytes to set, 0 if String mode)
2019-11-25 07:05:07 +00:00
`>SYSCALL SListSetData`
## RETURN VALUE
# SListGetByID
## ASM
2020-02-18 15:34:56 +00:00
`>PUSHB hSList`
`>PUSHW KeyID`
2020-06-07 08:06:51 +00:00
`>PUSHW KeyPtr`
2019-11-25 07:05:07 +00:00
`>SYSCALL SListGetByID`
## RETURN VALUE
Y,A = Next KeyID
# SListNewKey
## ASM
2020-02-18 15:34:56 +00:00
`>PUSHB hSList`
`>PUSHW KeyPtr`
2019-11-25 07:05:07 +00:00
`>SYSCALL SListNewKey`
## RETURN VALUE
Y,A = KeyID
X = KeyLen
# SListLookup
## ASM
2020-02-18 15:34:56 +00:00
`>PUSHB hSList`
`>PUSHW KeyPtr`
2019-11-25 07:05:07 +00:00
`>SYSCALL SListLookup`
## RETURN VALUE
Y,A = KeyID
X = Key Length
2020-02-18 15:34:56 +00:00
# SListFree
2019-11-25 07:05:07 +00:00
## ASM
2021-05-09 12:39:40 +00:00
`lda hSList`
2020-02-18 15:34:56 +00:00
`>SYSCALL SListFree`
2019-11-25 07:05:07 +00:00
## RETURN VALUE
2020-02-18 15:34:56 +00:00
# SListNew
2019-11-25 07:05:07 +00:00
## ASM
`lda Opt`
2020-02-18 15:34:56 +00:00
`>SYSCALL SListNew`
2019-07-26 14:23:36 +00:00
## RETURN VALUE
2020-02-18 15:34:56 +00:00
A=hSList
2019-07-26 14:23:36 +00:00
# ChMod
change permissions of a file
2020-02-16 20:45:16 +00:00
## C
`int chmod(const char *pathname, int mode);`
2020-02-16 20:45:16 +00:00
## ASM
`>PUSHW pathname`
`>PUSHW mode`
`>SYSCALL chmod`
2020-02-16 20:45:16 +00:00
## RETURN VALUE
# FStat
Return information about a hFILE
2020-07-30 14:10:49 +00:00
## C
`int fstat(short int hFILE, struct stat *statbuf);`
2020-07-30 14:10:49 +00:00
## ASM
`>PUSHB hFILE`
`>PUSHW statbuf`
`>SYSCALL fstat`
2020-07-30 14:10:49 +00:00
## RETURN VALUE
2018-06-18 08:44:02 +00:00
# Stat
Return information about a file
2018-07-20 11:51:08 +00:00
## C
`int stat(const char *pathname, struct stat *statbuf);`
## ASM
2020-02-16 20:45:16 +00:00
`>PUSHW pathname`
2018-07-20 11:51:08 +00:00
`>PUSHW statbuf`
`>SYSCALL stat`
2018-10-11 15:23:06 +00:00
## RETURN VALUE
2018-06-18 08:44:02 +00:00
2018-06-28 15:26:34 +00:00
# MKDir
2018-09-20 15:33:05 +00:00
create a directory
## C
`int mkdir(const char *pathname, int mode);`
## ASM
2020-02-16 20:45:16 +00:00
`>PUSHW pathname`
2018-09-20 15:33:05 +00:00
`>PUSHW mode`
`>SYSCALL mkdir`
2018-10-11 15:23:06 +00:00
## RETURN VALUE
2018-09-20 15:33:05 +00:00
CC : success
CS : error
A = EC
2018-06-18 08:44:02 +00:00
2019-06-03 15:50:41 +00:00
# MKFIFO
return a pathname to a new FIFO
2018-09-20 15:33:05 +00:00
## C
2020-06-07 08:06:51 +00:00
`hFILE mkfifo(const char *pathname, int mode);`
2018-09-20 15:33:05 +00:00
## ASM
2020-06-07 08:06:51 +00:00
`>PUSHW pathname`
2018-09-20 15:33:05 +00:00
`>PUSHW mode`
2019-06-03 15:50:41 +00:00
`>SYSCALL mkfifo`
2018-10-11 15:23:06 +00:00
## RETURN VALUE
2018-09-20 15:33:05 +00:00
CC = OK, CS = ERROR
2020-06-07 08:06:51 +00:00
A = hFILE
2018-06-18 08:44:02 +00:00
2019-06-03 15:50:41 +00:00
# MkNod
Create a special or ordinary file.
(CDEV, BDEV, DSOCKS, SSOCK, PIPE)
2018-09-20 15:33:05 +00:00
## C
2019-06-03 15:50:41 +00:00
`hFILE mknod(const char *pathname, int mode, hFD fd);`
2018-09-20 15:33:05 +00:00
## ASM
2020-06-07 08:06:51 +00:00
`>PUSHW pathname`
2019-06-03 15:50:41 +00:00
`>PUSHW mode`
2020-06-07 08:06:51 +00:00
`>PUSHB fd`
2019-06-03 15:50:41 +00:00
`>SYSCALL mknod`
2018-10-11 15:23:06 +00:00
## RETURN VALUE
2018-09-20 15:33:05 +00:00
CC = OK, CS = ERROR
A = hFILE
2018-06-18 08:44:02 +00:00
2019-02-08 16:13:43 +00:00
# pipe
## C
2019-05-17 14:57:14 +00:00
`hFD pipe(int size);`
2019-02-08 16:13:43 +00:00
## ASM
2019-05-17 14:57:14 +00:00
`>LDYA size`
2019-02-08 16:13:43 +00:00
`>SYSCALL pipe`
## RETURN VALUE
CC = OK, CS = ERROR
A = hFD
2021-05-14 20:58:20 +00:00
# fputc (BLOCKING)
Print A (char) to hFILE
2018-06-18 08:44:02 +00:00
## C
2021-05-14 20:58:20 +00:00
`int fputc ( hFILE stream , short int character );`
2018-06-18 08:44:02 +00:00
## ASM
**In:**
2021-05-14 20:58:20 +00:00
`>PUSHB stream`
`>PUSHB character`
`>SYSCALL fputc`
2018-10-11 15:23:06 +00:00
## RETURN VALUE
2018-06-18 08:44:02 +00:00
CC = success
2021-05-14 20:58:20 +00:00
# putchar (BLOCKING)
Print A (char) to StdOut
2018-06-18 08:44:02 +00:00
## C
2021-05-14 20:58:20 +00:00
`int putchar ( short int character );`
2018-06-18 08:44:02 +00:00
## ASM
**In:**
2021-05-14 20:58:20 +00:00
`lda character`
`>SYSCALL putchar`
2018-10-11 15:23:06 +00:00
## RETURN VALUE
2018-06-18 08:44:02 +00:00
CC = success
2019-02-20 16:07:43 +00:00
# puts (BLOCKING)
2018-06-18 08:44:02 +00:00
Write Str to StdOut, appends '\r\n'
## C
`int puts ( const char * str );`
**In:**
2018-07-27 13:34:34 +00:00
## ASM
`>LDYAI str`
2020-06-07 08:06:51 +00:00
`>SYSCALL PutS`
2018-10-11 15:23:06 +00:00
## RETURN VALUE
2018-06-18 08:44:02 +00:00
CC = success
2019-02-20 16:07:43 +00:00
# fputs (BLOCKING)
2019-05-17 14:57:14 +00:00
Write Str to hFILE
2018-06-18 08:44:02 +00:00
## C
2018-07-27 13:34:34 +00:00
`int fputs (hFILE stream, const char * str );`
## ASM
2018-06-18 08:44:02 +00:00
**In:**
2020-08-25 10:56:00 +00:00
`>PUSHB stream`
2018-07-27 13:34:34 +00:00
`>PUSHW str`
`>SYSCALL fputs`
2018-10-11 15:23:06 +00:00
## RETURN VALUE
2018-06-18 08:44:02 +00:00
CC = success
2019-02-20 16:07:43 +00:00
# fgets (BLOCKING)
2018-07-27 13:34:34 +00:00
read bytes from stream into the array
pointed to by s, until n-1 bytes are read, or a <newline> is read and
transferred to s, or an end-of-file condition is encountered. The
string is then terminated with a null byte.
## C
`char *fgets(hFILE stream, char * s, int n);`
## ASM
**In:**
2020-12-23 14:54:57 +00:00
`>PUSHB hFILE`
2018-07-27 13:34:34 +00:00
`>PUSHW s`
2020-12-23 14:54:57 +00:00
`>PUSHW n`
2018-07-27 13:34:34 +00:00
`>SYSCALL fgets`
2018-10-11 15:23:06 +00:00
## RETURN VALUE
Y,A: s
2018-07-27 13:34:34 +00:00
CC = success
2019-02-20 16:07:43 +00:00
# getchar (BLOCKING)
2018-06-18 08:44:02 +00:00
Get char from StdIn
2018-10-04 06:13:44 +00:00
## C
2020-08-02 12:19:43 +00:00
`short int getchar ( );`
2018-10-04 06:13:44 +00:00
## ASM
2018-06-18 08:44:02 +00:00
**In:**
2018-10-04 06:13:44 +00:00
`>SYSCALL getchar`
2018-10-11 15:23:06 +00:00
## RETURN VALUE
2018-06-18 08:44:02 +00:00
CC = success
A = char
2019-02-20 16:07:43 +00:00
# getc (BLOCKING)
2018-06-18 08:44:02 +00:00
Get char from Node
## C
2020-08-02 12:19:43 +00:00
`short int getc ( short int stream );`
2018-06-18 08:44:02 +00:00
## ASM
**In:**
2018-10-04 06:13:44 +00:00
`lda stream`
`>SYSCALL getc`
2018-10-11 15:23:06 +00:00
## RETURN VALUE
2020-07-20 15:19:32 +00:00
CC = success
A = char
# ungetc
push byte back into input stream
## C
2020-08-02 12:19:43 +00:00
`short int ungetc(short int c, short int stream);`
2020-07-20 15:19:32 +00:00
## ASM
`>PUSHB c`
`>PUSHB stream`
`>SYSCALL ungetc`
## RETURN VALUE
2018-06-18 08:44:02 +00:00
CC = success
A = char
# FOpen
Open a file
2018-06-18 11:42:48 +00:00
## C
2020-02-16 20:45:16 +00:00
`short int fopen ( const char *filename, short int flags, short int ftype, int auxtype );`
2018-06-18 08:44:02 +00:00
**In:**
2018-06-18 11:42:48 +00:00
## ASM
2020-02-16 20:45:16 +00:00
`>PUSHW filename`
`>PUSHB flags`
2018-10-04 06:13:44 +00:00
+ O.RDONLY : if R and exists -> ERROR
+ O.WRONLY : if W and exists -> CREATE
+ O.TRUNC : Reset Size To 0
+ O.APPEND : Append
+ O.TEXT : Open/Append in Text mode
+ O.CREATE : Create if not exists
2020-02-16 20:45:16 +00:00
`>PUSHB ftype`
`>PUSHW auxtype`
2018-10-04 15:30:14 +00:00
TODO: replace flags/ftype/auxtype with mode="w+,t=TYP,x=AUXTYPE"
2018-10-04 06:13:44 +00:00
+ r = O_RDONLY
+ r+ = O_RDWR
+ w = O_WRONLY | O_CREAT | O_TRUNC
+ w+ = O_RDWR | O_CREAT | O_TRUNC
+ a = O_WRONLY | O_CREAT | O_APPEND
+ a+ = O_RDWR | O_CREAT | O_APPEND
+ ,t=123 or t=$ff or t=TXT
+ ,x=12345 or x=$ffff
2018-10-11 15:23:06 +00:00
## RETURN VALUE
2018-06-18 08:44:02 +00:00
CC : A = hFILE
CS : A = EC
2018-06-28 15:26:34 +00:00
# FClose
2018-06-18 08:44:02 +00:00
Close a file
2018-07-17 15:45:59 +00:00
## C
2020-08-02 12:19:43 +00:00
`int fclose ( short int stream );`
2018-07-17 15:45:59 +00:00
## ASM
2018-06-18 08:44:02 +00:00
**In:**
2018-10-04 06:13:44 +00:00
`lda stream`
2020-06-07 08:06:51 +00:00
`>SYSCALL FClose`
2018-10-11 15:23:06 +00:00
## RETURN VALUE
2018-06-18 08:44:02 +00:00
2019-02-20 16:07:43 +00:00
# FRead (BLOCKING)
2018-06-18 08:44:02 +00:00
Read bytes from file
2018-10-04 15:30:14 +00:00
## C
2020-08-02 12:19:43 +00:00
`int fread (short int stream, void * ptr, int count );`
2018-10-04 15:30:14 +00:00
## ASM
2018-06-18 08:44:02 +00:00
**In:**
2021-05-14 20:58:20 +00:00
`>PUSHB stream`
2018-07-24 16:00:24 +00:00
`>PUSHW ptr`
2021-05-14 20:58:20 +00:00
`>PUSHW count`
2018-07-24 16:00:24 +00:00
`>SYSCALL fread`
2018-10-11 15:23:06 +00:00
## RETURN VALUE
2018-06-18 08:44:02 +00:00
Y,A = Bytes Read
2019-02-20 16:07:43 +00:00
# FWrite (BLOCKING)
2018-06-18 08:44:02 +00:00
Write bytes to file
2018-06-19 15:08:22 +00:00
## C
2020-08-25 10:56:00 +00:00
`int fwrite ( short int stream, const void * ptr, int count );`
2018-06-19 15:08:22 +00:00
## ASM
2018-06-18 08:44:02 +00:00
**In:**
2021-05-14 20:58:20 +00:00
`>PUSHB stream`
2018-07-24 16:00:24 +00:00
`>PUSHW ptr`
2021-05-14 20:58:20 +00:00
`>PUSHW count`
2018-07-24 16:00:24 +00:00
`>SYSCALL fwrite`
2018-10-11 15:23:06 +00:00
## RETURN VALUE
2018-06-18 08:44:02 +00:00
Y,A = Bytes Written
2018-06-28 15:26:34 +00:00
# FFlush
2018-07-27 13:34:34 +00:00
## C
2020-08-02 12:19:43 +00:00
`int fflush( short int stream );`
2018-07-27 13:34:34 +00:00
## ASM
2018-06-18 08:44:02 +00:00
**In:**
2018-10-04 06:13:44 +00:00
`lda stream`
`>SYSCALL fflush`
2018-06-18 08:44:02 +00:00
# FSeek
Set the file-position indicator for hFILE
2018-07-27 13:34:34 +00:00
## C
2020-08-02 12:19:43 +00:00
`int fseek( short int stream, long offset, short int whence );`
2018-07-27 13:34:34 +00:00
## ASM
2018-06-18 08:44:02 +00:00
**In:**
2021-05-14 20:58:20 +00:00
`>PUSHB stream`
2018-08-08 15:13:37 +00:00
`>PUSHL offset`
2021-05-14 20:58:20 +00:00
`>PUSHB whence`
2018-08-08 15:13:37 +00:00
`>SYSCALL fseek`
2018-06-18 08:44:02 +00:00
2018-06-28 15:26:34 +00:00
# FEOF
2018-06-18 08:44:02 +00:00
Test the end-of-file indicator for hFILE
2018-10-04 06:13:44 +00:00
## C
2020-08-02 12:19:43 +00:00
`int feof( short int stream );`
2018-10-04 06:13:44 +00:00
## ASM
2018-06-18 08:44:02 +00:00
**In:**
2018-10-04 06:13:44 +00:00
`lda stream`
`>SYSCALL feof`
2018-10-11 15:23:06 +00:00
## RETURN VALUE
CC :
2019-05-17 14:57:14 +00:00
A = $ff EOF
A = 0 NOT EOF
2018-06-18 08:44:02 +00:00
CS :
# FTell
Return the current value of the file-position indicator
2018-07-27 13:34:34 +00:00
## C
2020-08-02 12:19:43 +00:00
`long ftell( short int stream );`
2018-07-27 13:34:34 +00:00
## ASM
2018-06-18 08:44:02 +00:00
**In:**
2018-08-08 15:13:37 +00:00
`lda stream`
`>SYSCALL ftell`
2018-10-11 15:23:06 +00:00
## RETURN VALUE
2018-08-08 15:13:37 +00:00
On stack (long)
2018-06-18 08:44:02 +00:00
2018-06-28 15:26:34 +00:00
# Remove
2018-10-04 06:13:44 +00:00
Remove a file or directory
## C
2020-08-02 12:19:43 +00:00
`int remove ( const char *pathname );`
2018-10-04 06:13:44 +00:00
## ASM
**In:**
2020-06-07 08:06:51 +00:00
`>LDYA pathname`
2018-10-04 06:13:44 +00:00
`>SYSCALL remove`
2018-10-11 15:23:06 +00:00
## RETURN VALUE
2018-06-18 08:44:02 +00:00
# Rename
Rename a file
2018-08-08 15:13:37 +00:00
## C
2020-08-02 12:19:43 +00:00
`int rename ( const char * oldpath, const char * newpath );`
2018-08-08 15:13:37 +00:00
## ASM
2018-06-18 08:44:02 +00:00
**In:**
2020-02-16 20:45:16 +00:00
`>PUSHW oldpath`
2018-08-08 15:13:37 +00:00
`>PUSHW newpath`
`>SYSCALL rename`
2018-10-11 15:23:06 +00:00
## RETURN VALUE
2018-06-18 08:44:02 +00:00
2020-02-16 20:45:16 +00:00
# PrintF (BLOCKING)
# FPrintF (BLOCKING)
# SPrintF
Prints C-Style String
## C
`int printf ( const char *format, ... );`
`int fprintf ( short int stream, const char *format, ... );`
`int sprintf ( char *str, const char *format, ... );`
## ASM
**In:**
PrintF : (example is for printing Y,A as integer : format="%I", 2 bytes)
2020-02-16 20:45:16 +00:00
`>PUSHW format`
`>PUSHW i`
`...`
`>PUSHBI 2` #bytecount
2020-06-07 08:06:51 +00:00
`>SYSCALL PrintF`
FPrintF :
2020-02-16 20:45:16 +00:00
`>PUSHB hFILE`
`>PUSHW format`
`>PUSHW i`
`...`
`>PUSHBI 2` #bytecount
`>SYSCALL fprintf`
SPrintF :
2020-02-16 20:45:16 +00:00
`>PUSHW str`
`>PUSHW format`
`>PUSHW i`
`...`
`>PUSHBI 2` #bytecount
`>SYSCALL sprintf`
## RETURN VALUE
CC : success, Y,A = bytes sent
CS : error, A = code from Output
Specifiers :
+ %b : pull 1 byte to Print BIN
2020-02-16 20:45:16 +00:00
+ %d : pull 1 byte unsigned DEC 0..255
+ %D : pull 2 bytes unsigned DEC 0..65535
+ %u : pull 4 bytes long unsigned DEC 0..4294967295
+ %e : pull 5 Bytes float (-)1.23456789e+12
+ %f : pull 5 Bytes float (-)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 4 bytes signed DEC -2147483648..2147483647
+ %s : pull 2 bytes ptr to C-Style String
+ %S : pull 2 bytes ptr to P-Style String
+ \b : Print 'BS' (08)
+ \e : Print 'ESC' ($1B,27)
+ \f : Print 'FF' ($0C,12)
+ \n : Print 'LF' ($0A,10)
+ \r : Print 'CR' ($0D,13)
+ \t : Print 'TAB' ($09,09)
+ \v : Print 'VT' ($0B,11)
+ \xHH : Print byte with hexadecimal value HH (1 to 2 digits)
+ \\\\ : Print \
+ \\% : Print %
Modifiers for len and padding :
2020-02-16 20:45:16 +00:00
+ %d : '9' '12'
+ %2d : ' 9' '12'
+ %02d : '09' '12'
+ %11s : 'ABCDEFGH '
2020-02-16 20:45:16 +00:00
+ %011s : 'ABCDEFGH000'
+ %2f : '3.14'
# ScanF (BLOCKING)
# FScanF (BLOCKING)
# SScanF
Read formatted data from string
## C
2020-08-02 12:19:43 +00:00
`int scanf( const char *format, ... );`
`int fscanf( short int stream, const char *format, ... );`
2020-02-16 20:45:16 +00:00
`int sscanf ( const char *s, const char *format, ... );`
## ASM
**In:**
ScanF :
`>PUSHW format`
`>PUSHW ptr`
`...`
`>PUSHB bytecount`
`>SYSCALL scanf`
FScanF :
`>PUSHB stream`
`>PUSHW format`
`>PUSHW ptr`
`...`
`>PUSHB bytecount`
`>SYSCALL fscanf`
SScanF :
`>PUSHW s`
`>PUSHW format`
`>PUSHW ptr`
`...`
`>PUSHB bytecount`
`>SYSCALL sscanf`
Specifiers :
+ %i : short int
+ %d : byte
+ %I : int
+ %D : word
+ %L : long int
+ %U : dword
+ %h : HEX byte
+ %H : HEX word
+ %s : string
TODO : %10s
## RETURN VALUE
A = Number of arguments filled.
2020-06-07 08:06:51 +00:00
# StrToF
2018-06-18 08:44:02 +00:00
Convert String to 40 bits Float
2018-10-04 15:30:14 +00:00
## C
2020-08-02 12:19:43 +00:00
`float strtof (const char* str, char** endptr );`
2018-06-18 08:44:02 +00:00
2018-10-04 15:30:14 +00:00
## ASM
2018-06-18 08:44:02 +00:00
**In:**
2020-06-07 08:06:51 +00:00
`>PUSHW str`
2018-06-18 08:44:02 +00:00
`>PUSHWI EndPtr`
2020-06-07 08:06:51 +00:00
`>SYSCALL StrToF`
2018-10-11 15:23:06 +00:00
## RETURN VALUE
2018-06-18 08:44:02 +00:00
On stack (float)
# AToF
Convert String to 40 bits Float
## C
2020-08-02 12:19:43 +00:00
`float atof ( const char* str );`
2018-06-18 08:44:02 +00:00
## ASM
**In:**
`>LDYA str`
2018-06-18 15:48:00 +00:00
`>SYSCALL atof`
2018-10-11 15:23:06 +00:00
## RETURN VALUE
2018-06-18 08:44:02 +00:00
On stack (float)
# StrToL/StrToUL
Convert String to 32 bits (unsigned) int
## C
`long strtol (const char* str, char** endptr, int base);`
`unsigned long strtoul (const char* str, char** endptr, int base);`
## ASM
**In:**
2020-02-16 20:45:16 +00:00
`>PUSHW str`
`>PUSHW EndPtr`
2018-06-18 08:44:02 +00:00
`>PUSHB Base`
2020-06-07 08:06:51 +00:00
`>SYSCALL StrToL`
2018-10-11 15:23:06 +00:00
## RETURN VALUE
2018-06-18 08:44:02 +00:00
On stack (long)
2018-06-18 15:48:00 +00:00
# atol
Convert String to 32 bits long
2018-06-18 08:44:02 +00:00
## C
`long atol ( const char * str );`
## ASM
**In:**
`>LDYA str`
2018-06-18 15:48:00 +00:00
`>SYSCALL atol`
2018-10-11 15:23:06 +00:00
## RETURN VALUE
2018-06-18 08:44:02 +00:00
On stack (long)
2018-06-18 15:48:00 +00:00
# atoi
Convert String to 16 bits int
2018-06-18 08:44:02 +00:00
## C
`int atoi ( const char * str );`
## ASM
**In:**
2018-06-18 15:48:00 +00:00
`>LDYAI str`
`>SYSCALL atoi`
2018-10-11 15:23:06 +00:00
## RETURN VALUE
2018-06-18 15:48:00 +00:00
Y,A = int
2018-06-18 08:44:02 +00:00
2018-08-21 13:12:47 +00:00
# RealPath
2018-06-18 08:44:02 +00:00
Return the canonicalized absolute pathname
2018-06-18 15:48:00 +00:00
2020-02-16 20:45:16 +00:00
## C / CSH
`char *realpath(const char *path, char *resolvedpath);`
2018-06-18 15:48:00 +00:00
## ASM
2018-06-18 08:44:02 +00:00
**In:**
2020-02-16 20:45:16 +00:00
`>PUSHW path`
`>PUSHW resolvedpath`
2018-06-18 15:48:00 +00:00
`>SYSCALL realpath`
2018-10-11 15:23:06 +00:00
## RETURN VALUE
2018-06-18 15:48:00 +00:00
CC : success
2019-11-25 07:05:07 +00:00
Y,A = Ptr to Full Path (C-String Buffer, MLI.MAXPATH+1)
2018-06-18 15:48:00 +00:00
X = hMem of Full Path
CS : A = Error Code
2018-06-18 08:44:02 +00:00
2020-02-16 20:45:16 +00:00
# Expand
## C
`char *expand(const char *str, char *expanded);`
## ASM
`>PUSHW str`
`>PUSHW expanded`
`>SYSCALL expand`
## RETURN VALUE
2021-08-05 11:35:37 +00:00
if expanded == null
Y,A = PTR to Expanded String
X = hMem to Expanded String
if expanded = null
Y,A = strlen
2020-02-16 20:45:16 +00:00
# LoadStkObj
Load a file in AUX memory (Stock Objects)
PUSHW = PATH (Handled by....
PUSHB = MODE ...
PUSHB = TYPE ...
PUSHW = AUXTYPE ...FOpen)
## RETURN VALUE
Y,A = File Length
X = hMem of Loaded Object in AUX mem
# GetStkObj
## C
`int *ptr getstkobj (short int hStkObj);`
## ASM
`lda hStkObj`
`>SYSCALL GetStkObj`
## RETURN VALUE
CC : success
X = hMem
Y,A = ptr
CS : error
A = EC
2018-06-18 08:44:02 +00:00
# StrLen
Returns Length of C-String
## C
2018-06-19 15:08:22 +00:00
`int strlen ( char * str);`
2018-06-18 08:44:02 +00:00
## ASM
2018-06-19 15:08:22 +00:00
`>LDYAI str`
`>SYSCALL strlen`
2018-10-11 15:23:06 +00:00
## RETURN VALUE
2018-06-18 08:44:02 +00:00
Y,A = String length
# StrCat
Concatenate strings
## C
`char * strcat ( char * destination, const char * source );`
## ASM
**In:**
2021-05-04 17:31:21 +00:00
`>PUSHWI destination`
2018-06-18 08:44:02 +00:00
`>PUSHWI source`
`>SYSCALL strcat`
2018-10-11 15:23:06 +00:00
## RETURN VALUE
2018-06-18 08:44:02 +00:00
Y,A = destination
# StrCpy
Copy string
## C
`char * strcpy ( char * destination, const char * source );`
## ASM
**In:**
2021-05-04 17:31:21 +00:00
`>PUSHWI destination`
2018-06-18 08:44:02 +00:00
`>PUSHWI source`
`>SYSCALL strcpy`
2018-10-11 15:23:06 +00:00
## RETURN VALUE
2018-06-18 08:44:02 +00:00
Y,A = destination
2018-12-20 21:56:44 +00:00
# StrDup
Create a new copy of this C-String
2020-08-25 10:56:00 +00:00
## C
`char * strdup ( char * str);`
## ASM
Y,A = Ptr to source C-String
2018-12-20 21:56:44 +00:00
CC : success
Y,A = PTR to String
2019-11-25 07:05:07 +00:00
X = hMem (C-String)
2018-12-20 21:56:44 +00:00
CS : error
A = SYS error code
2018-06-18 08:44:02 +00:00
# StrUpr/StrLwr
Convert string to UPPERCASE/lowercase
2018-09-06 12:27:37 +00:00
## C
`int strupr ( char * str);`
`int strlwr ( char * str);`
## ASM
**In:**
`>LDYAI str`
`>SYSCALL strupr`
`>SYSCALL strlwr`
2018-10-11 15:23:06 +00:00
## RETURN VALUE
2018-06-18 08:44:02 +00:00
Uppercased/lowercased String in Buffer
2018-09-06 12:27:37 +00:00
Y,A = str
2018-06-18 08:44:02 +00:00
# StrCmp
Compare 2 strings
2018-09-06 12:27:37 +00:00
## C
`int strcmp(const char *s1, const char *s2);`
## ASM
2018-06-18 08:44:02 +00:00
**In:**
2021-05-04 17:31:21 +00:00
`>PUSHWI s1`
2018-09-06 12:27:37 +00:00
`>PUSHWI s2`
`>SYSCALL strcmp`
2018-10-11 15:23:06 +00:00
## RETURN VALUE
2018-09-06 12:27:37 +00:00
CC : match
CS : no match
CC, Y,A=0
CS, Y,A > 0 or < 0
2018-06-18 08:44:02 +00:00
2018-09-06 12:27:37 +00:00
# StrCaseCmp
Compare 2 strings, ignoring case
## C
`int strcasecmp(const char *s1, const char *s2);`
## ASM
2018-06-18 08:44:02 +00:00
**In:**
2021-05-04 17:31:21 +00:00
`>PUSHWI s1`
2018-09-06 12:27:37 +00:00
`>PUSHWI s2`
`>SYSCALL strcasecmp`
2018-10-11 15:23:06 +00:00
## RETURN VALUE
2018-09-06 12:27:37 +00:00
CC : match
CS : no match
2018-06-18 08:44:02 +00:00
CC, Y,A=0
CS, Y,A > 0 or < 0
2021-05-04 17:31:21 +00:00
# StrVSet
## ASM
`>PUSHB hSTRV`
`>PUSHW id`
`>PUSHW ptr`
`>SYSCALL StrVSet`
## RETURN VALUE
2020-06-07 08:06:51 +00:00
# StrVGet
2020-02-06 16:23:59 +00:00
## ASM
`>PUSHB hSTRV`
2021-05-04 17:31:21 +00:00
`>PUSHW id`
2020-06-07 08:06:51 +00:00
`>PUSHW ptr`
`>SYSCALL StrVGet`
2020-01-24 14:21:08 +00:00
## RETURN VALUE
2020-06-07 08:06:51 +00:00
CC: Y,A = Ptr
CS: Y,A = NULL
2020-01-24 14:21:08 +00:00
2021-05-04 17:31:21 +00:00
# StrVNew
2020-02-06 16:23:59 +00:00
## ASM
2021-05-04 17:31:21 +00:00
`>LDYA size`
`>SYSCALL StrVNew`
2020-02-06 16:23:59 +00:00
## RETURN VALUE
2021-05-04 17:31:21 +00:00
# StrVFree
2020-02-06 16:23:59 +00:00
## ASM
2021-05-04 17:31:21 +00:00
`lda hSTRV`
`>SYSCALL StrVFree`
2020-01-24 14:21:08 +00:00
## RETURN VALUE
2018-06-18 08:44:02 +00:00
# Time
Get System Time in Buffer
## C
`void time (struct tm* timeptr);`
2018-06-18 08:44:02 +00:00
2018-10-04 15:30:14 +00:00
## ASM
2020-01-18 19:55:03 +00:00
`>PUSHW timer`
2018-10-11 15:23:06 +00:00
`>SYSCALL time`
## RETURN VALUE
2018-06-18 08:44:02 +00:00
S.TIME filled with System date/time
# StrFTime
## C
Convert S.TIME struct to CSTR
`void strftime (char* str, const char* format, const struct tm* timeptr );`
2018-06-18 08:44:02 +00:00
## ASM
2020-01-21 16:35:11 +00:00
`>PUSHW str`
2020-01-18 19:55:03 +00:00
`>PUSHW format`
2018-06-18 08:44:02 +00:00
+ %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
2020-01-20 07:23:51 +00:00
`>PUSHW timeptr`
2018-10-11 15:23:06 +00:00
`>SYSCALL strftime`
## RETURN VALUE
2018-06-18 08:44:02 +00:00
none. always succeed.
2020-01-21 16:35:11 +00:00
# PTime2Time
Convert ProDOS Time To S.TIME
## C
`void PTime2Time (long* ptime, const struct tm* timeptr );`
2020-01-21 16:35:11 +00:00
## ASM
`>PUSHW ptime`
`>PUSHW timer`
`>SYSCALL PTime2Time`
## RETURN VALUE
# CTime2Time
Convert CTime Time To S.TIME
## C
`void CTime2Time (long* ctime, const struct tm* timeptr );`
2020-01-21 16:35:11 +00:00
## ASM
`>PUSHW ctime`
`>PUSHW timer`
`>SYSCALL CTime2Time`
## RETURN VALUE
2019-11-25 07:05:07 +00:00
# open
## C
`hFD open(const char *pathname, short int flags);`
## ASM
**In:**
2021-05-14 20:58:20 +00:00
`>PUSHW pathname`
2019-11-25 07:05:07 +00:00
`>PUSHB flags`
`>SYSCALL open`
## RETURN VALUE
A = hFD
REG File created on ProDOS : T=TXT,X=$0000
# close
## C
`int close(hFD fd);`
## ASM
**In:**
`lda fd`
`>SYSCALL close`
# read
## C
`int read(hFD fd, void *buf, int count);`
## ASM
**In:**
2021-05-14 20:58:20 +00:00
`>PUSHB fd`
2019-11-25 07:05:07 +00:00
`>PUSHW buf`
2021-05-14 20:58:20 +00:00
`>PUSHW count`
2019-11-25 07:05:07 +00:00
`>SYSCALL read`
## RETURN VALUE
CC: Y,A = bytes read
CS: A = EC
# write
## C
`int write(hFD fd, const void *buf, int count);`
## ASM
**In:**
2021-05-14 20:58:20 +00:00
`>PUSHB fd`
2019-11-25 07:05:07 +00:00
`>PUSHW buf`
2021-05-14 20:58:20 +00:00
`>PUSHW count`
2019-11-25 07:05:07 +00:00
`>SYSCALL write`
## RETURN VALUE
CC: Y,A = bytes written
CS: A = EC
2021-05-14 20:58:20 +00:00
# LSeek
Set the file-position indicator for hFD
## C
`int lseek( short int hFD, long offset, short int whence );`
## ASM
**In:**
`>PUSHB hFD`
`>PUSHL offset`
`>PUSHB whence`
`>SYSCALL fseek`
2020-06-07 08:06:51 +00:00
# ChOwn
## C
`short int chown(const char *pathname, short int owner, short int group);`
## ASM
**In:**
`>PUSHW pathname`
`>PUSHB owner`
`>PUSHB group`
`>SYSCALL chown`
## RETURN VALUE
## License
2019-12-16 21:36:35 +00:00
A2osX is licensed under the GNU General Public License.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
The full A2osX license can be found **[Here](../LICENSE)**.
*** End of Auto generated file ***