Subversion Repositories pentevo

Rev

Rev 183 | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 183 Rev 288
Line 88... Line 88...
88
 BYTE       buff[0x2000];
88
 BYTE       buff[0x2000];
89
 FILE*      f;
89
 FILE*      f;
90
 
90
 
91
 o=0;
91
 o=0;
92
 printf("ZX EVO project:  Calc CRC for bootloader\n");
92
 printf("ZX EVO project:  Calc CRC for bootloader\n");
93
 if (argc<3) { printf("usage: CRCBLDR <HexFileName> [<VersionFileName>]\n"); return 2; }
93
 if (argc<3) { printf("usage: crcbldr <HexFileName> [<VersionFileName>]\n"); return 2; }
94
 
94
 
95
 for (adr=0;adr<0x2000;adr++) buff[adr]=0xff;
95
 for (adr=0;adr<0x2000;adr++) buff[adr]=0xff;
96
 if (argc==4)
96
 if (argc==4)
97
  {
97
  {
98
   strncpy(s1,argv[3],1);
98
   strncpy(s1,argv[3],1);
Line 173... Line 173...
173
   if (checksum!=0) print_err_r(CHECKSUM);
173
   if (checksum!=0) print_err_r(CHECKSUM);
174
  }
174
  }
175
 }
175
 }
176
 fclose(f);
176
 fclose(f);
177
 
177
 
178
 if (err) { printf("Total %d error(s)!\n",err); return 3; }
178
 if (err) { printf("Total %d error(s)!\n",(int)err); return 3; }
179
 
179
 
180
 for (i=0;i<256;i++)
180
 for (i=0;i<256;i++)
181
 {
181
 {
182
  crc=i<<8;
182
  crc=i<<8;
183
  b=8;
183
  b=8;
Line 208... Line 208...
208
 buff[0x1ffe]=crc>>8;
208
 buff[0x1ffe]=crc>>8;
209
 buff[0x1fff]=crc&0xff;
209
 buff[0x1fff]=crc&0xff;
210
 
210
 
211
// - - - - - - - -
211
// - - - - - - - -
212
 
212
 
213
 f=fopen("ZXEVO_BL.HEX","wt");
213
 f=fopen("zxevo_bl.hex","wt");
214
 if (!f) { printf("Can't create output file!\n"); return 1; }
214
 if (!f) { printf("Can't create output file!\n"); return 1; }
215
 
215
 
216
 fputs(":020000020000FC\n:01000000FF00\n:020000021000EC\n",f);
216
 fputs(":020000020000FC\n:01000000FF00\n:020000021000EC\n",f);
217
 s[0]=':';
217
 s[0]=':';
218
 s[1]='1';
218
 s[1]='1';
Line 249... Line 249...
249
 while (adr<0x2000);
249
 while (adr<0x2000);
250
 
250
 
251
 fputs(":00000001FF\n",f);
251
 fputs(":00000001FF\n",f);
252
 fclose(f);
252
 fclose(f);
253
 
253
 
254
 printf("Created file ZXEVO_BL.HEX\n");
254
 printf("Created file zxevo_bl.hex\n");
255
 
255
 
256
// - - - - - - - -
256
// - - - - - - - -
257
 
257
 
258
 for (i=0;i<256;i++)
258
 for (i=0;i<256;i++)
259
 {
259
 {
Line 302... Line 302...
302
 crc=0;
302
 crc=0;
303
 for (adr=0;adr<0x96;adr++) crc=tabcrc[(crc&0xff)^E2Phead[adr]]^(crc>>8);
303
 for (adr=0;adr<0x96;adr++) crc=tabcrc[(crc&0xff)^E2Phead[adr]]^(crc>>8);
304
 E2Phead[0x96]=crc&0xff;
304
 E2Phead[0x96]=crc&0xff;
305
 E2Phead[0x97]=crc>>8;
305
 E2Phead[0x97]=crc>>8;
306
 
306
 
307
 f=fopen("ZXEVO_BL.E2P","wb");
307
 f=fopen("zxevo_bl.e2p","wb");
308
 if (!f) { printf("Can't create output file!\n"); return 1; }
308
 if (!f) { printf("Can't create output file!\n"); return 1; }
309
 fwrite(E2Phead,1,0x98,f);
309
 fwrite(E2Phead,1,0x98,f);
310
 for (adr=0;adr<256;adr++) s1[adr]=0xff;
310
 for (adr=0;adr<256;adr++) s1[adr]=0xff;
311
 for (adr=0;adr<0x1e0;adr++) fwrite(s1,1,256,f);
311
 for (adr=0;adr<0x1e0;adr++) fwrite(s1,1,256,f);
312
 fwrite(buff,1,0x2000,f);
312
 fwrite(buff,1,0x2000,f);
313
 for (adr=0;adr<0x10;adr++) fwrite(s1,1,256,f);
313
 for (adr=0;adr<0x10;adr++) fwrite(s1,1,256,f);
314
 fclose(f);
314
 fclose(f);
315
 
315
 
316
 printf("Created file ZXEVO_BL.E2P\n");
316
 printf("Created file zxevo_bl.e2p\n");
317
 
317
 
318
 return 0;
318
 return 0;
319
}
319
}