Paradox
Armored Cars
Posts: 172
What I am trying to do is copy a single bit into a variable through IND.· I have run into a brick wall and am hoping I'm wrong about something here.
Here FSR is changed when temp is accessed, changing FSR to temp before currentX can be written to.
mov·fsr,currentX
mov·w,temp
and·w,#%00000001
snz
setb·· IND.0
sz
clrb·· IND.0
Try to change FSR after accesing temp changes w.
mov·w,temp
mov fsr,currentX
and·w,#%00000001
snz
setb·· IND.0
sz
clrb·· IND.0
Try to change FSR after w is accessed messes up the zero flag.
mov·w,temp
and·w,#%00000001
mov fsr,currentX
snz
setb·· IND.0
sz
clrb·· IND.0
So far as I can tell there is no way this code will work.· I'm hoping some of my logic here is flawed or otherwise it will be back to the drawing board for me.
·
Here FSR is changed when temp is accessed, changing FSR to temp before currentX can be written to.
mov·fsr,currentX
mov·w,temp
and·w,#%00000001
snz
setb·· IND.0
sz
clrb·· IND.0
Try to change FSR after accesing temp changes w.
mov·w,temp
mov fsr,currentX
and·w,#%00000001
snz
setb·· IND.0
sz
clrb·· IND.0
Try to change FSR after w is accessed messes up the zero flag.
mov·w,temp
and·w,#%00000001
mov fsr,currentX
snz
setb·· IND.0
sz
clrb·· IND.0
So far as I can tell there is no way this code will work.· I'm hoping some of my logic here is flawed or otherwise it will be back to the drawing board for me.
·
Comments
movb c,temp.0
mov fsr,currentX
movb IND.0,c
Also you don't have the whole program, but make sure you don't need "mov fsr,#currentX".
Bean.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
"SX-Video·Module" Now available from Parallax for only $28.95
http://www.parallax.com/detail.asp?product_id=30012
"SX-Video OSD module" Now available from Parallax for only·$49.95
http://www.parallax.com/detail.asp?product_id=30015
Product web site: www.sxvm.com
Those that would give up freedom for security will have neither.
·
I attatched a picture of the problem. I have two sets of registers and need to "translate" the contents of one set into another set. Hopefully you can get this from the pricture.
Post Edited By Moderator (Ryan Clarke (Parallax)) : 11/11/2005 7:14:18 PM GMT
How accurate is your picture? Is it just a hypothetical example or is it the actual swap you need to do? If I am reading your picture correctly, you have four 8 bit registers, and you basically need to move groups of 4 bits (a nibble) from one register location to another, and sometimes you have to swap the high/low positions of the nibbles. Is this correct or am I reading too much into the picture??
Thanks, PeterM
PS - Next time you post a picture, make it a JPG so it's tinier. I have attached your image as a JPG to show you that it still looks fine. I did nothing more complicated than load you image in MsPaint (in Win2K) and then save it as a JPG. You'll notice that your 675 kb file became a 38 kb file.
Post Edited By Moderator (Ryan Clarke (Parallax)) : 11/11/2005 7:13:30 PM GMT
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
·1+1=10
I'm sure someone will correct me if that code is wrong.
Oh yeah, the file name was my initial reaction when I realized how horribly I messed up the display. I just didn't think to change it when I posted it. As far as minors in this forum, I'd like to meet them. I'm in highschool and this just absolutely sucks (as far as difficulty.)· Nobody here has the slightest idea what I'm doing so I think it'd be cool to meet someone my age who is·knows this also.
Post Edited (Armored Cars) : 11/10/2005 2:15:42 PM GMT
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
·1+1=10
Very cool of you to take the time to write the code sample. One suggestion for next time is to comment it to death. You should always assume that if someone has a code problem they can't solve on their own, then reading un-commented code makes it harder for them to fully comprehend the solution. Since the goal is always to help people learn and move on to the next level, clear and abundant comments really help.
Thanks, PeterM
Ryan
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Ryan Clarke
Parallax Tech Support
RClarke@Parallax.com
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
·1+1=10
Good idea, but slightly flawed execution.
1 - The picture is now completely gone and the renamed link is not even a link but just some text.
2 - It's spelled "defecation", so the correct new name is "ohdefecation.jpg". You could also use the simpler "poop" which creates the (I think) easier to read "ohpoop.jpg."
Thanks, PeterM
Comments are great.· However, I thought it·would·be more beneficial to Mr. Cars·if he·had to figure out for himself what·the code·did.· (I believe he did this by running it through the debugger.)· That was just my take on it.· Que sera'.
Armored Cars,· what do you think?· Was it more betterer to NOT have the comments?
·
Ryan
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Ryan Clarke
Parallax Tech Support
RClarke@Parallax.com
Again, it was awfully nice of you to take the time to write that code sample. However, did you actually write the code sample and conciously choose to have no comments in it? Were you thinking as you wrote it, "I'll intentionally leave off comments because this will force him to try and figure out how this code works," or did you just write it without comments because it was quicker and easier?
I think you might be a coder who believes that comments are for wimps, sissys, etc, and that you simply always write code with little to no comments. A friend of mine always refers to un-commented assembly as "Write Only Code." Perhaps you disagree with him. Que Sera'.
Thanks, PeterM