News:

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

Main Menu

Linux assembly for a total noob.

Started by zedd151, August 06, 2024, 11:13:30 PM

Previous topic - Next topic

zedd151

 :biggrin:
I have wondered how would a Windows user start to write assembly programs for Linux.
Linux OS needed, certainly - to run the program that is.

But what I want to know is what the programming environment would look like.
What development programs there are, debugging tools, maybe some Linux specific reference materials.
Maybe even tips on the Linux operating system as well. Which one, there are many different 'flavors'?

Serious replies only please, from those that know what is needed.  :smiley:
:azn:

jack

#1
for a beginner like myself, I would do the following
if you don't have the sasm IDE and nasm then install them
if you are a Linux beginner then open the terminal and issue these commands
sudo apt update
sudo apt dist-upgrade
sudo apt install nasm
sudo apt install sasm

some nasm examples https://cs.lmu.edu/~ray/notes/nasmtutorial/
you may need to set the sasm preferences to nasm and x64

zedd151

 :eusa_clap: Thanks jack.

Eeks!  :dazzled:  What have I gotten myself into? Seems it will be a steep learning curve to be sure. I will have to set aside a few weekends to investigate all of this, if I decide to explore this further.  :smiley:

Can you recommend a Linux distro?
:azn:



jack

OpenSuse is good too, but has a different package manager

NoCforMe

Quote from: zedd151 on August 06, 2024, 11:13:30 PMWhat development programs there are, debugging tools, maybe some Linux specific reference materials.

Yeah, good question. Specifically:
  • What assembler?
  • What linker?
  • What debugger?
  • What librarian?
  • What other programming tools? (make, etc.)
And while we're at it, what editors are good for writing code? (Please, please, please don't say vi!)
Assembly language programming should be fun. That's why I do it.

Vortex

#7
QuoteUASM 2.56 (Linux 64bit)    27/10/2022    uasm256_linux64.zip    64bit Linux Executable (GCC)

https://www.terraspace.co.uk/uasm.html#p2

stoo23

#8
Quotesudo apt update
sudo apt dist-upgrade
sudo apt install nasm
sudo apt install sasm
It should be mentioned that not all Linux distro's use 'apt' as mentioned above.
Different Distro's, use different 'Package Managers' depending on what initial distribution they are based on.
That said, the process is basically the same, although some distro's also provide a Graphical interface as well, like SuSE.

SuSE was the very first linux distro' I tried, way back and whilst I haven't played with it in a while, it is a very mature and stable product and the founders,
are Zappa fans,..  :smiley:  :thumbsup:

I also liked Zorin OS but can also suggest and recommend Porteus as well  :smiley:

sinsi


stoo23

QuoteAnd while we're at it, what editors are good for writing code? (Please, please, please don't say vi!)
:wink2:
Well, whilst Not a programmer, I am aware of a few Editors,.. NOT vi / vim etc  :joking:

Kate
Kate stands for KDE Advanced Text Editor.
KDE is a desktop environment (graphical interface) for Linux.
The KDE desktop isn't required to use Kate – you can install it on Windows, Linux, and Mac.
Kate allows you to edit multiple documents at the same time.
It supports color-coded syntax, customization, and plugins.

Geany
Geany is a relatively popular text editor and is one of the best Notepad++ alternatives for Linux.
It supports various programming languages (with cross-platform support).
It is fast, powerful, and lightweight.
Easily customizable
Various plugins available

There is also Visual Studio Code, which may or may not accord with your general outlook on life ... lol It may have issues depending on your distro'.
An interesting and similarly powerful alternative to Visual Studio might be VSCodium, definitely worth a look  :thumbsup:

jack

#11
Some beginner examples of using nasm on Linux NASM Tutorial

I am familiar with the geany IDE and use it for all my fun programming exercises.
I had posted a recommendation for geany to experiment with assembly programming in Linux but I ran into some strange problems which I was unable to resolve at the moment, so I withdrew that post, and recommended sasm instead which did a bit better but it has problems of it's own, for one, no matter how hard I looked for the executable I couldn't find it anywhere.

The examples in the tutorial mentioned above work fine with geany if some minor details are taken care of
if you create a Build command in geany with the following command the examples work
nasm -felf64 "%f" && gcc -no-pie -o %e %e.o -lc
but the gcc compiler is not happy unless you change this
        global  _start

        section .text
_start:

to this
        global  main

        section .note.GNU-stack progbits
        section .text
main:

As for what distro' to use, I like Zorin but OpenSuse ThumbleWeed has the more recent dev tools

jack

here is a series of 13 videos on 64-bit Linux programming using yasm COS284, about 14 hours altogether