在 z390 大型机代码中使用语句
关于我正在使用的内容:我正在使用 z390 便携式大型机汇编器和模拟器。
尝试组装时出现“未找到基址寄存器”错误。
我尝试输入 USING *,12
但无论我把它放在哪里它都不会执行任何操作。 “找不到基址寄存器”
我尝试应用 BASR 12,0;
遇到错误。我得到:
17:53:44 PROG4 EZ390 EZ390E error 11 ABEND PSW=07050600 800FFCEC F6F6F6F64040 ????? ABEND S0C1
17:53:44 PROG4 EZ390 EZ390E error 12 program aborting due to abend S0C1
汇编手册位于 http://publibz.boulder.ibm.com /epubs/pdf/asmr1020.pdf,但我在应用它时遇到问题。
我查看的来源:http://en.wikipedia.org/wiki/IBM_Basic_assemble_language#Assembler_instructions
如何让汇编器找到基址寄存器?
更新:基址寄存器仍然存在问题。
其他资源:
www.tradingwiz.net63.net/pdf/Sessions5and6.pdf
www.z390.org/z390_Documentation.htm
TITLE 'CS 4321 Program #4 by J. Colt Wright'
PRINT NOGEN
COPY SUBENTRY
USING *,12
TITLE 'PROGRAM 4 80/80 LISTING'
PRINT NOGEN
COPY2 SUBENTRY
WTO 'PROG4 COPY PROG4 (ASCII) TO COPY (ASCII)'
OPEN (INFILE,INPUT)
OPEN (OUTFILE,OUTPUT)
WTO 'Files opened successfully'
*
LOOP EQU *
GET INFILE,IRECORD
MVC ORECORD,=CL80' '
MVC ORECORD(72),IRECORD
PUT OUTFILE,ORECORD
B LOOP
*
EOF EQU *
CLOSE (INFILE,,OUTFILE)
WTO 'PROG4 ENDED OK'
SUBEXIT
SUBEXIT
INFILE DCB DDNAME=INFILE, X
DSORG=PS, X
RECFM=FT, X
LRECL=72, X
EODAD=EOF, X
MACRF=GM
*
OUTFILE DCB DDNAME=OUTFILE, X
DSORG=PS, X
RECFM=FT, X
LRECL=80, X
MACRF=PM
*
IRECORD DC CL72' '
ORECORD DC CL80' '
ENDPGM DS D
END COPY
我要么收到异常终止,要么收到“未找到基本寄存器”错误,具体取决于我是否提供 COPY2 SUBENTRY.
我正在尝试让代码运行。
除此之外,我还有代码可以工作。
About what I'm using: I'm using z390 Portable Mainframe Assembler and Emulator.
I'm getting a "no base register found" error when attempting to assemble.
I tried putting in USING *,12
but wherever I put it it doesn't do anything. "no base register found"
I tried to apply BASR 12,0;
got an error. I got:
17:53:44 PROG4 EZ390 EZ390E error 11 ABEND PSW=07050600 800FFCEC F6F6F6F64040 ????? ABEND S0C1
17:53:44 PROG4 EZ390 EZ390E error 12 program aborting due to abend S0C1
An assembly manual is at http://publibz.boulder.ibm.com/epubs/pdf/asmr1020.pdf, but I'm having trouble applying it.
A source I looked at: http://en.wikipedia.org/wiki/IBM_Basic_assembly_language#Assembler_instructions
How do I have the assembler find the base register?
Update: Still having trouble with the base register.
Additional resources:
www.tradingwiz.net63.net/pdf/Sessions5and6.pdf
www.z390.org/z390_Documentation.htm
TITLE 'CS 4321 Program #4 by J. Colt Wright'
PRINT NOGEN
COPY SUBENTRY
USING *,12
TITLE 'PROGRAM 4 80/80 LISTING'
PRINT NOGEN
COPY2 SUBENTRY
WTO 'PROG4 COPY PROG4 (ASCII) TO COPY (ASCII)'
OPEN (INFILE,INPUT)
OPEN (OUTFILE,OUTPUT)
WTO 'Files opened successfully'
*
LOOP EQU *
GET INFILE,IRECORD
MVC ORECORD,=CL80' '
MVC ORECORD(72),IRECORD
PUT OUTFILE,ORECORD
B LOOP
*
EOF EQU *
CLOSE (INFILE,,OUTFILE)
WTO 'PROG4 ENDED OK'
SUBEXIT
SUBEXIT
INFILE DCB DDNAME=INFILE, X
DSORG=PS, X
RECFM=FT, X
LRECL=72, X
EODAD=EOF, X
MACRF=GM
*
OUTFILE DCB DDNAME=OUTFILE, X
DSORG=PS, X
RECFM=FT, X
LRECL=80, X
MACRF=PM
*
IRECORD DC CL72' '
ORECORD DC CL80' '
ENDPGM DS D
END COPY
I either get an abend or a "no base register found" error, depending on whether or not I provide COPY2 SUBENTRY.
I'm trying to get the code to run.
I have the code working besides for this.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
首先,您不需要 COPY SUBENTRY,因为它仅在第一遍处理期间将宏定义的副本放入源中。有时您可能需要它(特别是用于宏调试),但这不是其中之一。 (SUBENTRY/EXIT 作为 z390 的辅助宏进行分发。)
我采用了您的程序并删除了 PRINT NOGEN 语句。一般来说,我不喜欢使用 PRINT NOGEN,因为它抑制了很多信息,例如 SUBENTRY 生成的指令。在砍伐树木打印输出的时代,您会更多地看到这种情况,但现在当列表发送到磁盘时,这不是什么大问题。
一般来说,当你有像 SUBENTRY 这样的入口宏时,它会设置一个基址寄存器。删除 PRINT NOGEN 表明它实际上将寄存器 13(或 R13——汇编器中的常见缩写)保存区域放在程序区域的开头,并且它使用 R13 作为基址寄存器并初始化它。所发生的情况是,您遇到了汇编程序的记录规则,但没有多少人记得它。规则是:如果一个地址被多个 USING 语句覆盖,汇编器将使用编号较低的寄存器。开头的 USING *,12 覆盖了整个程序,这是可以的,但它与 SUBENTRY 生成的“USING COPY2+8,13”重叠。
因此,您的数据区域被两个寄存器覆盖,而汇编器选择了较低的值 (12)。而且因为您从未将值加载到 R12 中,所以它指向谁知道什么。因此,当您尝试访问该寄存器的数据时 - 繁荣。
简单的解决方案是从程序中删除 USING *,12,汇编器从 R13 生成基址位移地址。我这样做了,但它死了,因为我没有输入文件,但我预料到了。
First, you should not need the COPY SUBENTRY, as that only places a copy of the macro definition into the source during first-pass processing. There are times where you might need it (specifically for macro debugging), but this is not one of those times. (SUBENTRY/EXIT are distributed as assist macros with z390.)
I took your program and removed the PRINT NOGEN statements. In general, I don't like using PRINT NOGEN, because there is lots of information that it suppresses, such as the instructions generated by SUBENTRY. Back in the days of tree-killing printouts, you saw this more, but now when listings are sent to disk, it's not a big deal.
Generally, when you have entry macros like SUBENTRY, it sets up a base register. Deleting the PRINT NOGEN shows that it's actually putting the register 13 (or R13--a common abbreviation in assembler) save area at the beginning of the program area, and it's using R13 as your base register and initializing it. What has happened is that you've run into a documented rule of the assembler, but not many people remember it. The rule is: if an address is covered by multiple USING statements, the assembler will use the lower-numbered register. Your USING *,12 at the beginning is covering the entire program, which is OK, but it overlaps the "USING COPY2+8,13" that SUBENTRY generates.
So what happens is that your data areas are covered by two registers, and the assembler chose the lower value (12). And because you never loaded a value into R12, it's pointing at who knows what. So when you try to access data off that register - boom.
The simple solution is to remove the USING *,12 from your program, and the assembler generates base-displacement address from R13. I did this and it died because I don't have the input files, but I expected that.
我没有使用过 z390 (并且对 390 程序集总体了解很少),但是:
SUBENTRY
和SUBEXIT
必须是扩展为CSECT
声明和用于进入/退出的适当寄存器调整的宏,所以我猜测嵌套副本2
是一个非常糟糕的主意。COPY SUBENTRY ... SUBEXIT
中的 SUBENTRY ... SUBEXITI haven't used z390 (and know only a little about 390 assembly in general), but:
SUBENTRY
andSUBEXIT
must be macros which expand to aCSECT
declaration and appropriate register fiddling for entry/exit, and so I would guess that nesting theCOPY2 SUBENTRY ... SUBEXIT
inside theCOPY SUBENTRY ... SUBEXIT
is a really bad idea.该网站没有明确说明如何评论原始问题,因此我将在这里添加一个条目。
需要更多信息。汇编器需要哪个基址寄存器? PRINT NOGEN 表示“不显示宏生成的指令”,如果没有看到它们,我们就无法知道发生了什么。 PRINT GEN 通常是默认值,并且通常很有用。
至于你的S0C1:PSW后面显示的
F6F6F6F64040
的值是理解问题的关键。您添加的BASR 12,0
指令似乎导致使用了无效的代码库地址。在异常结束时,寄存器 12 使用F6F6...
值寻址大量数据,其中第一个字节 (F6) 是无效操作码。无效操作码会产生 S0C1 异常终止。当基址寄存器被分配了不正确的地址时就会发生这种情况。The site doesn't make it apparent how to comment on the original question, so I'll make an entry here.
More information is needed. Which base register is the assembler expecting? PRINT NOGEN says "don't show the instructions generated by macros", and without seeing them, we can't tell what's going on. PRINT GEN is generally the default, and is generally useful.
As for your S0C1: The value of
F6F6F6F64040
showing after the PSW is the key to understanding the problem. It appears that your addedBASR 12,0
instruction caused the use of an invalid address for the code base. At the time of the abend, register 12 addressed a hunk of data with theF6F6...
value, the first byte of which (F6) is an invalid opcode. Invalid opcodes produce S0C1 abends. This kind of thing will happen when base registers are assigned improper addresses.