The include files system confused the hell out of me too when I started out. It's a bit messy all right but after the first couple of hours of swearing and ranting at it, you'll get the hang of it to *never* forget it! A bit like cycling I suppose.
What do you expect from something that came from the Unix world... at least I think that's where it originated.
Since I learned C under Unix it never really bothered me.
You really should try C#. I've been playing around with it and I'm beginning to like the simplistic and compact language structure. It does spoil you a bit though. :)
Oh, btw, there is a free MS Visual studio Express C# available for download from the MS website. It's an awesome IDE with great tools. Check it out!
To be honest with you I`m far faar more scared of C than I am of machine code, I know C should look pretty familiar to Basic, but I just hate the way the syntax looks, and I still don`t understand why to write one thing theirs always about nine or more files, never even know which one to read/look through :( So when I switch, i`ll be joining ya with MC :)
Learn it and you'll find (a) it's not that hard (especially if you understand asm, pointers should be a breeze), and (b) include files (or similar mechanisms) are so useful I don't know how anyone can live without them.
You can write a C program in one file if you really want. It's just a lot more readable if you break it into chunks.
When I write assembler, I make *heavy* use of include files in sjasm plus. It makes the program a lot easier to work on if it's split up into separate, small, selfcontained units.
Just wanted to say I take on board what you three are saying about C... I forget sometimes that my initial reaction to C on Amiga with help of turials back in `94 thereabouts was pure excitement and expectation to learning it soon... I tried GCC (?) and Bloodshed IDE a couple of years ago,and didn`t give it a proper try, couldn`t `settle ?` into it, too bewildered :(...
would be nice if could get away with modern Basic language, but would be more useful to dig earnestly into C.... sorry for constant whinging, just wish C looked like Basic, old, tired, lazy, decrepid, erm, stoned, drunk :D
Just wanted to say I take on board what you three are saying about C... I forget sometimes that my initial reaction to C on Amiga with help of turials back in `94 thereabouts was pure excitement and expectation to learning it soon... I tried GCC (?) and Bloodshed IDE a couple of years ago,and didn`t give it a proper try, couldn`t `settle ?` into it, too bewildered :(...
would be nice if could get away with modern Basic language, but would be more useful to dig earnestly into C.... sorry for constant whinging, just wish C looked like Basic, old, tired, lazy, decrepid, erm, stoned, drunk :D
Amiga... C... GCC... beginner.... not a good combination.
C itself has enough of a learning curve especially if you've never used a compiler but GCC is about the LEAST user friendly of any compiler I've used. The setup has to be just so or if will drive you nuts even if you are experienced.
I had my initial intro to C on Unix but much of what I learned WAS on the Amiga. I started when the Amiga was new and I had to learn by diving into the ROM Kernel manuals. The only examples I had were the IFF source files from Electronic Arts. It took a long time to come up to speed but it ended up making me a better programmer.
One thing it taught me is there is so much to learn on the Amiga to do anything that it might be tough for beginners.
Learning Turbo Pascal on DOS was simple by coparison. You didn't have to worry about a GUI, system libraries and devices. You had a few include files and people made some link libs for doing stuff on the screen and that was it.
Developing for the Speccy is much simpler. Setting up the compiler might be a problem if you don't know your way around DOS but once it up and running you shouldn't have many problems.
What do you expect from something that came from the Unix world... at least I think that's where it originated.
Since I learned C under Unix it never really bothered me.
C#? Meh
Unless you're staying away from Windows, C# & .NET 2.0/3.0 is great. You get great results fast and don't have to spend 60% of the time dealing with memory handling and clean up processes (managed language). You can spend most of your time doing the actual app instead. ;)
Unless you're staying away from Windows, C# & .NET 2.0/3.0 is great. You get great results fast and don't have to spend 60% of the time dealing with memory handling and clean up processes (managed language). You can spend most of your time doing the actual app instead. ;)
C# = the best bits from c++ & java.
Personally, I thought the best bits of C/C++ were bit bashing and pointer arithmetic. :razz:
would be nice if could get away with modern Basic language, but would be more useful to dig earnestly into C.... sorry for constant whinging, just wish C looked like Basic, old, tired, lazy, decrepid, erm, stoned, drunk :D
Learning Turbo Pascal on DOS was simple by coparison....... Developing for the Speccy is much simpler. Setting up the compiler might be a problem if you don't know your way around DOS but once it up and running you shouldn't have many problems.
Try HiSoft pascal +4. For Spectrum development, the +3 disk version is quite good. http://www.worldofspectrum.org/infoseekid.cgi?id=0008255
If you use an emulator that supports the +3e it will make development a lot easier. One reason for this is the the compiler uses the ram drive for compilations. On a +3e drive M: (ram drive) can be substituted for any partition on the +3e hard disk, so you get more temp space when compiling programs.
HiSoft Pascal is a fairly vanilla implementation, so there are a heap of tutorials available on the net to get you started. If your not initially going to be using Spectrum specific features, you can do a lot of the writting & testing with a DOS / Windows or Linux Pascal implementation first. Files can be imported into a Spectrum emulator and loaded into the HiSoft compiler, as it uses plain text files. See www.freepascal.org for a free Pascal implementation.
C# lets you do bit bashing and pointer arithmetic (within an unsafe block)
Yeah, I suppose so; it's not a dreadfully restrictive language (like Pascal) that stops you from doing these things entirely. It just doesn't encourage it.
Unless you're staying away from Windows, C# & .NET 2.0/3.0 is great. You get great results fast and don't have to spend 60% of the time dealing with memory handling and clean up processes (managed language). You can spend most of your time doing the actual app instead. ;)
C# = the best bits from c++ & java.
I've never had to spend 60% of my time dealing with memory handling and clean up.
@ dasteph, funny, but I`ve never ever thought about pascal, knowing nothing about it, or more importantly it`s syntax... I`d become aware that it was available for the Spectrum and it`s supposedly being quite fast. Will check it out.
...............
All this C variations stuff is confusing, hehe :D It`s good to hear that there are flavours that perhaps aren`t so convoluted... Like I don`t see why they can`t just give you a language where you don`t need to learn all the libraries etc etc, and just let you do everything yourself, especially the User Interface etc etc
I got given a Visual Basic CD and Book about 8 years ago, an all it was was a massive package and book to let you do the UI`s for programs, and it was soo soo much features, buttons and stuff to learn just for that, that I couldn`t get it wrapped in my head Why, when it can be fun doing your own, and would be quicker... hmph, I suppose once you know all these new things, package`s etc it then becomes quicker and simpler to do it the proper way...
All this C variations stuff is confusing, hehe :D It`s good to hear that there are flavours that perhaps aren`t so convoluted...
C itself is very small and simple... give it a go, you'll like it. It feels like freedom compared to Basic and Pascal to me. I've always hated Pascal because it's regimented, having been designed not to let the programmer do certain things, things that *might* be incorrect or unsafe whereas C let's you do whatever you want, good and bad. It assumes the programmer knows what he's doing. I also find it quite similar to programming in assembler, at least it feels like it minus all the hassle of being confined to a handful of registers and restricted instructions.
Like I don`t see why they can`t just give you a language where you don`t need to learn all the libraries etc etc, and just let you do everything yourself, especially the User Interface etc etc
... and because it's so small it doesn't do a lot for you. The core is there, but there is no way to print to the screen, draw a line, etc. *That's* what the libraries are for. There are standard ones that all C implementations come with that do thinks like math, character printing/reading, string manipulation, memory allocation, etc. There is nothing that says you have to use these functions -- you could write your own equivalents in C or assembler -- but that would take a large investment of time, likely won't be much better than what's already there, and worst of all means your program will only work on one machine rather than being portable across all machines with a C compiler. The standard C libraries are also not so big and can be picked up as you need to know them or fairly quickly if you want to know them all at once. The back of my C book has 17 pages describing these standard libraries.
As for GUIs, well they are necessarily large and complicated these days. But don't bother learning all the minutaie, just learn the concepts and then look up what you need. That's how I deal with very big messes anyway. But, you know, you *can* go ahead and write your own GUI. It's just that it will take a long, long time and your program won't likely look or behave like everyone else's. Then you get the users complaing that your program is difficult to use because it's different.
Thanks AA, That`s got me understanding a lot more :) I like the sound of it being a small simple language (just with lots of possible bolts ons :) ) That makes it sound less of a big monolith...
Thanks AA, That`s got me understanding a lot more :) I like the sound of it being a small simple language (just with lots of possible bolts ons :) ) That makes it sound less of a big monolith...
LOL, yeah, it's very simple on it's own. You just have to learn what the bolt ons are and to use them you include a file that tells the compiler what the bolt ons are.
I loved Pascal when I first learned it. The only other compiler I'd used was Fortran and I wasn't thrilled with it.
But Pascal did things in a way that looked right, was more organized and logical.
Then I learned C and Pascal was suddenly an evil oppressor I wanted nothing to do with.
I think I`ll take a tentative look into both on both the Speccy and PC then, it`ll probably be more fun to check em both out, and two sets of new syntax will cure me of being a lazy pussy :D
I think I`ll take a tentative look into both on both the Speccy and PC then, it`ll probably be more fun to check em both out, and two sets of new syntax will cure me of being a lazy pussy :D
Learning C or Pascal or whatever on a PC transfers directly to C or pascal on the Spectrum. The main difference is that the Spectrum is a much more limited platform so you must keep in mind its limitations when writing code; this includes the small memory space, the small size of data types, the importance of efficient program design (in code size and data size requirements), etc are all things that are very easy to forget about on a modern PC and in fact have become unimportant these days in comparison to writing code that is quickly delivered to market, that is easily maintainable and easily debuggable.
Anyway, the great thing about it is you may be picking up a new skill to feed your spectrum habit, but it is also something you can use on a modern PC too!
Oh, and here's a freebie. 99% of people who have trouble picking up C don't understand what a memory address is and that data is stored in memory at specific addresses. Ie POKE address,data in Basic. All Basic variables, all C variables, all C data structures are stored in memory at some address in some format. Integer variables take up two bytes to represent values 0-65535 if unsigned and -32768 to 32767 if signed. Floating point takes up 5 bytes in Sinclair basic and some math libraries in Spectrum C implementations. Strings in basic consist of a length followed by a list of ascii characters stored at some address. C strings are just a list of ascii characters terminated with a 0 byte to indicate the end. Pointers in C are aliases for memory addresses and writing data to an address "pointed at" by a pointer is the same as POKEing it there. There you go, the mystery of memory and pointers is solved and now you can get on with the fun :-)
Know these and you know all the "commands" in C. Anything else you use you will have to write or it will have to be written by someone else and included into your program. This includes all the useful gubbins found in the standard C libraries.
In addition you've got the usual */-+ and some bit manipulation operators that will be new to you but also very useful, and the concepts of pointers and arrays, the difference between local and global variables (all vars in Basic are global, ie visible everywhere but C functions can contain local variables that only exist while the function executes), passing parameters to functions by value (a copy of the variable passed to a function is sent not the variable itself), the notion of how to organize your source code into separate files, how to compile and how to use code written by others (this is "linking"). And that's it -- C is really small, keep this in mind while picking it up.
I'm not sure it was the best. This is a bit off topic but...
MSX2 had pretty decent hardware. A shame they didn't use the faster 64180/Z180.
The Tandy Color Computer 3 had really good bit mapped graphics, 80 column text and thanks to the 6809 were even able to do a DOOMish type FPS.
The Apple IIgs had some of the best bit mapped graphics, 4096 colors, a 3Mhz 65816 (commonly upgraded to much faster), lots of RAM and the best audio hardware of any 8 bit. It also had a GUI built into ROM.
The C64 had a lot for the money and was cheap. A great sound chip, decent graphics and sprites (a major buzz word at the time).
I think there was a trade off between colors and resolution that you see in a lot of games that other machines didn't suffer. It also had a relatively slow CPU for a game oriented system.
I post for the first time here, so hello everybody :smile:
As for the list mentioned here, we have to add 8-bit Atari line of home computers, because it had great features (display lists + interrupts, VBIs, player/missiles, POKEY sound chip, 256 colors, SIO (I/O), device handlers etc.) for the time and is still good enough for delivering great games and useful programs.
C itself has enough of a learning curve especially if you've never used a compiler but GCC is about the LEAST user friendly of any compiler I've used.
GCC is user friendly, it's just picky about who it calls a friend!
Actually, seriously - gcc is neither more nor less user friendly than any other compiler I've used (including Microsoft and IBM's offerings). The 'user friendly' bit you're thinking of is the IDE. The IDE is not the compiler - the compiler is a part the IDE drives.
For a beginner, even without any sort of IDE, editing "hello.c", and then typing:
gcc hello.c
Take a look at the command line syntax for Microsoft's C compiler - it's actually quite a bit harder and worse than gcc because it's very poorly documented. It's just usually hidden from you by the IDE, so usually you don't care.
There are IDEs that will hide gcc too. Apple's Xcode uses gcc as the default compiler. Most Apple developers don't even notice they are using gcc because - just like Microsoft developers don't realise there's a program called (iirc 'mcc') underneath the IDE with a really awful set of command line switches - the IDE knows how to drive the compiler. All that pretty display in Xcode with a progress bar, and files getting little ticks beside them is all happening because underneath, hidden from the user's view, gcc is doing work.
The second - T'n'T - is GamesMaster, a very straightforward games maker package by the same chap who wrote the Sam's ROM, and uses a simplified scripting style language. Still not true machine machine as it does interpret modules of instructions, and although i've never checked will probably still use ROM routines for graphic displays. (incidentally, T'n'T is going to be one of the games on the coverdisk with the next issue of Sam Revival!)
Nice! I think I have GamesMaster. I never did do anything with it though even after buying it just for the manual :(
Looks like a pretty decent games creator. I *think* I bought it from you as a matter of fact. If not then it was on ebay.
Just wanted to say thanks AA :) I`ve got a SAM`s Teach Yourself C in 21 Days book from my Sister, and a couple of PDF`s of other C books (naughty naughty) and shall be getting stuck in and joining a few C forums *_+
Comments
Since I learned C under Unix it never really bothered me.
C#? Meh
Learn it and you'll find (a) it's not that hard (especially if you understand asm, pointers should be a breeze), and (b) include files (or similar mechanisms) are so useful I don't know how anyone can live without them.
You can write a C program in one file if you really want. It's just a lot more readable if you break it into chunks.
When I write assembler, I make *heavy* use of include files in sjasm plus. It makes the program a lot easier to work on if it's split up into separate, small, selfcontained units.
would be nice if could get away with modern Basic language, but would be more useful to dig earnestly into C.... sorry for constant whinging, just wish C looked like Basic, old, tired, lazy, decrepid, erm, stoned, drunk :D
C itself has enough of a learning curve especially if you've never used a compiler but GCC is about the LEAST user friendly of any compiler I've used. The setup has to be just so or if will drive you nuts even if you are experienced.
I had my initial intro to C on Unix but much of what I learned WAS on the Amiga. I started when the Amiga was new and I had to learn by diving into the ROM Kernel manuals. The only examples I had were the IFF source files from Electronic Arts. It took a long time to come up to speed but it ended up making me a better programmer.
One thing it taught me is there is so much to learn on the Amiga to do anything that it might be tough for beginners.
Learning Turbo Pascal on DOS was simple by coparison. You didn't have to worry about a GUI, system libraries and devices. You had a few include files and people made some link libs for doing stuff on the screen and that was it.
Developing for the Speccy is much simpler. Setting up the compiler might be a problem if you don't know your way around DOS but once it up and running you shouldn't have many problems.
Unless you're staying away from Windows, C# & .NET 2.0/3.0 is great. You get great results fast and don't have to spend 60% of the time dealing with memory handling and clean up processes (managed language). You can spend most of your time doing the actual app instead. ;)
C# = the best bits from c++ & java.
Personally, I thought the best bits of C/C++ were bit bashing and pointer arithmetic. :razz:
Sounds like Pascal is your dream language.
Try HiSoft pascal +4. For Spectrum development, the +3 disk version is quite good.
http://www.worldofspectrum.org/infoseekid.cgi?id=0008255
If you use an emulator that supports the +3e it will make development a lot easier. One reason for this is the the compiler uses the ram drive for compilations. On a +3e drive M: (ram drive) can be substituted for any partition on the +3e hard disk, so you get more temp space when compiling programs.
HiSoft Pascal is a fairly vanilla implementation, so there are a heap of tutorials available on the net to get you started. If your not initially going to be using Spectrum specific features, you can do a lot of the writting & testing with a DOS / Windows or Linux Pascal implementation first. Files can be imported into a Spectrum emulator and loaded into the HiSoft compiler, as it uses plain text files. See www.freepascal.org for a free Pascal implementation.
C# lets you do bit bashing and pointer arithmetic (within an unsafe block)
Yeah, I suppose so; it's not a dreadfully restrictive language (like Pascal) that stops you from doing these things entirely. It just doesn't encourage it.
...............
All this C variations stuff is confusing, hehe :D It`s good to hear that there are flavours that perhaps aren`t so convoluted... Like I don`t see why they can`t just give you a language where you don`t need to learn all the libraries etc etc, and just let you do everything yourself, especially the User Interface etc etc
I got given a Visual Basic CD and Book about 8 years ago, an all it was was a massive package and book to let you do the UI`s for programs, and it was soo soo much features, buttons and stuff to learn just for that, that I couldn`t get it wrapped in my head Why, when it can be fun doing your own, and would be quicker... hmph, I suppose once you know all these new things, package`s etc it then becomes quicker and simpler to do it the proper way...
C itself is very small and simple... give it a go, you'll like it. It feels like freedom compared to Basic and Pascal to me. I've always hated Pascal because it's regimented, having been designed not to let the programmer do certain things, things that *might* be incorrect or unsafe whereas C let's you do whatever you want, good and bad. It assumes the programmer knows what he's doing. I also find it quite similar to programming in assembler, at least it feels like it minus all the hassle of being confined to a handful of registers and restricted instructions.
... and because it's so small it doesn't do a lot for you. The core is there, but there is no way to print to the screen, draw a line, etc. *That's* what the libraries are for. There are standard ones that all C implementations come with that do thinks like math, character printing/reading, string manipulation, memory allocation, etc. There is nothing that says you have to use these functions -- you could write your own equivalents in C or assembler -- but that would take a large investment of time, likely won't be much better than what's already there, and worst of all means your program will only work on one machine rather than being portable across all machines with a C compiler. The standard C libraries are also not so big and can be picked up as you need to know them or fairly quickly if you want to know them all at once. The back of my C book has 17 pages describing these standard libraries.
As for GUIs, well they are necessarily large and complicated these days. But don't bother learning all the minutaie, just learn the concepts and then look up what you need. That's how I deal with very big messes anyway. But, you know, you *can* go ahead and write your own GUI. It's just that it will take a long, long time and your program won't likely look or behave like everyone else's. Then you get the users complaing that your program is difficult to use because it's different.
Write games in C using Z88DK and SP1
LOL, yeah, it's very simple on it's own. You just have to learn what the bolt ons are and to use them you include a file that tells the compiler what the bolt ons are.
I loved Pascal when I first learned it. The only other compiler I'd used was Fortran and I wasn't thrilled with it.
But Pascal did things in a way that looked right, was more organized and logical.
Then I learned C and Pascal was suddenly an evil oppressor I wanted nothing to do with.
I think I`ll take a tentative look into both on both the Speccy and PC then, it`ll probably be more fun to check em both out, and two sets of new syntax will cure me of being a lazy pussy :D
Learning C or Pascal or whatever on a PC transfers directly to C or pascal on the Spectrum. The main difference is that the Spectrum is a much more limited platform so you must keep in mind its limitations when writing code; this includes the small memory space, the small size of data types, the importance of efficient program design (in code size and data size requirements), etc are all things that are very easy to forget about on a modern PC and in fact have become unimportant these days in comparison to writing code that is quickly delivered to market, that is easily maintainable and easily debuggable.
Anyway, the great thing about it is you may be picking up a new skill to feed your spectrum habit, but it is also something you can use on a modern PC too!
Oh, and here's a freebie. 99% of people who have trouble picking up C don't understand what a memory address is and that data is stored in memory at specific addresses. Ie POKE address,data in Basic. All Basic variables, all C variables, all C data structures are stored in memory at some address in some format. Integer variables take up two bytes to represent values 0-65535 if unsigned and -32768 to 32767 if signed. Floating point takes up 5 bytes in Sinclair basic and some math libraries in Spectrum C implementations. Strings in basic consist of a length followed by a list of ascii characters stored at some address. C strings are just a list of ascii characters terminated with a 0 byte to indicate the end. Pointers in C are aliases for memory addresses and writing data to an address "pointed at" by a pointer is the same as POKEing it there. There you go, the mystery of memory and pointers is solved and now you can get on with the fun :-)
Here are all the reserved keywords in C:
auto, break, case, char, const, continue, default, do, double, else, enum, extern, float, for, goto, if, int, long, register, return, short, signed, sizeof, static, struct, switch, typedef, union, unsigned, void, volatile, while
Know these and you know all the "commands" in C. Anything else you use you will have to write or it will have to be written by someone else and included into your program. This includes all the useful gubbins found in the standard C libraries.
In addition you've got the usual */-+ and some bit manipulation operators that will be new to you but also very useful, and the concepts of pointers and arrays, the difference between local and global variables (all vars in Basic are global, ie visible everywhere but C functions can contain local variables that only exist while the function executes), passing parameters to functions by value (a copy of the variable passed to a function is sent not the variable itself), the notion of how to organize your source code into separate files, how to compile and how to use code written by others (this is "linking"). And that's it -- C is really small, keep this in mind while picking it up.
Write games in C using Z88DK and SP1
As for the list mentioned here, we have to add 8-bit Atari line of home computers, because it had great features (display lists + interrupts, VBIs, player/missiles, POKEY sound chip, 256 colors, SIO (I/O), device handlers etc.) for the time and is still good enough for delivering great games and useful programs.
Gury
GCC is user friendly, it's just picky about who it calls a friend!
Actually, seriously - gcc is neither more nor less user friendly than any other compiler I've used (including Microsoft and IBM's offerings). The 'user friendly' bit you're thinking of is the IDE. The IDE is not the compiler - the compiler is a part the IDE drives.
For a beginner, even without any sort of IDE, editing "hello.c", and then typing:
gcc hello.c
Take a look at the command line syntax for Microsoft's C compiler - it's actually quite a bit harder and worse than gcc because it's very poorly documented. It's just usually hidden from you by the IDE, so usually you don't care.
There are IDEs that will hide gcc too. Apple's Xcode uses gcc as the default compiler. Most Apple developers don't even notice they are using gcc because - just like Microsoft developers don't realise there's a program called (iirc 'mcc') underneath the IDE with a really awful set of command line switches - the IDE knows how to drive the compiler. All that pretty display in Xcode with a progress bar, and files getting little ticks beside them is all happening because underneath, hidden from the user's view, gcc is doing work.
Nice! I think I have GamesMaster. I never did do anything with it though even after buying it just for the manual :(
Looks like a pretty decent games creator. I *think* I bought it from you as a matter of fact. If not then it was on ebay.