•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the Assembly section within the Software Development category of DaniWeb, a massive community of 397,706 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,346 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our Assembly advertiser:
Views: 1336 | Replies: 1
![]() |
•
•
Join Date: Mar 2007
Posts: 1
Reputation:
Rep Power: 0
Solved Threads: 0
I need to create a little assembly app for arm cpu which reads two 32 bit numbers from the address which register r0 points out. Then it compares absolute value of those two numbers and puts them back to those same addresses the way there's number which absolute value is higher in the first address. Finally the app sets 0 as the register r0 value, if the numbers were in the right order and sets 1 if the number orders needed to be changed.
The problem is that my little app isn't workin.
Hope someone can help me solve the problems there. thanks.
The problem is that my little app isn't workin.
Hope someone can help me solve the problems there. thanks.
assembly Syntax (Toggle Plain Text)
ldr r1,[r0,#0] ldr r2,[r0,#4] mov r3,#-1 cmp r1, #0 mulmi r4, r1, r3 movpl r4, r1 cmp r2, #0 mulmi r5, r2, r3 movpl r5, r2 subs r3,r4,r5 strmi r1,[r0,#4] strmi r2,[r0,#0] strpl r2,[r0,#4] strpl r1,[r0,#0] movpl r0,#0 movmi r0,#1
Last edited by 8ball : Mar 15th, 2007 at 4:48 am.
•
•
•
•
I need to create a little assembly app for arm cpu which reads two 32 bit numbers from the address which register r0 points out. Then it compares absolute value of those two numbers and puts them back to those same addresses the way there's number which absolute value is higher in the first address. Finally the app sets 0 as the register r0 value, if the numbers were in the right order and sets 1 if the number orders needed to be changed.
The problem is that my little app isn't workin.
Hope someone can help me solve the problems there. thanks.
assembly Syntax (Toggle Plain Text)
ldr r1,[r0,#0] ldr r2,[r0,#4] mov r3,#-1 cmp r1, #0 mulmi r4, r1, r3 movpl r4, r1 cmp r2, #0 mulmi r5, r2, r3 movpl r5, r2 subs r3,r4,r5 strmi r1,[r0,#4] strmi r2,[r0,#0] strpl r2,[r0,#4] strpl r1,[r0,#0] movpl r0,#0 movmi r0,#1
The problem is easy to fix. You used an unsigned multiply. Another way of doing it is this:
LDMIA r0,{r1,r2}
orrs r1,r1,r1
rsbmi r4,r1,#0
movpl r4,r1
orrs r2,r2,r2
rsbmi r5,r2,#0
movpl r5,r2
cmp r4,r5
strlt r2,[r0]
strlt r1,[r0,#4]
mov r0,#0
movlt r0,#1
There's no need to write back the 2 values if their places don't need to be swapped.
Larry B.
P.S. my blog covers topics like this:
bitbank.wordpad.com
![]() |
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
•
•
•
•
•
•
•
•
DaniWeb Assembly Marketplace
Similar Threads
- ARM Assembly Subroutine (Assembly)
- CPU Usage at 100% with Nero 6 (Windows NT / 2000 / XP / 2003)
- Question: Where are good Assembly Compilers? (Assembly)
- Slightly toasted cpu, as well as it being ripped out of the mother board (Motherboards, CPUs and RAM)
- Using x86 Assembly Language with Microsoft Visual C++ (C++)
- 100% CPU Usage - No Virus, No gaming (Windows NT / 2000 / XP / 2003)
- System CPU overusage (Windows NT / 2000 / XP / 2003)
- CPU is fully used up by a single process, HELP (Windows NT / 2000 / XP / 2003)
Other Threads in the Assembly Forum
- Previous Thread: Help. Emu8086
- Next Thread: Turn on a LED for 5 minutes Use PIC16F84A


Linear Mode