
; set console -n log=log.txt 
; set debug -n debug.txt
; set debug stdout
; set cpu debug=cmd;data;detail


; params: %1 source card deck to assemble with soap
;         %2 start address to run program (If empty, program not run)
;         %3 input card deck (if empty, do not attach input card)

set cpu 2k

; Load soap deck into drum (1 word per card format), but does not execute it

att cdr1 -q -l soap/soapII.dck

echo *** 
echo *** Load soap deck into drum
echo *** 

d csw 7019519999
d ar 8000
go

; Now put source cards in reader and start soap assembler

att cdr1 -q %1
set cdr1 wiring=soap

att cdp1 -n -q deck_out.dck
set cdp1 echo, print, wiring=soap
att cdp0 -n -q print.txt

echo *** 
echo *** Assemble source deck
echo *** 

d ar 1000
go

if "%2" == "" goto end

; Load assembled deck into drum
; -l switch allows to load the symbolic info so debug cmd info will show 
; soap source code read from card.

det cdp1
set cdr1 wiring=8WORD
att cdr1 -q -l deck_out.dck

att cdp1 -n -q deck_out_run.dck
set cdp1 echo, print, wiring=8WORD


echo *** 
echo *** Read assembled program deck
echo *** 

d csw 7019519999
d ar 8000
go

; attach input deck
if "%3" == "" goto run

att cdr1 -q %3

; Now execute the loaded deck
:run

echo *** 
echo *** Run assembled program
echo *** 

d ar %2
go

:end

