Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/assembly/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Arrays 删除MIPS中的换行符_Arrays_Assembly_Newline_Mips - Fatal编程技术网

Arrays 删除MIPS中的换行符

Arrays 删除MIPS中的换行符,arrays,assembly,newline,mips,Arrays,Assembly,Newline,Mips,我正在用MIPS编写一个程序,其中我将篮球运动员的名字存储在一个数组中。我已经查看了Stackoverflow上的现有代码,以了解如何删除从控制台读入的每个名称的换行符;然而,代码似乎不适合我。有人能帮我找出问题所在吗?这是代码中相关的部分: .align 2 .text .globl main #PART ONE: READ INPUT, CREATE ARRAY OF STRUCTS #$t0 stores number of players #$t1 is loop counte

我正在用MIPS编写一个程序,其中我将篮球运动员的名字存储在一个数组中。我已经查看了Stackoverflow上的现有代码,以了解如何删除从控制台读入的每个名称的换行符;然而,代码似乎不适合我。有人能帮我找出问题所在吗?这是代码中相关的部分:

.align 2 

.text
.globl main 

#PART ONE: READ INPUT, CREATE ARRAY OF STRUCTS 
#$t0 stores number of players
#$t1 is loop counter 
#$s0 stores memory allocation of entry
#$s1 also stores memory allocation, but will be used as array counter 

main: 
la      $a0, num                    
li      $v0, 4                      
syscall                             

li      $v0, 5                      
syscall                             
move    $a0, $v0                    

move    $t0, $a0                     
move    $t1, $a0                    
mul     $a0, $a0, 20        

li      $v0, 9                      
syscall                             
move    $s0, $v0                    
move    $s1, $v0                    

input:
beqz    $t1, set_counter            
la      $a0, name                   
li      $v0, 4                      
syscall                             

la      $a0, ($s1)                  
li      $a1, 16                     

li      $v0, 8                      
syscall                             

li      $t3, 0                      

strip: 
lb      $a2, ($a0)                  
addi    $t3, $t3, 1                 
addi    $a0, $a0, 1                 
bnez    $a2, strip                  
beq     $a1, $t3, continue_prompt   
sub     $a0, $a0, 2                 
sb      $0, ($a0)   

continue_prompt: 
la      $a0, points                 
li      $v0, 4                      
syscall                             

#read points per game 
li      $v0, 6                      
syscall                             
mov.s   $f2, $f0                     

la      $a0, minutes                
li      $v0, 4                      
syscall                             

#read minutes in game 
li      $v0, 6                  
syscall                             
mov.s   $f4, $f0                     

#compute points/minute 
div.s   $f0, $f2, $f4                
s.s     $f0, 16($s1)                
addi    $s1, $s1, 20                
addi    $t1, -1                     
b       input                       

.data 
num:        .asciiz    "Enter number of basketball players: "
name:       .asciiz    "Last name of player: "
points:     .asciiz     "Points per game: "
minutes:    .asciiz     "Minutes per game: "
space:      .ascii       " "
newline:    .asciiz      "\n"

“不起作用”是相当模糊的。你期望得到什么结果?你得到了什么结果?试着看一看<代码>设置计数器标签缺失。