1
私はオンラインで見ましたが、この構文はPI = 3.1415
でしたが、これは私が使用しているMIPSシミュレータプログラムでは動作しません。これはMARS 4.5です。 MIPS言語仕様の一部であれば動作するはずです。単純なhelloワールドプログラムをアセンブルしようとすると、コンパイラは私のコードに無効な言語要素があると言います。コード自体は次のとおりです。どのようにMIPSアセンブリ言語で定数を定義しますか?
################################################################################
# #
# This is a hello world program in the MIPS assembly language. It prints out #
# "Hello, World!" on the screen and exits. #
# #
################################################################################
# System call code constants
SYS_PRINT_STRING = 4
SYS_EXIT = 10
.data
msg: .asciiz "Hello, World!\n"
.text
.globl __start
__start:
la $a0, msg # Load the address of the string "msg" into the
# $a0 register
li $v0, SYS_PRINT_STRING # Store the system call for printing a string on
# the screen in the $v0 register
syscall
li $v0, SYS_EXIT # Store the system call to exit the program in the
# $v0 register
syscall