News:

Let's find out together what makes a PIC Tick!

Main Menu

Label_Bank_Resets error

Started by Pepe, Sep 15, 2025, 01:59 PM

Previous topic - Next topic

Pepe

If I use Label_Bank_Resets = on, the data from cdata is not assigned to the vector, and if I set Label_Bank_Resets = off, it is assigned correctly.



Device = 18F2550
Declare Xtal = 48
Declare Optimiser_Level = 3

Declare Label_Bank_Resets = On

Declare Create_Coff On


Dim u As Byte
Dim b[3] As Byte

 For u = 0 To 2   
  b[u] = CRead dato + u
 Next u 

End
 
dato:

CData 0x01, 0x02 , 0x03

;-------------------------------------------------------------------------------
;**** Added by Fuse Configurator ****
; Use the Fuse Configurator plug-in to change these settings

Config_Start
  PLLDIV = 5 ;Divide by 5 (20 MHz oscillator input)
  CPUDIV = OSC1_PLL2 ;[Primary Oscillator Src: /1][96 MHz PLL Src: /2]
  USBDIV = 2 ;USB clock source comes from the 96 MHz PLL divided by 2
  FOSC = HSPLL_HS ;HS oscillator, PLL enabled (HSPLL)
  FCMEN = OFF ;Fail-Safe Clock Monitor disabled
  IESO = OFF ;Oscillator Switchover mode disabled
  PWRT = On     ;PWRT enabled
  BOR = OFF  ;Brown-out Reset disabled in hardware and software
  BORV = 3     ;Minimum setting 2.05V
  VREGEN = On ;USB voltage regulator enabled
  WDT = OFF  ;WDT enabled (control is placed on the SWDTEN bit)
  WDTPS = 32768 ;1:32768
  CCP2MX = On ;CCP2 input/output is not multiplexed with RB3
  PBADEN = OFF ;PORTB<4:0> pins are configured as digital I/O on Reset
  LPT1OSC = On ;Timer1 configured for higher power operation
  MCLRE = On ;MCLR pin enabled; RE3 input pin disabled
  STVREN = OFF ;Stack full/underflow will not cause Reset
  LVP = OFF     ;Single-Supply ICSP disabled
  XINST = OFF ;Instruction set extension and Indexed Addressing mode disabled (Legacy mode)
  Debug = OFF ;Background debugger disabled, RB6 and RB7 configured as general purpose I/O pins
  Cp0 = On ;Block 0 (000800-001FFFh) is not code-protected
  CP1 = On ;Block 1 (002000-003FFFh) is not code-protected
  CP2 = On ;Block 2 (004000-005FFFh) is not code-protected
  CP3 = On ;Block 3 (006000-007FFFh) is not code-protected
  CPB = On ;Boot block (000000-0007FFh) is not code-protected
  CPD = OFF ;Data EEPROM is not code-protected
  WRT0 = On ;Block 0 (000800-001FFFh) is not write-protected
  WRT1 = On ;Block 1 (002000-003FFFh) is not write-protected
  WRT2 = On ;Block 2 (004000-005FFFh) is not write-protected
  WRT3 = On ;Block 3 (006000-007FFFh) is not write-protected
  WRTC = On ;Configuration registers (300000-3000FFh) are not write-protected
  WRTB = On ;Boot block (000000-0007FFh) is not write-protected
  WRTD = OFF ;Data EEPROM is not write-protected
  EBTR0 = OFF ;Block 0 (000800-001FFFh) is not protected from table reads executed in other blocks
  EBTR1 = OFF ;Block 1 (002000-003FFFh) is not protected from table reads executed in other blocks
  EBTR2 = OFF ;Block 2 (004000-005FFFh) is not protected from table reads executed in other blocks
  EBTR3 = OFF ;Block 3 (006000-007FFFh) is not protected from table reads executed in other blocks
  EBTRB = OFF ;Boot block (000000-0007FFh) is not protected from table reads executed in other blocks
Config_End

;**** End of Fuse Configurator Settings ****
;-------------------------------------------------------------------------------


top204

#1
It is not an anomaly.

The Label_Bank_Resets declare is now very, very old and obsolete, and is not actually required, and it will cause problems with CData because it will reset the RAM bank on the CData label. That is why it gives a 'Hint' message, because it can cause problems if left on at the start of the code listing. If absolutely required, which it is not, it needs to be enabled, and disabled when required.

I left it in place for backward compatability, and for debugging code when developing for new devices, that are causing real problems for no obvious reason, so I could force RAM resets. 'Not' for general purpose use, because it will cause large bloat, and slow a program's speed down, because extra mnemonics will be placed, and on standard 14-bit core devices, that is a lot of bloat for no reason. I will remove it from the next manual version.

For example, the BASIC code listing on a PIC18F device:

Declare Label_Bank_Resets = On                          ' Force RAM bank resets on ALL labels

Main:
MyData:
    CData 1, 2, 3, 4, 5

Will create the assembler code:

Main
MyData
    movlb 0x00
    db 1,2,3,4
    db 5


See how the movlb mnemonic is placed after the CData label, to reset the RAM bank?, because the compiler has been told to add RAM bank resets on "all" labels. Which will offset the data, and the compiler has not placed the one after the 'Main' label, because they were both setting RAM bank 0, straight after each other.

However, if the RAM bank resets are switched off in key places, such as below:

Declare Label_Bank_Resets = On                          ' Force RAM bank resets on ALL labels

Main:
    Declare Label_Bank_Resets = Off                     ' Switch off forced RAM bank switching
MyData:
    CData 1, 2, 3, 4, 5
    Declare Label_Bank_Resets = On                      ' Switch on forced RAM bank switching, again

The assembler code for the above looks like:

Main
MyData
    db 1,2,3,4
    db 5


Which has no RAM bank switching at that point in the code, so no offset.

Or if you place the label name on the same line as the CData directive, the compiler bypasses the Declare, because it knows there is a CData after it, so it is not a general purpose label, and has data following, not mnemonics. For example:

MyData: CData 1, 2, 3, 4, 5


I would recommend using the Dim As FlashX directives for all flash memory data storage, because the compiler has full control of them, and it places the flash memory data out of the way of mnemonic code. For example:

Dim MyData As Flash8 = 1, 2, 3, 4, 5

The CData directive is now rather obsolete, and not actually required, but I left it in place for backward compatability, or for "special" purposes that may arise at some point in the future.

Pepe

It doesn't help me to use dim MyData as flash8 because when I assign it to a vector of size 10 and the data of the MyData is 5, it assigns to positions vector 6, 7, 8, 9 which should not be assigned and it forces me to delete them, requiring more code.

trastikata

#3
Quote from: Pepe on Today at 02:02 PMIt doesn't help me to use dim MyData as flash8 because when I assign it to a vector of size 10 and the data of the MyData is 5, it assigns to positions vector 6, 7, 8, 9 which should not be assigned and it forces me to delete them, requiring more code.

As I see it, using CData and Flash only affects the internal selection of the compiler how to create the data table in the FLASH memory.

Using the name of the label i.e. the address inside the FLASH memory, does not change.

Otherwise said, you can create your data table with the new Flash directive and use the flash table as before ...

However I am not sure what do you mean with the vector assignment, this is what I do:

Device = 18F67K22    
Declare Xtal = 20

Dim bVideoMem[1024] As Byte
Dim bVideoMem1[16] As Byte
Dim wCounter As Word

'Assign values to bVideoMem from offset 0
For wCounter = 0 To Bound(bVideoMem)
    bVideoMem[wCounter] = CRead8 bVideoMemTable[wCounter]
Next

'Assign values To bVideoMem1 from offset 16
For wCounter = 0 To Bound(bVideoMem1)
    bVideoMem1[wCounter] = CRead8 bVideoMemTable[wCounter + 16]
Next

End

Dim bVideoMemTable As Flash8 =      0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,_
                                    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,_
                                    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,_
                                    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,_
                                    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,_
                                    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,_
                                    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,_
                                    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,_
                                    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,_
                                    0x00, 0x80, 0xE0, 0xF0, 0xF8, 0xF8, 0x78, 0x78, 0x38, 0x38, 0x38, 0x38, 0x18, 0x1C, 0x1C, 0x1C,_
                                    0x1C, 0x1C, 0x1C, 0x1C, 0x1C, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,_
                                    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,_
                                    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,_
                                    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,_
                                    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,_
                                    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,_
                                    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,_
                                    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,_
                                    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,_
                                    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,_
                                    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,_
                                    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,_
                                    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,_
                                    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,_
                                    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,_
                                    0x00, 0x80, 0xE0, 0xF0, 0xF8, 0xF8, 0x78, 0x78, 0x38, 0x38, 0x38, 0x38, 0x18, 0x1C, 0x1C, 0x1C,_
                                    0x1C, 0x1C, 0x1C, 0x1C, 0x1C, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,_
                                    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,_
                                    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,_
                                    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,_
                                    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,_
                                    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,_
                                    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,_
                                    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,_
                                    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,_
                                    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,_
                                    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,_
                                    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,_
                                    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,_
                                    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,_
                                    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,_
                                    0x00, 0x80, 0xE0, 0xF0, 0xF8, 0xF8, 0x78, 0x78, 0x38, 0x38, 0x38, 0x38, 0x18, 0x1C, 0x1C, 0x1C,_
                                    0x1C, 0x1C, 0x1C, 0x1C, 0x1C, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,_
                                    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,_
                                    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,_
                                    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,_
                                    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,_
                                    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,_
                                    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,_
                                    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,_
                                    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,_
                                    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,_
                                    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,_
                                    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,_
                                    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,_
                                    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,_
                                    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,_
                                    0x00, 0x80, 0xE0, 0xF0, 0xF8, 0xF8, 0x78, 0x78, 0x38, 0x38, 0x38, 0x38, 0x18, 0x1C, 0x1C, 0x1C,_
                                    0x1C, 0x1C, 0x1C, 0x1C, 0x1C, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,_
                                    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,_
                                    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,_
                                    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,_
                                    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,_
                                    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,_
                                    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,_
                                    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,_
                                    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,_
                                    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,_
                                    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,_
                                    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,_
                                    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,_
                                    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,_
                                    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,_
                                    0x00, 0x80, 0xE0, 0xF0, 0xF8, 0xF8, 0x78, 0x78, 0x38, 0x38, 0x38, 0x38, 0x18, 0x1C, 0x1C, 0x1C,_
                                    0x1C, 0x1C, 0x1C, 0x1C, 0x1C, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,_
                                    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,_
                                    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,_
                                    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,_
                                    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,_
                                    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,_
                                    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,_
                                    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,_
                                    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,_
                                    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,_
                                    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,_
                                    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,_
                                    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,_
                                    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,_
                                    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,_
                                    0x00, 0x80, 0xE0, 0xF0, 0xF8, 0xF8, 0x78, 0x78, 0x38, 0x38, 0x38, 0x38, 0x18, 0x1C, 0x1C, 0x1C,_
                                    0x1C, 0x1C, 0x1C, 0x1C, 0x1C, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,_
                                    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,_
                                    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,_
                                    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,_
                                    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,_
                                    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01

Pepe

Thanks for the reply. What I mean is that if I type bVideoMem = bVideoMemTable directly, and bVideoMemTable is smaller than bVideoMem, bVideoMem is assigned all its positions even if bVideoMemTable is missing values.

trastikata

Quote from: Pepe on Today at 05:35 PMThanks for the reply. What I mean is that if I type bVideoMem = bVideoMemTable directly, and bVideoMemTable is smaller than bVideoMem, bVideoMem is assigned all its positions even if bVideoMemTable is missing values.

If the two arrays/tables on both sides of the equation are different sizes, the compiler can't know what would prefer the user - to wrap the one on the left or on the right, the array or the table, so do it in code.

In the background it is the same - the compiler creates a flash table and since RAM is volatile memory, at the beginning of your program there's "invisible for the user" code that reads the flash table and loads the data to the memory. - The mechanism I posted does practically the same, but you have full control of what happens.

Pepe

It would be nice to be able to choose with a declaration which side to take the amount of data.