Changing Swordfish code to PBP


Closed Thread
Results 1 to 4 of 4
  1. #1
    Join Date
    Sep 2003
    Location
    Vermont
    Posts
    373

    Default Changing Swordfish code to PBP

    Hey guys,
    I'm stumped with the Swordfish XTEA encryption code. Changing it over to PBPL 2.50 is difficult due to the fact it will only support 32 bit signed integers, not unsigned. Plus, in the structured environment, the variables are resized in each subroutine(ie. word or longword).
    I can do separate variables in each sub, but the 32 bit math seems tricky. Would a long addition of one to$7FFFFFFF, make $80000000, or $00000000 with some kind of carry? Also, would the carry be lost, or is it recoverable somewhere?
    Am I better off trying to break up the math operations into word variables?
    The code is attached, any help would be greatly appreciated.
    Thanks,
    Ron
    PS. I am buying Swordfish, so I don't feel bad about changing the code to fit a current project.
    Attached Files Attached Files

  2. #2
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default

    Would a long addition of one to$7FFFFFFF, make $80000000
    Yes, $7FFFFFFF= 22147483647 $80000000 = 2147483648

    That is about as much help as I can give. But it does look like you will need to divide by 10000 or so to make the numbers workable.
    Dave
    Always wear safety glasses while programming.

  3. #3
    Join Date
    Sep 2003
    Location
    Vermont
    Posts
    373


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by mackrackit View Post
    Yes, $7FFFFFFF= 2147483647 $80000000 = 2147483648

    That is about as much help as I can give. But it does look like you will need to divide by 10000 or so to make the numbers workable.
    My belief is that when bit #31 is set, it becomes a negative number in the eyes of PBPL.So it would be -2147483647

  4. #4
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default

    You might be right, I am still learning this new stuff and I have a way of making it more confusing than it needs to be, I guess.

    If it is -2147483647 then the hex would be $FF8000001 ??? Now I see why you asked about the carry.
    Or if -2147483647 +1 = -2147483646 = $FF80000002 and the absolute value would be $7FFFFFFE

    I will be quiet now
    Dave
    Always wear safety glasses while programming.

Similar Threads

  1. PBP Extensions, What are they?
    By PJALM in forum PBP Extensions
    Replies: 9
    Last Post: - 28th September 2021, 11:26
  2. PBP code to read R/C signal from receiver
    By malc-c in forum mel PIC BASIC Pro
    Replies: 9
    Last Post: - 28th October 2009, 21:51
  3. Anyone do a comparison of the ASM code generated by PBP??
    By Frozen001 in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 19th November 2008, 20:01
  4. Making Program Code Space your playground...
    By Melanie in forum Code Examples
    Replies: 15
    Last Post: - 19th July 2008, 08:26
  5. convert code "c" lcd graphic to pbp
    By nicolasronan in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 19th June 2006, 15:49

Members who have read this thread : 1

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts