|
|
proton 12-05-2006, 05:15 PM So I have this Assembly project to do, and in it I have to convert a hexadecimal number to the BCD representation. And I honestly have no idea how to do it. So maybe if anyone could help me out and explain the algorithm I need to use, I can figure it out.
Thanks.
Funky 12-05-2006, 05:18 PM Change majors
Oddity 12-05-2006, 05:20 PM Change majors
Toaster 12-05-2006, 05:21 PM Change majors
proton 12-05-2006, 05:22 PM I know how to do it outside of Assembly but I don't know how to do it with all the register transfer bull**** and limitations of Assembly.
in case yall were wondering.
What assembly language you using is a good start? MIPS?
Oddity 12-05-2006, 05:27 PM ok here:
mov dword ptr [eax], 00000000
LMFAO OK GO
cyclozine 12-05-2006, 05:28 PM Change majors
jotun 12-05-2006, 05:30 PM mov ax, 0
mov bx, 0
int 16
gogogo
btw that assignment sounds like a pain in the ass, though not really difficult
write a C program that does it, then compile it and look at the assembly listing :p
proton 12-05-2006, 05:31 PM What assembly language you using is a good start? MIPS?
for a PIC processor. PIC16F84...we are doing like very introductory assembly, because we had some extra time in class and he wanted us to touch on it.
Oddity 12-05-2006, 05:33 PM mov ax, 0
mov bx, 0
int 16
gogogo
THAT'S GOOD BUT THIS IS QUICKER
mov ah, 0x4C
int 0x21
jotun 12-05-2006, 05:35 PM THAT'S GOOD BUT THIS IS QUICKER
mov ah, 0x4C
int 0x21
i dunno, i've never actually done x86 assembly. that was just something I remember someone saying ~5 years ago in high school
proton 12-05-2006, 05:36 PM mov ax, 0
mov bx, 0
int 16
gogogo
btw that assignment sounds like a pain in the ass, though not really difficult
write a C program that does it, then compile it and look at the assembly listing :p
it isn't hard, i have the rest of the project done already...and like i understand the concept here and everything, i just don't know like "shift left twice, then add 2, then shift left again, then blah blah blah" that bull****, so i can put it into code. just need like the general idea to convert it and i can put it into code.
ps assembly is gay but i like it more than c++
Durak 12-05-2006, 05:41 PM hex to bcd is no different than hex to binary, or binary to bcd
i.e.
the first place is 16^0, second place is 16^1, third place is 16^2, just like in binary first place is 2^0, second is, 2^1, etc...
if you can't understand that then switch majors
it isn't hard, i have the rest of the project done already...and like i understand the concept here and everything, i just don't know like "shift left twice, then add 2, then shift left again, then blah blah blah" that bull****, so i can put it into code. just need like the general idea to convert it and i can put it into code.
ps assembly is gay but i like it more than c++
Google is your friend:
http://www.engr.udayton.edu/faculty/jloomis/ece314/notes/devices/binary_to_BCD/bin_to_BCD.html
proton 12-05-2006, 05:45 PM hex to bcd is no different than hex to binary, or binary to bcd
i.e.
the first place is 16^0, second place is 16^1, third place is 16^2, just like in binary first place is 2^0, second is, 2^1, etc...
if you can't understand that then switch majors
read the thread you stupid ****
Google is your friend:
http://www.engr.udayton.edu/faculty/jloomis/ece314/notes/devices/binary_to_BCD/bin_to_BCD.html
i found that site, it isn't helping me. you can't really check the 10s place or 100s place like that with this assembly, it doesn't have a way to do that.
read the thread you stupid ****
i found that site, it isn't helping me. you can't really check the 10s place or 100s place like that with this assembly, it doesn't have a way to do that.
Use an AND with 0x00000F00 or whatever to isolate whatever field you want, shift it over and compare.
Durak 12-05-2006, 05:50 PM shh fei assembly is very limiting you can't do **** with it :rolleyes:
proton 12-05-2006, 05:55 PM Use an AND with 0x00000F00 or whatever to isolate whatever field you want, shift it over and compare.
yeah i just got it. thanks.
|
|