char	xstr[];
#line 1 "brk.c"








#line 1 "../INC5/monitor.h"









#line 1 "../INC5/promhdr.h"


















































#line 10 "../INC5/monitor.h"


#line 1 "../INC5/ais.h"






















#line 30 "../INC5/ais.h"



typedef char B8;
typedef short B16;
typedef int B32;
typedef unsigned char UB8;
typedef unsigned short UB16;
typedef unsigned int UB32;





















#line 12 "../INC5/monitor.h"

#line 1 "../INC5/cflags.h"




















					














	













#line 13 "../INC5/monitor.h"

#line 1 "../INC5/memmap.h"







































































#line 14 "../INC5/monitor.h"

#line 1 "../INC5/mondef.h"










#line 1 "../INC5/cflags.h"





#line 49 "../INC5/cflags.h"

#line 11 "../INC5/mondef.h"




typedef struct brkpntent {
	char	flag;
	char	*addr;
	char	ins;
	char	map;	
} BRKPNT; 


typedef struct itab {
	char *inames;	
	char *iproto;	
} INSTFORM;


typedef struct synopent {
    char	key;
    char	*cmd;
    char	*desc;
} SYNOP;


typedef struct symbol {
	struct symbol *next, *prev;
	unsigned int value;
	char	flags;
	char	name[11];
}  SYMBOL;


typedef struct {
	int	pf1;		
	int	pf0;		
	int	sc;		
	int	bpr1;		
	int	bpr0;		
	int	bcnt;		
	int	eia;		
	int	ptb1;		
	int	ptb0;		
}  MMUR;


typedef struct {
	int	f7;		
	int	f6;
	int	f5;
	int	f4;
	int	f3;
	int	f2;
	int	f1;
	int	f0;
	int	fsr;
}  FPUR;



typedef struct {
	FPUR	fpu;		
	MMUR	mmu;		
	int	id;		
	int	sp1;		
	int	fp;		
	int	sb;		
	int	r7;		
	int	r6;
	int	r5;
	int	r4;
	int	r3;
	int	r2;
	int	r1;
	int	r0;
	int	intbase;	
	int	sp0;		
	int	pc;		
	short	mod;		
	short	psr;		
	int	msr;		
}  INTSTACK;



#line 15 "../INC5/monitor.h"

#line 1 "../INC5/monflags.h"










#line 1 "../INC5/promhdr.h"






#line 50 "../INC5/promhdr.h"

#line 11 "../INC5/monflags.h"

#line 1 "../INC5/3200config.h"

























#line 28 "../INC5/3200config.h"



typedef union
	{
	unsigned char	c;
	unsigned int xxxx;
	} byt;



#line 1 "../INC5/32032.h"






























































































































#line 39 "../INC5/3200config.h"

#line 1 "../INC5/3200icu.h"



















































































typedef struct
	{
	byt hvct;
	byt svct;
	byt eltg0;
	byt eltg1;
	byt tpl0;
	byt tpl1;
	byt ipnd0;
	byt ipnd1;
	byt isrv0;
	byt isrv1;
	byt imsk0;
	byt imsk1;
	byt csrc0;
	byt csrc1;
	byt fprt0;
	byt fprt1;
	byt mctl;
	byt ocasn;
	byt ciptr;
	byt pdat;
	byt ips;
	byt pdir;
	byt cctl;
	byt cictl;
	byt lcsv0;
	byt lcsv1;
	byt hcsv0;
	byt hcsv1;
	byt lccv0;
	byt lccv1;
	byt hccv0;
	byt hccv1;
	} int_controller;



#line 40 "../INC5/3200config.h"


#line 1 "../INC5/3200addr.2a.h"































					


						




						





						


						


						


						


						



						




































#line 42 "../INC5/3200config.h"

#line 1 "../INC5/3200uart.2a.h"


































































	





































































































































typedef struct
	{
	byt	mode;
	byt	stat;
	byt	cmd;
	byt	odata;
	}  uart_controller;



typedef struct
	{
	uart_controller	uart0;
	byt		auxctl;
	byt		imr;
	byt		hctr;
	byt		lctr;
	uart_controller	uart1;
	byt		outcfg;
	byt		setout;
	byt		clrout;
	}  duart_controller;










#line 43 "../INC5/3200config.h"

#line 1 "../INC5/3200vctr.2a.h"





































#line 44 "../INC5/3200config.h"

#line 1 "../INC5/3200info.2a.h"

























































#line 45 "../INC5/3200config.h"










#line 12 "../INC5/monflags.h"

#line 1 "../INC5/mondef.h"






#line 95 "../INC5/mondef.h"

#line 13 "../INC5/monflags.h"

#line 1 "../INC5/cflags.h"





#line 49 "../INC5/cflags.h"

#line 14 "../INC5/monflags.h"



extern unsigned end, etext, edata;



























typedef struct {

			

 char	 ZRAM_defmod[16];	


 char	 ZRAM_intmod[16];	


 int*	 ZRAM_mondispatch[16+16];	


 int*	 ZRAM_viosdispatch[16+16];	


 int*	 ZRAM_oskdispatch[16+16];	


 int*	 ZRAM_osidispatch[16+16];	


 int*	 ZRAM_osudispatch[16+16];	


			

 char	 ZRAM_membitmap[((0x1000000/0x2000)/8)];	


 char	 ZRAM_debug_user_state;	


 int*	 ZRAM_reset_addr;		


	}  ZERO_RAM;		








typedef struct {

			

 int	 RAM_memsize;		


 int*	 RAM_cataddr;		


 int	 RAM_lasthrown;		


 int	 RAM_emergency[8+5];	


			

 INTSTACK*	 RAM_env;		


 BRKPNT	 RAM_brktab[16];	


 char	 RAM_autobuf[133];	


 SYMBOL	 RAM_symtab[75];	



 int	 RAM_tmpclrbr;		


 int	 RAM_tempbrk;		


 char*	 RAM_autoptr;		


 SYMBOL*	 RAM_symstart;	


			

 int	 RAM_cflags;	       	


 int	 RAM_stepcnt;		


 int	 RAM_procnt;		


 char*	 RAM_svbrka;		


 short*	 RAM_savpsr;		


 int	 RAM_instr_len;		


 unsigned	 RAM_curaddr;	


 char	 RAM_curbase;		


 unsigned char	 RAM_cursize;	

						
						
						

 char	 RAM_initflag;		


			

 int	 RAM_acontext;		


 char*	 RAM_ibuf;


 unsigned	 RAM_lastmod;	


 int	 RAM_firsthex;


 int	 RAM_opcxpd;


 int	 RAM_context;


 int	 RAM_instr;


 int	 RAM_istart;


 int	 RAM_ilen;


 int	 RAM_mapping;


 char	 RAM_inbuf[8];


			

 char	 RAM_lastinp[133];


 char	 RAM_lastcmd;


			


 char	 RAM_d__monstack[0x400];		
 int	 RAM_debug_monstack;	


 int	 RAM_recursive;		



 char	 RAM__monstack[0x400];		
 int	 RAM_monstack;		


 char	 RAM__viosstack[0x800];		
 int	 RAM_viosstack;		


	} MONITOR_RAM;		


#line 16 "../INC5/monitor.h"






#line 27 "../INC5/monitor.h"











#line 9 "brk.c"

#line 1 "../INC5/3200config.h"












#line 54 "../INC5/3200config.h"

#line 10 "brk.c"

#line 1 "../INC5/vctype.h"















extern	char	_vctype_[];
















#line 11 "brk.c"


brkpnt(argc,argv)
    int argc;
    char *argv[];



























{
    register int b;
    register char *addr, *opt;
    register int optx, brkadr;
    int brkcnt, rval;

    
    if ( (argc>1) && (*argv[0] != '-')) {
	if (conv(argv[0],&rval)) addr = (char *)(0x00ffffff & rval);
	else return;
    }

    switch(argc) {
    case 1:
	for(b=0; b<16; b++) {
	    if(((MONITOR_RAM*)(256 * 1024))->RAM_brktab[b].flag) {
		printf((&xstr[0]),b);
		if (((MONITOR_RAM*)(256 * 1024))->RAM_cflags & 256) psym(((MONITOR_RAM*)(256 * 1024))->RAM_brktab[b].addr);
		else printf((&xstr[6]),((MONITOR_RAM*)(256 * 1024))->RAM_brktab[b].addr);
		mdisasm(((MONITOR_RAM*)(256 * 1024))->RAM_brktab[b].addr, &rval, 1, ((MONITOR_RAM*)(256 * 1024))->RAM_brktab[b].map);
		{putchar('\n');};
	    }
	}
	if (((MONITOR_RAM*)(256 * 1024))->RAM_cflags & 2048) {
	    printf((&xstr[14]),((MONITOR_RAM*)(256 * 1024))->RAM_env->mmu.bpr0);
	    pbrkflgs(((MONITOR_RAM*)(256 * 1024))->RAM_env->mmu.bpr0);
	    printf((&xstr[25]),((MONITOR_RAM*)(256 * 1024))->RAM_env->mmu.bcnt);
	    printf((&xstr[38]),((MONITOR_RAM*)(256 * 1024))->RAM_env->mmu.bpr1);
	    pbrkflgs(((MONITOR_RAM*)(256 * 1024))->RAM_env->mmu.bpr1);
	    {putchar('\n');};
	}
	break;
    case 2:
	if (*argv[0] == '-') {
	    addr = argv[0];
	    clrbrk(0,*++addr);		
	} else msetbrk(addr, ((((MONITOR_RAM*)(256 * 1024))->RAM_cflags & 4096) ? 1 : getmap()));		
	break;
    case 3:
	if(*argv[1] == '-') {		
	    clrbrk(addr,'s');		
	    break;
	}
    case 4:
	brkadr = (int)addr;
	optx = 1;
	rval = 3;
	if(argc == 4) {
	    if ( !conv(argv[1],&brkcnt) ) return;
	    brkadr |= 0x04000000;
	    optx = 2;
	} else brkcnt = 0;
	opt = argv[optx];
	while (((_vctype_+1)[*opt]&(01|02)) || *opt == '1' || *opt == '0') {
	    switch(*opt++) {
	    case 'r':	brkadr |= 0x10000000; break;
	    case 'w':	brkadr |= 0x08000000; break;
	    case 'x':	brkadr |= 0x20000000; break;
	    case 'p':	brkadr |= 0x40000000; break;
	    case 'a':	brkadr |= 0x80000000; break;
	    case '0':	rval = 0; break;
	    case '1':
		rval = 1;
		if (brkcnt) printf((&xstr[49]));
		break;
	    default:
		break;
	    }
	}

#line 115 "brk.c"


	if (rval == 1) {
		((MONITOR_RAM*)(256 * 1024))->RAM_cflags |= 2048;
		prgb1(brkadr);		
		((MONITOR_RAM*)(256 * 1024))->RAM_env->mmu.bpr1 = brkadr;
	}
	else if(rval == 0) {
		((MONITOR_RAM*)(256 * 1024))->RAM_cflags |= 2048;
		prgb0(brkadr,brkcnt);
		((MONITOR_RAM*)(256 * 1024))->RAM_env->mmu.bpr0 = brkadr;
		((MONITOR_RAM*)(256 * 1024))->RAM_env->mmu.bcnt = brkcnt;
	}
	else printf((&xstr[59]));
    }
}



clrbrk(addr,number)
    char number;
    register char *addr;














{
    register int b;

    if (((_vctype_+1)[number]&(04|0100))) {		
	b = ctox(number);
	((MONITOR_RAM*)(256 * 1024))->RAM_brktab[b].ins = 0;
	((MONITOR_RAM*)(256 * 1024))->RAM_brktab[b].flag = 0;
    } else if (number == '*') {		
	((MONITOR_RAM*)(256 * 1024))->RAM_cflags &= ~2048;
	((MONITOR_RAM*)(256 * 1024))->RAM_env->mmu.bpr0 = ((MONITOR_RAM*)(256 * 1024))->RAM_env->mmu.bpr1 = 0;
    	for (b=0; b<16; b++) {
	    ((MONITOR_RAM*)(256 * 1024))->RAM_brktab[b].ins = 0;
	    ((MONITOR_RAM*)(256 * 1024))->RAM_brktab[b].flag = 0;
	}
    } else for (b=0; b<16; b++) {	
	if( ((MONITOR_RAM*)(256 * 1024))->RAM_brktab[b].addr == addr) {
	    ((MONITOR_RAM*)(256 * 1024))->RAM_brktab[b].ins = 0;
	    ((MONITOR_RAM*)(256 * 1024))->RAM_brktab[b].flag = 0;
	    break;
	}
    }
}



msetbrk(baddr, maptype)
    register char *baddr;
    register int maptype;











{
    register int b;
    char fflag;

    fflag = 0;	

    
    for(b=0;b<16;b++) {
	if ( (((MONITOR_RAM*)(256 * 1024))->RAM_brktab[b].addr == baddr) && (((MONITOR_RAM*)(256 * 1024))->RAM_brktab[b].map == maptype) ) {
	    if (((MONITOR_RAM*)(256 * 1024))->RAM_brktab[b].flag) {
		printf((&xstr[69]));
		return;
	    } else {
		fflag++;	
		break;
	    }
	}
    }
	
    
    if (!fflag)
	for(b=0,fflag=0;b<16;b++)
	    if( ((MONITOR_RAM*)(256 * 1024))->RAM_brktab[b].flag == 0) { fflag++; break; };

    
    if (fflag) {
	((MONITOR_RAM*)(256 * 1024))->RAM_brktab[b].ins = mrdbyte(baddr, maptype);

	mwrtmbyte(baddr, maptype, 0xf2);	
	if(mrdbyte(baddr, maptype) != 0xf2) {
	    printf((&xstr[78]));
	    return;
	}
	mwrtmbyte(baddr, maptype, ((MONITOR_RAM*)(256 * 1024))->RAM_brktab[b].ins);	

	((MONITOR_RAM*)(256 * 1024))->RAM_brktab[b].addr = baddr;
	((MONITOR_RAM*)(256 * 1024))->RAM_brktab[b].map = maptype;
	((MONITOR_RAM*)(256 * 1024))->RAM_brktab[b].flag++;
    } else printf((&xstr[91]));
}

	
misbrkset(baddr, maptype)
    register char *baddr;
    register int maptype;








{
    register int b;

    for(b=0; b<16; b++)
	if ( (((MONITOR_RAM*)(256 * 1024))->RAM_brktab[b].addr == baddr) && (((MONITOR_RAM*)(256 * 1024))->RAM_brktab[b].map == maptype) &&
							(((MONITOR_RAM*)(256 * 1024))->RAM_brktab[b].flag) ) {
	    return(1);
	}
    return(0);
}


brkexec()







{
    register int b;

    for(b=0; b<16; b++)
	if(((MONITOR_RAM*)(256 * 1024))->RAM_brktab[b].flag) 
	    mwrtmbyte (((MONITOR_RAM*)(256 * 1024))->RAM_brktab[b].addr, ((MONITOR_RAM*)(256 * 1024))->RAM_brktab[b].map, 0xf2);
}




brkinit()







{
    register int b;

    for(b=0; b<16; b++)
	if(((MONITOR_RAM*)(256 * 1024))->RAM_brktab[b].flag) 
	    mwrtmbyte (((MONITOR_RAM*)(256 * 1024))->RAM_brktab[b].addr, ((MONITOR_RAM*)(256 * 1024))->RAM_brktab[b].map, ((MONITOR_RAM*)(256 * 1024))->RAM_brktab[b].ins);
}




    static 
pbrkflgs(bpr)
    register int bpr;







{
    {putchar('(');};
    if(bpr & 0x80000000) printf((&xstr[97]));
    if(bpr & 0x40000000) printf((&xstr[101]));
    if(bpr & 0x20000000) printf((&xstr[105]));
    if(bpr & 0x10000000) printf((&xstr[109]));
    if(bpr & 0x08000000) printf((&xstr[113]));
    if(bpr & 0x04000000) printf((&xstr[117]));
    printf((&xstr[121]));
}

