![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#21 |
|
Expert Programmer
Join Date: Jun 2005
Posts: 810
Rep Power: 4
![]() |
well you have two "loop:" lines, so that might be causing a problem.
I don't think you need to put anything in an array. Try some code like this: [code] get a get b xor a and b into c set loopCounter to 0 set hamming = 0 loop: and c with 0x01 into d if d == 1 increment hamming shift c right by 1 increment loopCounter if loopCount <= 32* goto loop print hamming * replace 32 by whatever number of bits you have in your integer Note: you already have some of this code |
|
|
|
|
|
#22 |
|
Professional Programmer
Join Date: Feb 2005
Posts: 323
Rep Power: 4
![]() |
Thanks for the code. A couple questions though: i thought loop was a reserved word that you put everytime you want to loop but i guess not? Also what do you mean by
and c with 0x01 into d. |
|
|
|
|
|
#23 |
|
Expert Programmer
Join Date: Jun 2005
Posts: 810
Rep Power: 4
![]() |
No I'm pretty sure loop is just a label that you want to jump to.
0x01 is hexadecimal notation for 1. I should have just written 1 there instead. ANDing with 1 gives you the value of the least significant bit. |
|
|
|
|
|
#24 |
|
Professional Programmer
Join Date: Feb 2005
Posts: 323
Rep Power: 4
![]() |
so you think i have to write it like 0x01 or do i have to load one into another register and then use that register in the and condition because the one reference i have said and has 3 registers associated with it one for the result and then 2 that are being compared but if i know the number im always comparing it to you think i could just write that?
|
|
|
|
|
|
#25 | |
|
Expert Programmer
Join Date: Jun 2005
Posts: 810
Rep Power: 4
![]() |
No I don't think you should write it like 0x01 that is why i said:
Quote:
|
|
|
|
|
|
|
#26 | |
|
Professional Programmer
Join Date: Feb 2005
Posts: 323
Rep Power: 4
![]() |
yea i loaded one into another register and used that and i got no errors when i loaded it into the simulator im using so thats a good sign. Now i have one more question. When you said
Quote:
|
|
|
|
|
|
|
#27 |
|
Expert Programmer
Join Date: Jun 2005
Posts: 810
Rep Power: 4
![]() |
If your integers are 32 bit, it doesn't matter what value they have in them, they are still 32 bit. I was only pointing out that if you are doing this for a 64 bit integer, you will need to change the loop count.
|
|
|
|
|
|
#28 |
|
Professional Programmer
Join Date: Feb 2005
Posts: 323
Rep Power: 4
![]() |
o ok cool now i seem to not be able to find the less than or equal to command but it has to be here somewhere right because they have less than or equal to 0 but not less than or equal to any number you wan to put there.
|
|
|
|
|
|
#29 |
|
Expert Programmer
Join Date: Jun 2005
Posts: 810
Rep Power: 4
![]() |
|
|
|
|
|
|
#30 |
|
Professional Programmer
Join Date: Feb 2005
Posts: 323
Rep Power: 4
![]() |
im an idiot i could just use the branch if one is less than the other and then right after it i could put branch if one is equal to the other and then just make them both branch to the same place and its the same thing right?
|
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Assembly Language for Intel-Based Computers | melbolt | Book Reviews | 0 | Aug 15th, 2006 12:04 AM |
| Language display in program | Prm753 | C++ | 3 | May 30th, 2006 5:45 PM |
| More languages? | UnKnown X | Coder's Corner Lounge | 27 | Dec 18th, 2005 3:06 PM |
| Does assembly language vary per machine? | Xero | Assembly | 9 | Jan 17th, 2005 11:34 AM |