Skip to content

Commit

Permalink
is525 Register 14 not set for EODAD or SYNAD (z390development#528)
Browse files Browse the repository at this point in the history
* is525 Register 14 not set for EODAD or SYNAD

* modify TESTDCB2.MLC to only have one GET

* add belt and suspenders test for R14 contents
  • Loading branch information
jyganci authored Jun 5, 2024
1 parent 770b56b commit 956ab87
Show file tree
Hide file tree
Showing 8 changed files with 141 additions and 1 deletion.
24 changes: 24 additions & 0 deletions bash/runasmdemos
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,29 @@ export SYSOUT=demo/TESTDCB1.TF3

bash/asmlg demo/TESTDCB1 $1 $2 $3 $4 $5 $6 $7 $8 $9
cat demo/TESTDCB1.TF2

diff -q demo/TESTDCB1.TF1 demo/TESTDCB1.TF2 &>/dev/null
rc1=$?
if [ $rc1 -eq 0 ]; then x=""; else x=" not"; fi
echo "TESTDCB1: Copy demo/TESTDCB1.TF1 to demo/TESTDCB1.TF2$x successful"
echo "Verify demo/TESTDCB1 copied demo/TESTDCB1.TF1 to demo/TESTDCB1.TF2"
echo "Verify demo/TESTDCB1 wrote to demo/TESTDCB1.TF3"

export SYSUT1=demo/TESTDCB2.TF1
export SYSUT2=demo/TESTDCB2.TF2
export SYSOUT=demo/TESTDCB2.TF3

bash/asmlg demo/TESTDCB2 $1 $2 $3 $4 $5 $6 $7 $8 $9
cat demo/TESTDCB2.TF2
diff -q demo/TESTDCB2.TF1 demo/TESTDCB2.TF2 &>/dev/null
rc2=$?
if [ $rc2 -eq 0 ]; then x=""; else x=" not"; fi
echo "TESTDCB2: Copy demo/TESTDCB2.TF1 to demo/TESTDCB2.TF2$x successful"
echo "Verify demo/TESTDCB2 copied demo/TESTDCB2.TF1 to demo/TESTDCB2.TF2"
echo "Verify demo/TESTDCB2 wrote to demo/TESTDCB2.TF3"

# return code is not zero if either diff return code is not zero
rc=0
if [ $rc1 -ne 0 ] || [ $rc2 -ne 0 ]; then rc=1; fi

exit $rc
18 changes: 17 additions & 1 deletion bat/RUNASMDEMOS.BAT
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,22 @@ call bat\ASMLG %z_TraceMode% demo\TESTDCB1 %1 %2 %3 %4 %5 %6 %7 %8 %9 || goto er
:: type demo\TESTDCB1.TF2
:: echo "Verify demo\TESTDCB1 copied demo\TESTDCB1.TF1 to demo\TESTDCB1.TF2"
:: echo "Verify demo\TESTDCB1 wrote to demo\TESTDCB1.TF3"

set sysut1=demo\TESTDCB2.TF1
set sysut2=demo\TESTDCB2.TF2
set sysout=demo\TESTDCB2.TF3
call bat\ASMLG %z_TraceMode% demo\TESTDCB2 %1 %2 %3 %4 %5 %6 %7 %8 %9 || goto error
::comp /M demo\TESTDCB2.TF1 demo\TESTDCB2.TF2
::set z_ReturnCode=%ERRORLEVEL%
::if %z_ReturnCode% GTR 0 (set z_ReturnCode=8
:: echo %0 ERROR: TESTDCB2 data were not copied correctly
:: goto return
::
:: )
:: next 4 lines added to temporarily match bash version
:: type demo\TESTDCB2.TF2
:: echo "Verify demo\TESTDCB2 copied demo\TESTDCB2.TF1 to demo\TESTDCB1.TF2"
:: echo "Verify demo\TESTDCB2 wrote to demo\TESTDCB2.TF3"
set z_ReturnCode=0
goto return

Expand All @@ -38,4 +54,4 @@ echo %0 ERROR: Encountered RC %z_ReturnCode% - exiting
:return
popd
rem ----- Lvl(%z_NestLevel%) End %0 %1 %2 %3 %4 %5 %6 %7 %8 %9
exit /b %z_ReturnCode%
exit /b %z_ReturnCode%
67 changes: 67 additions & 0 deletions demo/TESTDCB2.MLC
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
*********************************************************************
* z390 - Mainframe assembler emulator and run-time engine
* Copyright (C) 2024 z390 Assembler LLC
*
* This file is part of z390.
*
* z390 is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
* z390 is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, see https://www.gnu.org/licenses.

* Author - Don Higgins and John Ganci *
* Date - 06/04/2024 *
*********************************************************************
* Same as demo/TESTDCB1 but illustrates EODAD that returns to GET
*********************************************************************
*
TESTDCB2 SUBENTRY
WTO 'TESTDCB2 Copy SYSUT1 ASC test file to SYSUT2 ASC text'
OPEN MF=(E,OFILES) Open all files
MVI EOFFLAG,C'N' Set not EOF on input file
LOOP DS 0H
GET SYSUT1,RECORD Get next/first record
AFTERGET DS 0H
CLI EOFFLAG,C'Y' No more records?
BE ELOOP Yes: all done
AP PTOT,=P'1' Count records
MVC DTOT,=X'40202020' Convert record count
ED DTOT,PTOT ... to printable decimal
PUT SYSOUT,MSG Put rec# || record
PUT SYSUT2,RECORD Put record
B LOOP
ELOOP DS 0H
CLOSE MF=(E,CFILES)
WTO 'TESTDCB2 Ended OK'
SUBEXIT
***********************************************************************
* EODAD routine
***********************************************************************
EOF DS 0H
MVI EOFFLAG,C'Y' Set end of file reached on input
C 14,@AFTERGET Belt and suspenders test
BER 14 Return to GET
DC H'0' Should not get here!
*
@AFTERGET DC A(AFTERGET) For belt and suspenders R14 test
OFILES OPEN MF=L,(SYSUT1,INPUT,SYSUT2,OUTPUT,SYSOUT,OUTPUT)
CFILES CLOSE MF=L,(SYSUT1,,SYSUT2,,SYSOUT)
SYSUT1 DCB DDNAME=SYSUT1,RECFM=FT,LRECL=80,EODAD=EOF,MACRF=GM
SYSUT2 DCB DDNAME=SYSUT2,RECFM=FT,LRECL=80,MACRF=PM
SYSOUT DCB DDNAME=SYSOUT,RECFM=FT,BLKSIZE=120,MACRF=PM
EOFFLAG DS CL1 Set to C'Y' when EOF on input file
PTOT DC PL2'0'
MSG DS 0CL120
DC C'REC#='
DTOT DC CL4' ',C' TEXT='
RECORD DC CL80' '
DC (MSG+120-*)C' '
DCBD
END
3 changes: 3 additions & 0 deletions demo/TESTDCB2.TF1
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
record 1 of 3
record 2 of 3 longer
record 3 of 3 longest
3 changes: 3 additions & 0 deletions demo/TESTDCB2.TF2
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
record 1 of 3
record 2 of 3 longer
record 3 of 3 longest
3 changes: 3 additions & 0 deletions demo/TESTDCB2.TF3
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
REC#= 1 TEXT=record 1 of 3
REC#= 2 TEXT=record 2 of 3 longer
REC#= 3 TEXT=record 3 of 3 longest
6 changes: 6 additions & 0 deletions src/sz390.java
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,10 @@ public class sz390 implements Runnable {
* 2023-08-07 Issue #515. Display FPC contents in interactive debug mode
* and when displaying floating-point registers in SNAP or DUMP.
^ 2024-02-26 Issue #463 Add missing subscript to cmd_read_line reference
* 2024-06-04 Issue #525. DCB or DCBE EODAD routine setup in dcb_eodad_exit()
* does not set R14 as a return address for GET or CHECK (READ/CHECK).
* Similarly, DCB or DCBE SYNAD routine setup in dcb_synad_exit() does
* not set R14 as a return address for GET or CHECK (READ/CHECK).
********************************************************
* Global variables (last RPI)
*****************************************************/
Expand Down Expand Up @@ -4177,6 +4181,7 @@ private void dcb_synad_error(int error_num,String error_msg){
log_error(error_num,error_msg);
pz390.set_psw_check(pz390.psw_pic_io); //RPI64
} else {
pz390.reg.putInt((14<<3)+4,pz390.psw_loc); // #525
pz390.set_psw_loc(cur_dcb_synad);
}
dcb_synad_recur = false; // RPI 377
Expand All @@ -4195,6 +4200,7 @@ private void dcb_eodad_exit(){
if (cur_dcb_eodad == 0){
abort_error(31,"read at end of file and no EODAD for " + tiot_ddnam[cur_tiot_index]);
} else {
pz390.reg.putInt((14<<3)+4,pz390.psw_loc); // #525
pz390.set_psw_loc(cur_dcb_eodad);
}
}
Expand Down
18 changes: 18 additions & 0 deletions z390test/src/test/groovy/org/z390/test/RunAsmDemos.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -36,5 +36,23 @@ class RunAsmDemos extends z390Test {
assert fileData.get('TF1') == fileData.get('TF2')
assert rc == 0
}
@Test
void test_TESTDCB2() {
// Set input files
env.put('SYSUT1', basePath('demo', 'TESTDCB2.TF1'))
env.put('SYSUT2', basePath('demo', 'TESTDCB2.TF2'))
env.put('SYSOUT', basePath('demo', 'TESTDCB2.TF3'))
// run the job
int rc = this.asmlg(basePath("demo", "TESTDCB2"), *options)
// Load files to fileData
loadFile(basePath('demo', 'TESTDCB2.TF1'), 'TF1')
loadFile(basePath('demo', 'TESTDCB2.TF2'), 'TF2')
loadFile(basePath('demo', 'TESTDCB2.TF3'), 'SYSOUT')
// print the fileData
this.printOutput()
// Check files equal
assert fileData.get('TF1') == fileData.get('TF2')
assert rc == 0
}

}

0 comments on commit 956ab87

Please sign in to comment.