Jump to content

Recommended Posts

Hi can any one help me i am new to boostc and cant use the following asm from the CC5X Sourcecode. Boostc is will not compile this code and will return some errors. I was able to define the Carry bit for 0x03.0 but boostc was still not able to compile this asm code. can any one please tell me how i can do this in boostc.

 

many thanks

 

 

   while(ByteLes != 0xFFFF)
   {
       Cluster=ByteLes;        
       Cluster=Cluster-2;      
       AL=Cluster;             
       Carry=0;               //clear carry bit
       AL = rl(AL);            //rotate left
       AH = rl(AH);           //rotate left


       #asm                    
       MOVF  Dat+1,W
       ADDWF AL+1,1
       MOVF  Dat,W
       ADDWF AL,1
       BTFSS 0x03,Carry  // if carry bit
       GOTO  noCarry
       BCF   0x03,Carry
       INCF  AL+1,1
       BTFSC 0x03,Carry
       INCF  AH,1
       noCarry:
       #endasm

   ........
  }

Link to post
Share on other sites

internet,

 

Some of this is a bit of a guess as I don't know what the data types should be.

 

Hope that helps :)

 

Regards

Dave

 

#include <system.h>

void main()
{
    int ByteLes = 0;
    unsigned int AL;
    unsigned int AH;
    unsigned char Dat;

    while(ByteLes != 0xFFFF)
    {
           int Cluster=ByteLes;        
           Cluster=Cluster-2;      
           AL=Cluster;             
           asm BCF _status, C
           asm rlf _AL, F //rotate left
           asm rlf _AL+1, F //rotate left
           asm rlf _AH, F //rotate left
           asm rlf _AH+1, F //rotate left
        
        asm 
        {
                              
           MOVF  _Dat+1,W
           ADDWF _AL+1,1
           MOVF  _Dat,W
           ADDWF _AL,1
           BTFSS _status,C  // if carry bit
           GOTO  noCarry
           BCF   _status,C
           INCF  _AL+1,1
           BTFSC _status,C
           INCF  _AH,1
           noCarry:
        }
    
    }
      
}

Link to post
Share on other sites

Yes, i know i confused too. Its the only sample i found for shifting low- and highbyte to get files across adresses that will be after the first 32MB. I found no other code to calculate addresses with a low- and highbyte.

 

This code will:

Loop until Cluster will not be = 0xFFFF

Cluster will contain first the cluster start number and the always the next one.

Then the cluster will be set to absolute position incl. fat-table and set it to AL.

Now calculate the sector-adress = 2*cluster. (With bit shifting in ASM) the sector-adress its 24 bit long and needs to split in two bytes. and for this calculation i need the carry bit i see no other way.

Link to post
Share on other sites

internet,

 

This code will:

Loop until Cluster will not be = 0xFFFF

Cluster will contain first the cluster start number and the always the next one.

Then the cluster will be set to absolute position incl. fat-table and set it to AL.

Now calculate the sector-adress = 2*cluster. (With bit shifting in ASM) the sector-adress its 24 bit long and needs to split in two bytes. and for this calculation i need the carry bit i see no other way.

I don't understand this explanation :)

 

Anyway when using BoostC you can use longs which are 32bits long.

 

Regards

Dave

Link to post
Share on other sites

Join the conversation

You are posting as a guest. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...