Laman

Rabu, 03 April 2013

Program dilanjutkan

Tapi untuk sekarang ingatlah kalau data section dimulai dari address 0x10000000. Half word atas adalah 0x1000. Nilai ini diload kedalam base register menggunakan lui



## strlen.asm 
## 
## Count the characters in a string 
## 
## Registers: 
##  $8 -- count 
##  $9 -- pointer to the char 
## $10 -- the char (in low order byte) 

.text 
.globl main 

# Initialize 

main: 
      ori $8,$0,0           # count = 0 
      lui $9,0x1000         # point at first char 
  
# while not ch==null do 
  
loop: 
       lbu $10,($9)    # get the char 
       
       sll   $0,$0,0        # load delay slot

        $10,$0,done    # exit loop if char == null 
       
       sll   $0,$0,0        # branch delay slot
   
       . . .
   
       j loop               # finish 
       sll   $0,$0,0        # branch delay slot

done:  sll $0,$0,0          # target for branch 

.data 
string: .asciiz "Time is the ghost of space." 

Quest 4: fill in the blank

Tidak ada komentar:

Posting Komentar