Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
PPC ASM feels like microcoding a LispM sometimes... Some of the instructions have a 1-1 correspondance to the semantics of some microinstructions on the TI Explorer I Raven processor... Far more often than those on the x86.
Anyway, back to on-topic. My last OS was written in a mutant Forth variant. My next OS will probably be written in a mutant Lisp variant. Assuming that I write another one, that is. I haven't been in an OS dev mood recently.
Hi
I take your point too.
I do not meen that asm is more readable than say C,just it is to me.
I do not do any C programing.But i can see what that code dose,but my girlfriend has not a clue, but she new straight away what this means :
mov ax,4 ; put 4 in to the reg ax
And there are so few people capable of doing ASM on the x86 that they are talking about reprogramming the bios in a differant language.
I use NASM most the time. SPHiNX C-- or QBasic PDS 7.1 if I want quick-and-dirty programs. I like C also. Pascal is okay. Everyone likes different programming styles and uses. Each language has its place in the world. Some people just prefer the oddball out of the bunch, but this is what makes programming languages so fun to use- choice. Lately I have been using NASM with a preprocessor I programmed to make it almost like a HLL but not taking away from the assembler. Using this method, I can do something like eax=ebx+(eax/[foobar]) or I can do it long hand in assembly, all within the same source code. Choice is a good thing, but can make things look more complex to the outside world
Combinations of languages is a good thing too. Like C+assembly, Pascal+Basic, or Hybrid+assembly, etc.
ASHLEY4 wrote:my girlfriend has not a clue, but she new straight away what this means :
mov ax,4 ; put 4 in to the reg ax
With the natural-language comment in there telling your girlfriend exactly what the line of code does, it doesn't matter how convoluted the actual code is:
/* program that inputs a name and outputs a greeting */
int main(int argc,char* argv[]){char name[100];printf("Enter name:");gets(name);printf("Hello, %s!\n",name);return 0;}
Case in point.
However, a simple assignment in C is more self-descriptive:
darklife wrote:
Maybe a programming language that is structured well, but uses very descriptive syntax, would be a good thing?
The most important thing for a language is that it is understood. Unfortunately, that plays in the ballpark of "compatibility" - not beeing too different.
cin and cout are streams. A stream represents something which looks like a file, but data written to or read from a stream could go to or come from anywhere. Standard types of stream are the file stream (base classes ifstream and ofstream), for reading and writing files; and the string stream (base class strstream), for reading and writing blocks of memory. Of course, you can define you own subclasses which do whatever you want with their data.
You program all streams in the same way, regardless of their type. << is called the insertion operator here, and is used to write. >> is called the extraction operator, and is used to read. Alternatively, streams define the read and write methods, if you prefer to use those. << and >> will behave correctly according to the type you give them, so you don't have to worry about getting the right %s, %d or %f. It's possible to change the formatting used for numbers, though I forget the syntax at the moment.
All in all, streams are a lot more powerful, more extensible, and safer than fprintf, fscanf, fwrite etc. Alternatively, C++ still supports the C functions, so you can use those too.