Page 2 of 2

Re: In what ways the assembly language can help us?

Posted: Wed Jul 17, 2013 7:42 pm
by IdiotOS
Is it possible to add GUI in assembly language?

Re: In what ways the assembly language can help us?

Posted: Wed Jul 17, 2013 8:36 pm
by Minoto
It's possible to write any program a computer is capable of executing in assembly. It just takes more effort than it's worth most of the time.

Re: In what ways the assembly language can help us?

Posted: Wed Jul 17, 2013 8:40 pm
by XanClic
Casm wrote:
I don't see the point why access to CPU control registers, I/O ports* or the creation of interrupt handlers should actually be impossible in all high level languages.
Because that is not what high level languages do. The whole point of them is to use high level instructions which hide (and are not tied to) the underlying hardware.
They hide it, if you don't want to see it. I don't know why it should be forbidden to be visible if necessary.
Casm wrote:
JAAman wrote:ultimately everything becomes assembly
That's the point. Since everything becomes assembly, your compiler is theoretically capable of emitting every assembly code you could also write yourself.
The compiler emits whatever the compiler writer decided it should emit. Unless you are the person who wrote the code generator, you have no control over that.
GCC is free software, so of course I do have control if I really badly want to.
Casm wrote:
JAAman wrote:in other languages, you are not directly controlling the CPU, you are controlling the logic, therefore there can be nothing inherently in the language that can directly control the CPU...
And this, on the other hand, is wrong. Of course there can. There is no fundamental reason to restrict a compiler to emit only arithmetic-logical and branching instructions.
A "high level" language which could do every thing you can do in assembly language would almost by definition not be a high level language. It would at least have to be some kind of strange hybrid.
I don't see how that relates to my argument you've cited.

As I've pointed out, there actually is a way to access CPU registers with GCC (without inline assembly, although the “asm” keyword is indeed reused). GCC however only allows access to the GPRs, so access of CR3 is forbidden there. I guess it'd be pretty easy to change that, though.

I have a hard time understanding that a language can't be both high and low level at the same time (the hybrid you mentioned). If it can abstract the whole “low level” stuff, it is high level. If it doesn't, it is low level, obviously. In pure C (read: C without abusing undefined constructs), I'm stuck at high level (with a pretty “basic” set of functionality). In assembly, I'm stuck at low level. What's the problem with having languages that allow you to access low level stuff in a high level manner and not having to deal with that low level if you don't need to?

I do see your point if you forbid the existence of such languages. I however don't see why they should be forbidden.

Re: In what ways the assembly language can help us?

Posted: Thu Jul 18, 2013 1:13 am
by Kevin
XanClic wrote:This is already ignoring the fact that most of us (if not all) are horribly abusing C/C++ already by doing basically completely undefined pointer operations (ever casted an integer to a pointer that wasn't created by casting a pointer to an integer?).
They are implementation defined, not undefined. Otherwise we'd be in big trouble.

Glad that you already found on your own how the gcc syntax for binding variables to registers works, that would have been my second comment. ;)

Re: In what ways the assembly language can help us?

Posted: Thu Jul 18, 2013 5:18 pm
by XanClic
Kevin wrote:
XanClic wrote:This is already ignoring the fact that most of us (if not all) are horribly abusing C/C++ already by doing basically completely undefined pointer operations (ever casted an integer to a pointer that wasn't created by casting a pointer to an integer?).
They are implementation defined, not undefined. Otherwise we'd be in big trouble.
Oh, yes, you're right. I'll take back the “horribly”, then.

This doesn't change my point, though: Then we're not using undefined C but rather implementation-defined C. I do have to amend one of my previous statements:
XanClic wrote:What's the problem with having languages that allow you to access low level stuff in a high level manner and not having to deal with that low level if you don't need to?
The fact that access to the whole address space through casting arbitrary integers to pointers is not undefined shows that C is in fact such a hybrid language (at least to me).

Re: In what ways the assembly language can help us?

Posted: Thu Jul 18, 2013 8:17 pm
by VolTeK
m12 wrote:
IdiotOS wrote:In what ways Assembly Language can specially help us to make an operating system ,when comparing to other programming languages like c,c++..?

For example: Controlling fan speed,data handling...
Here's a comprehensive list:


Other than that
Your experience is showing again

Re: In what ways the assembly language can help us?

Posted: Fri Jul 19, 2013 1:27 am
by Kevin
XanClic wrote:The fact that access to the whole address space through casting arbitrary integers to pointers is not undefined shows that C is in fact such a hybrid language (at least to me).
Then you'll have a hard time finding any natively compiled language that isn't.

Re: In what ways the assembly language can help us?

Posted: Fri Jul 19, 2013 8:56 am
by XanClic
Kevin wrote:
XanClic wrote:The fact that access to the whole address space through casting arbitrary integers to pointers is not undefined shows that C is in fact such a hybrid language (at least to me).
Then you'll have a hard time finding any natively compiled language that isn't.
Why would I bother? I said I don't see why such languages shouldn't exist and, in fact, I like such “hybrid” languages. :wink:

Re: In what ways the assembly language can help us?

Posted: Fri Jul 19, 2013 10:26 am
by Kevin
Just saying. A category like "hybrid language" loses its meaning when all languages are part of the category.

Re: In what ways the assembly language can help us?

Posted: Sat Jul 20, 2013 11:28 pm
by Prochamber
Kevin wrote:Just saying. A category like "hybrid language" loses its meaning when all languages are part of the category.
It's true most compiled language have some kind of 'low level' functionality; but often languages that attempt to create a higher level interface have little or no low level capabilities because the creators see no need to incorporate them. So in this sense there aren't as many "hybrid" languages as it seems at first glance.
i.e. Simply having the ability to do inline assembly would not qualify a language to be a low/high level hybrid.

Re: In what ways the assembly language can help us?

Posted: Sun Jul 21, 2013 12:06 pm
by Mikemk
Prochamber wrote:
Kevin wrote:Just saying. A category like "hybrid language" loses its meaning when all languages are part of the category.
It's true most compiled language have some kind of 'low level' functionality; but often languages that attempt to create a higher level interface have little or no low level capabilities because the creators see no need to incorporate them. So in this sense there aren't as many "hybrid" languages as it seems at first glance.
i.e. Simply having the ability to do inline assembly would not qualify a language to be a low/high level hybrid.
I agree with this in the same way that javascript and html are not the same language, even though they're typically embedded in one another.