How to program in machine code and problem learning assembly....

Started by
4 comments, last by ApochPiQ 12 years, 5 months ago
I would like to write applications using no APIs or programming languages - just machine code. I figured I can translate the assembler's instructions, but I'd have to understand Assembly 100% beforehand. Is it all one language? How does it work? How come there's different kinds of "Assembler" programs if the language is supposed to be the same? How can a program write another program?

And how do you write directly to RAM in OS runtime?

But yeah, it's either gonna be machine code, everything, graphics and all, or nothing.
Advertisement
Well to do code with no API's in assembler you're going to first need to write your own OS, followed by an assembler.

There are different assemblers because assembler is human readable machine code. They all have their own ways of compiling an executable, which is definied by the operating system. Intel usually publishes documents detailing the instruction set of the CPU, but good luck writing your own OS. Maybe study the linux kernal source or Free DOS.
May I ask why would you like to write applications directly in assembler instruction? What benefits do you expect from that?

I would like to write applications using no APIs or programming languages - just machine code. I figured I can translate the assembler's instructions, but I'd have to understand Assembly 100% beforehand.
[/quote]
Fair enough, but going below the level of assembly doesn't yield much of interest.


How come there's different kinds of "Assembler" programs if the language is supposed to be the same?
[/quote]
Each architecture has it's own machine language. Even if it didn't, there is nothing stopping two people writing different assemblers for the same architecture. There are plenty of reasons to do this, one might be more efficient than another, it might generate more descriptive error messages, it might have some simple extensions to help development, or it might be free or open source as opposed to expensive or proprietary.

Or, like yourself, you could have people who decide they must write their own.


How can a program write another program?
[/quote]
What is a program? A program is just data. Your program can output data to memory or to a file that can itself be interpreted as a program.


And how do you write directly to RAM in OS runtime?
[/quote]
Read the documentation for the processor you are targeting. Some instructions allow you to read or write to memory rather than to registers.
I feel that this is relevant here: http://xkcd.com/378
The OP is a known troll that likes to show up every couple of weeks. He's been dealt with.

As such, there should be no need to keep this thread open.

Wielder of the Sacred Wands
[Work - ArenaNet] [Epoch Language] [Scribblings]

This topic is closed to new replies.

Advertisement