User Tools

Site Tools


notes:comporg:fall2023:projects:bia0

This is an old revision of the document!


BIA0

Arrays of Structs in Assembly

In Breakout coded in C, we used an array of brick structs to keep track of all the bricks on the field. When porting over to assembly, the approach needs to be changed due to a multitude of factors.

Arrays don't formally exist in assembly. Since in array is simply an unchanging space of sequential memory, the stack must include the data for all the bricks in order. For breakout, each brick has five properties:

  1. X-axis Position
  2. Y-axis Position
  3. Color
  4. Health
  5. Visibility Toggle

Accessing an individual array element uses an ID value to get that position's specific data. In Assembly, we use a register to hold the memory address of a given element's first property. Here's an example in practice:

notes/comporg/fall2023/projects/bia0.1698280077.txt.gz · Last modified: 2023/10/26 00:27 by walley