Our culture has advanced beyond all that you could possibly comprehend with one hundred percent of your brain.
It is currently Mon Jan 20, 2020 1:35 am

All times are UTC - 8 hours [ DST ]

Forum rules

Discussion of illegal hacking/cracking is prohibited. (No virus/trojans/cracks/warez/etc allowed.)

Post new topic Reply to topic  [ 2 posts ] 
Author Message
PostPosted: Wed Apr 15, 2009 3:05 pm 

Joined: Fri Sep 05, 2008 4:27 pm
Posts: 95
Has anyone done something like this? I made a routine that does it but I think it's very inefficient (just wait till A_Random_Person replies saying how I fail XD)

This is what I have (it's part of a code I made for AC:WW)
By the way it's in THUMB

@where r5 is the address you're loading a value from (for example you might load FFF1 from address 21D88FE)
@r2 is #0xF
@r0 is specified earlier in the code, if you're loading an 8 bit value it's #0x0, if it's a 16 bit value it's #0x1, if it's 32 bit it's #0x3
@and r1 is the typed text address (so when the code is done, it displays the hex code on the text, which is why it has to convert from hex to ascii)
textconvert:ldrb r3,[r5]
add r5,#0x1
mov r4,r3
lsr r3,#0x4
and r4,r2
cmp r3,#0x9
ble notletters1
add r3,#0x7
notletters1:add r3,#0x30
cmp r4,#0x9
ble notletters2
add r4,#0x7
notletters2:add r4,#0x30
strb r3,[r1]
add r1,#0x1
strb r4,[r1]
sub r1,#0x3
sub r0,#0x1
bpl textconvert

so for example, you have something that's a value of 14FD
it'll load a byte at a time, so first it'll put 14 in r3 and r4
r3 will focus on converting the 1 and r4 will focus on converting the 4
Then in the end it stores both in the text address.

Also the reason why it goes backwards is
because that way it'll put for example

Reply with quote  
PostPosted: Thu Apr 16, 2009 4:30 pm 
Krew (Admin)
Krew (Admin)
User avatar

Joined: Sun Oct 01, 2006 9:26 pm
Posts: 3765
Title: All in a day's work.
1) Use a table:
ascii_tab: .asciz "0123456789ABCDEF"

2) After splitting the byte into nybbles, just offset acsii_tab with the nybble.
3) Copy the byte from the resulting pointer to the destination.
4) Repeat.
5) ????
6) Profit!

I have to return some video tapes.

Feed me a stray cat.

Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC - 8 hours [ DST ]

Who is online

Users browsing this forum: No registered users and 2 guests

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 post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group