|
TVI Memory TVI memory is managed in much the same way as memory on any computer system. TVI has a series of individual memory locations that are addressed as if they were arranged in one long array.
Three data types are provided; LONG, REAL, and STR. The STR data type provides a simple string type that can be used to provide basic interactivity. The STR data type is not an array of bytes and no manipulation of STR variables is allowed other than printing them. STR variables must be initialized in the data section where they are declared. The LONG and REAL data types are badly named as these names imply there is some form of type checking done by the interpreter. Rather, they should be named BYTE, WORD, and LONG to reflect the size of the memory location. TVI (or any computer for that matter) simply views a memory location as a series of 8, 16, 32, 64, … bit chunks, whether those bits are integers, or characters, or pictures downloaded from the net is up to the program and the compiler writer to decide.
There are two methods to allocate TVI memory, using DATA sections or using the alloc instruction. Variables declared in a DATA section are aliases to memory locations. If n variables are declared in the DATA section then the variables serve as aliases for the memory locations 0..n-1 and the first frame will begin at offset n. Consider the following DATA declarations. DATA LONG i,j,k REAL Pi = 3.1416 LONG A[10]
this assigns aliases to 19 memory, and the contents of the interpreter's memory will look like:
|
|