-- This is how it works (I have not tested this code, but it is a
short version of the same lib)

-- example usage
const dword LARGE_ARRAY_SIZE = 300           -- choose number of array
variables
const dword LARGE_ARRAY_VARIABLE_SIZE = 1    -- choose size of
variables (byte*1)
-- include large_array                    -- include the array library
-- alias test is large_array_1            -- rename/alias the array to
test


if LARGE_ARRAY_VARIABLE_SIZE == 1 then -- if array has byte variables

  -- create vars for if large_array_size is between 256 and 512
  var byte large_array_byte_1b[256]
  if !(LARGE_ARRAY_SIZE == 256) then
    var byte large_array_byte_2b[LARGE_ARRAY_SIZE - (256)]
  end if

  -- create vars for if large_array_size is between 0 and 256
  if !(LARGE_ARRAY_SIZE == 0) then
    var byte large_array_byte_1a[LARGE_ARRAY_SIZE]
  end if

  -- get a value from a large byte array
  function large_array_1'get(word in address) return byte is
    var byte data

    -- if "LARGE_ARRAY_SIZE > 256" we will use "b" array's. "a" arrays
will get ignored by compiler.
    if LARGE_ARRAY_SIZE >  256 then      -- notice constants here,
      if address >=  256 then
         data = large_array_byte_2b[address - 256]
      else
         data = large_array_byte_1b[address - 0]
      end if
    elsif LARGE_ARRAY_SIZE >  0 then    -- and constants here.
         data = large_array_byte_1a[address - 0]
    end if

    return data
  end function

  -- store a value into a large byte array
  procedure large_array_1'put (word in address, byte in data) is
    -- if "LARGE_ARRAY_SIZE > 256" we will use "b" array's. "a" arrays
will get ignored by compiler.
    if LARGE_ARRAY_SIZE >  256 then          -- notice constants here,
      if address >=  256 then
         large_array_byte_2b[address - 256] = data
      else
         large_array_byte_1b[address - 0] = data
      end if
    elsif LARGE_ARRAY_SIZE >  0 then         -- and constants here.
         large_array_byte_1a[address - 0] = data
    end if
  end procedure
if LARGE_ARRAY_VARIABLE_SIZE == 2 then -- if array has word variables
  -- code here
end if
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"jallib" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/jallib?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to