You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
While writing in MIPS, I used several .word directives, but didn't initialize them with a value, as they get initialized later on in the program. However, the assembler doesn't honour this and set aside space for them in the final executable.
LBL_1_ADDR: .word LABEL_1 # storing LABEL_1's addressLBL_2_ADDR: .word LABEL_2LABEL_1: .word # say this address is 0x10010068LABEL_2 .wordmain: lw$t0, LBL_1_ADDR # this reads 0x10010068 lw$t1, LBL_2_ADDR # this also reads 0x10010068
The fix would be to use .word 0, then the assembler does set aside space for them.
I'm not sure if this behaviour is intended, as I haven't seen this behaviour among other assemblers, but I thought it was worth bringing to your attention.
The text was updated successfully, but these errors were encountered:
Yeah, the .word directive gets a sequence of numbers. So .word 0 1 2 3 is also valid and will create 4 words. .word with no arguments will take zero words.
While writing in MIPS, I used several .word directives, but didn't initialize them with a value, as they get initialized later on in the program. However, the assembler doesn't honour this and set aside space for them in the final executable.
The fix would be to use
.word 0
, then the assembler does set aside space for them.I'm not sure if this behaviour is intended, as I haven't seen this behaviour among other assemblers, but I thought it was worth bringing to your attention.
The text was updated successfully, but these errors were encountered: