Arrays in ARM Assembly

Поделиться
HTML-код
  • Опубликовано: 16 сен 2024
  • Allocation of fixed-sized arrays, element access, and traversal
    EXAMPLE ARM ASSEMBLY CODE:
    github.com/cmc...

Комментарии • 26

  • @behnamahmadi2834
    @behnamahmadi2834 Год назад

    Dear Christopher, I would like to deeply appreciate your excellent and well described tutorial. Not only I finally manged to understand the arrays but also other topics such as offset.

  • @WatDiggityDawg
    @WatDiggityDawg 5 лет назад +2

    First explanation of the .balign that actually makes sense. Thank you!

  • @DCALVERTMW2
    @DCALVERTMW2 5 лет назад +2

    One of the most informative videos I've seen. Took me from totally lost, to feeling confident in arrays now. Thank you!

  • @kevinphillips6333
    @kevinphillips6333 6 лет назад +7

    Thanks for the video. There's a few things I noticed at first glance:
    1. line 18 is redundant if you move the compare to the end of the loop (saving one cycle)
    2. line 19 LDR R1 could/should be moved outside of the loop as R1 is never changed (more cycles saved :)
    3. You could put the LSL shift into the STR instruction directly
    4. You could even combine the ADD into the STR using [R1, #offset]! and do your comparison directly on R1
    ...and then there's all those pops and pushes which should really be grouped into one command eg. POP {r1-r3}.
    Sorry to be pedantic. It's just that there's a lot of fun to be had in refactoring ARM code, as there's a LOT of scope for combining logic into one instruction, making sure memory access is minimised (looping using registers only if at all possible).
    I started writing ARM2 assembler in 92 - 8MHz single core, and in those days every cycle counted...after all these years...I see dead cycles!
    Hopefully this is useful info to someone watching :)

  • @Mustafa-jy8el
    @Mustafa-jy8el 7 лет назад +1

    Very clear and informative. Subscribed.

  • @greob
    @greob 4 года назад

    Thanks for sharing this well produced video! :)

  • @_415_
    @_415_ 3 года назад

    You saved my weekend

  • @afinewhitehorse
    @afinewhitehorse 7 лет назад

    Thanks Christopher, thought you did a nice job with this.

  • @rdoetjes
    @rdoetjes 4 года назад

    This code can be optimized. You keep loading R1 with memory location a, every iteration. That’s a bit useless. Also this approach is more efficient if you store from back to front. Then you just have to decrement and then you can omit an extra compare. But that’s a bit case dependent.
    You have a great ability to teach!!!

    • @ChristopherMcMurrough
      @ChristopherMcMurrough  4 года назад

      Good catch. You can move that instruction out of the loop to optimize things a bit in this case. This won't work in cases where you can't dedicate an entire register to hold the base address during the life of the loop (for example, calling a function during each iteration). In those situations, it is probably better to just load the base address with one instruction instead of pushing / popping from the stack with multiple instructions.

  • @sydneyhester7042
    @sydneyhester7042 2 года назад

    This was SOOOOOO helpful. Thank yo so much!

  • @ownyounext
    @ownyounext 3 года назад

    Thank you so much for this video. So helpful!!

  • @mikeli1123
    @mikeli1123 6 лет назад

    Appreciate your effort, great video

  • @hashirbadar786
    @hashirbadar786 8 лет назад

    Good explanation. Thanks

  • @Halfelino
    @Halfelino 7 лет назад

    Thanks man! Helped me greatly!

  • @exL1kz
    @exL1kz 5 лет назад +1

    Awesome video. How hard do you think it would be to expand on this and implement a bubble sort?

  • @rroiboi125
    @rroiboi125 2 года назад

    thx m8

  • @user-dh7qu1yj4h
    @user-dh7qu1yj4h 7 лет назад

    is R1 your implementation of the frame pointer from the frame record and is R2 essentially storing where to look on the stack?

    • @kevinphillips6333
      @kevinphillips6333 6 лет назад

      R1 is essentially the base address, R2 is the offset against this base address which gets incremented each time around the loop until the limit is met.

  • @sirazulislamsiraz7631
    @sirazulislamsiraz7631 6 лет назад

    how can I run and debug a program in ccs without external hardware? is it possible? someone help me plz.

  • @idcemail123
    @idcemail123 4 года назад

    Can you help me with my assembly assignment please!! Willing to pay for help

  • @user-px9eu4tv1n
    @user-px9eu4tv1n 2 года назад

    Hi can you helpme with my assembly test
    My teacher using your video

  • @KommToby
    @KommToby 3 года назад

    do u play osu

  • @ThirstyButcher
    @ThirstyButcher 3 года назад

    Skip class. Watch this video.