user3413028
user3413028

Reputation: 1

MIPS Julia set that connects with bitmap display

I've already created the Julia iterations but i'm having trouble integrating that with the bitmap display in MARS. It should only take an input of a and b and use nested loops to iterate the function 256 times. Here is what I have so far:

    .data
str1: .asciiz "Enter the value of a:"  #Declaring all the string variables that will print to the screen.
str2: .asciiz "Enter the value of b:"

height: .float 256  #Create the height and width constants to be used.
width: .float 256
const: .float -1.5  

    .text
main:   
    li $v0, 4        #Load the appropriate system call code into register $v0.
    la $a0, str1     #Load address of string to be printed into $a0.
    syscall          #Call OS to perform print operation.
    li $v0, 6        #Load the system call code for reading a float.
    syscall      #Call OS to read the user input.
    mov.s $f1, $f0   #Move the user inputted float into register $f12.

    li $v0, 4
    la $a0, str2
    syscall
    li $v0, 6
    syscall  
    mov.s $f2, $f0

    j Loop       #Jump to Loop.

    li $v0, 10       #Load the appropriate system call code into register $v0.
    syscall          #Call OS to perform the exit operation.

Loop:   
    addi $s0, $s0, 256      #Set number of iterations to 256.
    blt $s1, $s0, Loop2     #If i < 256 then go to Loop2.
    j exit              #If i >= 256 then jump to exit.

Loop2:
    beq $s2, $s0, exit      #If j = 256 then exit

    lwc1 $f20, const($0)        #Load the constant -1.5 in register $f20.
    lwc1 $f18, width($0)        #Load the constant width in register $f18.
    lwc1 $f18, height($0)       #Load the constant height in the register $f18.

    #div.s $s2, $s1, $t0        #Divide pixel i by with and store into register $s2.
    #ac1 dd $s3, $s2, $s2       #2*(i/w).
    #add $s3, $s3, $s2      #3*(i/w). 

Julia:  
    mul.s $f30, $f8, $f8        #Register $f30 gets x^2.
    mul.s $f28, $f6, $f6        #Register $f28 gets y^2.
    sub.s $f28, $f30, $f28      #Register $f28 gets x^2 - y^2.
    add.s $f28, $f28, $f1       #Register $f28 gets (x^2 - y^2) + a.

    mul.s $f26, $f8, $f6        #Register $f26 gets xy.
    add.s $f26, $f26, $f26      #Register $f26 gets 2xy.
    add.s $f26, $f26, $f2       #Register $f26 gets 2xy + b. 

    mov.s $f8, $f28         #x = (x^2 - y^2) + a.
    mov.s $f6, $f26         #y = 2xy + b.

    addi $s1, $s1, 1        #Increment the number of iterations.

    j Julia             #Go through loop again.
exit:

Upvotes: 0

Views: 1033

Answers (1)

user2829366
user2829366

Reputation: 11

It looks like in your Julia loop, you're missing a condition to exit the loop.

Upvotes: 1

Related Questions