# Build PROGRAM BCMX  

if exi(stage1),tg stage1,er
if exi(stage1),er stage1   

if exi(stage2),tg stage2,er
if exi(stage2),er stage2   

dp 0, BUILD PLAN SEGMENTS 
if exi(PLANSEMI), ER PLANSEMI 
CE PLANSEMI(/SEMI)(*DA,BUCK1,KWOR1) 
PLAN4T *CR PLANSEGMENTS 

dp 0,BUILD STAGE1 COMPILER
mk stage1  
bcplgo bcmx program bcmx,cgmx program cgmx,basiclib subgroupsrb1,ownpd,prog bcmx,saveocode stage1.bcmx-ocode,savebin stage1.program bcmx   
bcplgo cgmx program cgmx,basiclib subgroupsrb1,ownpd, prog cgmx,bcmx stage1.program bcmx,savebin stage1.program cgmx   

dp 0,BUILD STAGE 1 LIB
bcplgo ownpd standardpd,prog bcpllib, savesemi stage1.bcpllib(/semi), nocons, bcmx stage1.program bcmx, cgmx stage1.program cgmx   
bcplgo ownpd standardpd,prog lib2,savesemi stage1.lib2(/semi), nocons, bcmx stage1.program bcmx, cgmx stage1.program cgmx  
ADDSUBS stage1.subgroupsrb1,plansemi   
ADDSUBS stage1.subgroupsrb1,stage1.bcpllib(/semi)  
ADDSUBS stage1.subgroupsrb1,stage1.lib2(/semi) 

dp 0,BUILD STAGE2 COMPILER
mk stage2  
bcplgo ownpd,prog bcmx,bcmx stage1.program bcmx,cgmx stage1.program cgmx,basiclib stage1.subgroupsrb1,saveocode stage2.bcmx-ocode,savebin stage2.program bcmx  
bcplgo ownpd,prog cgmx,bcmx stage2.program bcmx,cgmx stage1.program cgmx,basiclib stage1.subgroupsrb1,savebin stage2.program cgmx  

dp 0, BUILD STAGE2 LIB
bcplgo ownpd standardpd,prog bcpllib, savesemi stage2.bcpllib(/semi), nocons, bcmx stage2.program bcmx, cgmx stage2.program cgmx   
bcplgo ownpd standardpd,prog lib2,savesemi stage2.lib2(/semi), nocons, bcmx stage2.program bcmx, cgmx stage2.program cgmx  
ADDSUBS stage2.subgroupsrb1,plansemi   
ADDSUBS stage2.subgroupsrb1,stage2.bcpllib(/semi)  
ADDSUBS stage2.subgroupsrb1,stage2.lib2(/semi) 

lo program comp
as *tr,stage1.bcmx-ocode   
as *tr1,stage2.bcmx-ocode  
as *lp 
ti 5mins   
en 
if hal(BH),(dp 0, COMPARISON OK)ELSE(dp 0, COMPARISON FAILED) 

