How was the first assembler made?

Started by
31 comments, last by Drakkcon 19 years, 5 months ago
How do you program a compiler for the lowest level programming language? Are assemblers programmed in binary? And at what point can as assembler be called an assembler instead of another programming language? With all the high level macros, can MASM and TASM really be called assemblers?
Advertisement
If you really want, you can program computers in machine language. In fact, people did that for longer than you'd guess. These were the days of punchcards, where you'd write an entire program before the computer would ever see a single character of it.

As you've correctly identified, the line between "assembler" and "compiler" is at times a vague one. I still think it's a legitimate distinction, however, and I think the key is that the code you write in MASM/TASM has a distinct mapping onto machine language. This differs from C, Java, etc. in that the assembler is not free to optimize, choose registers, etc. It has macros, but you always know what macros those opcodes evaluate to.
Alright, so an assembler's macros translate into low-level asm, and then into hexcodes, and then machine code; whereas high level languages like C++ do a whole lot of crap in between?
Used to be the case that high-lev language compilers would compile down to assembler, then build a binary out of that assembler code. Modern compilers (VC++ for instance) compiles directly to binary.

Sounds like you've got a good handle on it =)
Bingo. Of course, in assembler you end up doing that "whole lot of crap in between" yourself. The advantage of HLLs (high-level languages) over assembler is that they free you from the minutiae of controlling the CPU while allowing you to have complete control over the important part, namely what your program actually _does_. The disadvantage is that sometimes you want that full control.
Thanks for explaining it both of you! This has puzzled me for a while, because I actually found some high-level assemblers easier than C++ for some things. I'm just learning about calling interupts (Namely 24h), and now what sneftel said about doing all the crap your self makes sense :)
how would you write a programe in binary today?
Quote:Original post by kingpinzs
how would you write a programe in binary today?


my guess would be use a hex editor...

you could also easily write a program in a high level language that just lets you write a binary file
I mean binary is 1 and 0 right.

can I actuly right in 1 and 0 or is just hex that repersents the 1 and 0?
Just make a blank non .txt file and start using coding in binary. After your done, just rename the file to .exe and your good to go. Of course you must know the structure of an executable, you must know what all of the binary opcodes translate to in hex, and you gotta know a lot of assembly. Doing this for a 32 bit OS that requires all of that stupid PE BS would take months and months of coding everyday.

I suggest you pick up an older version of dos and than start hacking away. Your not going to have to worry about loading dlls, making system calls, PE structure, and the rest of the works. You could getting an executing program in under 3 minutes. Especially if you made or use a tool to convert hex into binary. The program would have one assembly command. This would be -> int 21h. Your file would be two bytes.
GL!
I study day and night, memorizing the game.

This topic is closed to new replies.

Advertisement