JP1 Remotes Forum Index JP1 Remotes


FAQFAQ SearchSearch 7 days of topics7 Days MemberlistMemberlist UsergroupsUsergroups RegisterRegister
ProfileProfile Log in to check your private messagesLog in to check your private messages Log inLog in

S3C8 executor question

 
Post new topic   Reply to topic    JP1 Remotes Forum Index -> JP1 - General Forum
View previous topic :: View next topic  
Author Message
The Robman
Site Owner


Joined: 01 Aug 2003
Posts: 21197
Location: Chicago, IL

                    
PostPosted: Thu Sep 28, 2017 12:27 pm    Post subject: S3C8 executor question Reply with quote

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!
Back to top
View user's profile Send private message Visit poster's website
vickyg2003
Site Admin


Joined: 20 Mar 2004
Posts: 7073
Location: Florida

                    
PostPosted: Thu Sep 28, 2017 1:40 pm    Post subject: Reply with quote

So you have taken up writing to yourself now? Surprised Surprised
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.
Back to top
View user's profile Send private message Visit poster's website
The Robman
Site Owner


Joined: 01 Aug 2003
Posts: 21197
Location: Chicago, IL

                    
PostPosted: Thu Sep 28, 2017 1:58 pm    Post subject: Reply with quote

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!
Back to top
View user's profile Send private message Visit poster's website
vickyg2003
Site Admin


Joined: 20 Mar 2004
Posts: 7073
Location: Florida

                    
PostPosted: Thu Sep 28, 2017 2:47 pm    Post subject: Reply with quote

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.
Back to top
View user's profile Send private message Visit poster's website
The Robman
Site Owner


Joined: 01 Aug 2003
Posts: 21197
Location: Chicago, IL

                    
PostPosted: Thu Sep 28, 2017 4:34 pm    Post subject: Reply with quote

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!
Back to top
View user's profile Send private message Visit poster's website
The Robman
Site Owner


Joined: 01 Aug 2003
Posts: 21197
Location: Chicago, IL

                    
PostPosted: Thu Sep 28, 2017 5:00 pm    Post subject: Reply with quote

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!
Back to top
View user's profile Send private message Visit poster's website
vickyg2003
Site Admin


Joined: 20 Mar 2004
Posts: 7073
Location: Florida

                    
PostPosted: Thu Sep 28, 2017 5:40 pm    Post subject: Reply with quote

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.
Back to top
View user's profile Send private message Visit poster's website
The Robman
Site Owner


Joined: 01 Aug 2003
Posts: 21197
Location: Chicago, IL

                    
PostPosted: Thu Sep 28, 2017 11:50 pm    Post subject: Reply with quote

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:
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!
Back to top
View user's profile Send private message Visit poster's website
The Robman
Site Owner


Joined: 01 Aug 2003
Posts: 21197
Location: Chicago, IL

                    
PostPosted: Fri Sep 29, 2017 8:37 pm    Post subject: Reply with quote

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.php?action=file&file_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!
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic       JP1 Remotes Forum Index -> JP1 - General Forum All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


 

Powered by phpBB © 2001, 2005 phpBB Group
Top 7 Advantages of Playing Online Slots The Evolution of Remote Control