0

I am having an issue with a program I am writing right now, here is the program exactly.

.data
BYTE1:  .byte 0xAD
BYTE2:  .byte 0xDE

WORD1:  .word 0
WORD2:  .word 0
WORD3:  .word 0
WORD4:  .word 0
WORD5:  .word 0

MYNAME: .asciiz "SamW"

    .text
    .globl main

main:

#WORD1
lui $t0, 0xCAFE
srl $t0, $t0, 16
la $t1, WORD1
sw $t0, 0($t1)

#WORD2
lui $t0, 0xBEAD
srl $t0, $t0, 16
la $t1, WORD2
sw $t0, 0($t1)

#WORD3
lui $t0, 0xDEAF
srl $t0, $t0, 16
la $t1, WORD3
sw $t0, 0($t1)

#WORD4
lui $t0, 0xDEED
srl $t0, $t0, 16
la $t1, WORD4
sw $t0, 0($t1)

#MYNAME
lw $t0, 8($t1)
la $t1, WORD5
sw $t0, 0($t1)

#LOAD_B1
la $t0, BYTE1
lbu $s0, 0($t0)

#LOAD_B2
addi, $t0, $t0, 1
lbu $s1, 0($t0)

#LOAD_W1
la $t0, WORD1
lw $s2, 0($t0)

addi $t0, $t0, 4


#LOAD_W2

lw $s3, 0($t0)

The issue that is occurring is with the last couple lines of code where I am instructing a lw to pull the information from WORD1 and WORD2 and store it in a save register. For some reason when I go to run that code one time through nothing happens, but then when I clear out all of the registers and reinitialize the program again, within the first 2 instructions those instructions are executed correctly. Any insight would be greatly appreciated.

Notice the highlighted instruction and what is printed in Register 19. Once again on the initial run through the code nothing happened in Register 19 then when I reinitialized it that popped in on instruction 3.

Here is a picture of the memory banks:

Community
  • 1
  • 1
Samuel
  • 5
  • 4

0 Answers0