News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests
NB: Posting URL's See here: Posted URL Change

Main Menu

Assembler Compiler

Started by esmaz, September 24, 2014, 07:25:10 AM

Previous topic - Next topic

esmaz

Hi all!,

I am newbie in assembly. I wonder how a compiler assembler language is.
Example:
               C compiler: It is done in Assembler.
               Assembler: It is done in Machine Code?... How do they do then?

Greetings.

hutch--

While the question would take both compiler design and assembler design to answer fully, basically an assembler converts instructions to processor opcodes. Some simpler assemblers also add the start and exit code to make executable files bit most of the larger ones create object modules and you use a linker to put the executable code together and it adds the entry and exit code. The linker will also handle multiple object modules.

esmaz

That would be like using the old punch card programming but using a compiler, making instructions are converted to 1 and 0.

hutch--

You will find it is a bit more complex than that. If you can get your C up to scratch you will find that most compiler and assemblers are written in C.

Vortex

Quote from: esmaz on September 24, 2014, 07:25:10 AM
Assembler: It is done in Machine Code?... How do they do then?

Some assemblers like SolAsm and Fasm are written in assembly.

KeepingRealBusy

Quote from: esmaz on September 24, 2014, 08:39:39 AM
That would be like using the old punch card programming but using a compiler, making instructions are converted to 1 and 0.

Been there, done that (1965-66). I worked as a technician for a mainframe manufacture and had to debug the new CPU boxes coming off of the line (long before any integrated circuits - nothing but small boards with discrete components). We could thumb into memory (via switches) instructions and then execute them. When a certain level of logic was verified that it worked (the interrupt vectors), we could start booting small programs that we "wrote" and executed them. This was done on tab cards with an IBM 027 keypunch  in the multi-punch mode (we could punch any of the 12 holes in a single column then advance to the next column) 3 columns per instruction (36 bit words in that era). The program was manually written on a code pad and then converted to machine instructions with physical addressing and then manually punched. The first card had to be smart enough to read any subsequent card (27 instructions per 80 column card).

Let me tell you, you learn a lot about a machine working at that level - hardware peripherals, I/O controllers, Memory storage units (magnetic core storage, remember, no integrated circuits yet), CPUs. It was a blast!

Dave.

Gunther

Quote from: Vortex on September 25, 2014, 04:46:00 AM
Some assemblers like SolAsm and Fasm are written in assembly.

That's true. The PowerBASIC compilers are written in assembly language, too. Those tools are very fast, but not so easy to maintain.

Gunther
You have to know the facts before you can distort them.

guga

RosAsm is also written in assembly
Coding in Assembly requires a mix of:
80% of brain, passion, intuition, creativity
10% of programming skills
10% of alcoholic levels in your blood.

My Code Sites:
http://rosasm.freeforums.org
http://winasm.tripod.com

esmaz

Is one always wonders about the origin of the first compiler. It was very expensive to design the first compiler Assembler 8).

dedndave

early processors had a very limited instruction set - not so bad, really
a new processor comes out - they use the old machine to write a new assembler
of course, things got a little hairy when the 8086/8088 was introduced, as they had to accomodate segments
but, they probably used an 8080 machine to write the first one
(billy gates wrote the OS for the altair 8080 machine)
or - they may have used a mainframe, like an IBM 360/380

dedndave

by the early 70's, they had CRT terminals for the mainframes, so not all programming was done with cards - lol

i remember, when i got out of the army in 1975, i went to college - GI bill   :P
i also got a job working second shift at Courrier Terminal Systems (fixing circuit boards, mostly)
a factory full of CRT terminals - and i was still writing 4004/8008 test code in ML hex - lol
even though the terminals were designed for IBM and Univac mainframes,
the company didn't allow access to the mainframe for production use   ::)

the college only had 1 CRT terminal at that time - you had to schedule time on it against teachers and advanced students
so, i wrote Fortran at college using holerith cards during the day
and worked on CRT terminal hardware at night
it wasn't until a few years later that i actually got to write code using a CRT

i was like, "oh - they have an assembler to do that - cool!"

esmaz

The current problem is that many programmers just programmed in high level.
I program in C, but see above Assembler, is more complex.
So I think that when you start to learn to program in assembler, it is important to know how the first compiler Assembler was designed to better understand the language. Not too deep I speak, I speak to have clear concepts that make us understand how they managed binary code move to Assembler, to make it easier to work with.