+ Reply to Thread
Page 1 of 5 123 ... LastLast
Results 1 to 10 of 46

Thread: ZC32 (ZCPU C compiler)

  1. #1
    That furred thing Black Phoenix's Avatar
    Join Date
    Feb 2007
    Location
    Kyiv, Ukraine
    Posts
    3,565

    Default ZC32 (ZCPU C compiler)

    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.
    I'm a wire-crazy person with a tail.

    Take a daily journey into my brain

    D2K5

  2. #2
    That furred thing Black Phoenix's Avatar
    Join Date
    Feb 2007
    Location
    Kyiv, Ukraine
    Posts
    3,565

    Default Re: ZC32 (ZCPU C compiler)

    Release 9, fixed wrongful assumption that DS = SS
    I'm a wire-crazy person with a tail.

    Take a daily journey into my brain

    D2K5

  3. #3
    Wire Amateur Imdsm's Avatar
    Join Date
    May 2009
    Location
    Manchester, UK
    Posts
    39

    Default Re: ZC32 (ZCPU C compiler)

    zomg, awesome!
    MY SATELLITES SHALL DOT OUT THE SUN!

    (http://adamsnetwork.co.uk/satellite/...103-201048.png)

  4. #4
    Wire Sofaking Whodunnit's Avatar
    Join Date
    Jan 2008
    Location
    New Zealand, Ackl
    Posts
    636

    Default Re: ZC32 (ZCPU C compiler)

    you forgot to update teh string that says version 8 in -h :P
    ЗАГРУЗКА...................

  5. #5
    ◕␣◕ McLovin's Avatar
    Join Date
    Sep 2008
    Location
    Batman, Turkey
    Posts
    2,341
    Blog Entries
    3

    Default Re: ZC32 (ZCPU C compiler)

    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.

  6. #6
    Wire Amateur Die Nacht's Avatar
    Join Date
    Jun 2009
    Posts
    30

    Default Re: ZC32 (ZCPU C compiler)

    I don't understand. I download it and get a .rar file. What do I do with it?

  7. #7
    Wire Sofaking Officer Tibbles's Avatar
    Join Date
    Aug 2008
    Location
    Barnus Philbert Boulevard
    Posts
    867

    Default Re: ZC32 (ZCPU C compiler)

    Extract the Rar? :| L2WinRar

  8. #8
    Wire Sofaking Whodunnit's Avatar
    Join Date
    Jan 2008
    Location
    New Zealand, Ackl
    Posts
    636

    Default Re: ZC32 (ZCPU C compiler)

    if you dont know about .rar files or how to use google , then ZC or zcpu is too complicated for you at the moment.
    ЗАГРУЗКА...................

  9. #9
    Wire Amateur Die Nacht's Avatar
    Join Date
    Jun 2009
    Posts
    30

    Default Re: ZC32 (ZCPU C compiler)

    I just never heard about .rar files (never used them. I always see ZIP, and windows takes care of that).

    Thanks though.

  10. #10
    Wirererer ben1066's Avatar
    Join Date
    Aug 2009
    Posts
    151

    Default Re: ZC32 (ZCPU C compiler)

    it'll be so cool to make apps for alcyoneOS with this and the bios libary, i already know some c.

+ Reply to Thread
Page 1 of 5 123 ... LastLast

LinkBacks (?)

  1. 01-28-2010, 07:56 AM

Similar Threads

  1. Zc32
    By Whodunnit in forum CPU, GPU, and Hi-speed Discussion & Help
    Replies: 1
    Last Post: 02-18-2009, 10:21 PM
  2. C-like Syntax Compiler for ZCPU [alpha]
    By starvinmarvin in forum CPU, GPU, and Hi-speed Discussion & Help
    Replies: 7
    Last Post: 12-24-2008, 06:12 AM
  3. ZC Compiler question
    By wizard111 in forum CPU, GPU, and Hi-speed Discussion & Help
    Replies: 9
    Last Post: 08-04-2008, 05:51 AM
  4. [WIP] ZBF - A Brainf*** compiler for ZCPU
    By CFSworks in forum CPU, GPU, and Hi-speed Discussion & Help
    Replies: 16
    Last Post: 07-29-2008, 04:22 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
proceed-collector
proceed-collector
proceed-collector
proceed-collector
linguistic-parrots
linguistic-parrots
linguistic-parrots
linguistic-parrots