Discuss Scratch

ninjaMAR
Scratcher
1000+ posts

How to learn NASM?

How to learn NASM?

Nevermind. I just figured it out mostly by reading other peoples code

Last edited by ninjaMAR (Sept. 28, 2021 00:59:31)

Raihan142857
Scratcher
1000+ posts

How to learn NASM?

why do you want to learn it? There's not really any good way to learn it online as far as I know… I got a basic understanding of it by reading other people's / the c compiler's assembly code.

scratchieguy12345678
Scratcher
500+ posts

How to learn NASM?

redacted

Last edited by scratchieguy12345678 (May 21, 2021 02:44:24)

ninjaMAR
Scratcher
1000+ posts

How to learn NASM?

Raihan142857 wrote:

why do you want to learn it? There's not really any good way to learn it online as far as I know… I got a basic understanding of it by reading other people's / the c compiler's assembly code.

idk sounds cool

scratchieguy12345678 wrote:

You don't.
if some people know then how? also don't be offtopic
scratchieguy12345678
Scratcher
500+ posts

How to learn NASM?

I guess if you really want to, you could use this tutorial I dug up somehow: https://cs.lmu.edu/~ray/notes/nasmtutorial/
imfh
Scratcher
1000+ posts

How to learn NASM?

If you learn a different assembly language first and it will be much easier. Do you know any other assembly languages?
ninjaMAR
Scratcher
1000+ posts

How to learn NASM?

scratchieguy12345678 wrote:

I guess if you really want to, you could use this tutorial I dug up somehow: https://cs.lmu.edu/~ray/notes/nasmtutorial/
I saw that

imfh wrote:

If you learn a different assembly language first and it will be much easier. Do you know any other assembly languages?
I don't know any other assembly languages. Which should I learn?
PkmnQ
Scratcher
1000+ posts

How to learn NASM?

ninjaMAR wrote:

imfh wrote:

If you learn a different assembly language first and it will be much easier. Do you know any other assembly languages?
I don't know any other assembly languages. Which should I learn?
6502 is easy to learn, but it isn't helping me understand the NASM tutorial linked above, so I'm not sure if it will help.
Raihan142857
Scratcher
1000+ posts

How to learn NASM?

ninjaMAR wrote:

scratchieguy12345678 wrote:

I guess if you really want to, you could use this tutorial I dug up somehow: https://cs.lmu.edu/~ray/notes/nasmtutorial/
I saw that

imfh wrote:

If you learn a different assembly language first and it will be much easier. Do you know any other assembly languages?
I don't know any other assembly languages. Which should I learn?
nasm is pretty much the python of assembly languages in terms of easiness to learn
here are some programs I wrote in nasm, you can read those to try and understand it
ninjaMAR
Scratcher
1000+ posts

How to learn NASM?

Raihan142857 wrote:

ninjaMAR wrote:

scratchieguy12345678 wrote:

I guess if you really want to, you could use this tutorial I dug up somehow: https://cs.lmu.edu/~ray/notes/nasmtutorial/
I saw that

imfh wrote:

If you learn a different assembly language first and it will be much easier. Do you know any other assembly languages?
I don't know any other assembly languages. Which should I learn?
nasm is pretty much the python of assembly languages in terms of easiness to learn
here are some programs I wrote in nasm, you can read those to try and understand it
I understand a little although I would like a guide
imfh
Scratcher
1000+ posts

How to learn NASM?

Here's an assembly program I wrote for a class on the LC3. I commented it pretty well, so hopefully that helps some. If you want to learn more about the instruction set of the LC3, you can skip ahead to page five (525) of this pdf I found. If you have questions, feel free to ask! There is no subtract, multiplies, or equals instruction, so they have to be implemented manually.

I'm not completely sure if it is a good language to learn assembly from, however. Half of my class was about understanding how the computer actually interprets the instructions on the hardware level all the way down at the transistors, which was actually really interesting. It's possible the language was chosen to help more with learning about the hardware rather than assembly programming.

If you actually want to run a program like this, there are instructions for downloading and running the emulator here (it's a .jar file). To run a program, do what it tells you to do for assembling and loading the lc3os, but with different file names (“as program.asm”, “ld program.obj”). Note that you will need to load both the lc3os and the program for it to work correctly.

Ignore the red boxes in the code, I don't think bbcode has a better assembly syntax highlighter than nasm.

The BR instruction looks at the result of the last time a value was saved to a register. BRz will “branch” to a label if the last saved value was a zero.

I've added some extra comments to explain what things do. I started them with ;# to catch attention.

I can't have this here forever since it is possible the same assignment will be reused, so if you want to keep it, you might want to save a copy on your computer.

(removed code, I may put it back later with chunks taken out.)

Last edited by imfh (May 29, 2021 14:05:34)

Raihan142857
Scratcher
1000+ posts

How to learn NASM?

imfh wrote:

Here's an assembly program I wrote for a class on the LC3. I commented it pretty well, so hopefully that helps some. If you want to learn more about the instruction set of the LC3, you can skip ahead to page five (525) of this pdf I found. If you have questions, feel free to ask! There is no subtract, multiplies, or equals instruction, so they have to be implemented manually.

I'm not completely sure if it is a good language to learn assembly from, however. Half of my class was about understanding how the computer actually interprets the instructions on the hardware level all the way down at the transistors, which was actually really interesting. It's possible the language was chosen to help more with learning about the hardware rather than assembly programming.

If you actually want to run a program like this, there are instructions for downloading and running the emulator here (it's a .jar file). To run a program, do what it tells you to do for assembling and loading the lc3os, but with different file names (“as program.asm”, “ld program.obj”). Note that you will need to load both the lc3os and the program for it to work correctly.

Ignore the red boxes in the code, I don't think bbcode has a better assembly syntax highlighter than nasm.

The BR instruction looks at the result of the last time a value was saved to a register. BRz will “branch” to a label if the last saved value was a zero.

I've added some extra comments to explain what things do. I started them with ;# to catch attention.

I can't have this here forever since it is possible the same assignment will be reused, so if you want to keep it, you might want to save a copy on your computer.
(code)
this doesn't look much like nasm as far as I know… what type of assembly is it?
imfh
Scratcher
1000+ posts

How to learn NASM?

Raihan142857 wrote:

this doesn't look much like nasm as far as I know… what type of assembly is it?
It's just LC3 assembly.

Last edited by imfh (May 21, 2021 18:03:57)

Powered by DjangoBB