6 Replies - 343 Views - Last Post: 09 February 2019 - 07:05 AM

#1 TonyRymond   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 49
  • Joined: 09-February 19

Assembly's instruction

Posted 09 February 2019 - 05:46 AM

Hello, i'm writting a code which I didn't understand exactly what the differences between those store's instructions; could anyone please explain what're the differences?

I already attached a photo of store's instructions.

Attached image(s)

  • Attached Image

Is This A Good Question/Topic? 0
  • +

Replies To: Assembly's instruction

#2 TonyRymond   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 49
  • Joined: 09-February 19

Re: Assembly's instruction

Posted 09 February 2019 - 06:02 AM

could please explain what the differences between those load's instructions?! thanks.
sounds they are all loading but ofcourse there's a difference between using them.

Attached image(s)

  • Attached Image

Was This Post Helpful? 0
  • +
  • -

#3 sepp2k   User is offline

  • D.I.C Lover
  • member icon

Reputation: 2740
  • View blog
  • Posts: 4,389
  • Joined: 21-June 11

Re: Assembly's instruction

Posted 09 February 2019 - 06:32 AM

The colon tells you how many bytes it writes memory. So sb writes one byte, sh two and sw 4 (store byte, store half, store word). LB and LH presumably stand for "low byte" and "low half" respectively. So sb stores the lowest byte of $t into memory, sh stores the lowest half (i.e. the lowest two bytes) and and sw stores the entire four bytes of $t.
Was This Post Helpful? 0
  • +
  • -

#4 sepp2k   User is offline

  • D.I.C Lover
  • member icon

Reputation: 2740
  • View blog
  • Posts: 4,389
  • Joined: 21-June 11

Re: Assembly's instruction

Posted 09 February 2019 - 06:46 AM

You should really ask closely related questions like there in the same thread instead of opening a new one. Someone will probably merge these two.

Anyway, the answer is basically the same as to your previous question: The instructions read different amounts of memory. SE and ZE stand for "sign extension" and "zero extension" respectively and the u consequently stands for "unsigned".
Was This Post Helpful? 1
  • +
  • -

#5 TonyRymond   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 49
  • Joined: 09-February 19

Re: Assembly's instruction

Posted 09 February 2019 - 06:57 AM

View Postsepp2k, on 09 February 2019 - 06:32 AM, said:

The colon tells you how many bytes it writes memory. So sb writes one byte, sh two and sw 4 (store byte, store half, store word). LB and LH presumably stand for "low byte" and "low half" respectively. So sb stores the lowest byte of $t into memory, sh stores the lowest half (i.e. the lowest two bytes) and and sw stores the entire four bytes of $t.


so If I have word of char; I can't use sh/sw for storing because char is one byte and I must use sb in this case .. am I right? thanks.
Was This Post Helpful? 0
  • +
  • -

#6 TonyRymond   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 49
  • Joined: 09-February 19

Re: Assembly's instruction

Posted 09 February 2019 - 06:59 AM

meaningful ; thanks a lot.
Was This Post Helpful? 0
  • +
  • -

#7 sepp2k   User is offline

  • D.I.C Lover
  • member icon

Reputation: 2740
  • View blog
  • Posts: 4,389
  • Joined: 21-June 11

Re: Assembly's instruction

Posted 09 February 2019 - 07:05 AM

Yes, assuming a single-byte encoding (such as ASCII or one of the ISO encodings), writing a single char to memory would mean using sb.
Was This Post Helpful? 1
  • +
  • -

Page 1 of 1