Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
data [2019/05/07 08:12]
neils
data [2019/09/19 08:00] (current)
neils
Line 9: Line 9:
     data varname![] = incbin "​path/​to/​binary_file"​     data varname![] = incbin "​path/​to/​binary_file"​
  
-The ''​DATA''​ directive allocates a one-dimensional static array in memory filled with pre-initialized data //in compile time//. The length of the array will equal to the number of elements in the list of values..+The ''​DATA''​ directive allocates a one-dimensional static array in memory filled with pre-initialized data //in compile time//. The length of the array will equal to the number of elements in the list of values. ​Values can be of any type, but this type must match the type of the variable.
  
 If the right-hand side of the assignment is an ''​INCBIN''​ directive, the length of the array will equal to the length of the file and each byte in the file will become one array element. Only //byte type// arrays can be initialized this way. If the right-hand side of the assignment is an ''​INCBIN''​ directive, the length of the array will equal to the length of the file and each byte in the file will become one array element. Only //byte type// arrays can be initialized this way.