This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revision | |||
notes:comporg:spring2025:projects:mtb3 [2025/03/21 18:26] – [manifestation in memory] cgrant9 | notes:comporg:spring2025:projects:mtb3 [2025/04/03 04:11] (current) – [logic for accessing] bdildine | ||
---|---|---|---|
Line 22: | Line 22: | ||
</ | </ | ||
====logic for accessing==== | ====logic for accessing==== | ||
+ | If you gave each attribute of the brick its own memory address (for example active flag, xpos, ypos) we can access them by going back to that address. | ||
+ | If you used 0x00000000 as your starting address for defining the brick field for example, you would set a register to that memory address and then read from it and its following addresses as such: | ||
+ | < | ||
+ | | ||
+ | _brick_activeflag: | ||
+ | | ||
+ | | ||
+ | | ||
+ | ; repeat loop if not active | ||
+ | </ | ||
+ | Similarly when displaying the bricks we can use [R0+1] and [R0+2]. | ||
+ | Since R0 is the memory address of our brick and each brick has three addresses (active flag, xpos, ypos), | ||
+ | [R0] is the active flag [R0+1] is the xpos and [R0+2] is the ypos. |