首页 > 解决方案 > MIPS - 打印没有伪指令的字符串

问题描述

我想在 MIPS 中打印一些字符串,但必须在没有任何伪指令的情况下完成。我很难找到字符串的开头在哪里。这是代码:

   .globl main


    .data

terminal_prompt:
    .asciiz "Enter Integers: " #17 chars

prompt0:
    .asciiz "Smallest int: "
prompt1:
    .asciiz "\nLargest int: "
prompt2:
    .asciiz "\nQuotient: "
prompt3:
    .asciiz "\nRemainder: "

    .text
main:
    addi $v0, $zero, 4
    lui $a0, 0x1000
    ori $a0, $zero, 17
    syscall

    addi $v0, $zero, 10
    syscall

我认为第二个字符串 prompt0 从偏移量 17 开始,但似乎并非如此。这是内存段:

[10000000]    65746e45  6e492072  65676574  203a7372    E n t e r   I n t e g e r s :   
[10000010]    616d5300  73656c6c  6e692074  00203a74    . S m a l l e s t   i n t :   . 
[10000020]    72614c0a  74736567  746e6920  0a00203a    . L a r g e s t   i n t :   . . 
[10000030]    746f7551  746e6569  0a00203a  616d6552    Q u o t i e n t :   . . R e m a 
[10000040]    65646e69  00203a72  00000000  00000000    i n d e r :   . . . . . . . . . 
[10000050]..[1003ffff]  00000000

标签: stringassemblymips

解决方案


推荐阅读