flat assembler
Message board for the users of flat assembler.

Index > DOS > new asssembler problem

Goto page 1, 2  Next
Author
Thread Post new topic Reply to topic
b



Joined: 15 Oct 2004
Posts: 11
b
hi every body, i'm new assembler and i have aprob dealin with this assembly language,

mostly i have problem in putting this value i took from key board ito a variable!! to deal with ,

they told me that by default the value is stored in "al" register, and i build my code depending on this Crying or Very sad but it's not working!!!!

if any knows about this adding decimals!!! can u offer any help!!!
plz!!!
thx
b
Post 16 Oct 2004, 21:10
View user's profile Send private message MSN Messenger Reply with quote
Matrix



Joined: 04 Sep 2004
Posts: 1171
Location: Overflow
Matrix
Hello b

i'd suggest you learning the cpu operations,
then look at a few examples

like
keyboard reading and writing hex value to screen
http://board.flatassembler.net/topic.php?t=2438
variable using and writing to screen
http://board.flatassembler.net/topic.php?t=2399

i don't have to say you move a variable to a register like
Code:
mov ax,word [testvar]
    

and register into variable
Code:
mov word [testvar],ax
    

and variable offset into register
Code:
mov ax,testvar
    

of course you initialize variables like:

Code:
testvar dw 0 ; declares 2 bytes in com file
testvar rw 1 ; reserves 1 words in com file
testvar rb 2 ; reserves 2 bytes in com file
; reserved variables won't be in com file unless they're not at the end
    


exit to dos:
Code:
int 20h
;or
mov ax,4c00
int 21h
;or
ret
    
Post 17 Oct 2004, 02:39
View user's profile Send private message Visit poster's website Reply with quote
b



Joined: 15 Oct 2004
Posts: 11
b
thx sir for ur help, but i'm so new inthis , and i have only learnt the directive db, dw ...etc
this r directive i didnt recognize!!!!

i made this code

Code:
        int 21h
        mov ah,1
        int 21h
    

i think this takes the value & then i dealed with the value through the al register,
it's like:
Code:
                   sub al,30h 
                   mov bl,al
    

is it right sofar!!

and sir i have another question if i wanna take another value how am i allowed to retype this code!!1

Code:
      int 21h
        mov ah,1
        int 21h
    


and deal with al another time????

thx 4 help and sorry if i'm bothering
Post 17 Oct 2004, 07:06
View user's profile Send private message MSN Messenger Reply with quote
Matrix



Joined: 04 Sep 2004
Posts: 1171
Location: Overflow
Matrix
HY
you can call me Z,
well, what do you wanna do?

exactly that int 21h
is a dos interrupt you are calling
and you should pass the paramerers for the dos function call when you 're calling it, refer to Ralph Brown's interrupt list.

you call interrupts with subfunctions for example:
Code:
mov ax,$13
int 10h
    


now this sets video mode 320x200x256 color via bios function call and the parameter is $13 in ax, it depends on what interrupt are you calling

Code:
mov ax,$3
int 10h
    


this sets 80x25 text mode back better do this before you exit

you will see many codes using int funtions if you look around a little.
you can try searching forums too.
Post 17 Oct 2004, 08:14
View user's profile Send private message Visit poster's website Reply with quote
b



Joined: 15 Oct 2004
Posts: 11
b
hi & thx Z

all what i wanna do is to make a decimal adder, its the first time for me to assemble, it's my first code and i have troubles in the run time.
he gave me an error which i dont understand and when i ignore it, it gives me this state " divide over flow"

mostly i dont know how to deal with the value entered by the user by keyboard.
our instructor told me that it's stored in the al register. but it's not working!!!

this my code
Code:
dosseg 
.model small
.data
msg1 db ' give a decimal number1:',13,10,'$'
msg2 db ' give a decimal number2:',13,10,'$'

.code


mov ax,@data
mov ds,ax

mov dx,offset msg1
mov ah,9
int 21h
mov ah,1
int 21h

sub al,30h; this for taking the value from the asci code.
mov bl,al


mov dx, offset msg2
mov ah,9
int 21h
mov ah,1
int 21h

sub al,30h
add al,bl 

mov ah,2 
int 21h

mov ah,4ch
end
    


it's supposed to add 2 numbers but it's not working!!! when i tasm it its ok but in the runtime it's not!!!
sorry for make it long but i dont know what to do
thx 4 ur time sir
Post 17 Oct 2004, 15:57
View user's profile Send private message MSN Messenger Reply with quote
Matrix



Joined: 04 Sep 2004
Posts: 1171
Location: Overflow
Matrix
Hy b

well that was tasm source you wanted to compile,

in Flaat assembly a code looks like this:
this is a simple com file
Code:
org 100h ; this is for offset calculations we wanna create a comfile

mov dx,msg ; offset message in dx
mov ah,9      ; 9 in ah
int 21h ; dos function ah=9 dx= string offset

int 20h ; exit

;variables:
msg db 'hello$' ; $ is the string terminator
wordvar dw 0 ; this is a word variable value = 0
wordvar rw 1 ; this is a word variable reserved at the end
    


and it is a good idea to first write down somewhere what do you wanna do if you're starting programming,
then it might be easier to translate the algorithm in asm.
i saw you are not using conditional jumjs, refer to fasm tutorial
Code:
cmp ax,3 ; - compare and set the flags
jb xlabel  ; jump if ax below 3 to xlabel
xor al,al
xlabel:
    


jc ja jb jz are the most commonly used

ps.: on this board look you can make code sniplets more readable if you use the code /code directive refer to the below thread
http://board.flatassembler.net/topic.php?t=2444
Post 17 Oct 2004, 20:09
View user's profile Send private message Visit poster's website Reply with quote
b



Joined: 15 Oct 2004
Posts: 11
b
aha, sorry sir for bothering i didnt know it's differnet and thx 4 ur advice.

by the way i didi what u said but it's not easy also:) , looks like i dont belong here.
anyway thx again and very much .

bodour
Post 17 Oct 2004, 22:46
View user's profile Send private message MSN Messenger Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid
check my tutorial, possibly at decard's site.

It is very incomplete, but there is some useful info. btw. i will upload new chapter soon, so check it in few weeks again.
Post 18 Oct 2004, 11:21
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
b



Joined: 15 Oct 2004
Posts: 11
b
thx vid,

i checked ur site, it's also using fasm!!!! i wonder is it close ro tasm?!! or it very different !!!
see i'm a student and i wanna develope my abilities in programming in assembly, but i am related to our insructor!!! is it ok to deal with this FASM!!!! or i should stick to what my insructor says!!!

and i'll be checking ur site, really thx this site is very help full.

bodour
p.s i found also this one helpfull!!!
http://www.geocities.com/plasma_os/downtutors/asmlang1.html

do u know it!!!
Post 18 Oct 2004, 23:10
View user's profile Send private message MSN Messenger Reply with quote
Matrix



Joined: 04 Sep 2004
Posts: 1171
Location: Overflow
Matrix
In my opinion Tasm has gone with the wind,
its very old.

However i use Tasm for Atmel microcontrollers

Assembly languages are nearly the same in that aspect, they're interpreting your code and converting it to binary executable format.
assembly nstructions are a standard like stosb = mov byte [es:dig,al inc di
Post 19 Oct 2004, 11:52
View user's profile Send private message Visit poster's website Reply with quote
b



Joined: 15 Oct 2004
Posts: 11
b
i know sir but i'm taking a course in assembly in the university as a major one so i have to follow our teacher, and i guess it's the only assembler they know!!! lol Laughing

u know he also wants us to make projects using this TASM. can u sir offer me some help determining the idea!! he asked for calculators !!!! but i couldent make the code for adding how about multiplycation!!!! a student did it it took 3 pages!!!

i 'm not good in low level programming!! it was easier to deal with java!!!
Post 19 Oct 2004, 18:52
View user's profile Send private message MSN Messenger Reply with quote
b



Joined: 15 Oct 2004
Posts: 11
b
thx alot sir
u r the best!!!

but i guess it's alittele difficult for me to deal with!!! i know i'm annoying you!!! now this i should write in tasm code!!! that what u mean!!! then i'll ask u for another help!!! where to find theses equal intructions in tasm!!! cause i dont know much in tasm!!!! Confused or how to convert it!!! Confused

and do u think he'll beleive that it is my work!!! Evil or Very Mad Smile

i really approciate ur help!!! very much!!

i tried to tasm it lol but it gave me many errors lol
Post 19 Oct 2004, 20:27
View user's profile Send private message MSN Messenger Reply with quote
wanderer



Joined: 18 Jun 2003
Posts: 44
Location: Moldova, Kishinev
wanderer
Matrix wrote:
Here's a calculator i found somewhere


Probably on this board as I posted it here.

Matrix wrote:
it uses FPU, and its nice

Thank you, Matrix. However it contained some really bad bugs in it. I corrected what I found (unfortunately I did't have time to test better - I'm on my job now), so if you find some more just let me know. Sorry, there's no way right now to make it work with e+-n, I'll add it this evening.

[EDIT] attachment removed as there's newer version - see below [/EDIT]

_________________
Best regards,
Antoch Victor


Last edited by wanderer on 21 Oct 2004, 19:14; edited 1 time in total
Post 20 Oct 2004, 12:20
View user's profile Send private message Yahoo Messenger Reply with quote
Matrix



Joined: 04 Sep 2004
Posts: 1171
Location: Overflow
Matrix
If i make a better one i'll post it to you,
i'm having some work right now

i guess my post is not needed anymore, so its removed
Post 20 Oct 2004, 17:16
View user's profile Send private message Visit poster's website Reply with quote
wanderer



Joined: 18 Jun 2003
Posts: 44
Location: Moldova, Kishinev
wanderer
Matrix wrote:
If i make a better one i'll post it to you,
i'm having some work right now

i guess my post is not needed anymore, so its removed


Sorry, I didn't mean to offend you. However, taking into consideration that I'm the author of this program, it's me who should be ashamed Sad. When I posted it I didn't think that it'll go so far Smile, as I remember it was just an example. So right now I just want to remove bugs from it, so it would be completed program.

_________________
Best regards,
Antoch Victor
Post 20 Oct 2004, 21:24
View user's profile Send private message Yahoo Messenger Reply with quote
Matrix



Joined: 04 Sep 2004
Posts: 1171
Location: Overflow
Matrix
Hy
There whould be no problem if you include your name and ehatever data about you in the archive i didn't changed anything.

It was a little time ago since i have downloaded, so now i know it was yours.
I can even help you remmoving those bugs if you'd like.
Post 21 Oct 2004, 08:35
View user's profile Send private message Visit poster's website Reply with quote
wanderer



Joined: 18 Jun 2003
Posts: 44
Location: Moldova, Kishinev
wanderer
Matrix wrote:
Hy
There whould be no problem if you include your name and ehatever data about you in the archive i didn't changed anything.

Done.

Matrix wrote:
It was a little time ago since i have downloaded, so now i know it was yours.
I can even help you remmoving those bugs if you'd like.

Thank you again. Right now I removed all bugs that I found myself, but if you find some more you can either let me know about them, or correct yourself, as you wish.

An updated version is in the attachment.


Description:
Download
Filename: calculator.zip
Filesize: 7.64 KB
Downloaded: 366 Time(s)


_________________
Best regards,
Antoch Victor


Last edited by wanderer on 21 Oct 2004, 19:12; edited 1 time in total
Post 21 Oct 2004, 16:16
View user's profile Send private message Yahoo Messenger Reply with quote
wanderer



Joined: 18 Jun 2003
Posts: 44
Location: Moldova, Kishinev
wanderer
b wrote:
but i guess it's alittele difficult for me to deal with!!! i know i'm annoying you!!! now this i should write in tasm code!!! that what u mean!!! then i'll ask u for another help!!! where to find theses equal intructions in tasm!!! cause i dont know much in tasm!!!! Confused or how to convert it!!! Confused

and do u think he'll beleive that it is my work!!! Evil or Very Mad Smile

i really approciate ur help!!! very much!!

i tried to tasm it lol but it gave me many errors lol


Try to replace these lines:
Code:
          org 100h
            use16    

with
Code:
                .model tiny
                .code
                .286
                org 100h    

Can't check if this is enough as I don't have tasm.

_________________
Best regards,
Antoch Victor
Post 21 Oct 2004, 16:19
View user's profile Send private message Yahoo Messenger Reply with quote
Matrix



Joined: 04 Sep 2004
Posts: 1171
Location: Overflow
Matrix
Hello b
there is no use of your post that way, so i have removed it if you don't mind.
if you have a problem with a source you should post the source,
anyway you shouldn't post text as picture, it can be copied after selecting as text.

this is Flat assembly message board,
if you have problems writing tasm codes, i'd recommend you this message board:
http://www.win32asmcommunity.net/phpBB2/index.php?sid=62da0062bfde2f89b857bdc1535e917a
Post 21 Oct 2004, 22:02
View user's profile Send private message Visit poster's website Reply with quote
b



Joined: 15 Oct 2004
Posts: 11
b
it's ok sir

and sorry but i wanted to show the errors!!

sorry again
Confused
Post 22 Oct 2004, 13:25
View user's profile Send private message MSN Messenger Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  
Goto page 1, 2  Next

< 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. Also on GitHub, YouTube, Twitter.

Website powered by rwasa.