The MASM Forum

Miscellaneous => The Orphanage => Topic started by: esmaz on September 24, 2014, 07:25:10 AM

Title: Assembler Compiler
Post by: esmaz on September 24, 2014, 07:25:10 AM
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.
Title: Re: Assembler Compiler
Post by: hutch-- on September 24, 2014, 08:21:35 AM
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.
Title: Re: Assembler Compiler
Post by: 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.
Title: Re: Assembler Compiler
Post by: hutch-- on September 25, 2014, 04:26:51 AM
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.
Title: Re: Assembler Compiler
Post by: Vortex on September 25, 2014, 04:46:00 AM
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.
Title: Re: Assembler Compiler
Post by: KeepingRealBusy on September 25, 2014, 07:48:55 AM
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.
Title: Re: Assembler Compiler
Post by: Gunther on September 25, 2014, 05:38:18 PM
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
Title: Re: Assembler Compiler
Post by: guga on September 25, 2014, 09:19:02 PM
RosAsm is also written in assembly
Title: Re: Assembler Compiler
Post by: esmaz on September 25, 2014, 09:47:22 PM
Is one always wonders about the origin of the first compiler. It was very expensive to design the first compiler Assembler 8).
Title: Re: Assembler Compiler
Post by: dedndave on September 25, 2014, 09:54:20 PM
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
Title: Re: Assembler Compiler
Post by: dedndave on September 25, 2014, 10:07:38 PM
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!"
Title: Re: Assembler Compiler
Post by: esmaz on September 25, 2014, 11:07:39 PM
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.