Jump to content

JeffVincent

New Members
  • Posts

    1
  • Joined

  • Last visited

JeffVincent's Achievements

Combat Commando

Combat Commando (1/9)

0

Reputation

  1. Hi, I recently started using OSS's Action, but I've run into some problems. In short, is there a limit on the size of arrays? I find that when I try to create a BYTE ARRAY of >256 elements, the compiler starts each array only a few bytes apart (as if it is ignoring the MSB of the size.) To expand a bit... I was trying to do a Life simulation and wanted to create several linked lists. I've since concluded that can't be done since the language doesn't seem to be able to dynamically allocate memory. So I decided to do a sort of pseudo-linked-list, creating a record with CARDs for capacity and current size and a BYTE for the start of a virtual x,y coordinate array. Then I created a BYTE ARRAY to hold the record with the virtual array and declared the record and assigned it the address of the BYTE ARRAY. When I tried to Zero() the arrays, I ran into trouble, and when I investigated further I found the problem mentioned above. (I've appended the code below to clarify.) When I run this with a BYTE ARRAY size of 256, it creates three arrays and prints out the starting addresses: $2933 $2A33 $2B33 which is as expected. But if i increase the BYTE ARRAY size to 257, it prints: $2933 $2937 $293B with the arrays overlapping... I didn't see any mention of an array size limit in the manual (and they even show a 1000 byte array in the advanced record example.) I'm running this on the Atari800 emulator (3.1.0) in 800XL mode with the Action 3.5 cart on a Linux Mint 18.1 laptop. Thanks for any help you can offer. -- Jeff ; pseudo-linked-list DEFINE ARRAY_SIZE="256" TYPE LIST=[CARD CAPACITY, size BYTE xy] BYTE ARRAY _ba1(ARRAY_SIZE) BYTE ARRAY _ba2(ARRAY_SIZE) BYTE ARRAY _ba3(ARRAY_SIZE) LIST live=_ba1 LIST newLive=_ba2 LIST adjacent=_ba3 PROC initLists() BYTE i BYTE POINTER ptr live.CAPACITY=(ARRAY_SIZE-4)/2 live.size=0 ptr=@(live.xy) PrintF("%H%E", ptr) ; Zero(ptr,ARRAY_SIZE-4) newLive.CAPACITY=(ARRAY_SIZE-4)/2 newLive.size=0 ptr=@(newLive.xy) PrintF("%H%E", ptr) ; Zero(ptr,ARRAY_SIZE-4) adjacent.CAPACITY=(ARRAY_SIZE-4)/2 adjacent.size=0 ptr=@(adjacent.xy) PrintF("%H%E", ptr) ; Zero(ptr,ARRAY_SIZE-4) RETURN PROC main() initLists() RETURN
×
×
  • Create New...