Code Comments

Programming Forum and web based access to our favorite programming groups.
For Programmers: Free Programming Magazines | New: Database administration forum
Registration is free! Edit your profileCalendarFind other membersFrequently Asked QuestionsSearch -> 
Post New Thread











Thread
Author

i wanna convert hex to decimal but i don't know what is problem in my source T T
this is my source. i'm beginner but i did my best to think about and
make it.
i can get the exe file but this exe file doesn't change hex to
decimal.
what i try was after get the input by the keyboard, assign through the
indirect address and multifly each digit with power of 16 and sum up.
but the result was nothing i mean even thogh i got the exe file, it
didn't work
please save from this chaos.........



hexdec1 segment
ASSUME CS : hexdec1,ds:data

loop1:
mov	ah,02h
int	21h
call    hex
mov	cx,0
mov	si,0
mov     [bx+si],dl
INC	SI
MOV	NUM1,SI
CMP	DL,0
JE	GAP
LOOP	LOOP1

GAP:
MOV	pow,1
DEC	SI

LOOP2:
MOV	CX,SI
MOV	AL,16
MUL	POW

MOV     [bx+si+1000],al
DEC	SI
MOV	NUM2,SI
LOOP	LOOP2

LOOP3:
MOV	CX,NUM1
MOV	SI,NUM1
MOV	AL,[BX+SI]

A:
MOV	SI,NUM2
Mov	dx,[bx+si+1000]
MUL	dx
ADD	TOT,Ax
DEC	NUM1
INC	NUM2
CMP	NUM1,1
JE	MULTI2
CMP	NUM1,0
JE	PRINT

LOOP	LOOP3

MULTI2:
INC 	NUM2
JMP	A

PRINT:
MOV	AL,0AH
MOV	AH,02H
INT	21H
mov	dh,0
MOV	Dx,TOT
MOV	AH,02H
INT	21H
MOV	AH,4CH
INT	21H

HEX	PROC	NEAR

CMP	DL,'0'
JL	HEX_1
CMP	DL,'9'
JG	HEX_1
SUB	DL,'0'
ret


HEX_1:

CMP	DL,'A'
JL	HEX_2
CMP	DL,'F'
JG	HEX_2
SUB	DL,55
ret

HEX_2:

CMP	DL,'a'
JL	HEX_3
CMP	DL,'f'
JG	HEX_3
SUB	DL,87
ret

HEX_3:

MOV	DL,0
RET
HEX	ENDP

hexdec1	ENDS

DATA	SEGMENT

NUM1	Dw	?
NUM2	Dw	?
POW	DB	?
MULTI	DB	?
TOT	Dw	?
DATA	ENDS
END
END

Report this thread to moderator Post Follow-up to this message
Old Post
crazy for closegl
12-20-04 08:55 PM


Re: i wanna convert hex to decimal but i don't know what is problem in my source T T
Well, I've got good news, and I've got bad news:

The good news:

It's much easier than you've shown. All you need is a CVD instruction.
(Convert To Decimal).

The Bad News:

You'll need to change platforms, or find the correct/appropriate
group. <g>

Gary




"crazy for closegl" <johttt@hotmail.com> wrote in message
news:a81985a8.0412201020.53fd0441@posting.google.com...
> this is my source. i'm beginner but i did my best to think about and
> make it.
> i can get the exe file but this exe file doesn't change hex to
> decimal.
> what i try was after get the input by the keyboard, assign through the
> indirect address and multifly each digit with power of 16 and sum up.
> but the result was nothing i mean even thogh i got the exe file, it
> didn't work
> please save from this chaos.........
>
>
>
> hexdec1 segment
>        ASSUME CS : hexdec1,ds:data
>
> loop1:
> mov ah,02h
> int 21h
> call    hex
> mov cx,0
> mov si,0
> mov     [bx+si],dl
> INC SI
> MOV NUM1,SI
> CMP DL,0
> JE GAP
> LOOP LOOP1
>
> GAP:
>         MOV pow,1
> DEC SI
>
> LOOP2:
> MOV CX,SI
> MOV AL,16
> MUL POW
>
> MOV     [bx+si+1000],al
> DEC SI
>         MOV NUM2,SI
> LOOP LOOP2
>
> LOOP3:
> MOV CX,NUM1
> MOV SI,NUM1
> MOV AL,[BX+SI]
>
> A:
> MOV SI,NUM2
> Mov dx,[bx+si+1000]
> MUL dx
> ADD TOT,Ax
> DEC NUM1
> INC NUM2
> CMP NUM1,1
> JE MULTI2
> CMP NUM1,0
> JE PRINT
>
> LOOP LOOP3
>
> MULTI2:
> INC NUM2
> JMP A
>
> PRINT:
> MOV AL,0AH
> MOV AH,02H
> INT 21H
>         mov dh,0
> MOV Dx,TOT
> MOV AH,02H
> INT 21H
> MOV AH,4CH
> INT 21H
>
> HEX PROC NEAR
>
>    CMP DL,'0'
>    JL HEX_1
>    CMP DL,'9'
>    JG HEX_1
>    SUB DL,'0'
>    ret
>
>
> HEX_1:
>
>        CMP DL,'A'
>        JL HEX_2
>        CMP DL,'F'
>        JG HEX_2
>        SUB DL,55
>        ret
>
> HEX_2:
>
>       CMP DL,'a'
>       JL HEX_3
>       CMP DL,'f'
>       JG HEX_3
>       SUB DL,87
> ret
>
> HEX_3:
>
> MOV DL,0
> RET
> HEX ENDP
>
> hexdec1 ENDS
>
> DATA SEGMENT
>
> NUM1 Dw ?
> NUM2 Dw ?
> POW DB ?
> MULTI DB ?
> TOT Dw ?
> DATA ENDS
> END
> END



Report this thread to moderator Post Follow-up to this message
Old Post
The Family
12-20-04 08:55 PM


Re: i wanna convert hex to decimal but i don't know what is problem in my source T T
johttt@hotmail.com wrote:

>
>
>hexdec1 segment
>       ASSUME CS : hexdec1,ds:data
>
>loop1:
>	mov	ah,02h
>	int	21h
>	call    hex
>	mov	cx,0
>	mov	si,0
>	mov     [bx+si],dl
>	INC	SI
>	MOV	NUM1,SI
>	CMP	DL,0
>	JE	GAP
>LOOP	LOOP1
>
>GAP:
>        MOV	pow,1
>	DEC	SI
>
>LOOP2:
>	MOV	CX,SI
>	MOV	AL,16
>	MUL	POW
>
>	MOV     [bx+si+1000],al
>	DEC	SI
>        MOV	NUM2,SI
>	LOOP	LOOP2
>
>LOOP3:
>	MOV	CX,NUM1
>	MOV	SI,NUM1
>	MOV	AL,[BX+SI]
>
>A:
>	MOV	SI,NUM2
>	Mov	dx,[bx+si+1000]
>	MUL	dx
>	ADD	TOT,Ax
>	DEC	NUM1
>	INC	NUM2
>	CMP	NUM1,1
>	JE	MULTI2
>	CMP	NUM1,0
>	JE	PRINT
>
>LOOP	LOOP3
>
>MULTI2:
>	INC 	NUM2
>	JMP	A
>
>PRINT:
>	MOV	AL,0AH
>	MOV	AH,02H
>	INT	21H
>        mov	dh,0
>	MOV	Dx,TOT
>	MOV	AH,02H
>	INT	21H
>	MOV	AH,4CH
>	INT	21H
>
>HEX	PROC	NEAR
>
>   CMP	DL,'0'
>   JL	HEX_1
>   CMP	DL,'9'
>   JG	HEX_1
>   SUB	DL,'0'
>   ret
>
>
>HEX_1:
>
>       CMP	DL,'A'
>       JL	HEX_2
>       CMP	DL,'F'
>       JG	HEX_2
>       SUB	DL,55
>       ret
>
>HEX_2:
>
>      CMP	DL,'a'
>      JL	HEX_3
>      CMP	DL,'f'
>      JG	HEX_3
>      SUB	DL,87
>	ret
>
>HEX_3:
>
>	MOV	DL,0
>	RET
>HEX	ENDP
>
>hexdec1	ENDS
>
>DATA	SEGMENT
>
>NUM1	Dw	?
>NUM2	Dw	?
>POW	DB	?
>MULTI	DB	?
>TOT	Dw	?
>DATA	ENDS
>	END
>	END
>


Good gawd! All that to simulate CVD? No wonder Microsoft sucks!

heh heh



Report this thread to moderator Post Follow-up to this message
Old Post
RFCOMMSYS
12-23-04 08:57 AM


Sponsored Links




Last Thread Next Thread Next
Search this forum -> 
Post New Thread

ASM370 archive

Show a Printable Version Send to friend Email This Page to Someone! subscribe to this thread Receive updates to this thread
Computer Consultants
Programming Jobs
Visual Basic Controls
SQL Server Programming
Webservices
Java Security
Visual Studio
C# Programming
Visual J++
Software engineering
Open source Software
Perl Programming
PHP Programming
ASP Programming
ASP .NET Programming
Visual Basic Programming
Windows Scripting Host
Java Programming
Java Help
Java Beans
VBScript
Cobol
MAC Applications
Unix Programming
Forum Jump:
All times are GMT. The time now is 08:01 AM.

 
Free MCSE Braindumps | Real Estate Topics

Programming forum archive

Copyrights CodeComments.com 2004 - 2006

Powered by vBulletin Copyright 2000-2006 Jelsoft Enterprises Limited.