合并排序MIPS未知用户输入量

时间:2017-10-04 01:57:13

标签: assembly mips mergesort

我正在尝试为它的h * ck开发我的汇编编码技能,并且我试图通过创建Merge Sort来挑战自己,因为我的朋友说我无法做到,但是程序中不知道数组中的数字量。

我存储了用户输入,直到输入" -1"进入命令行(或者如果数组已满,但我可以看到它是一个大数组。)

我查看了Merge Sort的其他版本,包括找到here的其他版本,但他/她假设一个特定大小的数组充满了整数,这不是我和我#39;我试图这样做。

这是我到目前为止所做的:

    .data
array:  .space 4096
string: .asciiz "Enter #s - -1 stops input: \n"

.text
.globl main

main:
   la $s0, array
   la $s1, ($s0)
   la $a0, string
   li $v0, 4
   syscall

   move $t0, $zero

readInput:
   beq $t0, 4096, setSize
   li $v0, 5
   syscall
   beq $v0, -1, setSize
   sw $v0, 0($s0)
   addi $s0, $s0, 4
   addi $t0, $t0, 4
   j readInput

setSize:
   add $s2, $s1, $t0
   j printUnsortedArray

printUnsortedArray:
    # here is where I want to print it unsorted, first

mergeSort:
   # I have a pretty good idea of how to do the algorithm, but I do
   # not know how to start it off with what I have/what I still need
   # to implement

任何帮助都会受到极大的赞赏,所以我可以安心地转向不同的装配理念。

PS - 你不再是我的朋友了。你知道你是谁,恶魔。

0 个答案:

没有答案
相关问题