S3C8 executor question

General JP1 chit-chat. Developing special protocols, decoding IR signals, etc. Also a place to discuss Tips, Tricks, and How-To's.

Moderator: Moderators

Post Reply
The Robman
Site Owner
Posts: 21886
Joined: Fri Aug 01, 2003 9:37 am
Location: Chicago, IL
Contact:

S3C8 executor question

Post by The Robman »

This question is for the guys who are experts at writing protocol executors. Is there a way for me to load a 16-byte block of data somewhere in an executor. I want to calculate a checksum in the executor itself and to do so, I need 16 bytes of pattern data. In order to avoid writing 16 different calls to a routine, passing in a different byte of data each time, I'd like to load them somewhere and then pull the correct byte as an offset in some loop logic. Is this possible?
Rob
www.hifi-remote.com
Please don't PM me with remote questions, post them in the forums so all the experts can help!
vickyg2003
Site Admin
Posts: 7104
Joined: Sat Mar 20, 2004 12:19 pm
Location: Florida
Contact:

Post by vickyg2003 »

So you have taken up writing to yourself now? :eek: :o
So you want to create an array and then use an @r instruction to get the proper array member. If I recall correctly you can pull up the current location and add the number of instruction bytes between your located and the address of the array. I can't recall an executor that does it, but i know we did that in extenders.
Remember to provide feedback to let us know how the problem was solved and share your upgrades.

Tip: When creating an upgrade, always include ALL functions from the oem remote, even if you never plan on assigning them to a button. Complete function lists makes an upgrade more helpful to others.
The Robman
Site Owner
Posts: 21886
Joined: Fri Aug 01, 2003 9:37 am
Location: Chicago, IL
Contact:

Post by The Robman »

I know how to pull from offsets, or at least, I know there's code in existing executors that does that which I can copy, so if, for example, the executor had 4 fixed bytes, I could write a loop that pulls from each of them (ie, from R03, then R03+1, then R03+2, etc). So if my data was already in some registers, I could pull it in a loop. But I really don't want to write 16 LD statements, or 8 LDW statements, to load it somewhere, and even if I did, where would be a good place to load it?

I have seen executors that send their own pairs, use the data block for this sort of thing as that data gets loaded into R28 and up. But I'm using the IR engine, so I can't do that.

I doubt there's a way, but what I'd like to do is just have a block of data in the executor itself, which I can JP over to avoid, but for that to work, I'd need to know how to read the data back in the assembler code.

When I did the executor for 4DTV, the checksum was based on the one 8-bit field (not 16-bits like with MCE) and the checksum itself was just 4-bits (not 5-bits like with MCE). So I just needed 8 * 4-bit chunks to define the pattern, which I supplied to the executor via the 4 fixed bytes. For MCE, I need 16 * 5-bit chunks, and as 5 isn't a round number, that equates to 16 * 8-bit chunks (where 3 bits in each are wasted).
Rob
www.hifi-remote.com
Please don't PM me with remote questions, post them in the forums so all the experts can help!
vickyg2003
Site Admin
Posts: 7104
Joined: Sat Mar 20, 2004 12:19 pm
Location: Florida
Contact:

Post by vickyg2003 »

Im on my phone so cant look things up

CALL get-arraddress
Branch over data
Data block

Processing checksome loop
And databyte1 @ww1
Inc ww1
And databyte2 @ww1
Whatever
Return

Get-arraddress:
Pull the return address from the stack into ww1
Push the ww1 back on the stack
Return

To save instructions you probabbly get away with no push&return just jump to end of data block.....
Remember to provide feedback to let us know how the problem was solved and share your upgrades.

Tip: When creating an upgrade, always include ALL functions from the oem remote, even if you never plan on assigning them to a button. Complete function lists makes an upgrade more helpful to others.
The Robman
Site Owner
Posts: 21886
Joined: Fri Aug 01, 2003 9:37 am
Location: Chicago, IL
Contact:

Post by The Robman »

I hadn't thought of using the stack, PUSH and POP might work. What is the easiest (ie, least code) way to push 16 bytes into the stack? I know how to push register values into the stack, but not hex codes.
Rob
www.hifi-remote.com
Please don't PM me with remote questions, post them in the forums so all the experts can help!
The Robman
Site Owner
Posts: 21886
Joined: Fri Aug 01, 2003 9:37 am
Location: Chicago, IL
Contact:

Post by The Robman »

Reading the S3C8 manual, I think the LDCD and LDED commands might be what I'm looking for. Need to do some experimenting.
Rob
www.hifi-remote.com
Please don't PM me with remote questions, post them in the forums so all the experts can help!
vickyg2003
Site Admin
Posts: 7104
Joined: Sat Mar 20, 2004 12:19 pm
Location: Florida
Contact:

Post by vickyg2003 »

I wasn't thinking of pushing the data onto the stack, but rather putting the address of the data array. It is my understanding that a CALL puts the address to return to on the stack. So popping the stack into a double wide register should allow you to point at the array. I understand this in the other H assembler but am at a loss on the S chips.
Remember to provide feedback to let us know how the problem was solved and share your upgrades.

Tip: When creating an upgrade, always include ALL functions from the oem remote, even if you never plan on assigning them to a button. Complete function lists makes an upgrade more helpful to others.
The Robman
Site Owner
Posts: 21886
Joined: Fri Aug 01, 2003 9:37 am
Location: Chicago, IL
Contact:

Post by The Robman »

LDCD is the answer! I just created a "proof of concept" executor. I created a simple NEC2 executor and tested it to verify that it sends regular NEC2 signals, then I added extra data, after the regular data block, but before the start of the normal logic, and verified that that didn't cause anything to break. (The data in the new data block as between addresses FF17 and FF1A). Then I added the following code and verified that it changed all 3 values (OBC, dev1, dev2) accordingly:

Code: Select all

LDW   W2,#FF1Ah ; load the address of the end of the data to W2
LDCD  W4,@W2    ; load the byte at FF1A into W4
LD    R05,W4    ; load the W4 value into the OBC
LDCD  W4,@W2    ; load the byte at FF19 (ie, FF1A minus 1) into W4
LD    R04,W4    ; load the W4 value into DEV2
LDCD  W4,@W2    ; load the byte at FF18 (ie, FF1A minus 2) into W4
LD    R03,W4    ; load the W4 value into DEV1
So now I know how to write the loop logic for the MCE checksum.
Rob
www.hifi-remote.com
Please don't PM me with remote questions, post them in the forums so all the experts can help!
The Robman
Site Owner
Posts: 21886
Joined: Fri Aug 01, 2003 9:37 am
Location: Chicago, IL
Contact:

Post by The Robman »

If anyone wants to see the executor that I wrote that uses the LDCD command, it's here:
http://www.hifi-remote.com/forums/dload ... e_id=14702
Rob
www.hifi-remote.com
Please don't PM me with remote questions, post them in the forums so all the experts can help!
Post Reply