我有一个任务,我必须在 MMIX 中输入并返回完全相同的内容,但所有空格都必须是换行符。我已经尝试了大约 2 天,并且已经弄清楚如何获取输入以及如何将其输出到控制台。但是第二部分让我望而却步,明天就要交作业了。这是我到目前为止所拥有的:
LOC Data_Segment % Sets data storage location
GREG @ % Reserves a new global register
Wordbuffer BYTE 0 % New Byte for incoming words
LOC Wordbuffer+5 % After the buffer
Arg OCTA Wordbuffer
OCTA 21 % Sets max word length
LOC #100 % Code section
Main LDA $255,Arg % Loads the buffer into the global register
TRAP 0,Fgets,StdIn % Gets input
LDA $255,Wordbuffer % Puts input in global register
TRAP 0,Fputs,StdOut % Prints inputted word
TRAP 0,Halt,0 % Stops program