Jump to content
  • Advertisement
Sign in to follow this  
Drakkcon

How was the first assembler made?

This topic is 5014 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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?

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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?

Share this post


Link to post
Share on other sites
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 =)

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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 :)

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
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!

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!