collapse collapse

* Who's Online

  • Dot Guests: 167
  • Dot Hidden: 0
  • Dot Users: 0

There aren't any users online.

* Board Stats

  • stats Total Members: 88
  • stats Total Posts: 11164
  • stats Total Topics: 1700
  • stats Total Categories: 4
  • stats Total Boards: 76
  • stats Most Online: 1470

Author Topic: [2] Basics of ASM  (Read 4113 times)

0 Members and 1 Guest are viewing this topic.

Offline Nathan

  • Administrator
  • Hero Member
  • *
  • Posts: 1437
  • Reputation 1768
  • Gender: Male
  • woof woof
    • View Profile
[2] Basics of ASM
« on: December 24, 2008, 09:32:30 pm »
So before we go ahead and write our next program lets discus some ASM instructions and what are variables ect.

To start with you get 4 general registers to work with:
-          Arithmetic registers
o       AX  [ AH | AL ] A = accumulator
o       BX  [ BH | BL ] B = base register used as index in arrays
o       CX  [ CH | CL ] C = count register used in loop operations
o       DX  [ DH | DL ] D = data register used as an extension involving 32 bits
ax is used to access all 16 bits, ah is used to access the higher order 8bits and al is used to access the lower order 8 bits

There are 2 more registers that are used for string manipulation.
si and di
si = source string
di = destination string

There are a handful of variable types that are available to you, but the main purpose is not to provide you with different classes, just allows you to access a series of bits.
a byte is 8 bits so this will be used with al or ah
a word is 16 bits so this will need to be used with ax

To define a string you put:
Code: [Select]
string db 'string'db = define byte
Inside of your data segment

To define a number you put:
Code: [Select]
num1 dw dup(?)dw = define word
Inside of your data segment

To copy data among variables/registers around you use the mov instruction. This does NOT move data, it makes a copy of it.
So...
Code: [Select]
mov ax, 5Puts 5 into ax
« Last Edit: April 21, 2009, 07:14:09 am by Nathan Adams »
Projects:
[ Axios Engine ] [ sourcehub ]
Compilers: Microsoft Visual Studio 2008, GNU C++, FASM, MASM, VB 6/.Net.
Languages: C++, PHP, ASM, JS, VB6/.Net, BASIC, HTML, MySQL
Please buy me some books: Amazon Wishlist

Offline Celestialkey

  • Administrator
  • Hero Member
  • *
  • Posts: 3962
  • Reputation 4874
  • Gender: Male
  • Its Alive!!
    • View Profile
    • www.CelestialCoding.com
Re: [2] Basics of ASM
« Reply #1 on: March 03, 2009, 02:40:41 pm »
Next tutorial is expected when? I need to know this stuff now for my OS programming.
Created By: Eczuo
Quote
I have noticed that people who claim that everything is predestined, and we can do nothing to change it, look both ways before they cross the road.
Quote
I'd prefer to die standing, than to live on my knees - Che Guevara
Quote
If you change the way you look at something, does that something change in any way?
- Quantum Theory

Hacking
Quote
Never in the field of human conflict was so much owed by so many to so few. - Winston Churchill


Quote from: Revelations 12:4
And his tail drew the third part of the stars of heaven, and did cast them into the earth; and the dragon stood before the woman which was ready to be delivered, for to devour her child as soon as it was born.

Quote
It takes skill to build an empire. It takes an idiot to maintain it.

Offline Nathan

  • Administrator
  • Hero Member
  • *
  • Posts: 1437
  • Reputation 1768
  • Gender: Male
  • woof woof
    • View Profile
Re: [2] Basics of ASM
« Reply #2 on: March 05, 2009, 09:48:32 am »
Next tutorial is expected when? I need to know this stuff now for my OS programming.
I can post my notes, but I have been very busy lately.
Projects:
[ Axios Engine ] [ sourcehub ]
Compilers: Microsoft Visual Studio 2008, GNU C++, FASM, MASM, VB 6/.Net.
Languages: C++, PHP, ASM, JS, VB6/.Net, BASIC, HTML, MySQL
Please buy me some books: Amazon Wishlist

Offline Celestialkey

  • Administrator
  • Hero Member
  • *
  • Posts: 3962
  • Reputation 4874
  • Gender: Male
  • Its Alive!!
    • View Profile
    • www.CelestialCoding.com
Re: [2] Basics of ASM
« Reply #3 on: March 05, 2009, 11:02:30 am »
Please do.
Created By: Eczuo
Quote
I have noticed that people who claim that everything is predestined, and we can do nothing to change it, look both ways before they cross the road.
Quote
I'd prefer to die standing, than to live on my knees - Che Guevara
Quote
If you change the way you look at something, does that something change in any way?
- Quantum Theory

Hacking
Quote
Never in the field of human conflict was so much owed by so many to so few. - Winston Churchill


Quote from: Revelations 12:4
And his tail drew the third part of the stars of heaven, and did cast them into the earth; and the dragon stood before the woman which was ready to be delivered, for to devour her child as soon as it was born.

Quote
It takes skill to build an empire. It takes an idiot to maintain it.

Offline isaro

  • Software Developer
  • Administrator
  • Sr. Member
  • *
  • Posts: 393
  • Reputation 505
  • Gender: Male
    • View Profile
Re: [2] Basics of ASM
« Reply #4 on: April 20, 2009, 08:18:50 pm »
If anyone has time, I would like more ASM tutorials.

Ones that are easyish to understand, having trouble comprehending everything >.<
0001 + 1000 = 1001

Offline SphinX

  • Full Member
  • ***
  • Posts: 198
  • Reputation 373
  • Gender: Male
    • View Profile
Re: [2] Basics of ASM
« Reply #5 on: April 20, 2009, 10:06:19 pm »
Nice Start Nathan..
Looking forward to further tutorials..  :)
- SphinX

 

Donate


* Search


* Recent Posts

I miss the chatbox by Shishka
[August 27, 2019, 11:52:39 pm]


Image Comparison by Shishka
[May 15, 2017, 01:18:02 pm]


Re: srchub - free source code hosting by Nathan
[December 14, 2015, 11:37:02 pm]


Re: srchub - free source code hosting by Celestialkey
[November 27, 2015, 08:51:42 am]


Updates by Nathan
[October 30, 2015, 08:27:36 pm]