:: i650_test.ini
::
:: there are not know diagnostic program for ibm 650.
:: so sanity check of simulator is done by executing some programs
::

cd %~p0
cd ../sw

set console -n log=console.txt
set debug -q -n debug.txt
set cpu debug=cmd;data;detail
set mt debug=cmd;data;detail;exp
set dsk debug=cmd;data;detail;exp

:: Limit maximum diagnostic execution time
runlimit 50M instructions
set on
on error ignore
on runtime echof "\r\n*** Test Runtime Limit %SIM_RUNLIMIT% %SIM_RUNLIMIT_UNITS% Exceeded ***\r\n"; exit 1

:: Basic Opcodes test

echof 
echof 
echof "** IBM 650: Basic Instruction Test: "

do run_fds.ini fds/example.txt

if ar!=9999 echof "FDS failed (bad ar)";exit 1

:: checks mem contents
if 0977!=0000000009 echof "FDS failed (bad 0977)";exit 1
if 0978!=5090000000 echof "FDS failed (bad 0978)";exit 1
if 0979!=5030000000 echof "FDS failed (bad 0979)";exit 1
echof "FDS Ok"
echof "** Test: passed."


echof 
echof 
echof "** IBM 650: Floating Point Instruction Test: "

do run_fortransit.ini  fortransit/fortransit_example_2_src.txt  fortransit/fortransit_example_2_data.txt  

if -f not "deck_out.dck" == "../tests/testmm.dck"  echof "FORTANSIT Mat Mult failed"; exit 1

echof "FORTRANSIT Ok"
echof "** Test: passed."

echof 
echof 
echof "** IBM 650: Index, IAS and RAMAC: "

do run_supersoap_ramac.ini supersoap/ssoap_example_src.txt

if ar!=9898 echof "SuperSoap failed (bad ar)";exit 1
if -f not "deck_out.dck" == "../tests/ssoapexpl.dck"  echof "SuperSoap Example failed"; exit 1

echof "SuperSoap Ok"
echof "** Test: passed."

echof 
echof 
echof "** IBM 650: 4k Drum and Tape: "

do build_soap4_tap_lib.ini
if ar!=0002 echof "Soap4 failed (bad ar)";exit 1
if -f not "deck_out.dck" == "../tests/soap4tap.dck"  echof "Soap4 tap lib failed"; exit 1

echof "Soap4 Ok"
echof "** Test: passed."

echof 
echof 
echof "** clean up temp files generated during tests "

det all
set -q nodebug 
set -q console nolog

del -q debug.txt
del -q print.txt
del -q console.txt
del -q deck_out_run.dck
del -q deck_out_pat.dck
del -q deck_out_5cd.dck
del -q deck_out.dck
del -q deck_in.dck

echof
echof
echof "!! All Tests Passed !!"
echof

exit 0

:end