简体   繁体   English

如何在 RISC-V 中将字符串数组打印到控制台?

[英]How do you print an array of strings to console in RISC-V?

I am really confused about how to print arrays of strings to console in RISC-V.我真的很困惑如何在 RISC-V 中将字符串的 arrays 打印到控制台。 I am having trouble finding helpful examples and documentation.我无法找到有用的示例和文档。 I know that you could use ecall with addi, a0,x0, 4, but I can only find examples of the ecall being used to print integers.我知道您可以将 ecall 与 addi、a0、x0、4 一起使用,但我只能找到 ecall 用于打印整数的示例。

You can't print an array of strings in any environment I know, such as simulators like RARS.你不能在我知道的任何环境中打印字符串数组,比如像 RARS 这样的模拟器。

However, you can write a loop to identify a single string, one after another, and then print that single string, using ecall 4 to print one string.但是,您可以编写一个循环来识别单个字符串,一个接一个,然后打印该单个字符串,使用 ecall 4 打印一个字符串。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM