35 KiB
*** Auto generated by docgen.cmd ***
Copyright
Copyright 2015 - 2025, Remy Gibert and the A2osX contributors.
Shift
ASM
A = argument index.
RETURN VALUE
CC : success
Y,A = PTR To Arg[A]
CS : Out Of Bound
ArgV
ASM
A = argument index.
RETURN VALUE
CC : success
Y,A = PTR To Arg[A]
CS : Out Of Bound
LoadDrv
ASM
Y,A = PTR to "NAME.DRV [PARAM]" C-String
RETURN VALUE
none
InsDrv
ASM
>SS
>PUSHW src
>PUSHW drvcsstart
>PUSHW drvcsend
>PUSHW drvidend
>KAPI insdrv
>SR
RETURN VALUE
Y,A = Ptr to installed driver
GetDevByName
Y,A = Ptr to device name (C-String)
RETURN VALUE
CC = OK, CS = ERROR
Y,A = hFD
MkFD
C
int int mkfd(short int type);
ASM
>SS
>PUSHB DevID
>LIBC MKFD
>SR
RETURN VALUE
A = hFD
MKDev
Create a CDEV or BDEV
C
int mkdev (S.FD *fd, const char *devname)
ASM
>SS
>PUSHW fd
>PUSHW devname
>LIBC mkdev
>SR
RETURN VALUE
Y,A = hDEV
IOCTL
C
int ioctl(int fd, short int request, void *param);
ASM
>SS
>PUSHW fd
>PUSHB request
>PUSHW param
>LIBC IOCTL
>SR
RETURN VALUE
Y,A = ...
OpenDir
C
#include <dirent.h>
DIR *opendir(const char *name);
ASM
>LDYA name
>LIBC opendir
RETURN VALUE
CC : success
Y,A = pDIR
CS : error
A = EC
ReadDir
C
#include <dirent.h>
struct dirent *readdir(DIR *dirp);
ASM
>LDYA dirp
>LIBC readdir
RETURN VALUE
CC : success
Y,A = pDIRENT
CS : error
A = EC
note : A = 0 means no more entry
CloseDir
C
#include <dirent.h>
int closedir(DIR *dirp);
ASM
>LDYA dirp
>LIBC closedir
RETURN VALUE
none, always succeed.
PutEnv
Change or add an environment variable, string is 'NAME=VALUE'
C / CSH
#include <stdlib.h>
int putenv(char *string);
ASM
>LDYA string
>LIBC putenv
RETURN VALUE
CC, Y,A = 0
CS, Y,A = -1, ERRNO
SetEnv
Change or add an environment variable
C / CSH
#include <stdlib.h>
int setenv(const char *envname, const char *envval, int overwrite);
ASM
>SS
>PUSHW envname
>PUSHW envval
>PUSHW overwrite
>LIBC setenv
>SR
RETURN VALUE
CC, Y,A = 0
CS, Y,A = -1, ERRNO
GetEnv
searches the environment list to find the environment variable name,
and returns a pointer to the corresponding value string.
C / CSH
#include <stdlib.h>
char *getenv(const char *name);
ASM
>LDYA name
>LIBC getenv
RETURN VALUE
CC : Y,A = PTR to VALUE (C-String)
CS : Y,A = NULL
UnsetEnv
Remove an environment variable
C / CSH
#include <stdlib.h>
int unsetenv(const char *name);
ASM
>LDYA name
>LIBC unsetenv
RETURN VALUE
CC, Y,A = 0
CS, Y,A = -1, X=ERRNO
GetErrMsg
Get error description for this errcode
C / CSH
int geterrmsg(short int errcode, char *buf);
ASM
>PUSHB errcode
>PUSHW buf
>LIBC GetErrMsg
RETURN VALUE
FAdd,FSub,FMul,FDiv,FMod
Return X*Y, X/Y, X+Y, X-Y
ASM
>PUSHF X (float)
>PUSHF Y (float)
>FPU fmul
>FPU fdiv
>FPU fmod TODO
>FPU fadd
>FPU fsub
RETURN VALUE
On stack (float)
float
Return 'floated' long
C
`float f = (float)l;
ASM
>PUSHL l (long)
>FPU float
RETURN VALUE
On stack (float)
Add32,Sub32,Mul32,IMul32,Div32,IDiv32,Mod32,IMod32,Cmp32,ICmp32
Return X+Y, X-Y, X*Y, X/Y, X mod Y....
ASM
>PUSHL X (long)
>PUSHL Y (long)
>FPU add32
...
RETURN VALUE
On stack (long)
GetMemStat
Y,A = Ptr to S.MSTAT buffer
RETURN VALUE
Buffer filled with memory stats
GetBufData
ASM
>SS
>PUSHW hBuf
>PUSHW start
>PUSHW len
>PUSHW dst
>KAPI GetBufData
>SR
GetBuf
ASM
>LDA Size
>KAPI GetBuf
RETURN VALUE
Y,A = hBuf (Y=RWBnk, A = BitMask)
lrintf
Return float rounded into a long
C
#include <math.h>
long int lrintf (float x);
ASM
>SL
>SS
>PUSHF x
>LIBC lrintf
>SR
RETURN VALUE
On stack (long)
Logf,sqrtf,Expf,Cosf,Sinf,Tanf,ATanf
Return Log(x), Sqr(x), E^X, Cos(x), Sin(X), Tan(x), ATan(x)
C
#include <math.h>
float logf ( float x);
float sqrtf ( float x);
float expf ( float x);
float cosf ( float x);
float sinf ( float x);
float tanf ( float x);
float atanf ( float x);
ASM
>SF
>SS
>PUSHF x (Float)
>LIBC logf
>SR
RETURN VALUE
On stack (Float)
powf
Return the value of x raised to the power y
C
#include <math.h>
float powf(float x, float y);
ASM
>SF
>SS
>PUSHF x
>PUSHF y
>LIBC powf
>SR
RETURN VALUE
On stack (float)
MD5
Return MD5 Hash for input String
C
void md5 (const char* str, char* digest);
ASM
>SS
>PUSHW str
>PUSHW digest
>LIBC md5
>SR
RETURN VALUE
CC
MD5Init
Initialize a MD5 computation
C
void *md5init();
ASM
>LIBC MD5Init
RETURN VALUE
Y,A = pMD5
MD5Update
Add Data to MD5 computation
C
void md5update (void *md5, char *data, int len);
ASM
>SS
>PUSHW md5
>PUSHW data
>PUSHW len
>LIBC MD5Update
>SR
RETURN VALUE
MD5Finalize
C
void md5finalize (void *md5, char* digest);
ASM
>SS
>PUSHW md5
>PUSHW digest
>LIBC MD5Finalize
>SR
RETURN VALUE
Realloc
C / CSH
#include <stdlib.h>
void *realloc(void *ptr, size_t size);
ASM
>SS
>PUSHW ptr
>PUSHW size
>LIBC realloc
>SR
RETURN VALUE
YA = ptr
X = hMem
Malloc
C / CSH
#include <stdlib.h>
void *malloc(size_t size);
ASM
>LDYAI size
>LIBC malloc
RETURN VALUE
CC : success
YA = PTR to Mem (Uninitialised)
- X = hMem
CS :
A = EC
Free
C / CSH
#include <stdlib.h>
void free(void *ptr);
ASM
>LDYA ptr
>LIBC free
RETURN VALUE
none.
PTime2Time
Convert ProDOS Time To S.TM
C
#include <prodos.h>
void PTime2Time (long ptime, const struct tm* timeptr);
ASM
>SS
>PUSHL ptime
>PUSHW timeptr
>LIBC PTime2Time
>SR
RETURN VALUE
Online
Get ProDOS Volume Info
C
#include <prodos.h>
int online(int volid, void *buf);
ASM
>PUSHB volid
>PUSHW buf
>LIBC Online
RETURN VALUE
ChTyp
Change Type of a ProDOS File
C
#include <prodos.h>
int chtyp(const char *filepath, int filetype);
ASM
>PUSHW filepath
>PUSHW filetype
>LIBC ChTyp
RETURN VALUE
ChAux
Change AuxType of a ProDOS File
C
#include <prodos.h>
int chaux(const char *filepath, int auxtype);
ASM
>PUSHW filepath
>PUSHW auxtype
>LIBC ChAux
RETURN VALUE
ChAttr
Change Attributes of a ProDOS File
C
#include <prodos.h>
int chattr(const char *filepath, int attributes);
ASM
>PUSHW filepath
>PUSHW attributes
>LIBC chattr
RETURN VALUE
ExecV
C / CSH
#include <unistd.h>
int execv(const char* argv[], int flags);
ASM
>SS
>PUSHW argv
>PUSHW flags
>LIBC execv
>SR
RETURN VALUE
Y,A = Child PSID
ExecL
C / CSH
#include <unistd.h>
int execl(const char *args, int flags);
ASM
>SS
>PUSHW args
>PUSHW flags
>LIBC execl
>SR
RETURN VALUE
Y,A = Child PSID
Fork
C / CSH
#include <unistd.h>
pid_t fork(void);
ASM
>LIBC fork
RETURN VALUE
A = Child PSID
Kill
C
#include <signal.h>
int kill(int pid, int sig);
ASM
>SS
>PUSHW pid
>PUSHW sig
>LIBC Kill
>SR
RETURN VALUE
GetPS(int PID)
C
void *getps (int PID);
ASM
>LDYA PID
>LIBC GetPS
RETURN VALUE
Y,A = Ptr to PS struct
LoadTxtFile
Load TXT a file in memory (with ending 0)
C
void *loadtxtfile ( const char * filename );
ASM
>LDYA filename
>LIBC loadtxtfile
RETURN VALUE
Y,A = Ptr to loaded file
LoadFile
Load a file in memory
C
void *loadfile(const char *filename, short int flags, short int ftype, int auxtype);
ASM
>SS
>PUSHW filename
>PUSHB flags
>PUSHB ftype
>PUSHW auxtype
>LIBC loadfile
>SR
RETURN VALUE
Y,A = Ptr to loaded file
FileSearch
Search a file in the provided PATH list
And return, if found, the full path to it.
C
int filesearch(char *filename, char *searchpath, char *fullpath, stat *filestat);
ASM
>SS
>PUSHW filename
>PUSHW fullpath
>PUSHW searchpath
>PUSHW filestat
>LIBC filesearch
>SR
RETURN VALUE
CC : success
DstBuf = FilePath
DstStat = S.STAT
CS : not found
GetPWUID
C
#include <pwd.h>
struct passwd *getpwuid(uid_t uid);
ASM
>LDYA uid
>LIBC getpwuid
RETURN VALUE
GetPWName
C
#include <pwd.h>
struct passwd *getpwnam(const char *name);
ASM
>LDYA name
>LIBC getpwname
RETURN VALUE
GetGRGID
C
#include <grp.h>
struct group *getgrgid(gid_t gid);
ASM
>LDYA gid
>LIBC getgrgid
RETURN VALUE
GetGRName
C
#include <grp.h>
struct group *getgrnam(const char *name);
ASM
>LDYA name
>LIBC getgrname
RETURN VALUE
SListGetData
ASM
>SS
>PUSHW pSList
>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)
>KAPI SListGetData
>SR
RETURN VALUE
Y,A = DataPtr
SListAddData
ASM
>SS
>PUSHW pSList
>PUSHW KeyID
>PUSHW DataPtr
>PUSHW DataLen (Data bytes to add, 0 if String mode)
>KAPI SListAddData
>SR
RETURN VALUE
SListSetData
ASM
>SS
>PUSHW pSList
>PUSHW KeyID
>PUSHW DataPtr
>PUSHW DataLen (Data bytes to set, 0 if String mode)
>KAPI SListSetData
>SR
RETURN VALUE
SListGetByID
ASM
>SS
>PUSHW pSList
>PUSHW KeyID
>PUSHW KeyPtr
>KAPI SListGetByID
>SR
RETURN VALUE
Y,A = Next KeyID
SListNewKey
ASM
>SS
>PUSHW pSList
>PUSHW KeyPtr
>PUSHW ScopeID
>PUSHWI NextPtr
>KAPI SListNewKey
>SR
RETURN VALUE
Y,A = KeyID
SListLookup
ASM
>SS
>PUSHW pSList
>PUSHW KeyPtr
>PUSHW ScopeID
>PUSHWI NextPtr
>KAPI SListLookup
>SR
RETURN VALUE
Y,A = KeyID
SListFree
ASM
>LDYA pSList
>KAPI SListFree
RETURN VALUE
SListNew
ASM
lda Opt
>KAPI SListNew
RETURN VALUE
Y,A=pSList
Socket
C / CSH
#include <sys/socket.h>
int socket(int socket_family, int socket_type, int protocol);
ASM
>SS
>PUSHWI socket_family
>PUSHWI socket_type
>PUSHWI protocol
>LIBC Socket
>SR
RETURN VALUE
CC = success
YA = sockfd
Bind
C / CSH
#include <sys/socket.h>
int bind(int socket, const struct sockaddr *address, socklen_t address_len);
ASM
>SS
>PUSHW socket
>PUSHW address
>PUSHWI address_len
>LIBC Bind
>SR
RETURN VALUE
CC = success
Connect
C / CSH
#include <sys/socket.h>
int connect(int socket, const struct sockaddr *address, socklen_t address_len);
ASM
>SS
>PUSHW socket
>PUSHW address
>PUSHWI address_len
>LIBC Connect
>SR
RETURN VALUE
CC = success
Listen
C / CSH
#include <sys/socket.h>
int listen(int socket, int backlog);
ASM
>SS
>PUSHW socket
>PUSHWI backlog
>LIBC Listen
>SR
RETURN VALUE
CC = success
Accept
C / CSH
#include <sys/socket.h>
int accept(int socket, struct sockaddr *restrict address, socklen_t *restrict address_len);
ASM
>SS
>PUSHW socket
>PUSHW address
>PUSHWI address_len
>LIBC Accept
>SR
RETURN VALUE
CC = success
YA = hFD
CS = error
YA = -1 (ERRNO)
Shutdown
C / CSH
#include <sys/socket.h>
int shutdown(int socket, int how);
ASM
>SS
>PUSHW socket
>PUSHWI how
>LIBC Shutdown
>SR
RETURN VALUE
CC = success
Recv
C / CSH
#include <sys/socket.h>
ssize_t recv(int socket, void *buffer, size_t length, int flags);
ASM
>SS
>PUSHW socket
>PUSHW buffer
>PUSHW length
>PUSHW flags
>LIBC Recv
>SR
RETURN VALUE
CC = success
RecvFrom
C / CSH
#include <sys/socket.h>
ssize_t recvfrom(int socket, void *restrict buffer, size_t length,
int flags, struct sockaddr *restrict address,
socklen_t *restrict address_len);
ASM
>SS
>PUSHW socket
>PUSHW buffer
>PUSHWI length
>PUSHWI flags
>PUSHW dest_addr
>PUSHWI address_len
>LIBC RecvFrom
>SR
RETURN VALUE
CC = success
Send
C / CSH
#include <sys/socket.h>
ssize_t send(int socket, const void *buffer, size_t length, int flags);
ASM
>SS
>PUSHW socket
>PUSHW message
>PUSHW length
>PUSHW flags
>LIBC Send
>SR
RETURN VALUE
CC = success
SendTo
C / CSH
#include <sys/socket.h>
ssize_t sendto(int socket, const void *message, size_t length,
int flags, const struct sockaddr *dest_addr,
socklen_t dest_len);
ASM
>SS
>PUSHW socket
>PUSHW message
>PUSHWI length
>PUSHWI flags
>PUSHW dest_addr
>PUSHWI address_len
>LIBC SendTo
>SR
RETURN VALUE
CC = success
GetPeerName
C / CSH
#include <sys/socket.h>
int getpeername(int socket, struct sockaddr *restrict address, socklen_t *restrict address_len);
ASM
>SS
>PUSHW socket
>PUSHW address
>PUSHWI address_len
>LIBC GetPeerName
>SR
RETURN VALUE
CC = success
CS = error
GetSockName
C / CSH
#include <sys/socket.h>
int getsockname(int socket, struct sockaddr *restrict address, socklen_t *restrict address_len);
ASM
>SS
>PUSHW socket
>PUSHW address
>PUSHWI address_len
>LIBC GetSockName
>SR
RETURN VALUE
CC = success
CS = error
ChMod
change permissions of a file
C
#include <sys/stat.h>
int chmod(const char *path, mode_t mode);
ASM
>SS
>PUSHW path
>PUSHW mode
>LIBC chmod
>SR
RETURN VALUE
Stat
Return information about a file
C
#include <sys/stat.h>
int stat(const char *pathname, struct stat *statbuf);
ASM
>SS
>PUSHW pathname
>PUSHW statbuf
>LIBC stat
>SR
RETURN VALUE
FStat
Return information about a FD
C
#include <sys/stat.h>
int fstat(int fd, struct stat *statbuf);
ASM
>SS
>PUSHW fd
>PUSHW statbuf
>LIBC fstat
>SR
RETURN VALUE
MKDir
create a directory
C
int mkdir(const char *pathname, int mode);
ASM
>SS
>PUSHW pathname
>PUSHW mode
>LIBC mkdir
>SR
RETURN VALUE
CC : success
CS : error
A = EC
MKFIFO
return a pathname to a new FIFO
C
#include <sys/stat.h>
int mkfifo(const char *path, mode_t mode);
ASM
>SS
>PUSHW path
>PUSHW mode
>LIBC mkfifo
>SR
RETURN VALUE
CC = OK, CS = ERROR
MkNod
Create a special or ordinary file.
(CDEV, BDEV, DSOCK, SSOCK, PIPE)
C
#include <sys/stat.h>
int mknod(const char *pathname, mode_t mode, dev_t dev);
ASM
>SS
>PUSHW pathname
>PUSHW mode
>PUSHW dev
>LIBC mknod
>SR
RETURN VALUE
CC = OK, CS = ERROR
pipe
C
hFD pipe(int size);
ASM
>LDYA size
>LIBC pipe
RETURN VALUE
CC = OK, CS = ERROR
A = hFD
fileno
map a stream pointer to a file descriptor
C / CSH
#include <stdio.h>
int fileno(FILE *stream);
ASM
>LDYA stream
>LIBC fileno
RETURN VALUE
CC = success
YA = fildes
fputc (BLOCKING)
Print A (char) to hFILE
C / CSH
#include <stdio.h>
int fputc(int c, FILE *stream);
ASM
>PUSHW character
>PUSHW stream
>LIBC fputc
RETURN VALUE
CC = success
putchar (BLOCKING)
Print A (char) to StdOut
C / CSH
#include <stdio.h>
int putchar ( int c );
ASM
lda c
>LIBC putchar
RETURN VALUE
CC = success
puts (BLOCKING)
Write Str to StdOut, appends '\r\n'
C / CSH
#include <stdio.h>
int puts ( const char * str );
ASM
>LDYAI str
>LIBC PutS
RETURN VALUE
CC : success Y,A > 0
CS : Y,A = EOF
fputs (BLOCKING)
Write Str to FILE
C / CSH
#include <stdio.h>
int fputs (const char *s, FILE *stream);
ASM
>SS
>PUSHW s
>PUSHW stream
>LIBC fputs
>SR
RETURN VALUE
CC = success
fgets (BLOCKING)
read bytes from stream into the array
pointed to by s, until n-1 bytes are read, or a is read and
transferred to s, or an end-of-file condition is encountered. The
string is then terminated with a null byte.
C / CSH
#include <stdio.h>
char *fgets(char *s, int n, FILE *stream);
ASM
>PUSHW s
>PUSHW n
>PUSHW FILE
>LIBC fgets
RETURN VALUE
Y,A: s
CC = success
getchar (BLOCKING)
Get char from StdIn
C / CSH
#include <stdio.h>
int getchar (void);
ASM
>LIBC getchar
RETURN VALUE
CC = success
A = char
getc (BLOCKING)
Get char from Node
C / CSH
#include <stdio.h>
int getc(FILE *stream);
ASM
>LDYA pStream
>LIBC getc
RETURN VALUE
CC = success
A = char
ungetc
push byte back into input stream
C / CSH
#include <stdio.h>
int ungetc(int c, FILE *stream);
ASM
>SS
>PUSHW stream
>PUSHW c
>SR
>LIBC ungetc
RETURN VALUE
CC = success
A = char
FOpen
Open a file
C / CSH
#include <stdio.h>
FILE *fopen ( const char *filename, short int flags, short int ftype, int auxtype );
ASM
>SS
>PUSHW filename
>PUSHB flags
- 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
>PUSHB ftype
>PUSHW auxtype
>LIBC FOpen
>SR
DESCRIPTION
TODO: replace flags/ftype/auxtype with mode="w+,t=TYP,x=AUXTYPE"
- 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
RETURN VALUE
CC : YA = pFILE
CS : YA = EC
FClose
Close a file
C / CSH
#include <stdio.h>
int fclose(FILE *stream);
ASM
>LDYA stream
>LIBC FClose
RETURN VALUE
FRead (BLOCKING)
Read bytes from file
C
#include <stdio.h>
int fread (FILE *stream, void * ptr, int count );
ASM
>PUSHW stream
>PUSHW ptr
>PUSHW count
>LIBC FRead
RETURN VALUE
Y,A = Bytes Read
FWrite (BLOCKING)
Write bytes to file
C
#include <stdio.h>
int fwrite (FILE *stream, const void *ptr, int count);
ASM
>PUSHW stream
>PUSHW ptr
>PUSHW count
>LIBC fwrite
RETURN VALUE
Y,A = Bytes Written
FFlush
C
#include <stdio.h>
int fflush(FILE *stream);
ASM
>LDYA stream
>LIBC fflush
FSeek
reposition a file-position indicator in a stream
C / CSH
#include <stdio.h>
int fseek(FILE *stream, long offset, int whence);
ASM
>SS
>PUSHW stream
>PUSHL offset
>PUSHW whence
>LIBC FSeek
>SR
FEOF
Test the end-of-file indicator for hFILE
C / CSH
#include <stdio.h>
int feof(FILE *stream);
ASM
>LDYA stream
>LIBC feof
RETURN VALUE
CC :
Y,A = 0 EOF
Y,A == 0 NOT EOF
CS :
FTell
Return the current value of the file-position indicator
C / CSH
#include <stdio.h>
long ftell(FILE *stream);
ASM
>SL
>LDYA stream
>LIBC ftell
RETURN VALUE
On stack (long)
Remove
Remove a file or directory
C
#include <stdio.h>
int remove ( const char *pathname );
ASM
>LDYA pathname
>LIBC remove
RETURN VALUE
Rename
Rename a file
C
#include <stdio.h>
int rename ( const char * oldpath, const char * newpath );
ASM
>SS
>PUSHW oldpath
>PUSHW newpath
>LIBC rename
>SR
RETURN VALUE
PrintF (BLOCKING)
FPrintF (BLOCKING)
SPrintF
Prints C-Style String
C / CSH
#include <stdio.h>
int printf ( const char *format, ... );
int fprintf ( FILE *stream, const char *format, ... );
int sprintf ( char *str, const char *format, ... );
ASM
PrintF : (example is for printing Y,A as integer : format="%I", 2 bytes)
>SS
>PUSHW format
>PUSHW i
...
>PUSHBI 2 #bytecount
>LIBC PrintF
>SR
FPrintF :
>SS
>PUSHW FILE
>PUSHW format
>PUSHW i
...
>PUSHBI 2 #bytecount
>LIBC fprintf
>SR
SPrintF :
>SS
>PUSHW str
>PUSHW format
>PUSHW i
...
>PUSHBI 2 #bytecount
>LIBC sprintf
>SR
RETURN VALUE
CC : success, Y,A = bytes sent
CS : error, A = code from Output
Specifiers :
- %% : print % char
- %b : pull 1 byte to Print BIN
- %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
Modifiers for len and padding :
- %d : '9' '12'
- %2d : ' 9' '12'
- %02d : '09' '12'
- %11s : 'ABCDEFGH '
- %011s : 'ABCDEFGH000'
- %2f : '3.14'
ScanF (BLOCKING)
FScanF (BLOCKING)
SScanF
Read formatted data from string
C
int scanf( const char *format, ... );
int fscanf( FILE *stream, const char *format, ... );
int sscanf ( const char *s, const char *format, ... );
ASM
ScanF :
>SS
>PUSHW format
>PUSHW ptr
...
>PUSHB bytecount
>LIBC scanf
>SR
FScanF :
>SS
>PUSHB stream
>PUSHW format
>PUSHW ptr
...
>PUSHB bytecount
>LIBC fscanf
>SR
SScanF :
>SS
>PUSHW s
>PUSHW format
>PUSHW ptr
...
>PUSHB bytecount
>LIBC sscanf
>SR
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.
Random
C / CSH
#include <stdlib.h>
long random(void);
StrToF
Convert String to 40 bits Float
C / CSH
#include <stdlib.h>
float strtof (const char* str, char** endptr );
ASM
>SF
>SS
>PUSHW str
>PUSHWI EndPtr
>LIBC StrToF
>SR
RETURN VALUE
On stack (float) at pBase
AToF
Convert String to 40 bits Float
C / CSH
#include <stdlib.h>
float atof ( const char* str );
ASM
>SF
>LDYA str
>LIBC atof
RETURN VALUE
On stack (float) at pBase
StrToL/StrToUL
Convert String to 32 bits (unsigned) int
C / CSH
#include <stdlib.h>
long strtol (const char* str, char** endptr, int base);
unsigned long strtoul (const char* str, char** endptr, int base);
ASM
>SL
>SS
>PUSHW str
>PUSHW EndPtr
>PUSHW Base
>LIBC StrToL
>SR
RETURN VALUE
On stack (long) at pBase
atol
Convert String to 32 bits long
C / CSH
#include <stdlib.h>
long atol ( const char * str );
ASM
>SL
>LDYA str
>LIBC atol
RETURN VALUE
On stack (long)
atoi
Convert String to 16 bits int
C /CSH
#include <stdlib.h>
int atoi ( const char * str );
ASM
>LDYA str
>LIBC AToI
RETURN VALUE
Y,A = int
RealPath
C / CSH
#include <limits.h>
#include <stdlib.h>
char *realpath(const char *path, char *resolvedpath);
ASM
>SS
>PUSHW path
>PUSHW resolvedpath
>LIBC realpath
>SR
DESCRIPTION
Return the canonicalized absolute pathname.
If resolvedpath is specified as NULL, then realpath() uses
malloc() to allocate a buffer of PATH_MAX bytes to hold
the resolved pathname, and returns a pointer to this buffer.
The caller should deallocate this buffer using free().
RETURN VALUE
CC : Y,A = Ptr to resolvedpath
CS : Y,A = NULL, ERRNO set
Expand
C / CSH
#include <stdlib.h>
char *expand(const char *str, char *expanded);
ASM
>SS
>PUSHW str
>PUSHW expanded
>LIBC expand
>SR
RETURN VALUE
CC : Y,A = PTR to Expanded String
CS : Y,A = NULL, ERRNO
StrDup
Create a new copy of this C-String
C
#include <string.h>
char *strdup(const char *s);
ASM
Y,A = Ptr to source C-String
CC : success
Y,A = PTR to String
CS : error
A = SYS error code
StrLen
Returns Length of C-String
C
#include <string.h>
size_t strlen(const char *s);
ASM
>LDYAI str
>LIBC strlen
RETURN VALUE
Y,A = String length
StrCat
Concatenate strings
C
#include <string.h>
char * strcat ( char * destination, const char * source );
ASM
>SS
>PUSHWI destination
>PUSHWI source
>LIBC strcat
>SR
RETURN VALUE
Y,A = destination
StrCpy
#include <string.h>
Copy string
C
#include <string.h>
char *strcpy(char *restrict dst, const char *restrict src);
ASM
>SS
>PUSHWI destination
>PUSHWI source
>LIBC strcpy
>SR
RETURN VALUE
Y,A = destination
StrUpr/StrLwr
Convert string to UPPERCASE/lowercase
C
#include <string.h>
int strupr ( char * str);
int strlwr ( char * str);
ASM
>LDYAI str
>LIBC strupr
>LIBC strlwr
RETURN VALUE
Uppercased/lowercased String in Buffer
Y,A = str
StrCmp
Compare 2 strings
C
#include <string.h>
int strcmp(const char *s1, const char *s2);
ASM
>SS
>PUSHWI s1
>PUSHWI s2
>LIBC strcmp
>SR
RETURN VALUE
CC : match
CS : no match
CC, Y,A=0
CS, Y,A > 0 or < 0
StrCaseCmp
Compare 2 strings, ignoring case
C
#include <string.h>
int strcasecmp(const char *s1, const char *s2);
ASM
>SS
>PUSHWI s1
>PUSHWI s2
>LIBC strcasecmp
>SR
RETURN VALUE
CC : match
CS : no match
CC, Y,A=0
CS, Y,A > 0 or < 0
StrVNew
ASM
>LDYA size
>KAPI StrVNew
RETURN VALUE
StrVSet
ASM
>SS
>PUSHW pSTRV
>PUSHW id
>PUSHW ptr
>KAPI StrVSet
>SR
RETURN VALUE
StrVGet
ASM
>SS
>PUSHW pSTRV
>PUSHW id
>PUSHW ptr
>KAPI StrVGet
>SR
RETURN VALUE
CC: Y,A = Ptr
CS: A = E.NOKEY
TBufInsL
ASM
>SS
>PUSHW pTBuf
>PUSHW LineNum
>PUSHW DataPtr
>KAPI TBufInsL
>SR
RETURN VALUE
TBufGetL
ASM
>SS
>PUSHW pTBuf
>PUSHW LineNum
>PUSHW DataPtr
>KAPI TBufGetL
>SR
RETURN VALUE
CC:Y,A = Line length
CS:Y,A = Line count
TBufInsC
ASM
>SS
>PUSHW pTBuf
>PUSHW PosX
>PUSHW PosY
>PUSHW Char
>KAPI TBufInsC
>SR
RETURN VALUE
TBufGetB
ASM
>SS
>PUSHW pTBuf
>PUSHW DataOfs
>PUSHW DataPtr
>PUSHW DataLen
>KAPI TBufGetB
>SR
RETURN VALUE
TBufInsB
ASM
>SS
>PUSHW pTBuf
>PUSHW PosX
>PUSHW PosY
>PUSHW DataPtr
>PUSHW DataLen
>KAPI TBufInsB
>SR
RETURN VALUE
TBufDelB
ASM
>SS
>PUSHW pTBuf
>PUSHW PosX
>PUSHW PosY
>PUSHW DataLen
>KAPI TBufDelB
>SR
RETURN VALUE
TBufNew
ASM
>KAPI TBufNew
RETURN VALUE
TBufFree
ASM
>LDYA pTBuf
>KAPI TBufFree
RETURN VALUE
Time
Get System Time in Buffer
C
#include <time.h>
time_t time(time_t *tloc);
ASM
>SL
>LDYA tloc
>LIBC time
RETURN VALUE
time_t
MKTime
Convert S.TM to CTime
C
#include <prodos.h>
time_t mktime(struct tm *timeptr);
ASM
>SL
>LDYA timeptr
>LIBC MKTime
RETURN VALUE
GMTime
Convert CTime To S.TM
C
#include <time.h>
struct tm *gmtime(const time_t *timer);
ASM
>LDYA timeptr
>LIBC CTime2Time
RETURN VALUE
Y,A = pointer to allocatd tm struct
StrFTime
C
Convert S.TM struct to CSTR
#include <time.h>
void strftime (char* str, const char* format, const struct tm* timeptr);
ASM
>SS
>PUSHW str
>PUSHW format
- %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)
- %I : Hour in 12h format (01-12)
- %m : Month as a decimal number (01-12)
- %M : Minute (00-59)
- %p : AM or PM designation
- %S : Second (00-61)
- %w : Weekday as a decimal number with Sunday as 0 (0-6)
- %y : Year, last two digits (00-99)
- %Y : Year four digits (2025)
>PUSHW timeptr
>LIBC strftime
>SR
RETURN VALUE
none. always succeed.
open
C / CSH
#include <unistd.h>
int open(const char *pathname, int flags);
ASM
>SS
>PUSHW pathname
>PUSHWI flags
>LIBC open
>SR
RETURN VALUE
A = hFD
REG File created on ProDOS : T=TXT,X=$0000
close
C
#include <unistd.h>
int close(int fd);
ASM
>LDYA fd
>LIBC close
read
C
#include <unistd.h>
size_t read(int fd, void *buf, size_t count);
ASM
>SS
>PUSHW fd
>PUSHW buf
>PUSHW count
>LIBC read
>SR
RETURN VALUE
CC: Y,A = bytes read
CS: A = EC
write
C
#include <unistd.h>
int write(int fd, const void *buf, int count);
ASM
>SS
>PUSHW fd
>PUSHW buf
>PUSHW count
>LIBC write
>SR
RETURN VALUE
CC: Y,A = bytes written
CS: A = EC
LSeek
Set the file-position indicator for hFD
C
#include <unistd.h>
off_t lseek(int fildes, off_t offset, int whence);
ASM
>SS
>PUSHW hFD
>PUSHL offset
>PUSHB whence
>LIBC LSeek
>SR
ChOwn
C
#include <unistd.h>
int chown(const char *pathname, uid_t owner, gid_t group);
ASM
>SS
>PUSHW pathname
>PUSHW owner
>PUSHW group
>LIBC chown
>SR
RETURN VALUE
GetCWD
C
#include <unistd.h>
char *getcwd(char *buf, size_t size);
ASM
>SS
>PUSHW buf
>PUSHW size
>LIBC chown
>SR
RETURN VALUE
NULL CS
buf CC
ChDir
Description
chdir() changes the current working directory of the calling
process to the directory specified in path.
See also
getcwd()
C
#include <unistd.h>
int chdir(const char *path);
ASM
>LDYA path
>LIBC chdir
RETURN VALUE
CS : YA = int RC < 0 $FFxx
CC : YA = 0
GetHostName
Description
gethostname() returns the null-terminated hostname in the
character array name, which has a length of len bytes. If the
null-terminated hostname is too large to fit, then the name is
truncated, and no error is returned
See also
C
#include <unistd.h>
int gethostname(char *name, size_t len);
ASM
>SS
>PUSHW name
>PUSHW len
>LIBC GetHostName
>SR
RETURN VALUE
CS : YA = -1, ERRNO
CC : YA = 0
License
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.
*** End of Auto generated file ***