 int memo(int cur_addr)
 {
  int c1, c2, c3, c4 = 1;
  char buff[32];
  while(1) {
	gotoxy(1, 0);
	if(c4) {
		c3 = check(cur_addr);
		if(c3 == 0) {
			reset();
			return(1);
		}
		c3 = memr(cur_addr);
		c1 = c3 / 0x10;
		c2 = c3 % 0x10;
		if(c1 > 9) c1 += 87; 
		else c1 += 48;
		if(c2 > 9) c2 += 87; 
		else c2 += 48;
		c4 = 0;
	}
	sprintf(buff, "%0x  %c%c", cur_addr, c1, c2);
	write(1, buff, 8);
	c3 = getch();
	if(c3 == 'z') {
		code();
		continue;
	}
	if( (c3 > 47 && c3 < 58) || (c3 > 96 && c3 < 103) ) {
		c1 = c2;
		c2 = c3;
		continue;
	}
	if(c3 == 'p' || c3 == 'n' || c3 == 'x') {
		c4 = (ascci_to_int(c1)) * 0x10 + ascci_to_int(c2);
		memw(cur_addr, c4);
		if(c3 == 'n') cur_addr++;
		if(c3 == 'p') cur_addr--; 
		c4 = 1;
		if(c3 == 'x') return(1);
		continue;
	}
	if(c3 != 'r') reset();
	gotoxy(1, 0);
	write(1, "_ups  85", 8);
	return(1);
  }
 }
