所以我试图学习汇编程序,并且我使用z390作为模拟器(不是我的选择),而且我遇到了很大的困难。我希望得到一些帮助,因为我有很多错误。
所以我接受了大学的尝试并得到了这个:
FIRST CSECT
BALR 12,0
USING BASE,12
* FIRST VOLUME BEING CALCULATED ------------------------
L R2,L1 STORE L1 IN REG 2.
L R3,W1 STORE W1 IN REG 3.
L R4,H1 STORE H1 IN REG 4.
MR R1,3 MUTIPLY CONTENTS OF REG 2. BY REG 3. STORE CONTENTS IN REG 2.
M R1,H1 MUTIPLY CONTENTS OF REG 2. BY H1.
ST R2,VOL1 STORE RESULT OF VOLUME IN VOL1.
* SECOND VOLUME BEING CALCULATED ------------------------
L R2,L1 STORE L1 IN REG 2.(UNCHANGED FROM BEFORE)
M R1,DBL DOUBLES REG 2. VALUE
ST R2,L2 STORE DOUBLED LENGTH IN L2
M R2,DBL DOUBLES REG 3. VALUE
ST R3,W2 STORE DOUBLED WIDTH IN W2
M R3,DBL DOUBLES REG 4. VALUE
ST R4,H2 STORE DOUBLED HEIGHT IN H2
MR R1,3 MUTIPLY CONTENTS OF REG 2. BY REG 3. STORE CONTENTS IN REG 2.
M R1,H2 MUTIPLY CONTENTS OF REG 2. BY H1.
ST R2,VOL2 STORE RESULT OF VOLUME(DOUBLED) IN VOL2.
* DIFF. BETWEEN BOTH ------------------------
L R2,VOL1 LOAD VOL1 INTO REG. 2.
S R2,VOL2 SUBTRACT R2 FROM VOL2.
ST R2,DIF STORE THE RESULT.
* LABLES ------------------------
L1 DC F'2' LENGTH - 2
W1 DC F'2' WIDTH - 2
H1 DC F'2' HEIGHT - 2
DBL DC F'2' CONSTANT TO DOUBLE ALL VALUES.
VOL1 DS F STORES VOLUME 1. - NON DOUBLED.
VOL2 DS F STORES VOLUME 2. - DOUBLED.
L2 DS F DOUBLED LENGTH
W2 DS F DOUBLED WIDTH
H2 DS F DOUBLED HEIGHT
DIF DS F DIFF. BETWEEN VOL1 AND VOL2
*
*
所以我认为这是因为我理解了这里的一切概念,但是Z390给了我这个输出:
Enter command or help
Microsoft Windows [Version 6.1.7601]
Copyright (c) 2009 Microsoft Corporation. All rights reserved.
*** 02/06/17 18:26:24 CMD task started
C:\Program Files (x86)\Automated Software Tools\z390>CD \Program Files (x86)\Automated Software Tools\z390\
C:\Program Files (x86)\Automated Software Tools\z390>ASMLG "C:\Users\Owner\Desktop\New folder\SHELL" TRACE CON
C:\Program Files (x86)\Automated Software Tools\z390>rem asmlg assemble, link, and go from mlc to 390 execution
C:\Program Files (x86)\Automated Software Tools\z390>echo off
18:26:24 SHELL MZ390 START USING z390 V1.5.06 ON J2SE 1.8.0_73 02/06/17
AZ390E error 98 (1/3)3 USING BASE,12
AZ390E error 198 (1/5)5 L R2,L1 STORE L1 IN REG 2.
AZ390E error 198 (1/6)6 L R3,W1 STORE W1 IN REG 3.
AZ390E error 198 (1/7)7 L R4,H1 STORE H1 IN REG 4.
AZ390E error 198 (1/8)8 MR R1,3 MUTIPLY CONTENTS OF REG 2. BY REG 3. STORE
AZ390E error 198 (1/9)9 M R1,H1 MUTIPLY CONTENTS OF REG 2. BY H1.
AZ390E error 198 (1/10)10 ST R2,VOL1 STORE RESULT OF VOLUME IN VOL1.
AZ390E error 198 (1/12)12 L R2,L1 STORE L1 IN REG 2.(UNCHANGED FROM BEFORE)
AZ390E error 198 (1/13)13 M R1,DBL DOUBLES REG 2. VALUE
AZ390E error 198 (1/14)14 ST R2,L2 STORE DOUBLED LENGTH IN L2
AZ390E error 198 (1/15)15 M R2,DBL DOUBLES REG 3. VALUE
AZ390E error 198 (1/16)16 ST R3,W2 STORE DOUBLED WIDTH IN W2
AZ390E error 198 (1/17)17 M R3,DBL DOUBLES REG 4. VALUE
AZ390E error 198 (1/18)18 ST R4,H2 STORE DOUBLED HEIGHT IN H2
AZ390E error 198 (1/19)19 MR R1,3 MUTIPLY CONTENTS OF REG 2. BY REG 3. STORE
AZ390E error 198 (1/20)20 M R1,H2 MUTIPLY CONTENTS OF REG 2. BY H1.
AZ390E error 198 (1/21)21 ST R2,VOL2 STORE RESULT OF VOLUME(DOUBLED) IN VOL2.
AZ390E error 198 (1/23)23 L R2,VOL1 LOAD VOL1 INTO REG. 2.
AZ390E error 198 (1/24)24 S R2,VOL2 SUBTRACT R2 FROM VOL2.
AZ390E error 198 (1/25)25 ST R2,DIF STORE THE RESULT.
18:26:25 SHELL MZ390 ENDED RC=12 SEC= 0 MEM(MB)= 38 IO=232
Press any key to continue . . .
C:\Program Files (x86)\Automated Software Tools\z390>exit
*** 02/06/17 18:26:25 CMD task ended TOT SEC=1 TOT LOG IO=30
所以,我一直想弄清楚我一小时做错了什么,所以我转向你们/ gals。那么****我做错了什么?
更新了代码,仍然在第9,20行遇到错误?
FIRST CSECT
BALR 12,0
USING BASE,12
BASE L 3,L1 R3 = LENGTH OF BOX.
L 5,W1 R5 = WIDTH OF BOX.
L 7,H1 R7 = HEIGHT OF BOX.
MR 2,5 HEIGHT OF BOX X WIDTH OF BOX.
M 2,H1 RESULT OF MUTIPLY X HEIGHT OF BOX.
ST 3,VOL1 R2 = ALL HEIGHT X WIDTH X HEIGHT.
L 3,L1 R3 = LENGTH OF BOX.
M 2,DBL MUTIPLY LENGTH OF BOX BY 2.
ST 3,L2 R3 = LENGTH OF BOX X 2.
M 4,DBL MUTIPLY WIDTH OF BOX BY 2.
ST 5,W2 R5 = WIDTH OF BOX BY 2.
M 6,DBL MUTIPLY HEIGHT OF BOX BY 2
ST 7,H2 R7 = HEIGHT OF BOX X 2
MR 2,5 MUTIPLY LENGTH OF BOX (DOUBLED) BY WIDTH OF BOX(DOUBLED)
M 2,H2 MUTIPLY RESULT BY HEIGHT OF BOX (DOUBLED)
ST 3,VOL2 R3 = LENGTH X WIDTH X HEIGHT
L 3,VOL2 R3 = VOLUME OF FIRST BOX.
S 3,VOL1 FIRST VOLUME - SECOND VOLUME(DOUBLED)
ST 3,DIF R3 = DIFF. BETWEEN VOLUMES.
L1 DC F'2' LENGTH = 2
W1 DC F'2' WIDTH = 2
H1 DC F'2' HEIGHT = 2
DBL DC F'2' CONSTANT VALUE = 2
VOL1 DS F STORAGE FOR FIRST VOLUME (NON-DOUBLED)
VOL2 DS F STORAGE FOR SECOND VOLUME (DOUBLED)
L2 DS F LENGTH(DOUBLED)
W2 DS F WIDTH(DOUBLED)
H2 DS F HEIGHT(DOUBLED)
DIF DS F STORAGE FOR DIFFERNCE IN VOLUMES.
*
*
END FIRST
(根据用户的建议更新了更好的评论。)
新错误???
16:08:37 SHELL EZ390 START USING z390 V1.5.06 ON J2SE 1.8.0_73 02/08/17
EZ390I Copyright 2011 Automated Software Tools Corporation
EZ390I z390 is licensed under GNU General Public License
EZ390I program = C:\Users\Owner\Desktop\New folder\SHELL.390
EZ390I options =
EZ390I Trace Table Entry 800FFFB0 5050C066 ST
EZ390I Trace Table Entry 800FFFB4 5C60C056 M
EZ390I Trace Table Entry 800FFFB8 5070C06A ST
EZ390I Trace Table Entry 800FFFBC 1C25 MR
EZ390I Trace Table Entry 800FFFBE 5C20C06A M
EZ390I Trace Table Entry 800FFFC2 5030C05E ST
EZ390I Trace Table Entry 800FFFC6 5830C05E L
EZ390I Trace Table Entry 800FFFCA 5B30C05A S
EZ390I Trace Table Entry 800FFFCE 5030C06E ST
EZ390E error 11 ABEND PSW=07052600 800FFFD2 F6F600000002 ????? ABEND S0C1
R0-R3 F4F4F4F4800FFF88 F4F4F4F400002300 F4F4F4F400000000 F4F4F4F400000038
R4-R7 F4F4F4F400000000 F4F4F4F400000004 F4F4F4F400000000 F4F4F4F400000004
R8-RB F4F4F4F4F4F4F4F4 F4F4F4F4F4F4F4F4 F4F4F4F4F4F4F4F4 F4F4F4F4F4F4F4F4
RC-RF F4F4F4F4800FFF8A F4F4F4F400002100 F4F4F4F400002018 F4F4F4F4800FFF88
EZ390E error 12 program aborting due to abend S0C1
EZ390I instructions/sec = 333
EZ390I total errors = 1
16:08:37 SHELL EZ390 ENDED RC=16 SEC= 0 MEM(MB)= 18 IO=37 INS=21
答案 0 :(得分:1)
我可以看到您忘记为程序设置出口。它按顺序执行指令,ST 3,DIF 是最后一条有效指令。之后你有一些 DC,这基本上是数据。当 CPU 执行上述存储时,它将按顺序获取“下一条指令”并找到常量,给出“OC1”异常终止,或者更好地解释为“无效操作异常”。在 ST 3,DIF 之后,您应该通过发出 RETURN 宏指令将控制权交还给操作系统。
答案 1 :(得分:0)
我目前没有安装z390,因此我无法告诉您如何打印更有意义的错误消息,但查看您的代码我可以立即看到:
BASE
未定义(您建立可寻址性的方式必须遵循BALR 12,0
)
R1
,R2
等未定义(您需要一系列R1 EQU 1
,R2 EQU 2
等语句。)
您可能需要花费更多时间来学习汇编程序中名称的含义。