EFF7_GIGASCREEN    EFF7_NOTURBO
comp.atm_pal   comp.comp_pal
temp.atm_pal_changed  temp.comp_pal_changed
conf.atm.xt_kbd   conf.xt_kbd
RF_ATMPAL -> RF_COMPPAL

=============================================================
emul.cpp

   SetErrorMode(SEM_FAILCRITICALERRORS | SEM_NOOPENFILEERRORBOX);

   init_all(argc-1, argv+1);
++   //applyconfig();
   sound_play();

=============================================================
init.cpp (init_all()):

   init_z80tables();
++   load_spec_colors();	//   
   video_permanent_tables();
   init_ie_help();
   load_config(config);
++   comp.pEFF7=EFF7_NOTURBO;	//      EFF7
   //make_samples();
   #ifdef MOD_GS
   init_gs();

-------------------------------------------------------------

   *(DWORD*)trd_loaded = 0; // clear loaded flags, don't see autoload'ed images

++   bool lbpx = false;
   for (; argc; argc--, argv++) {
      if (**argv == '-' || **argv == '/') {
         if (argc > 1 && !stricmp(argv[0]+1, "i")) argc--, argv++;
++         if (argv[0][1] == 'b') lbpx = true;  // bpl by Kurles
         continue;
      }

-------------------------------------------------------------

   if (load_errors) {
      int code = MessageBox(wnd, "Some files, specified in\r\ncommand line, failed to load\r\n\r\nContinue emulation?", "File loading error", MB_YESNO | MB_ICONWARNING);
      if (code != IDYES) exit();
   }

++   if (lbpx) loadbpx("user.bpt"); //Kurles
   
   SetCurrentDirectory(conf.workdir);
   timeBeginPeriod(1);


=============================================================
snapshot.cpp

int load_arc(char *fname);

++// breakpoint list. idea by kurles
++int loadbpx (char *fname){ 
++   char tmp[0x200];
++   addpath(tmp,fname);	//   ,  .      
++   FILE *ff = fopen(temp.path,"r");
++   if (!ff) {
++     color(CONSCLR_ERROR);
++     printf("file %s not found\n",fname);
++     color();
++     return 0;
++   }
++   char line[64];
++   int l_num = 0;
++   while (!feof(ff)){
++      l_num++;
++	  if (!fgets(line, sizeof line, ff)) {fclose(ff);return 0;}
++      int val = 0;
++      for (int l=0;l<4;l++){
++         if (!ishex(line[l])) { //error in line
++			color(CONSCLR_ERROR);
++            printf("error in line %d %s\n", l_num , line);
++            color();
++			fclose(ff);
++            return 1;
++         }
++         val=(val<<4)+hex(line[l]);
++      }
++      if (line[4] != '-'){
++		//printf("breakpoint set at #%x\n",val); 
++		membits[val] |= MEMBITS_BPX;
++        continue;
++      }
++   }
++   fclose(ff);
++   return 0;
++}

unsigned char what_is(char *filename)
{

-------------------------------------------------------------
int readSNA128(), int readSNA48(), int readSP(), int readZ80()
{
++   //conf.mem_model = MM_PENTAGON; conf.ramsize = 128;


=============================================================
z80.cpp:

void reset(ROM_MODE mode)
{
   comp.pEFF7 &= conf.EFF7_mask;
++   if(!(conf.EFF7_mask&EFF7_NOTURBO)) comp.pEFF7 |= EFF7_NOTURBO;	//   
   {


-------------------------------------------------------------
   ay[0].reset();
   ay[1].reset();
   if (conf.sound.ay_scheme == AY_SCHEME_CHRV){
++        out(0xfffd,0xfe); //0.36.7
        //printf("tfmstatuson0=%d\n",tfmstatuson0);
   };//Alone Coder

   #ifdef MOD_GS
   if (conf.sound.gsreset) reset_gs();
   #endif

-------------------------------------------------------------
   if (conf.mem_model == MM_ATM710) reset_atm();
   hdd.reset();
   input.atm51.reset();
++   input.profxt.clear();


=============================================================
z80_main.cpp (step()):

   if (bankr[(cpu.pc >> 14) & 3] < RAM_BASE_M+PAGE*MAX_RAM_PAGES) goto close_dos;
      if (conf.trdos_traps) comp.wd.trdos_traps();
   }
++   if (conf.tape_traps)  tape_traps();	// tape traps'
   if (comp.tape.play_pointer && !conf.sound.enabled) fast_tape();

=============================================================
tape.cpp

void tape_traps() {
  if ((cpu.pc & 0xFFFF) == 0x056B){
	if(comp.tape.play_pointer){
    unsigned pulse;
	  do{
      if(comp.tape.play_pointer>=comp.tape.end_of_tape||
         (pulse=tape_pulse[*comp.tape.play_pointer++])==-1){stop_tape();return; }      
	  }while(pulse>770);
    comp.tape.play_pointer++;

    // loading header
    cpu.l=0;
    for(unsigned bit=0x80;bit;bit>>=1){
      if(comp.tape.play_pointer>=comp.tape.end_of_tape||
        (pulse=tape_pulse[*comp.tape.play_pointer++])==-1){
        stop_tape();
        cpu.pc=0x05E2;
        return;
      }
      cpu.l|=(pulse>1240)?bit:0;
      comp.tape.play_pointer++;
    }

    // loading data
    do{
      cpu.l=0;
      for(unsigned bit=0x80;bit;bit>>=1){
        if(comp.tape.play_pointer>=comp.tape.end_of_tape||
           (pulse=tape_pulse[*comp.tape.play_pointer++])==-1){
          stop_tape();
          cpu.pc=0x05E2;
          return;
        }
        cpu.l|=(pulse>1240)?bit:0;
        comp.tape.play_pointer++;
      }
      z80dbg::wm(cpu.ix++, cpu.l);
      cpu.de--;
    }while(cpu.de&0xFFFF);

    // loading CRC
    cpu.l=0;
    for(unsigned bit=0x80;bit;bit>>=1){
      if(comp.tape.play_pointer>=comp.tape.end_of_tape||
        (pulse=tape_pulse[*comp.tape.play_pointer++])==-1){
        stop_tape();
        cpu.pc=0x05E2;
        return;
      }
      cpu.l|=(pulse>1240)?bit:0;
      comp.tape.play_pointer++;
    }

    cpu.pc=0x05DF;
    cpu.f|=CF;
    cpu.bc = 0xB001;
    cpu.h = 0;
	}
  }
}

=============================================================
config.cpp

   GetPrivateProfileString(input, "Fire", "0", line, sizeof line, ininame);
   conf.input.firenum = 0; conf.input.fire = 0;
   zxkeymap *active_zxk = conf.input.active_zxk;
   for (i = 0; i < active_zxk->zxk_size; i++)
+++      if (!strnicmp(line, active_zxk->zxk[i].name,strlen(active_zxk->zxk[i].name)))
      {  conf.input.firenum = i; break; }

   char buff[0x7000];


=============================================================
 :
=============================================================

io.cpp (out()):

      if (conf.mem_model == MM_ATM710) {
         if ((p1 & 0x9F) == 0x17) { set_atm_FF77(port, val); return; }
         if ((p1 & 0x9F) == 0x97) { comp.pFFF7[((comp.p7FFD & 0x10) >> 2) + ((port >> 14) & 3)] = val ^ 0xFF; set_banks(); return; }
         if ((p1 & 0x9F) == 0x9F && !(comp.aFF77 & 0x4000)) atm_writepal(val); // don't return - write to TR-DOS system port
      }
      
++      if (conf.mem_model == MM_PROFI){
++        if(comp.p7FFD&0x10 && comp.pDFFD&0x20){	// modified ports
++		  // BDI ports
++          if((p1&0x9F)==0x83){ comp.wd.out((p1&0x60)|0x1F,val); return;}  // WG93 ports
++          if((p1&0xE3)==0x23){ comp.wd.out(0xFF,val); return;}          // port FF
++          // RTC
++          if((port&0x9F)==0x9F && conf.cmos){
++            if(port&0x20){ comp.cmos_addr=val; return; }
++            else{ cmos_write(val); return; }
++          }
++          // IDE
++          if ((p1&0x9F)==0x8B && (conf.ide_scheme == IDE_PROFI)) {
++			if(p1&0x40){    // cs1
++			  if (!(p1&0x20)){ comp.ide_write=val; return; }
++			  port>>=8;
++			  goto write_hdd;              
++			}else{  // cs3
++			  if(p1&0x20){
++				if(((port>>8)&7)==6) hdd.write(8, val);
++				return;
++			  }
++			}
++		  }
++        }else{
++		  // BDI ports
++          if((p1&0x83)==0x03){ comp.wd.out((p1&0x60)|0x1F,val); return;}  // WG93 ports
++		  if((p1&0xE3)==((comp.pDFFD&0x20)?0xA3:0xE3)){ comp.wd.out(0xFF,val); return;}          // port FF
++        }        
++      }

      if ((p1 & 0x1F) == 0x1F) { comp.wd.out(p1, val); return; }
      // don't return - out to port #FE works in trdos!


-----------------------------------------------------------------

      if (conf.mem_model == MM_ATM450) set_atm_aFE((unsigned char)port);
      
++      if (conf.mem_model == MM_PROFI){
++        if(!(port & 0x80) && (comp.pDFFD&0x80)){
++          comp.comp_pal[(~comp.pFE)&0xF]=(~(port>>8));
++          temp.comp_pal_changed=1;
++        }
++      }

      comp.pFE = val;

-------------------------------------------------------------------

   #ifdef MOD_GS
   if ((port & 0xF7) == 0xB3 && conf.gs_type) { out_gs(port, val); return; }
   #endif
   
++   if (conf.mem_model == MM_PROFI){
++	 if(comp.pDFFD&0x20){
++	   if(comp.p7FFD&0x10 && (port&0x9F)==0x87){   // profi stereo covox
++         flush_dig_snd();
++         if((port&0x60)==0x40) covProfiL = (val*conf.sound.covoxProfi)>>8;
++         if((port&0x60)==0x20) covProfiR = (val*conf.sound.covoxProfi)>>8;
++         return;
++       }
++	 }else if(!(comp.flags & CF_DOSPORTS)){
++	   if((port&0x83)==0x03){
++         flush_dig_snd();
++         if((port&0x60)==0x40) covProfiL = (val*conf.sound.covoxProfi)>>8;
++         if((port&0x60)==0x20) covProfiR = (val*conf.sound.covoxProfi)>>8;
++         return;
++       }
++	 }
++   }

   if ((port & 0xAF) == 0x0F) { // soundrive

--------------------------------------------------------------------
in1()

      unsigned char p1 = (unsigned char)port;
++	  if (conf.mem_model == MM_PROFI){
++        if(comp.p7FFD&0x10 && comp.pDFFD&0x20){	// modified ports
++		  // BDI ports
++          if((p1&0x9F)==0x83){ return comp.wd.in((p1&0x60)|0x1F);}  // WG93 ports
++          if((p1&0xE3)==0x23){ return comp.wd.in(0xFF);}          // port FF
++          // RTC
++          if((port&0x9F)==0x9F && conf.cmos){
++            if(!(port&0x20)){ return cmos_read(); }
++          }
++          // IDE
++          if((p1&0x9F)==0x8B && (conf.ide_scheme == IDE_PROFI)) {
++            if(p1&0x40){    // cs1
++              if (p1&0x20) return comp.ide_read;
++              port>>=8;
++              goto read_hdd;      
++            }
++          }
++        }else{
++		  // BDI ports
++          if((p1&0x83)==0x03){ return comp.wd.in((p1&0x60)|0x1F);}  // WG93 ports
++		  if((p1&0xE3)==((comp.pDFFD&0x20)?0xA3:0xE3)){ return comp.wd.in(0xFF);}          // port FF
++        }        
++      }
      
      if ((p1 & 0x1F) == 0x1F) return comp.wd.in(p1);

======================================================================
emul.h

   unsigned char soundfilter; //Alone Coder (IDC_SOUNDFILTER)
   struct {
      unsigned fq, ayfq;
      int beeper, micout, micin, ay, aydig,
++          covoxFB, covoxDD, sd, gs, bass, covoxProfi;
      VOID_FUNC do_sound;

----------------------------------------------------------------------
enum IDE_SCHEME { IDE_NONE = 0, IDE_ATM, IDE_NEMO, IDE_NEMO_A8, IDE_SMUC, IDE_PROFI };

======================================================================
sound.cpp

#include "sndrender/sndchip.cpp"
#include "sndrender/sndcounter.cpp"

++int spkr_dig, mic_dig, covFB_vol, covDD_vol, sd_l, sd_r, covProfiL, covProfiR;

----------------------------------------------------------------------

inline void flush_dig_snd()
{
   if (temp.sndblock) return;
   unsigned mono = (spkr_dig+mic_dig+covFB_vol+covDD_vol);
++   sound.update(cpu.t - temp.cpu_t_at_frame_start, mono + sd_l + covProfiL, mono + sd_r + covProfiR);

======================================================================
-  (  draw.cpp)

void load_spec_colors(){
// spectrum colors -> palette indexes (RF_PALB - gg0rr0bb format)
   static unsigned char comp_pal[16] =
      { 0x00, 0x02, 0x10, 0x12, 0x80, 0x82, 0x90, 0x92,
        0x00, 0x03, 0x18, 0x1B, 0xC0, 0xC3, 0xD8, 0xDB };
   memcpy(comp.comp_pal, comp_pal, sizeof comp.comp_pal);
}

======================================================================
atm.cpp

void reset_atm(){
   load_spec_colors();
}


======================================================================
dxr_prof.cpp

      dffd = comp.pDFFD; needclr = 2;
   }
   
++   if (temp.comp_pal_changed) {
++      pixel_tables();
++      temp.comp_pal_changed = 0;
++   }

   unsigned char *dst2 = dst + (temp.ox-512)*temp.obpp/16;

======================================================================
draw.cpp

void apply_video()
{
   set_ula_preset(conf.ula_preset);
   temp.rflags = renders[conf.render].flags;
++   if (conf.use_comp_pal && (conf.mem_model == MM_ATM710 || conf.mem_model == MM_ATM450 || conf.mem_model == MM_PROFI )) {
      temp.rflags |= RF_COMPPAL | RF_PALB;
      // disable palette noflic, only if it is really used
      if (temp.obpp == 8 && (temp.rflags & (RF_DRIVER | RF_USEFONT | RF_8BPCH)) == RF_DRIVER) conf.noflic = 0;


======================================================================
input.h

   void reset();
   void clear();
};

++struct PROFI_KBD{
++   unsigned char ext_data;
++   unsigned char zxkeys[8];
++
++   unsigned char read(unsigned char scan, unsigned char zxdata);
++   void setkey(unsigned scancode, unsigned char pressed);
++   void clear();
++};

struct K_INPUT


======================================================================
input.cpp

void PROFI_KBD::clear(){
   memset(zxkeys,0xFF,8);
   ext_data=0xFF;
}

unsigned char PROFI_KBD::read(unsigned char scan, unsigned char zxdata){
  unsigned char res=ext_data;
  for (unsigned i=0;i<8;i++)
    if (!(scan&(1<<i))) res&=zxkeys[i];
  return res;
}

void PROFI_KBD::setkey(unsigned scancode, unsigned char pressed){
  static const unsigned short PRFXT[]={
      0x9301, 0x8301, 0x8302, 0x8304, 0x8308, 0x8310, 0x8410, 0x8408, // 00
      0x8404, 0x8402, 0x8401, 0xA608, 0xA602, 0x9401, 0x9504, 0x8201, // 08
      0x8202, 0x8204, 0x8208, 0x8210, 0x8510, 0x8508, 0x8504, 0x8502, // 10
      0x8501, 0xA510, 0xA508, 0x8601, 0x8001, 0x8101, 0x8102, 0x8104, // 18
      0x8108, 0x8110, 0x8610, 0x8608, 0x8604, 0x8602, 0xA502, 0xA408, // 20
      0x0000, 0x8702, 0xA104, 0x8002, 0x8004, 0x8008, 0x8010, 0x8710, // 28
      0x8708, 0x8704, 0xA708, 0xA704, 0xA010, 0x8702, 0x0000, 0xA601, // 30
      0x8701, 0x9702, 0xC101, 0xC710, 0xC008, 0xC104, 0xC204, 0xC108, // 38
      0xC110, 0xC610, 0xC504, 0xC608, 0x0000, 0x0000, 0xC604, 0x9408, // 40
      0xC704, 0x0000, 0x9310, 0x0000, 0x9404, 0x0000, 0xC602, 0x9410, // 48
      0xC708, 0xC502, 0xC501, 0x0000, 0x0000, 0x0000, 0xA201, 0xA202, // 50
      0x0000, 0x0000, 0x0000
   };
   unsigned char kright=(scancode&0x100)>>8;
   scancode=(scancode&0xFF)-1;
   unsigned short x=PRFXT[scancode];
   if(x&0x8000){  // zxkey action
     if(x&0x1000) if (pressed) zxkeys[0]&=~0x01; else zxkeys[0]|=0x01;
     if(x&0x2000) if (pressed) zxkeys[7]&=~0x02; else zxkeys[7]|=0x02;
     if(x&0x4000) if (pressed) ext_data&=~0x20; else ext_data|=0x20;
     
     if(kright && scancode==0x37) x=0xA701; // rigth alt     
     if (pressed) zxkeys[(x>>8)&7] &= ~(x&0xFF);
	 else zxkeys[(x>>8)&7] |= (x&0xFF);
   }
}

-------------------------------------------------------------------
K_INPUT::read()


   kbdled &= scan;
++   if (conf.xt_kbd){
++     if(conf.mem_model==MM_PROFI) return input.profxt.read(scan, res);
++     else return input.atm51.read(scan, res);
++   }

====================================================================
util.cpp

      if (msg.message == WM_KEYDOWN || msg.message == WM_SYSKEYDOWN) {
++         if (conf.xt_kbd){
++           if(conf.mem_model==MM_PROFI) input.profxt.setkey(msg.lParam >> 16, 1);
++           else input.atm51.setkey(msg.lParam >> 16, 1);
++         }

-------------------------------------------------------------------
      else if (msg.message == WM_KEYUP || msg.message == WM_SYSKEYUP) {
++         if(conf.xt_kbd){
++           if(conf.mem_model==MM_PROFI) input.profxt.setkey(msg.lParam >> 16, 0);
++           else input.atm51.setkey(msg.lParam >> 16, 0);
++         }

-=================================================================-
     gui  , tape_traps  ...      .
 .

   ,     ...