Release 9, fixed wrongful assumption that DS = SS
ZC32 Compiler (release 10)
Download: http://filesmelt.com/downloader/release10.rar
Old versions:
Revision 9:http://users.d2k5.com/Black%20Phoeni.../release09.rar
Revision 8: http://users.d2k5.com/Black%20Phoeni.../release08.rar
The ZC32 compiler translates a subset of the C language into ZASM assembly language. ZC compiler is based on source code of Small C compiler by J. E. Hendrix, and SmallC32 port by done by Hans Walheim.
ZC32 supports arrays of one dimension. Functions always return return integer values. Initialization of global variables is supported. The preprocessor supports #include, #define, #ifdef, #ifndef, #else, #endif, #asm, #endasm commands.
The following control statements are supported: if, switch, case, default, break, continue, while, for, and do/while. All expression operators are supported. Only integer and character data types are supported (integers are considered floats here at same time).
The following standard C features are not supported: structures, fields, unions, arrays of pointers, and casts.
Unpack ZC32 into CPUChip, or any other convenient folder. Try running test program, if it compiles - proceed. Else consult troubleshooting (readme.txt).
Modify batch to your needs.
CPUChip folder is situated in [/b]/SteamApps/<yourname>/garrysmod/garrysmod/data/cpuchip/[b]
Usage:
zc.bat file should basic batch file to compile your source code. It's pretty straightforward if you are at least slightly familiar with batches.
Command line
ZC <filename1> <filename2> ... <-m> <-a> <-p>
Parameters:
- [-M] - Monitor status
- [-A] - Beep on error
- [-P] - Pause on errors
- [-NO] - No optimization
CLIB
CLIB is the default library which provides very basic service (port I/O and some stuff the compiler needs there). There are additional libraries available, see "lib" folder, and also see example program.
Some library functions (mostly string ones):
strcmp(str1,str2) - compare strings str1 and str2 (fast version of strncmp)
delay(time) - wait time in miliseconds
curtime() - CPU time in seconds
strcat(s, t) - concatenate t to end of s; s must be large enough
strchr(str, c) - return pointer to 1st occurrence of c in str, else 0
strcpy(s, t) - copy t to s
strlen(s) - return length of string s
strncat(s, t, n) - concatenate n bytes max from t to end of s; s must be large enough
strncmp(s,t,n) - compares two strings for at most n characters and returns an integer >0, =0, or <0 as s is >t, =t, or <t.
strncpy(dest, sour, n) - copy n characters from sour to dest (null padding)
strrchr(s,c) - search s for rightmost occurrance of c. (s - pointer to string to be searched, c - character to search for). returns pointer to rightmost c or NULL.
abs(nbr) - returns absolute value of nbr
isascii( c ) - return 'true' if c is an ASCII character (0-127)
sign(nbr) - return -1, 0, +1 depending on the sign of nbr
toascii( c ) - return ASCII equivalent of c
tolower( c ) - return lower-case of c if upper-case, else c
toupper( c ) - return upper-case of c if it is lower-case, else c
atoi(s) - convert s to integer.
utoi(decstr, nbr) - convert unsigned decimal string to integer nbr; returns field size, else -1 on error
xtoi(hexstr, nbr) - convert hex string to integer nbr; returns field size, else -1 on error
pad(dest, ch, n) - place n occurrences of ch at dest.
left(str) - left adjust and null terminate a string
itox(nbr, str, sz) - converts nbr to hex string of length sz, right adjusted and blank filled, returns str; if sz > 0 terminate with null byte; if sz = 0 find end of string; if sz < 0 use last byte for data;
itod(nbr, str, sz) - convert nbr to signed decimal string of width sz, right adjusted, blank filled; returns str; if sz > 0 terminate with null byte; if sz = 0 find end of string; if sz < 0 use last byte for data;
itoa(n,s) - convert n to characters in s
itoab(n,s,b ) - convert "unsigned" n to characters in s using base b.
reverse(s) - reverse string in place
outport(port,value) - output value to port
inport(port) - input value from port
There's more console functions in CONLIB.C, and math functions in MATH.C.
CONLIB usage:
Wire Console Screen to MemBus, and use drawing functions.
If you are using Address Bus, you need to call setoffset(<new console screen offset>) (offset must be 65536+what_you_have_on_address_bus).
Last edited by Black Phoenix; 01-15-2010 at 08:09 AM.
Release 9, fixed wrongful assumption that DS = SS
zomg, awesome!
you forgot to update teh string that says version 8 in -h :P
ЗАГРУЗКА...................
For some reason, some of the conlib functions don't work. :/
Anticept - HP you are terrible at trolling. Always have been. Leave it up to the pros like Jat.
Black Phoenix - Actually cunt goes into bullshit. Bullshit does not fit in cunt.
Drunkie - Logically, Jat Goodwin must be a fist pumping guido.
I don't understand. I download it and get a .rar file. What do I do with it?
Extract the Rar? :| L2WinRar
if you dont know about .rar files or how to use google , then ZC or zcpu is too complicated for you at the moment.
ЗАГРУЗКА...................
I just never heard about .rar files (never used them. I always see ZIP, and windows takes care of that).
Thanks though.
it'll be so cool to make apps for alcyoneOS with this and the bios libary, i already know some c.
Bookmarks