flat assembler
Message board for the users of flat assembler.

Index > DOS > Assembler routines

Author
Thread Post new topic Reply to topic
Jzee



Joined: 12 Apr 2005
Posts: 2
Jzee
Hi there,

I'll be much appreciated if you guys could help me out.

I'm looking for assembler routines as follows:
a) 5 digit BCD to binary conversion
b) 16-bit binary to BCD conversion
c) 64-bit X 32-bit multiplication
d) 64-bit / 64-bit comparison

If you could supply me with these routines
jzalho@hotmail.com

If you know of where I can find them on the net, let me know.

Thank you in advance.
Post 12 Apr 2005, 21:19
View user's profile Send private message Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid
another school project?
Post 12 Apr 2005, 22:41
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
Jzee



Joined: 12 Apr 2005
Posts: 2
Jzee
Yip, for this afternoon. Very Happy
Post 13 Apr 2005, 06:01
View user's profile Send private message Reply with quote
MCD



Joined: 21 Aug 2004
Posts: 604
Location: Germany
MCD
I use this macro for 64bit / 64bit IFs:
Code:
jnne    equ     je
jnnz    equ     jz
jnnc    equ     jc
jnnb    equ     jb
jnna    equ     ja
jnnbe   equ     jbe
jnnae   equ     jae
jnnl    equ     jl
jnng    equ     jg
jnnle   equ     jle
jnnge   equ     jge
jnns    equ     js
jnnp    equ     jp
jnpe    equ     jpo
jnpo    equ     jpe
jnno    equ     jo

macro   Cmp64   h1,l1,cc,h2,l2,IfTrue,IfFalse
{
local   CmpTrue,CmpLow,CmpFalse,Done
        cmp     h1,h2
        je      CmpLow
        jn#cc   CmpFalse

CmpTrue:;This executes if (h1:l1 cc h2:l2) is true
        IfTrue
        jmp     Done

CmpLow:
        cmp     l1,l2
        j#cc    CmpTrue

CmpFalse:;This executes if (edx:eax cmp ebx:ecx) is false
        IfFalse

Done:
}
;Usage example:
macro SomethingA
{
xor eax,eax;Whatever you want
}

macro SomethingB
{
int 20h;Whatever you want
}

 Cmp64 eax,[SomeVar], nbe ,edx,[SomeVar+4],\
 SomethingA,\
 SomethingB
    


Even simpler (If you have the nerves to use 64bit instructions):
Code:
cmp r64,r/m64
;or
cmp r/m64,r64
    
Post 13 Apr 2005, 08:07
View user's profile Send private message Reply with quote
MCD



Joined: 21 Aug 2004
Posts: 604
Location: Germany
MCD
I made this 64nit * 32bit multiply code:
Code:
;ecx:eax * ebx -> ebx:ecx:eax
Mul64_32:
;remove the first instruction line if you can afford to swap ecx and eax
;input registers
        xchg    eax,ecx
        mul     ebx
        xchg    eax,ecx
        xchg    edx,ebx
        mul     ebx
        add     edx,ecx
        adc     ebx,0
        ret
    

_________________
MCD - the inevitable return of the Mad Computer Doggy

-||__/
.|+-~
.|| ||
Post 13 Apr 2005, 09:40
View user's profile Send private message Reply with quote
Bitdog



Joined: 18 Jan 2004
Posts: 97
Bitdog
BCD = Binary Coded Decimal
A hex digit holds the value of 0-9
A word has 4 digits
BCD holds a value in every 4 bits (called a nibble)
AL reg can hold the BCD value of 99 decimal max.
AX = 9999 BCD max (comprehendo?)
AAM is an instruction associated with BCD conversions

http://bitdog.home.att.net/files/fasmenv.zip
unzips to path and creates an environment/dir-tree.
C:\FASM\INC16\ (dir has BCD conversion macro's some where)

I hope there is some BCD help in there some where for you ?
(ps. please correct/point-out any errors in this message)
Post 21 Apr 2005, 07:13
View user's profile Send private message 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. Also on GitHub, YouTube, Twitter.

Website powered by rwasa.