notes:comporg:spring2024:projects:pncx
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
notes:comporg:spring2024:projects:pncx [2024/04/24 21:00] – [Array in ASM] wgates1 | notes:comporg:spring2024:projects:pncx [2024/04/24 23:18] (current) – [dmorey2 pnc2 runtimes] dmorey2 | ||
---|---|---|---|
Line 261: | Line 261: | ||
Lets look at what is happening here, so we have created an array called primeAr and we have a loop that starts at 2 and goes till upperBound which could be 1024, 2048, and so on. Inside the loop, we are specifying the index at a given point in the array and assigning it pop. This is populating our array going 2, | Lets look at what is happening here, so we have created an array called primeAr and we have a loop that starts at 2 and goes till upperBound which could be 1024, 2048, and so on. Inside the loop, we are specifying the index at a given point in the array and assigning it pop. This is populating our array going 2, | ||
+ | Now lets look at that in asm: | ||
+ | <code asm> | ||
+ | mov R8, primeAr ; Starting point goes into R8 | ||
+ | iadd R8, 2 ; Incrementing R8 by 2 | ||
+ | mov R9, 2 ; starting point/ | ||
+ | |||
+ | _bLoop: | ||
+ | ; Loop condition | ||
+ | mov R13, R9 | ||
+ | ile R13, R2 | ||
+ | jf R13, _bLoopEnd | ||
+ | |||
+ | mov [R8], R9 ; R9 moved into R8 array at current index | ||
+ | iadd R8, 1 ; Increment memory address | ||
+ | iadd R9, 1 ; Increment loop | ||
+ | |||
+ | jmp _bLoop ; Back to start of loop | ||
+ | |||
+ | _bLoopEnd: | ||
+ | </ | ||
+ | |||
+ | As you can see the logic is very similar but just knowing how to write it might be the hard part but after doing a couple look overs and experimenting it will click. | ||
Line 308: | Line 330: | ||
====dmorey2 pnc1 runtimes==== | ====dmorey2 pnc1 runtimes==== | ||
{{: | {{: | ||
+ | |||
+ | ====dmorey2 pnc2 runtimes==== | ||
+ | {{: | ||
====rspringe Runtimes==== | ====rspringe Runtimes==== | ||
===pnc0=== | ===pnc0=== | ||
Line 314: | Line 339: | ||
{{: | {{: | ||
===pnc2=== | ===pnc2=== | ||
+ | {{: | ||
+ | {{: |
notes/comporg/spring2024/projects/pncx.1714006821.txt.gz · Last modified: 2024/04/24 21:00 by wgates1