New answers tagged

3

Yes. The Windows NT kernel API (which is traditionally accessed by using the functions defined in ntdll.dll) can be accessed directly by use of the int 2e instruction. However this is not a supported way of using the system, and details of the implementation (including function codes) are likely to change between Windows versions. The basic approach is: ...


1

Now what would simple inclusion imply? For starters, everything that is in the runtime library would have to be included. I suspect that inclusion would take less space as the objects would not need to have tables containing entry points and potentially variables with names. I'm dynamic linking, the entry point table has to be there. I am not sure if ...


0

You want the .eqv directive. It is similar to #define in C or C++. .eqv SPACE_SIZE 40 See: http://courses.missouristate.edu/KenVollmar/mars/Help/MacrosHelp.html But please, see if you can use a better name then, SPACE_SIZE. Re google: found this with a "SPIM MIPS simulator preprocessor" search.


4

If a number takes up 16 bits, and you use 6 of them for something, that leaves 10 bits.


15

They seem to mean simple textual concatenation / insertion. In other words, even though the source text was split into individual files, the program wasn't split into modules.


4

You are seeing connections that don't exist. "Write an assembler" is a programming task just like any other programming task. You use the tools to handle that task that are best for that task. There is nothing special about writing an assembler; there is no reason at all not to write it in a high level language. C is actually at a quite low level, and I ...


1

One thing has absolutely nothing to do with the other. Are web browsers strictly to be written using html or php or some other web content language? No, why would they? Can cars only be driven by other cars and not by humans? Converting one blob of bits (some ascii) to another blob of bits (some machine code) is just a programming task, the programming ...


1

Addressing specifically this part of the question only: "By the way I'm aware that GNU Assembler and Netwide Assembler have been written in C. I am also wondering why they are written in C?" Speaking as part of the team that originally wrote the Netwide Assembler, the decision seemed so obvious to us at the time that we basically didn't consider any other ...


6

What were they doing in the past while the absence of C language? Were they writing Assembler in Machine Code? Assembly is essentially a mnemonic for machine code; each opcode in the machine language is given an assembly mnemonic i.e. in x86 NOP is 0x90. This makes assembler's rather simple (n.b. most assemblers have two passes, one to translate, and a ...


2

Among the reasons to write an assembler in C (or any other higher level language) are all the reasons you might use to justify writing any other program in that higher level language. Chief among those in this case are probably portability and usability. Portability: If you write your assembler in a native language you have an assembler on that platform. If ...


11

People have written assemblers in machine code. They've also written then in assembly language--often a subset of the language they translate themselves, so they start with a simple "bootstrap" version of the assembler, then add features to it as they need them for the assembler itself. However, none of this is particularly a necessity. In the end, an ...


1

We don't have to write a C Compiler for every new architecture. For example the Lisp Machine and the Java VM can do very well without a C compiler. However, if you really want to, C is portable even to these architectures as they are Turing complete. For the common, C-friendly architectures an often used approach is to start writing and using a C cross-...


4

How C language is portable to any instruction set (I mean for new architecture). It is not, but C is portable to most reasonable instruction sets close to existing ones. As an hypothetical counter-example, you might define a computer architecture using ternary (not binary) or decimal. Both did happen in the past (1960s: IBM/1620 was decimal, Russian ...


2

Yes. The instruction set is defined, machine code, an assembly language syntax is defined along with an assembler. Most likely a linker, and then you are ready for a port of the C compiler. And then you can start with bootloaders, operating systems etc (naturally after design verification or as part of it). On rare occasions does anyone vary from this ...


4

in general, every new architecture needs a new port of the C compiler (along with the rest of the C tool chain) Usually this starts with the development of a 'cross compiler' on a known architecture to compile C for the new architecture. (the compiler, itself, can be what is being compiled, from source, for the new architecture.) even a related new ...



Top 50 recent answers are included