Searching \ for '[SX] memory questions' in subject line. ()
Make payments with PayPal - it's fast, free and secure! Help us get a faster server
FAQ page: www.piclist.com/techref/ubicom/lib/mem/index.htm?key=memory
Search entire site for: 'memory questions'.

Exact match. Not showing close matches.
PICList Thread
'[SX] memory questions'
2005\11\01@075114 by dog8spamn/a

flavicon
face
In SX Microcontrollers, SX/B Compiler and SX-Key Tool, dog8spam wrote:

If I set org $0A and then set a list of variables with "variable  ds   1" once the ds 1 reaches $10 will that variable be in bank 0 or bank 1?

---------- End of Message ----------

You can view the post on-line at:
http://forums.parallax.com/forums/default.aspx?f=7&p=1&m=94182
Need assistance? Send an email to the Forum Administrator at forumadmin@parallax.com
The Parallax Forums are powered by dotNetBB Forums, copyright 2002-2005 (http://www.dotNetBB.com)

2005\11\02@054133 by dog8spamn/a

flavicon
face
In SX Microcontrollers, SX/B Compiler and SX-Key Tool, dog8spam wrote:

Anybody?

---------- End of Message ----------

You can view the post on-line at:
http://forums.parallax.com/forums/default.aspx?f=7&p=1&m=94182#m94374
Need assistance? Send an email to the Forum Administrator at forumadmin@parallax.com
The Parallax Forums are powered by dotNetBB Forums, copyright 2002-2005 (http://www.dotNetBB.com)

2005\11\02@071551 by Coriolisn/a

flavicon
face
In SX Microcontrollers, SX/B Compiler and SX-Key Tool, Coriolis wrote:

How about compiling an example then looking at the generated asm file and list file? The answer may be dependent on whether you are using a SX28 and SX52 since the addressing mode in SX52 is handled differently and bank 0 is a special case.

---------- End of Message ----------

You can view the post on-line at:
http://forums.parallax.com/forums/default.aspx?f=7&p=1&m=94182#m94382
Need assistance? Send an email to the Forum Administrator at forumadmin@parallax.com
The Parallax Forums are powered by dotNetBB Forums, copyright 2002-2005 (http://www.dotNetBB.com)

2005\11\02@072355 by dog8spamn/a

flavicon
face
In SX Microcontrollers, SX/B Compiler and SX-Key Tool, dog8spam wrote:

I'll try that.  I am using an SX 52 though.

---------- End of Message ----------

You can view the post on-line at:
http://forums.parallax.com/forums/default.aspx?f=7&p=1&m=94182#m94385
Need assistance? Send an email to the Forum Administrator at forumadmin@parallax.com
The Parallax Forums are powered by dotNetBB Forums, copyright 2002-2005 (http://www.dotNetBB.com)

2005\11\02@090404 by g_daubachn/a
flavicon
face
In SX Microcontrollers, SX/B Compiler and SX-Key Tool, g_daubach wrote:

Letting the variables "overflow" into the next bank can cause you a lot of sleepless nights. Here is an example:


     org    $8
aaa          ds 1
bbb          ds 1
ccc          ds 1
ddd          ds 1
eee          ds 1
fff          ds 1
ggg          ds 1
hhh          ds 1
iii          ds 1
         org    $10
jjj          ds 1

When you look at the list file, you will notice that the assembler has defined address $10 for variable iii due to "overflowing" the bank border but it also has defined address $10 for variable jjj as it is defined immediately following the org $10 directive.

SASM does not generate an error because in general, it is absolutely legal referring to one value by more than one symbol. The disaster will come up when you indeed assume that iii and jjj are two different variables occupying different RAM locations. As this is not the case, modifying the contents of variable iii also changes the contents of variable jjj, and vice-versa, which is not what you might expect. Therefore, it's a good idea to check the list file for such possible pitfalls.

BTW, the same is true for code-generation across page boundaries.


       org                $2f3
ClearVars
       clr   !wdt
   sb      fsr.4              
     setb  fsr.3              
   clr     ind                
   incsz   fsr                
     jmp   ClearVars
     
   bank        PWM
   mov     PWM_Prescaler, #PWMPeriod    
   mov     !option, #INT_ON
:MainLoop
   bank        Analog
   mov     w, Analog_ADCresult
   mov     rb, w
   bank    PWM
   mov         PWM_DutyCycle, w
   jmp         :MainLoop

When you assemble this code, and look at the list file, you will notice that code generation "overflows" into the next page, i.e. the instruction code for "mov w, Analog_ADCResult" will be located at $02ff, and the instruction code for "mov rb, w" is at $300, with the next instruction codes following at subsequent locations in page $0300. To make the disaster complete, see what happens when the final "jmp :MainLoop" is executed. As the SX-internal program counter is simply incremented as long as no skips, jumps, or calls are executed, there is no problem, crossing the page when this code is executed the very first time. But the final jmp instruction targets to a location which is not in the page currently addressed by the program counter. So, this jump will not go back to address $2fe, the first instruction following the label ":MainLoop" but the jump will go to $3FE instead, i.e. right into "nowhere land".

Here is a "trick" to let the assembler generate an error on such situations: Place nop instructions at the very first location of each page, as long as you don't need that page for "real" code. When you follow the lines of this sample code with
     org $300
nop
SASM will generate an "Overwriting same program counter location" error in this case.

---------- End of Message ----------

You can view the post on-line at:
http://forums.parallax.com/forums/default.aspx?f=7&p=1&m=94182#m94408
Need assistance? Send an email to the Forum Administrator at forumadmin@parallax.com
The Parallax Forums are powered by dotNetBB Forums, copyright 2002-2005 (http://www.dotNetBB.com)

More... (looser matching)
- Last day of these posts
- In 2005 , 2006 only
- Today
- New search...