Cronus GPC Documentation
Cronus CommunityGPC LibraryGPC Guide
  • Welcome
  • Introduction
    • GPC Explained
    • What's New with Zen?
  • Basic Syntax
  • A Simple Tutorial
  • Style Guide
  • GPC Structure
  • Basic GPC Structure
  • Definitions
  • Data Section
  • Remapping
  • Variables
  • Init Section
  • Main Section
  • Combo Section
  • User Created Functions
  • GPC Programming Basics
  • Constants
    • Zen
      • OLED
      • ASCII Constants
      • PIO
    • Keyboard
      • Keyboard
    • Controller
      • Polar
      • LED
      • Rumble
      • PS3
      • PS4
      • XBox 360
      • Xbox One
      • Nintendo WII
      • Nintendo Switch
    • Racing Wheel
      • G29
      • G27
      • G25
      • DF
      • DF GT
      • DF Pro
    • Trace
    • Memory
    • Misc
  • Flow Control
  • Persistent Memory
  • Operator Types
  • Identifiers
  • Functions & Commands
    • Internal Functions
      • Bit Functions
      • Combo Functions
      • Math Functions
      • Device Functions
      • OLED Display Functions
    • Console Functions
      • Core Console Functions
    • Controller Functions
      • Core Controller Functions
      • Rumble Functions
      • LED Functions
    • Keyboard Functions
      • Core Keyboard Functions
  • GPC Examples
    • #1
Powered by GitBook
On this page

Was this helpful?

Data Section

PreviousDefinitionsNextRemapping

Last updated 5 years ago

Was this helpful?

The data section is located at the first portion of the virtual address space within the GPC bytecode and contains static values which cannot be altered during run time.

The main purpose for the data section is to store static information and the size of it is determined by the values within it. The static values can be accessed in a GPC through the use of an indexer and can also be used if they are placed before the data section, as shown below.

define myValue = 255;

//Index No.   0   1   2   3        4  5    6  7   8    9   10
data (        20, 42, 35, myValue, 1, 100, 0, 86, 255, 11, 2  );       

int a, b, c;

main {
    a = dbyte(3);    //a = 255
    b = dchar(3);    //b = -1;
    c = dword(3);    //c = 511;
}

Functions

The values placed within the data section are expressed in bytes (8 bit unsigned integer). The index is zero based. As you can see above, the first value is index point 0 (zero) and the 11th value would be index point 10.

dbyte Function

a = dbyte(3);    // a = 255

This function returns a byte value (8 bit unsigned integer) from the selected index within the array.

Syntax

dbyte ( <index>);

Parameters

<index> : The index of an element with the data section

dchar Function

b = dchar(3);    // b = -1;

This function returns a char value (8 bit signed integer) from the selected index within the array.

Syntax

dchar ( <index>);

Parameters

<index> : The index of an element with the data section

dword Function

c = dword(3);    // c = 511;

This function returns a word value (16 bit signed integer) from the selected index within the array.

Syntax

dword ( <index>);

Parameters

<index> : The index of an element with the data section

definitions
Definitions