+dhe Posted April 14, 2022 Share Posted April 14, 2022 Need some c help, I'm more of a using c to replace basic, versus using c to replace assembly kind of guy. The original line of code is: void ShowMaze(const char *maze, int width, int height) Which compiles perfectly with gcc - on linux for linux. I'm trying to use TIC 1.67 on the geneve. It seems TIC doesn't groove on defs in the function name line. So I pulled it out old school and put it before the {} I re-wrote things to look like: That results in: Removing * in front of maze gets: c99's favorite error seems to be lval, tic seems to like punctuation. I did find: char* is a mutable pointer to a mutable character/string. const char* is a mutable pointer to an immutable character/string. You cannot change the contents of the location(s) this pointer points to. Also, compilers are required to give error messages when you try to do so. For the same reason, conversion from const char * to char* is deprecated. char* const is an immutable pointer (it cannot point to any other location) but the contents of location at which it points are mutable. const char* const is an immutable pointer to an immutable character/string. Yea.. That makes my head want to explode.... So can anyone tell me what construct would stand in for the program goal above, but still work with an old tired K&R C like compiler? Quote Link to comment Share on other sites More sharing options...
+FarmerPotato Posted April 14, 2022 Share Posted April 14, 2022 Have you tried without const? Maybe TIC doesn’t have const? I seem to recall that const came along in ANSI 1.0 or even later. I think I first saw const in C++ in 1990 Without const, you just have to respect the char * and not write to it. 1 Quote Link to comment Share on other sites More sharing options...
+Lee Stewart Posted April 14, 2022 Share Posted April 14, 2022 46 minutes ago, FarmerPotato said: Have you tried without const? Maybe TIC doesn’t have const? I seem to recall that const came along in ANSI 1.0 or even later. I think I first saw const in C++ in 1990 Without const, you just have to respect the char * and not write to it. The second edition of K&R (1988) says const and volatile were parts of the ANSI C Standard, which was completed in late 1988, but already implemented in most C compilers of the day. ...lee 1 Quote Link to comment Share on other sites More sharing options...
+TheBF Posted April 15, 2022 Share Posted April 15, 2022 I found this SMALL C Handbook. Don't know how closely TI C follows it but I searched and did not find 'const char anywhere. the-small-c-handbook-9780835970129-0835970124_compress.pdf 1 Quote Link to comment Share on other sites More sharing options...
F.G. Kaal Posted April 15, 2022 Share Posted April 15, 2022 If TIC is like C99C then it doesn't know anything about const and static. I found TIC on my backup disk but I don't have a manual of TIC., I suppose this can be found on WHTECH. But for what it is worth, here is the specs of C99C: c99specs.txt 1 Quote Link to comment Share on other sites More sharing options...
+dhe Posted April 15, 2022 Author Share Posted April 15, 2022 The chicken dinner goes to FPo! >Have you tried without const? Maybe TIC doesn’t have const? That did the trick. > Without const, you just have to respect the char * and not write to it. And also, the practical answer! Fred got me thinking, so I went back through the documentation and found it: Clint Pulley's C compiler was based on small c. Al's compiler (which Clint Helped with) was based on: "TIC was derived from a 68000 based C compiler developed by Matthew Brandt. " Source supposedly compile-able with gcc can be found: http://ftp.whtech.com/programming/TIC/ tic.zip From the readme in tic.zip: This is the source code for Al Beard's "Big C" compiler. Al wrote: "I have attached the last build I did for the TIC C compiler, it was about 20 years ago. Unfortunately I lost the source code for the companion TASM assembler. Much of the work for the TIC C compiler was based on the public domain 68000 C compiler that was in circulation at the time (even though it was a bit buggy). Paul Charlton at the time sent me some code he was working on from the same source baseline that was helpful, as well as Clint Pulley's testing it for me." To compile, do gcc -o tic -m32 *.c in the source directory. See the file 'manual.txt' for usage instructions. The code compiles without warnings on a basic gcc compilation, but adding -Wall, or compiling with clang shows many warnings. Most seem to be innocent (simply reflecting that C got more and more strict about types over the last 30 years), some may indicate old bugs. Compiling as a 32 bit binary seems the safe choice, as the code appears to assume int's and pointers being the same size, which isn't true on x64 systems. The compiler outputs assembler source, intended for the TASM assembler. The Dave Pitts assembler and linker seem to work fine. http://www.cozx.com/~dpitts/ti990.html The runtime support file must be linked as the first object file and is written for use on Stuart's breadboard 9995 system. http://www.avjd51.dsl.pipex.com/tms9995_breadboard/tms9995_breadboard.htm For use on other systems this crt0.S can be used as a guide. The key things to change are the WP and stack location in the start routine, and the 'OUTC' and 'GETC' routines to out/input a single character to/from the console. When deciding on the initial value of the stack pointer, please remember that the stack grows 'up' in memory, which is unusual for a C implementation. If you use this code, don't forget to post a big thank you to Al in a vintage computing forum of your own choice. " 3 Quote Link to comment Share on other sites More sharing options...
+dhe Posted April 25, 2022 Author Share Posted April 25, 2022 I did pull over TIC source from WHTECH / programming / tic / tic.zip I was able to compile and run with gcc 9.4 - it's what I have on my linux box. Even without -Wall or -Wextra - gcc let me know about some concerns it had! ? 2 Quote Link to comment Share on other sites More sharing options...
+TheBF Posted April 26, 2022 Share Posted April 26, 2022 16 hours ago, dhe said: I did pull over TIC source from WHTECH / programming / tic / tic.zip I was able to compile and run with gcc 9.4 - it's what I have on my linux box. Even without -Wall or -Wextra - gcc let me know about some concerns it had! ? So for us ill-informed-about-C people: You can compile TIC programs on Linux now? Does that output an 9900 Assembly program that you then assemble and link with other TI-99 tools? Quote Link to comment Share on other sites More sharing options...
+dhe Posted April 26, 2022 Author Share Posted April 26, 2022 7 hours ago, TheBF said: You can compile TIC programs on Linux now? Compiling programs under linux is problematic, because of lack of libraries. I did move the files to the Geneve, with appropriate renaming and tried to compile with TIC. TIC ran out of memory. Guess it's either the C compiler we have, or we wait for someone more knowledgeable then myself to adapt GCC with libraries for the Geneve. =( 1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.