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

RMPB\PB Assembler Learning

 
Post new topic   Reply to topic    JP1 Remotes Forum Index -> JP1 - Software
View previous topic :: View next topic  
Author Message
jmezz13



Joined: 28 Oct 2004
Posts: 94

                    
PostPosted: Wed Mar 01, 2023 7:38 pm    Post subject: RMPB\PB Assembler Learning Reply with quote

After a quick trip to the forum to solve a small problem, for some reason, I've gotten interested in delving deeper into JP1 workings. My latest thing is trying to understand the assembler code in PB or RMPB. I've done some reading of the SC380 manual, read the text file on assembler included with PB, and reviewed the RMPB help file. Lately, I've been using RMPB to review the assembly code for Proto 005a (NEC) and trying to understand how it is implemented and accounts for all the variations (NEC2, NECx1, etc). I have some confusion on a few things, and rather than asking specific questions at this point, it is likely that there is some other background information that I'm missing. For example, W0 seems to be referred to as a working register, but how is it loaded and from where - and what does it relate to in the register file memory or flash memory?

Are there any other resources for recommended reading?
Back to top
View user's profile Send private message
jmezz13



Joined: 28 Oct 2004
Posts: 94

                    
PostPosted: Thu Mar 02, 2023 1:01 am    Post subject: Reply with quote

Ok, I found an old file by Rob "5a-commented.txt" that had the NEC protocol code with his comments which was very helpful in figuring out how the registers are organized. I also realize that the W registers are the SC380 working registers and seem to be used as scratch registers for the most part. The other piece was the fact in some protocols like NEC, the first byte of the fixed data is actually a control byte which dictates execution flow and the pointer to the fixed data buffer is incremented to skip over this byte.

There's still some things kind of fuzzy, but I think I know enough to play around and create dummy protocols and test them out.
Back to top
View user's profile Send private message
The Robman
Site Owner


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

                    
PostPosted: Thu Mar 02, 2023 9:53 am    Post subject: Reply with quote

Looks like you've mostly answered your own question there. The way I learned most of it for myself was, if I wanted to write some code to do something and I knew another executor already did it, I'd go look at that executor to see HOW they did it, then I'd learn from that.

I never learned how to use RMPB, so all of my work was done using PB. I have created PB files for most of my work and they can be found here:

http://www.hifi-remote.com/forums/dload.php?action=category&cat_id=42

The 5A executor is a very good place to start because it has a lot of code to generate a fairly simple signal, because it combines so many variants into one. If you only needed one variant of NEC, the code would be very simple, in fact, you likely wouldn't need any assembler at all, you could just use the built in IR engine.

If one of your goals is to be able to create new executors, then in addition to knowing assembler, you will need to gain a good understanding of the IR engine in these remotes. There's a lot of info on that here:

http://www.hifi-remote.com/forums/dload.php?action=category&cat_id=86

Another thing, regarding those W* registers, the main benefit of using them, over regular registers, is that several functions have shorter syntax using them compared to regular registers. However, some functions don't have the shorter syntax, in such cases the W* registers get references as RC* registers (eg, W0 is called RC0). If you disassemble code, the disassembler calls them W0 or RC0 based on how they are coded, but when you're writing code, you can use W0 throughout and the assembler knows what to do.

If you do start writing code, one of the things you will learn to keep in mind is to always make the code as small as possible, given that the remote has limited memory for storing such things. So many times, you'll come back to some code that you wrote before because you just thought of a way to save 5 bytes! Smile
_________________
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
jmezz13



Joined: 28 Oct 2004
Posts: 94

                    
PostPosted: Thu Mar 02, 2023 5:59 pm    Post subject: Reply with quote

Thanks for the links and pointing out the IR Engine information.

I do have a couple things that I'm not sure and they have more to do with pre-processing or post-processing related to the protocol assembler code. I'll probably feel silly after asking these...

1) I see how the data is defined in the data block, but how does that make it's way into the appropriate Rn registers?

2) Why is there a jump in the middle of the data block? Seems like the data prior to the jump would be misinterpreted as code.

3) How did you guys come up with all the vectors into various routines within the remote? (This is more for interest than needed for anything related to generating code)
Back to top
View user's profile Send private message
The Robman
Site Owner


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

                    
PostPosted: Thu Mar 02, 2023 6:29 pm    Post subject: Reply with quote

jmezz13 wrote:
1) I see how the data is defined in the data block, but how does that make it's way into the appropriate Rn registers?

There's probably code inside the ROM somewhere that copies the data from the block and moves it into the registers.

jmezz13 wrote:
2) Why is there a jump in the middle of the data block? Seems like the data prior to the jump would be misinterpreted as code.

Because you don't have to use the IR engine, you have the option to completely manually send the data yourself, but when you are using the IR engine, that JP statement skips over the data block.

jmezz13 wrote:
3) How did you guys come up with all the vectors into various routines within the remote? (This is more for interest than needed for anything related to generating code)

Mostly from reading the assembler in protocol upgrades and then determining what they do. Keep in mind that the JP1 project is nearly 23 years old, so there has been a LOT of tinkering and experimenting over the years.
_________________
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
jmezz13



Joined: 28 Oct 2004
Posts: 94

                    
PostPosted: Fri Mar 03, 2023 12:53 pm    Post subject: Reply with quote

I think there may be some light bulb moments from your answers above. For some reason, I was under the impression the protocol upgrades were self-contained and custom code by JP1er's. I'm starting to understand (I think) that although they could be independent, they mostly still use the UEI OS (for example, to fill the registers from the data block like you mentioned). It sounds like they are based on original UEI protocol code that has been disassembled.(?) I don't see how anyone could come up with that format without knowing how the UEI OS handles it. That begs another question - is the 005A protocol where you commented the code actual UEI code that was somehow pulled from ROM? Or, am I still confused?

Thanks for your patience in helping me understand.
Back to top
View user's profile Send private message
The Robman
Site Owner


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

                    
PostPosted: Fri Mar 03, 2023 2:41 pm    Post subject: Reply with quote

Most of the time when RMIR gives you a protocol upgrade, it is using official UEI protocol code, which we probably obtained from an official upgrade at some point. Some of the protocols offered by RMIR are indeed homemade by us.
_________________
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 - Software 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