OSDev.org

The Place to Start for Operating System Developers
It is currently Tue Oct 23, 2018 4:21 am

All times are UTC - 6 hours




Post new topic This topic is locked, you cannot edit posts or make further replies.  [ 84 posts ]  Go to page Previous  1, 2, 3, 4, 5, 6  Next
Author Message
 Post subject: Re: Probable quantity of machine code programmers and Assemb
PostPosted: Wed May 09, 2018 11:06 pm 
Offline
Member
Member

Joined: Tue Mar 04, 2014 5:27 am
Posts: 899
manhobby wrote:
@alexfru,

I asked about machine language, I did not ask about Assembly


That's the closest you'll get. The difference is mainly in that you'll have to encode instructions manually (or with a calculator). CPU manuals typically explain how to encode instructions, so, I'm not sure what difficulties you can have there. Do you know binary, octal and hex? That's all you'll need to encode instructions. But do you know the instructions, how they work and how to express your program's logic in terms of primitive ALU operations and such? If not, you'll need to learn that. Assembly groups/forums are helpful there.


Top
 Profile  
 
 Post subject: Re: Probable quantity of machine code programmers and Assemb
PostPosted: Wed May 09, 2018 11:46 pm 
Offline
Member
Member
User avatar

Joined: Sat Mar 31, 2012 3:07 am
Posts: 3292
Location: Chichester, UK
Why anyone would want to use machine code when assemblers, that produce exactly the same sequence of bytes, are available is a mystery to me. But if you are intent on doing so everything is explained in the Intel manuals, including listings of the operation codes.

Do everyone a favour and stop polluting the forum by asking the same, meaningless, question over and over again.


Top
 Profile  
 
 Post subject: Re: Probable quantity of machine code programmers and Assemb
PostPosted: Thu May 10, 2018 1:15 am 
Offline
Member
Member

Joined: Wed Mar 21, 2018 12:11 pm
Posts: 73
@alexfru,

I said you this answer because Schol-R-LEA and DavidCooper said the following answers:

Schol-R-LEA wrote:
manhobby wrote:
I want to learn machine code and assembly language programming as a hobby.


OK, then. Fair enough.

Now that we have that settled, which system do you mean to learn assembly (or machine code) for? Each processor family (x86, x86-64, ARM, MIPS, PowerPC, Itanium, AVR, 8051, 6502, etc.) has its own machine code and corresponding assembly language instructions, and different models within a family might not support everything that others in their family do (e.g., the current Xeon Phi, and Skylake-X CPUs have the AVX-512 SIMD math instructions, but most of the other x86 CPUs don't, including the Coffee Lake models released last fall, even though they came out a year after Skylake-X).

Also, writing assembly code that uses any kind of operating system facilities will depend on the OS it is written for, as well; an assembly program for Linux won't run on Windows, and vice versa, even when they are both running on the same hardware.

Conversely, if you intend to write for bare metal, either in the form of a self-booting PC program or something running bare on an SBC such as a Raspberry Pi, Libre Renegade, Imagination Creator Ci40, Onion Omega2, or any of the myriad Arduino systems (or retro-computing boards such as the COSMAC Membership Card or the PE6502), then you would have to write everything yourself, and know enough about the hardware and firmware to do that before you begin. For any sort of bare-metal programming, I would recommend using an emulator or virtualizer when developing the program, and waiting until it works in the emulator before trying to run it on live hardware.

For some operating systems - including Windows and most Unix-like systems such as Linux or MacOS - writing machine code directly isn't really feasible at all, as the systems' program loaders will expect the program to be in a loadable Executable Format such as ELF, PE, or Mach-O - and as complex as writing a program in raw machine code is, writing a loadable executable file in hex would be far worse. Machine code programming is really only something you would want to do on bare metal, if at all.

Finally, for assembly language, it will depend on which assembler you are using - most of the common platforms have at least two or three different assemblers targeting them, and the syntax they accept can be very different from each other.

My recommendation is to settle on a specific hardware and software target, and development toolchain, before proceeding. You will probably want to find a book that covers those specifically, rather than trying to translate one book's information to a different system - and trust me, this is one topic you will want at least one good book on. For example, IMAO one of the best books for programming x86 assembly for Linux using the Netwide Assembler (NASM) is Jeff Duntemann's Assembly Language Step By Step, but it won't do you much good if you are targeting an ODROID (which uses an ARM processor), or an x86 system that is running Windows, or even x86 Linux if you are using GAS.

There are plenty of online assembly language tutorials as well (such as these ans these), and even some for machine code programming, but the quality of them is going to be more variable than that of the books - while terrible books can sometime slide by the editors, most online tutorials don't have editors to fix the author's mistakes.

manhobby wrote:
Who here who would help me with that?


Hmmmn... not sure, really. While most of the assembly programmers here are going to be focused on their OS dev projects, if you post specific questions (not general, open-ended ones like you've been doing) or ask help in debugging something you wrote, I and several others will probably give what advice we can. I couldn't promise any specific individuals other than myself.

Machine code programming, meh, not many here or anywhere else will be able to help with that, really. If you ask a specific question about a specific problem, some of us might try to help, but it would be hit or miss.

manhobby wrote:
Which are several more specialized message boards where they certainly would?


I don't know of any machine-code programming fora offhand, and I have no idea if there are any at all, but there are several for different assembly languages. Let Me Google That For You... OK, here are a few I found. Now, most of these are specific to a particular system or assembler, but they might be a few places to try, depending on what you what to target.

Hope this helps.


DavidCooper wrote:
manhobby wrote:
I want to learn machine code and assembly language programming as a hobby.

If you really want to work in machine code as a hobby, you'll need some kind of program to start with which will let you type your machine code numbers into memory and then run your code. You should maybe start by looking at a single-sector OS like BwtSecOS (see the tenth post in https://forum.osdev.org/viewtopic.php?f=15&t=26339) or Selfer (viewtopic.php?f=2&t=26446) - these are self-hosting development systems that fit in a sector and can boot a PC, modify themselves and save themselves back to disk. You could use either of those programs, or write your own single-sector OS based on the same idea, and then try to extend it to add more functionality.

You'll soon find out that to build anything of any size with it, you'll need to automate the repairs to your code whenever it's edited. When you need more space in a routine (to fix a bug or improve its functionality in any way), you have to move parts of it around to make room for the extra code, and that breaks things like jump and call distances. Any variables that are moved will also lead to the parts of code that point at them pointing at the wrong place. Without an automated system to do these repairs, you will waste most of your time fixing them manually (and frequently failing to do so correctly, resulting in crash after crash after crash). That is the main reason that assembler was invented, and it's also why you should put most of your time into learning assembler instead.



manhobby wrote:
What do I need to start to work in Assembly as a hobby?


DavidCooper wrote:
Schol-R-LEA gave you links to possible places to find help, such as the NASM forum. However, I don't know which is the best assembler for you to use. If you're working in a high-level programming language and need to use a bit of assembly for something, you need to use an assembler that integrates well with that high-level language, and that's something I have no experience of, so you need to ask other people for advice on that.


@alexfru,

There is machine language groups?

There is machine language forums?


Top
 Profile  
 
 Post subject: Re: Probable quantity of machine code programmers and Assemb
PostPosted: Thu May 10, 2018 1:18 am 
Offline
Member
Member

Joined: Wed Mar 21, 2018 12:11 pm
Posts: 73
iansjack wrote:
Why anyone would want to use machine code when assemblers, that produce exactly the same sequence of bytes, are available is a mystery to me. But if you are intent on doing so everything is explained in the Intel manuals, including listings of the operation codes.

Do everyone a favour and stop polluting the forum by asking the same, meaningless, question over and over again.


@iansjack

Did you read all the questions I posted on this topic?

Did you read all the answers that were posted on this topic?

@iansjack,

I said I want to learn machine code and assembly language programming as a hobby.

Please, read the following:


manhobby wrote:
Schol-R-LEA wrote:

I have to second the question which Zaval, and several others, have already asked: what are you trying to accomplish by asking these questions? We've already told you that this is a dead end with regards to professional programming. If you want to learn machine code or assembly language programming out of curiosity or as a hobby, go ahead and do it (Hell, there are probably some here who would help you with that, and there several more specialized message boards where they certainly would), but there is no reason for you to be belaboring this if you intent is to find work.

Or do you think we are lying? If you do, then what would you gain out of badgering us about this - seriously, do you think we'll change our answers or something?



@Schol-R-LEA

I want to learn machine code and assembly language programming as a hobby.

Who here who would help me with that?

Which are several more specialized message boards where they certainly would?


@iansjack,

Why you do not ask to DavidCooper why he use pure machine code?

iansjack wrote:
Why anyone would want to use machine code when assemblers, that produce exactly the same sequence of bytes, are available is a mystery to me.


Top
 Profile  
 
 Post subject: Re: Probable quantity of machine code programmers and Assemb
PostPosted: Thu May 10, 2018 1:25 am 
Offline
Member
Member
User avatar

Joined: Sat Mar 31, 2012 3:07 am
Posts: 3292
Location: Chichester, UK
If you want to know what Andrew Tanenbaum meant why don't you ask him? No-one else can tell you for sure.

Wanting to learn assembler and machine code is a fine ambition. Asking other people why you should do so is pointless. If you don't know why you want to do something, what makes you suppose that others do?

There is a wealth of online and printed information about assembler (or machine code) programming. Use it rather than asking others to do the work for you.

Another reply along the lines of your previous ones, asking the same questions yet again, will only confirm the suspicion of some that you are either a bot or a troll.


Top
 Profile  
 
 Post subject: Re: Probable quantity of machine code programmers and Assemb
PostPosted: Thu May 10, 2018 2:20 am 
Offline
Member
Member

Joined: Tue Mar 04, 2014 5:27 am
Posts: 899
manhobby wrote:
@alexfru,

There is machine language groups?

There is machine language forums?


I can't find any. I've really spent some time on google looking for any machine language forum or machine code forum, I've gone through 5 pages of search results for each.

Here's a question very similar to yours, asked 7 years ago and closed as not constructive:
Resources on learning to program in machine code? [closed]
It has answers and comments similar to ours.

I think our moderators should close this thread as equivalently not constructive in nature.


Top
 Profile  
 
 Post subject: Re: Probable quantity of machine code programmers and Assemb
PostPosted: Thu May 10, 2018 2:43 am 
Offline
Member
Member

Joined: Mon Jul 25, 2016 6:54 pm
Posts: 135
Location: Adelaide, Australia
@manhobby Schol-R-LEA said he knows assembly language forums and groups. In his post he said he doesn't know any machine language forums or groups. I don't know any people here who can help you with machine code, but many people here can help with assembly.
It is likely if you want to know machine code you will need to learn it by reading CPU documentation.


Top
 Profile  
 
 Post subject: Re: Probable quantity of machine code programmers and Assemb
PostPosted: Thu May 10, 2018 10:56 am 
Offline
Member
Member
User avatar

Joined: Wed Oct 27, 2010 4:53 pm
Posts: 988
Location: Scotland
@manhobby

If you want to program in machine code you should expect to work without depending on direct help from anyone. The resources available to assembly language programmers are helpful, and one way to learn the machine code numbers is to start by writing lists of assembly instructions (it doesn't have to be a real program) and assembling them into files that show you the hex values that they are converted into. I had to do that for a few advanced instructions when I couldn't work out from any other resources how to form them. I started out though by searching (using a search engine) for something like "PC instruction set". (I would use the wording "x86 instruction set reference" if I was doing it today.) I had very little access to the Internet at the time and managed to get the use of a machine at a church for an hour, saving files to floppy disk. In the search results, I found an entry which led me to a list of instructions and just enough information to work out the machine code numbers for most of them. Many things weren't clear, so I had to do lots of experiments (which led to lots of crashes) to find the missing clarity. It's much easier today and there are plenty of good resources, as you'll find if you do such a search. After that, it's up to you to apply your own intelligence - that's the whole fun of taking on such a challenge: you don't want to be handed everything on a plate. Explore, experiment and build.

_________________
Help the people of Laos by liking - https://www.facebook.com/TheSBInitiative/?ref=py_c

MSB-OS: http://www.magicschoolbook.com/computing/os-project - direct machine code programming


Top
 Profile  
 
 Post subject: Re: Probable quantity of machine code programmers and Assemb
PostPosted: Fri May 11, 2018 8:17 am 
Offline
Member
Member

Joined: Wed Mar 21, 2018 12:11 pm
Posts: 73
Schol-R-LEA wrote:
I'm going say that the question itself betrays a confusion of ideas. In machine code, all you have are numeric values (or, to be very precise, electrical impulses which are conventionally interpreted as numeric values). Regarding addressing, in machine code, the addresses of memory locations are represented as either linear, absolute numeric addresses - 0000:0000, 0000:0001, etc. - or as offsets from the present location - +08, -000A, etc.

These values have to be computed by hand when writing machine code, or at the very least, need to be inserted by hand once they'v been computed. Even more than the difficulty of memorizing the instruction codes, it is this need to get all of these addresses and offsets correct, without fail, that makes machine code programming difficult.

In a conventional assembly language, the language provides tools such as labels which allow the assembler to compute these values for you. In @DavidCooper's toolchain, he developed a different solution, but the basic idea - that the address computations can be handed off to the computer itself - remains the primary solution to this problem.

I hope this makes more sense now, but I have a feeling you will have a lot more questions for us on this.


@Schol-R-LEA,

I don't have other question for you on this.

I also don't have other question general about machine code and Assembly.


Top
 Profile  
 
 Post subject: Re: Probable quantity of machine code programmers and Assemb
PostPosted: Fri May 11, 2018 8:37 am 
Offline
Member
Member

Joined: Wed Mar 21, 2018 12:11 pm
Posts: 73
DavidCooper wrote:
manhobby wrote:
You did not answer a question about a statement of Andrew Tanenbaum.

Sua pergunta já foi respondida duas vezes; uma vez por mim e a outra por StudlyCaps. Eu disse: "Porque ele poderia afirmar que eu não estou fazendo programação pura de código de máquina porque eu automatizei essa parte do processo."


Quote:
You said that is arguably wrong the following affirmation of Andrew Tanenbaum:

"The machine language programmer must always work with the numerical values of the addresses".

Why Andrew Tanenbaum says that the machine language programmer must always work with the numerical values of the addresses?

Ele fez uma suposição de que um programador de código de máquina deveria escrever os endereços e distâncias de salto diretamente, em vez de usar qualquer sistema para automatizar essa parte do processo. Indiscutivelmente, isso é correto se você está escrevendo 100% em código de máquina, mas também é indiscutivelmente errado porque endereços e distâncias de salto não são instruções.


@DavidCooper,

Do you understand Brazilian Portuguese?

If you do not understand Brazilian Portuguese, what is the tool that you used to answer me in Brazilian Portuguese?

I ask this question because will be good to know which is the tool that you used to answer me in Brazilian Portuguese, I want to learn to use this tool.


Top
 Profile  
 
 Post subject: Re: Probable quantity of machine code programmers and Assemb
PostPosted: Fri May 11, 2018 10:26 am 
Offline
Member
Member
User avatar

Joined: Wed Oct 27, 2010 4:53 pm
Posts: 988
Location: Scotland
manhobby wrote:
Do you understand Brazilian Portuguese?

I can make sense of it most of the time, and I can just about speak it well enough to hold a conversation (I know Spanish and French much better, but I've read through language courses for Portuguese, Italian and Romanian in order to be able to understand them too). I just think of it as Portuguese though - I'm not really aware of any great difference between Brazilian and Portuguese Portuguese.


Quote:
...what is the tool that you used to answer me in Brazilian Portuguese?

I used Google Translate to save a lot of time and effort (and I simply selected "Portuguese"), but because I know the language well enough to recognise the seriously mistranslated parts, I was able to correct them.

By the way, if you haven't found it yet, there's a little machine code programming tutorial in the on-disk manual for my operating system (which can be found if you run my OS, and you can do that safely within QEMU or Bochs if you don't want to risk using real hardware or if you lack a floppy disk drive) - there are examples in the tutorial illustrated by little bits of machine code which can be run through a monitor program just by lining up the cursor on them and pressing a key. If you have any difficulty with it, use the PM system to ask me for help.

_________________
Help the people of Laos by liking - https://www.facebook.com/TheSBInitiative/?ref=py_c

MSB-OS: http://www.magicschoolbook.com/computing/os-project - direct machine code programming


Top
 Profile  
 
 Post subject: Re: Probable quantity of machine code programmers and Assemb
PostPosted: Fri May 11, 2018 1:24 pm 
Offline
Member
Member

Joined: Wed Mar 21, 2018 12:11 pm
Posts: 73
To end the topic:

@Schol-R-LEA, @DavidCooper,

Wich are the high level programming languages that has reason to learn to find job?

Wich are the high level programming languages that has no reason to learn to find job?


Top
 Profile  
 
 Post subject: Re: Probable quantity of machine code programmers and Assemb
PostPosted: Fri May 11, 2018 5:00 pm 
Offline
Member
Member
User avatar

Joined: Wed Oct 27, 2010 4:53 pm
Posts: 988
Location: Scotland
manhobby wrote:
Wich are the high level programming languages that has reason to learn to find job?

The ones that are in demand now and the ones that will be in demand in the future.

Quote:
Wich are the high level programming languages that has no reason to learn to find job?

The ones that aren't in demand now and which won't be in demand in the future.

Look at job adverts to see what's wanted now. Look at the changes in job adverts over time to see what's becoming more popular or less popular. Look at what's being taught in universities to try to work out what the experts think will be most useful in the future. Don't expect me to name specific languages because I'm the least qualified person here for doing that.

_________________
Help the people of Laos by liking - https://www.facebook.com/TheSBInitiative/?ref=py_c

MSB-OS: http://www.magicschoolbook.com/computing/os-project - direct machine code programming


Top
 Profile  
 
 Post subject: Re: Probable quantity of machine code programmers and Assemb
PostPosted: Fri May 11, 2018 5:19 pm 
Offline
Member
Member

Joined: Wed Mar 21, 2018 12:11 pm
Posts: 73
DavidCooper wrote:
Don't expect me to name specific languages because I'm the least qualified person here for doing that.


@DavidCooper,

Why you is the least qualified person here for doing that?


Top
 Profile  
 
 Post subject: Re: Probable quantity of machine code programmers and Assemb
PostPosted: Sat May 12, 2018 5:39 am 
Offline
Member
Member
User avatar

Joined: Thu Mar 10, 2016 7:35 am
Posts: 149
Location: Lancaster, England, Disunited Kingdom
manhobby wrote:
DavidCooper wrote:
Don't expect me to name specific languages because I'm the least qualified person here for doing that.


@DavidCooper,

Why you is the least qualified person here for doing that?


Ohhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh!!!!!!!

Please everyone: Cotton on to this... whatever he/she/it is!


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic This topic is locked, you cannot edit posts or make further replies.  [ 84 posts ]  Go to page Previous  1, 2, 3, 4, 5, 6  Next

All times are UTC - 6 hours


Who is online

Users browsing this forum: No registered users and 8 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group