Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon.

Pages: 1-

Learn x86 assembly

Name: Anonymous 2014-05-18 2:33

I am on Windows using FASM. Is this ok? Any tutorials? I'm not really interested in learning the winAPI, console applications are fine.

Name: Anonymous 2014-05-18 3:49

The best way to learn assembly is to write a compile. A good tutorial for this is Structure and Interpretation of Computer Programs.

Another good way is to start at the beginning and study finite automata, specifically Von Newman machines, and how they relate to computability. Then move onto deterministic Turing machines and their mathematical grounding. Finally, when you can express any algorithm you like in a typed lambda calculus, you will be ready to write programs in assembly with ease because it is just a change of grammar.

Name: Anonymous 2014-05-18 4:50

I am on Windows using FASM. Is this ok?
FASM might be ok, nasm is better. Windows is not ok.

Any tutorials?
Assembly programs are just bunch of instructions. It's probably so simple there's no need for tutorials.

If you have problems understanding how to structure your program flow, you could just start by writing a C-version of that program. After that, replace all blocks with `goto`. After that, replace all `for` and `while` with `if` and `goto`. After that, it's trivial to transform that to assembly.

If you still have problems, you can make your compiler produce assembly listings and study those.

And here's how those `if` statements are written in assembly (x86_64 example)


// a, b and c are unsigned long integers
if (a < b) goto something_else;
c = a + b;
goto end;
something_else:
c = a - b;

end: ;

; Assembly version, variables a, b and c are stored in registers rax, rbx, rcx
cmp rax, rbx ; compare rax and rbx
jl something_else ; "jump if less"
mov rcx, rax ; c = a
add rcx, rbx ; c += b
jmp end
something_else:
mov rcx, rax ; c = a
sub rcx, rbx ; c -= b

end:

Name: Anonymous 2014-05-18 5:06

I'm not really interested in learning the winAPI

That's not how it works in Assembly. Unless you intend to write programs that take absolutely zero input and never output anything you need to interface with the kernel. You will be learning Windows-kernel specific calling conventions and names. Otherwise you won't even be able to print to the console.

Unless you're going to use C library functions from your assembly programs, but then there's no point in learning assembly.

Name: sage 2014-05-18 8:21

there.s already an x86 thread you dickhead.......

Name: Anonymous 2014-05-18 11:03

>>5
Great, so I make "programming" thread, and no other threads are allowed in this board ever again, since they all somehow relate to programming?

Name: Anonymous 2014-05-18 17:48

>>4
Maybe he justs want to program an 8255 to control an [blink]LED[/blink]. You don't need a kernel for that.

Name: Anonymous 2014-05-18 19:29

Windows is written in pure, self-modifying assembly code. Notice how you can install 15 gigs of data from a single Windows install DVD, which can only hold 5 gigs? This is because the code is dynamically generated to minimize attack vectors. Any attempt to observe the static files on the disk will change how it looks in runtime. This is also why Windows needs to be updated so often, so the running code never looks like it did before. Only the most well written virii can operate on a modern Windows system that uses self-modifying code, Address Space Layout Randomization, and Data Execution Prevention.

Name: Anonymous 2014-05-19 8:13

>>8
More of this.

Name: Anonymous 2014-05-20 1:03

>>8
*viruses

Name: Anonymous 2016-07-11 5:27

(stopping the dubsfaggot from dubsbumping)

Don't change these.
Name: Email:
Entire Thread Thread List