Hi guys help this newbie out. My code which uses midpoint circle algorithm to draw the circle and seeking algorithm (steering behaviour) to move the circle towards a position. However the circle is not being drawn and the seeking algorithm i believe is flawed. Please review this and tell me what I am doing wrong.

.data

xvalue: .word 0

yvalue: .word 10

radius: .word 10

colour: .word 0x00FFFFFF

one: .word 1

two: .word 2

three: .word 3

five: .word 5

bmp: .space 0x80000

bmpheight: .word 70

bmpwidth: .word 90

angle: .word 0xffff0014

orientation: .word 0xffff0040

velocity: .word 0xffff0010

maxspeed: .word 200

pi: .float 3.142

max_force: .word 5

sinangle: .double 0.96

cosangle: .double 0.99

square1: .double 67.08

square2: .double 316.23

anglemain: .double 8.13

.text

main:

lw $a2, one

lw $a1, radius

jal dvalue

dvalue:

sub $a3, $a2, $a1 # d

jal drawpixel

lw $t4, three

lw $t5, five

li $a0, 0 # x

lw $a1, radius # y

bgt $a1, $a0, dlessthan

dlessthan:

blez $a3, selectE # if d < 0 then

bgtz $a3, selectSE

jal stopalgorithm

selectE:

sll $a0, $a0, 2

add $t3, $a0, $t4 # 2x + 3

add $a3, $a3, $t3 # d + = x * 2 + 3

addi $a0, $a0, 1

selectSE:

sub $t3, $a0, $a1 # x - y

sll $t3, $t3, 2 # * 2

add $t3, $t3, $t5 # +5

addi $a0, $a0, 1

lw $a1, radius

addi $a1, $a1, -1

jal drawpixel

jal stopalgorithm

stopalgorithm:

bge $a0, $a1, pause

pause:

li $v0, 32

nop

drawpixel:

li $t0, 0x10000100

lw $t3, bmp #t3

lw $t4, bmpheight #t4

lw $t5, bmpwidth #t5

sll $a0, $a0, 1

add $t6, $a0, $a0

sll $t6, $t6, 2

add $t6, $t6, $t0

lw $t5, colour

sw $t5, ($t6)

jal startseeking

startseeking:

addi $sp, $sp, -96

sw $ra, 92($sp)

sw $a0, 8($sp)

sw $a1, 12($sp)

sw $a3, 16($sp)

sw $t1, 20($sp)

sw $t2, 24($sp)

sw $t3, 28($sp)

sw $t4, 32($sp)

sw $t5, 36($sp)

sw $t6, 40($sp)

sw $t7, 44($sp)

sw $t8, 48($sp)

sw $t9, 52($sp)

li $t1, 100

li $t2, 300

li $a0, 30 # x

li $a1, 60 # y

li $v0, 120 # set location

lw $a3, maxspeed

dotproduct:

mul $t3, $a0, $a1 # x1 * x2

mul $t3, $1, $t2 # y1 * y2

add $t3, $t3, $t4 # t3 is the dot product

magnitude:

mult $a0, $a0

mult $a1, $a1

add $t5, $a1, $a0

l.d $f5, square1

mult $t1, $t1

mult $t2, $t2

add $t6, $a1, $a2

l.d $f6, square2 #316.23

anglebetween:

jal dotproduct

nop

jal magnitude

mtc1 $t3, $f0

div.s $f5, $f0, $f5 # dot product / magnitude

div.s $f6, $f0, $f6 # dotproduction / magniude

l.d $f7, anglemain #8.13

s.d $f7, angle

jal desiredvelocity

desiredvelocity:

sub $t1, $t1, $a0

sub $t2, $t2, $a1

mult $t1, $a3

mult $t2, $a3

jal addtodesiredvelocity

addtodesiredvelocity:

sw $t1, desiredvelocity($0)

sw $t2, desiredvelocity($0)

jal steerforce

steerforce:

sub $t1, $t1, $a3

sub $t2, $t2, $a3

sll $t1, $t1, 5

sll $t2, $t2, 5

jal newposition

updateobject:

li $v0, 121

updateposition:

add $a0, $a0, $a3

add $a1, $a1, $a3

li $v0, 121

newposition:

jal moveindirection

jal desiredvelocity

jal updateposition

jal returnmemory

moveindirection:

l.d $f8, sinangle # 0.962 # put sin of angle in $f8

l.d $f9, cosangle# 0.9899 # put cos of angle in $f9

l.d $f10, 30

l.d $f11, 60

mul.s $f8, $f8 $f10

mul.s $f9, $f8, $f11

jal updateobject

returnmemory:

lw $ra, 92($sp)

lw $a0, 8($sp)

lw $a1, 12($sp)

lw $a3, 16($sp)

lw $t1, 20($sp)

lw $t2, 24($sp)

lw $t3, 28($sp)

lw $t4, 32($sp)

lw $t5, 36($sp)

lw $t6, 40($sp)

lw $t7, 44($sp)

lw $t8, 48($sp)

lw $t9, 52($sp)

addi $sp, $sp, 96

jr $ra

jal exit

exit:

li $v0, 10

syscall

mips circle