flat assembler
Message board for the users of flat assembler.

Index > Main > Newbie really needs help with registers!

Author
Thread Post new topic Reply to topic
Kristian_



Joined: 13 Nov 2004
Posts: 38
Kristian_
Hi!
Well, today I started to learn assembly! I found it very interestring, but difficult too. My first question is about registers! What exactly are they? For example if register ah has value 2, then I need to set ASCII code value for dl register and then use system call to display character who is stored into bl register. As far as I understand registers are like variables, but there is some difference that I don't understand. For example al register is something what controls what will be output of a program? Like:
if al = 2 then display text output
if al = 3 then for example do I/O to parallel port
if ....
Is it this way? And the bl is responsible what would be but out and other registers have other purposes?

And my second question! I try to add contents from one variable to another, but I have an error! Here is my code:
Code:
 ORG 256
 MOV ah, 2
 MOV [variable], word variable2
 MOV dl, word [variable]
 INT 21h
 INT 20h

 variable DW 100
 variable2 DW 200    


Thank you!
Post 13 Nov 2004, 22:32
View user's profile Send private message Reply with quote
Tommy



Joined: 17 Jun 2003
Posts: 489
Location: Norway
Tommy
Code:
mov ax,[variable]
mov [variable2],ax    
Post 13 Nov 2004, 23:28
View user's profile Send private message Visit poster's website Reply with quote
Matrix



Joined: 04 Sep 2004
Posts: 1171
Location: Overflow
Matrix
Registers are the part of your CPU = Central Processing Unit
it Contains ALU FPU in simple cases,
ALU Arithmetical & Logical Unit contains the registers
FPU Floating Point Unit contains the fpu stack 8*10 bytes (also these are somwhat MMX registers too)
32bit ALU contains 32 bit registers EAX EBX ECX EDX
each has a 16 bit lower part accessable simply by using AX BX ...
and these have lower and upper bytes accesable simply by using AL (low) AH (hi) byte BL BH ...
segment registers, which you can load a general purpose register in/out
in 16 bit mode: cd ds es gs fs gs ss
32 bit mode:
ESI EDI EBP ESP EBX EDX can be used as address pointer you can extend my post, this was a quick.

for example you can in 16 bit mode address a byte in memory like:
Code:

mov byte [es:di],al ; these 2 lines are equal to stosb (if direction flag cleared (cld))
inc di

mov al,byte [ds:si] ; these 2 lines are equal to lodsb (if direction flag cleared (cld))
inc si
    
Post 14 Nov 2004, 01:23
View user's profile Send private message Visit poster's website Reply with quote
Kristian_



Joined: 13 Nov 2004
Posts: 38
Kristian_
Thank you!
Post 14 Nov 2004, 12:23
View user's profile Send private message Reply with quote
Matrix



Joined: 04 Sep 2004
Posts: 1171
Location: Overflow
Matrix
well i see your thread is already DUPE,

http://board.flatassembler.net/topic.php?p=18303

why do you post same question multiple times?
Post 15 Nov 2004, 23:51
View user's profile Send private message Visit poster's website Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
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 vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2020, Tomasz Grysztar.

Powered by rwasa.