English Amiga Board


Go Back   English Amiga Board > Coders > Coders. General

 
 
Thread Tools
Old 21 June 2006, 14:08   #1
-Rob-
 
Posts: n/a
Hex to Decimal

..

Last edited by -Rob-; 23 June 2008 at 00:46.
 
Old 21 June 2006, 15:24   #2
Galahad/FLT
Going nowhere
 
Galahad/FLT's Avatar
 
Join Date: Oct 2001
Location: United Kingdom
Age: 50
Posts: 8,986
This what you want?

lea converted_string(pc),a2
move.l d0,d2
moveq #8-1,d3
nextconversion:
rol.l #4,d2
move.l d2,d4
and.l #$f,d4
add.l #"0",d4
cmp.l #"9",d4
bls.s skip_addition
addq.l #7,d4
skip_addition:
move.b d4,(a2)+
dbra d3,nextconversion

converted_string: dcb.b 8+2,0
Galahad/FLT is offline  
Old 21 June 2006, 16:46   #3
-Rob-
 
Posts: n/a
Lets say at address $300 i have the HEX value F. I want to turn this single value in to decimal..
 
Old 21 June 2006, 18:09   #4
NOB
Zone Friend
 
Join Date: Aug 2005
Location: Germany
Age: 52
Posts: 424
Maybe this is of any use(from asm manual):
Attached Files
File Type: txt converting numbersystems.txt (22.5 KB, 291 views)
NOB is offline  
Old 21 June 2006, 18:31   #5
Galahad/FLT
Going nowhere
 
Galahad/FLT's Avatar
 
Join Date: Oct 2001
Location: United Kingdom
Age: 50
Posts: 8,986
This then...

moveq #0,d0
moveq #0,d1
move.b $300.s,d0
divu.w #$a,d0
move.b d0,d1
rol.l #4,d1
swap d0
add.b d0,d1

Converted value will be left in d1

I've never had to do it before, so forgive the non-optimisation!

Also, because its a byte conversion, its only good up to a hex value of $63 (99 in decimal). But it does as you requested
Galahad/FLT is offline  
Old 21 June 2006, 18:36   #6
-Rob-
 
Posts: n/a
Quote:
Originally Posted by Galahad/FLT
moveq #0,d0
moveq #0,d1
move.b $300.s,d0
divu.w #$a,d0
move.b d0,d1
rol.l #4,d1
swap d0
add.b d0,d1

Converted value will be left in d1

I've never had to do it before, so forgive the non-optimisation!

Also, because its a byte conversion, its only good up to a hex value of $63 (99 in decimal). But it does as you requested
Amazing!

Just what i needed, thanks
 
Old 21 June 2006, 18:50   #7
Galahad/FLT
Going nowhere
 
Galahad/FLT's Avatar
 
Join Date: Oct 2001
Location: United Kingdom
Age: 50
Posts: 8,986
I assume its for a trainer menu
Galahad/FLT is offline  
Old 21 June 2006, 19:17   #8
-Rob-
 
Posts: n/a
Quote:
Originally Posted by Galahad/FLT
I assume its for a trainer menu
Hehe, yeah. Its for Great Giana Sisters. It uses HEX in game code to determine level nr. But nr. shown on screen is decimal. Its to be used for the level selector function, so it shows correct level on screen.
 
Old 21 June 2006, 19:22   #9
-Rob-
 
Posts: n/a
Now that we are at the trainers, perhaps you could help out on Magic Pockets. In game progress, it stores level nr. at 171e.w and stage nr. at 1720.w. The instruction at $4f2c set the start level to 1. If i change this to ex. 2, it loads level 1 anyway, but level acts & look strange, so there must be another value to be set..
 
 


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Similar Threads
Thread Thread Starter Forum Replies Last Post
Little hex editing help please Aria support.Games 4 16 June 2011 20:20
Hex Comp mai support.Other 2 28 May 2010 20:00
Hex Editor Retro1234 request.Other 9 24 October 2006 11:03
Hex Editor Help misguided_fool request.Apps 5 22 March 2006 09:53
HEX --> DEC Converter Joe Maroni request.Apps 9 03 May 2005 11:23

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 15:44.

Top

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Page generated in 0.08046 seconds with 14 queries