Page 4 of 5

Posted: Wed Nov 16, 2005 10:33 am
by Flavor
The Robman wrote: Are you 100% positive that you loaded the new protocol correctly? I'm pretty sure you did, but it wouldn't be the first time that we've spent ages trying to get something working only for the user to come back with some DUH statement. For instance, could you try re-loading one of the previous versions just to verify that it works the same way that t did before.
Well, I can't do anything more again until tonight, but last night, I tried version #4 with a few different values. Then, when they didn't work, I went back to version #3, and it worked just like I remembered that it did. I'm pretty sure that I didn't make a stupid mistake, but I never like to rule that out.

I also started to look over the ASM code differences between 3 and 4 to see if I could spot any problem. It's hard, though, because I don't know what the function calls do/return. Is there a doc for that somewhere?

Posted: Wed Nov 16, 2005 2:39 pm
by Flavor
I couldn't figure out how to use PB. Nothing seemed to work.

I finally figured out that I needed the Analysis ToolPak.

So, now that I've got a disassembler/assembler, I can read the code a bit easier.

Is W6 and RC6 the same thing? In ir.exe, the disassembly seems to only refer to it as RC6, but PB shows W6 and RC6. Is one W a word and RC the entire register?

Anyway, I can read it a bit, now. I've got some new guesses.

CALL 0146H ; XMITIR (thanks to PB)
CALL 010AH ; is the button still pressed? If it is, the carry bit will be set.
CALL 0158H ; wait some ammount of uSec? This is a big guess.

Posted: Wed Nov 16, 2005 3:35 pm
by Flavor
Could the call to 010AH (button check) modify the W4 register? If it does, that could cause version #4 to not work properly.

I can try a PUSH W4 / POP W4 around that call tonight.

Posted: Wed Nov 16, 2005 3:54 pm
by johnsfine
Flavor wrote: Is W6 and RC6 the same thing?
Yes.
Flavor wrote:In ir.exe, the disassembly seems to only refer to it as RC6, but PB shows W6 and RC6. Is one W a word and RC the entire register?
No. Both are the same one byte. Words are rarely used and take two registers.

The machine language has two different ways to address registers. Some operations can only be done using registers addressed by the W method, other operations can only be done using registers addressed by the R method, others can be done either way.

Only registers RC0 through RCF can be addressed by the W method. All registers can be addressed by the R method.

Some of the assemblers we use may auto-correct errors of addressing method: If you code RC6 when W6 is either better or the only way to do the operation the assembler acts as if you had coded W6. If you code W6 when only RC6 could work the assembler acts as if you coded RC6.

When I code by hand, I try to get the RC vs. W correct, because I'm trying to make the smallest possible version of the code and it's easier to see how much space each instruction will take if the W vs. RC is correct in the source code.

Posted: Wed Nov 16, 2005 4:01 pm
by The Robman
Flavor wrote:In ir.exe, the disassembly seems to only refer to it as RC6, but PB shows W6 and RC6.
If you want IR to always display it correctly, uncheck the "Register Translation" box.

As John mentioned, the assembler that's built into PB will automatically substitute a W register for an RC register when possible, so personally when I write code, I always refer to the scratch registers as Ws and I let PB convert them back to RC when needed.
Flavor wrote:CALL 0158H ; wait some amount of uSec?
Yes, the wait time is loaded into the RRF8 word.

Posted: Wed Nov 16, 2005 4:03 pm
by johnsfine
Flavor wrote:Could the call to 010AH (button check) modify the W4 register? If it does, that could cause version #4 to not work properly.
No. 010A modifies ONLY W0 and WF.

0146 does NOT modify any of W5, W6, W9 or WA. In some cases it might modify any of the other 12 W registers. I haven't checked the details of this particular use of 0146 to see if any register other than those four is preserved in this case.

I think 0158 modifies only W7 and it's purpose to wait until some previously set timer expires and then start a new timer. (The chip has hardware timers, so the timer started there runs in parallel with whatever code executes after the return from 0158).

Posted: Wed Nov 16, 2005 7:31 pm
by Flavor
I put the push/pop in and it seems to work. I feel like I'm getting the hang of this a bit, so I'm gonna mess around with it some more.

Version #5
Upgrade protocol 0 = 01 DF (S3C8+) PB v3.12
3D 90 51 8B 12 85 24 08 05 03 0C 00 F0 01 04 02
F8 0D AC 01 04 00 F0 18 08 56 C1 07 87 21 03 29
03 B0 C6 F6 01 46 6E 37 61 F9 4C 0C 70 C4 F6 01
0A 50 C4 FB 0B C6 F8 14 00 F6 01 58 4A EE 8B E3
AF
End

Posted: Wed Nov 16, 2005 7:48 pm
by Flavor
Version #6

Upgrade protocol 0 = 01 DF (S3C8+) PB v3.12
3D 90 51 8B 12 85 24 08 05 03 0C 00 F0 01 04 02
F8 0D AC 01 04 00 F0 18 08 56 C1 07 87 21 03 29
03 5C 01 B0 C6 F6 01 46 6E 37 61 F9 37 50 06 00
C5 4C C0 8B 02 4C 30 70 C4 F6 01 0A 50 C4 FB 0B
C6 F8 05 00 F6 01 58 4A EE 8B DA AF
End

This one seems to behave very similar to my original remote. I'm still going to mess around with the ASM. Maybe I can get rid of the push/pop.

Posted: Wed Nov 16, 2005 7:52 pm
by Flavor
This code seems to only be there to call XMITIR twice every time you want to XMIT.

CLR RC6
CALL XMITIR
INC W6
BTJRT XMIT,W6.0

Is that correct, or am I missing something?

Posted: Wed Nov 16, 2005 8:11 pm
by Flavor
I made another mod. This one is more elegant (IMHO) and more responsive to quick button presses.

Version #7

Upgrade protocol 0 = 01 DF (S3C8+) GXB #7 (PB v3.12)
3D 90 51 8B 12 85 24 08 05 03 0C 00 F0 01 04 02
F8 0D AC 01 04 00 F0 18 08 56 C1 07 87 21 03 29
03 5C 04 F6 01 46 F6 01 46 6C F0 F6 01 0A FB 12
C6 F8 01 00 F6 01 58 6A F2 A6 C5 00 6B E5 00 C5
8B E9 AF
End

Posted: Wed Nov 16, 2005 8:31 pm
by Flavor
Okay, I noticed a coding error that I ended up deciding isn't a problem but a feature. :) This new version is even closer to the original.

Version #8
Upgrade protocol 0 = 01 DF (S3C8+) GXB #8 (PB v3.12)
3D 90 51 8B 12 85 24 08 05 03 0C 00 F0 01 04 02
F8 0D AC 01 04 00 F0 18 08 56 C1 07 87 21 03 29
03 5C 04 F6 01 46 F6 01 46 6C FF F6 01 0A FB 12
C6 F8 00 E0 F6 01 58 6A F2 A6 C5 00 6B E5 00 C5
8B E9 AF
End

So, this is probablly my last version for tonight. I'm sorry that I posted so much junk in a row. I was just happy to figure it all out and I kept posting every time I came up with a minor mod.

I'll check back in a while, but I don't plan to do much more JP1 tonight.

Thanks!!! :P

Posted: Wed Nov 16, 2005 9:09 pm
by The Robman
I just tried testing v8 and it doesn't repeat, but looking at the code I can't see why.

Posted: Wed Nov 16, 2005 9:18 pm
by Flavor
I just tried v8 again. I cut/pasted it from this page.

It worked fine on my RadioShack remote tested on the XBox.

Posted: Wed Nov 16, 2005 9:37 pm
by The Robman
Do the buttons repeat properly (ie, for as long as you hold the button down) ? Maybe I make an error copying the code, but I won't be able to check it until tomorrow evening now.

Posted: Wed Nov 16, 2005 10:45 pm
by Flavor
Yeah. I compared it to the original remote, and the differences are hardly noticable at all.

The only real difference is that the original is a little more responsive to quick repeated button presses. Though, I don't think it's enough that anyone would even notice a difference unless they knew what to look for.