flat assembler
Message board for the users of flat assembler.

Index > Main > Tajga tutorials question.

Author
Thread Post new topic Reply to topic
Embrance



Joined: 14 Mar 2004
Posts: 116
Location: Greece
Embrance
(1)Is org 256 used to define that the file produced by FASM will be a COM file.Right?

(2)On tutorial #2:
"Now how to set value of register? There is a instruction which does this, for example"
mov al,10

I could use other register as well,coudlnt i?Or is this register used for a specific purpose?

(3)After this part there is:
"mov al,bl"

I assume this copies the value of "al" register to "bl" register.I could use any registers instead?
Example:

mov bl,5
mov bl,al

Would it be coreect and work?
In this case does "al" register get the value "5" as well?

(4)Now if i run the example:

org 256
mov ah,2
mov dl,'a'
int 21h
int 20h

and execute it on CMD(Command Line) it prints "a".
Note:It 8 bytes compiled.

Now i did some tests.

(a)changed "move ah,2" to "mov ah,1".
In this case nothing is shown and the cursor blinks until i press Enter and get me a line.(Nothing is shown thought)
Why this happens?

(b)changed "move ah,2" to "mov ah,3".
Now it was kinda strange.It was blining again,but even if i hit Enter,nothing happens.
Why this happens?

(c)Now i modded a little bit the source:
org 256 => same e as it was
mov ah,2 => mov dl,2
mov dl,'a' => move ah,'a'
int 21h => same.
int 20h => same.

Even if this compiles it dont get anything on CMD.
Why is this happening since both "ah" and "dl" are registers.
Is there any meaning/difference on using "ah" or "dl" on specific areas of my program/s?

Also its 10 bytes(from 10 it was before).
All i did was to change the registers order.Why it got 2 more bytes?

Thanks for your time![/code]
Post 12 Feb 2005, 17:34
View user's profile Send private message MSN Messenger ICQ Number Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid
Quote:

(1)Is org 256 used to define that the file produced by FASM will be a COM file.Right?

Yes, you can take it that way.
Quote:
(2)On tutorial #2:
"Now how to set value of register? There is a instruction which does this, for example"
mov al,10
I could use other register as well,coudlnt i?Or is this register used for a specific purpose?

Of course, you can use "mov" instrcution with any register.
Quote:

...
Would it be coreect and work?
In this case does "al" register get the value "5" as well?

yes, again you can use any register this way. And in this case, after first instruction AL will hold value 5, after second instruciton (mov bl,al) BL will hold 5 too, and value of AL won't be modified (mov instruction only changes it's first argument), so it will be still 5.

a), b). value in AH (2) identifies which service of DOS you wish. Service 2 is for printing single character, and if AL contains other number, then it calls other service of DOS. You can look at http://www.ctyme.com/intr/int-21.htm for list if DOS services

In exmple c), you called service whose number is ASCII code of 'a' (in assemblers 'a' means ASCII value of character "a").
Post 12 Feb 2005, 18:11
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
Embrance



Joined: 14 Mar 2004
Posts: 116
Location: Greece
Embrance
Thanks.I reply with more questions(if i have any.)
Post 12 Feb 2005, 18:38
View user's profile Send private message MSN Messenger ICQ Number Reply with quote
Embrance



Joined: 14 Mar 2004
Posts: 116
Location: Greece
Embrance
Quote:
a), b). value in AH (2) identifies which service of DOS you wish. Service 2 is for printing single character, and if AL contains other number, then it calls other service of DOS. You can look at http://www.ctyme.com/intr/int-21.htm for list if DOS services

Is there a zipped version of it or any other files with helpful info as this?
Post 13 Feb 2005, 11:23
View user's profile Send private message MSN Messenger ICQ Number Reply with quote
gumletis



Joined: 18 Dec 2004
Posts: 128
gumletis
there is alot of interrupts, its take years for just getting they most to know, i only know like 10-20, and can remember 7 Razz lol, but there is also 21/9, that print out a whole string out on the screen, and stop printing when its get the symbol '$' so if you have a msg with this is in it msg db 'hello world$forfun',0 it will print out 'hello world'... Let me give you some examples..
21/9 takes dx and print out until $ is meet in the string

Code:
org 0x100        ; this just start a normal com file(all hexedecimal can be used with fx   0x100/100h/$100  in fasm - donno others
mov dx,msg         ; mov msg to dx register
mov ah,0x9          ; mov 0x9 to ah register, can also be of course  9/09h
int 0x21                  ; this is the one there start the full thing, this "int" means that its start a interrupt, i think almost all interrupts checks ah register for services number, and this is 0x9(print out dx until $ is meeted) and its called 21/9      or 21h/09h
RET                       ; return to OS, there is also a interrupt for this i think its
                      ; mov ah,0x4c
                      ; int 0x21
                      ; but im not suree  Rolling Eyes 
    


so there is one there copy the command line arguments to the dx register
Code:
org 0x100
mov dx,0x82              ; copy 0x82 to dx, 0x82 is the command line address
mov ah,0x9                ; if you don't understand this, READ THE FIRST CODE!  Laughing 
int 0x21                        ; And if you don't know this lol read the first 
RET                                ; SAME HERE
    

this print out the command line arguments, so lets say it called "print.com" so you want fx to print out "hello world, i hate you" so you do like this "print.com hello world, i hate you$" its importen with the '$' if you don't have that, it will print out the whole program there is under address 0x82, and that would beep a lot Laughing (becuase all ascii(American Standard Charactors blah blah some more, can't remember Shocked ) charactors from 1-31 have something special to do, number 7 is a beep, number 1 is a simley, and so off. www.asciitable.com good site for ascii symbols... And wanna show you one more interrupt, theres called 16/0 its used for input a charectors, can also be used for a "stop until key pressed" thing(i use i almost only to that) its easy to do, a example here

Code:
org 0x100
mov dx,0x82
mov ah,0x9
int 0x21
; thats the other code, now to the new one
mov ah,0x0
int 0x16           ; if you guess it would be so easy, your right!
                          ; i use this, but instead of the    mov ah,0x0    almost all use    xor ah,ah      its just move the 0 to ah, as before you can also do like this     mov ah,0       or         mov ah,0h          you choose!.
RET
    


Now i don't wanna boring your mind with asm information right now

_________________
LOOOL
Post 13 Feb 2005, 12:27
View user's profile Send private message Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid
emrance: search for "ralf brown interrupt list"
Post 13 Feb 2005, 13:21
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
Embrance



Joined: 14 Mar 2004
Posts: 116
Location: Greece
Embrance
Post 14 Feb 2005, 02:00
View user's profile Send private message MSN Messenger ICQ Number Reply with quote
Embrance



Joined: 14 Mar 2004
Posts: 116
Location: Greece
Embrance
Heres another question:Can i store into a register multiple values?
Example:

mov al,10
mov al,20

Will al hold both 10 and 20?
Post 19 Feb 2005, 07:38
View user's profile Send private message MSN Messenger ICQ Number Reply with quote
Tommy



Joined: 17 Jun 2003
Posts: 489
Location: Norway
Tommy
No, you can't... The second instruction will alter the contents of the AL-register
Post 19 Feb 2005, 08:36
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.