help assembly language code

Discussion in 'Programmer's Corner' started by lephuduc, Oct 12, 2012.

  1. lephuduc

    Thread Starter New Member

    Oct 11, 2012
    5
    0
    I'm writing this code, can anyone help me to find out the mistakes?

    slt $t3,$s5,$zero # s5 contains “k”
    bne $t3,$zero,Exit
    bne $t3,$zero,Exit
    slt $t3,$s5,$t2 # t2 contains “4”
    beq $t3,$zero,Exit
    add $t1,$s5,$s5
    add $t1,$t1,$t1 # PC address = 4*k

    add $t1,$t1,$t4 # t4 - jump table base address
    lw $t0,0($t1)
    jr $t0 # new instruction: “jump reg.”
    L0: . . . (R-format)|
    L1: . . .
    L2: . . .
    L3: . . .
    Exit:
     
  2. kubeek

    AAC Fanatic!

    Sep 20, 2005
    4,670
    804
    What assembler do you use, and what is the code supposed to do? If you know the mistakes, why ask us to find them?
     
  3. lephuduc

    Thread Starter New Member

    Oct 11, 2012
    5
    0
    cause my teacher said that my code is not clear, he asked me to find mistakes and rewrite the code, but I cannot find the mistakes
     
  4. takao21203

    Distinguished Member

    Apr 28, 2012
    3,577
    463
    the question should be: How can I become a programmer.

    Above excerpt clearly is not a program.

    If you aren't (yet) a programmer, assembler is not the best way to make progress with that.
     
Loading...