Thank you. In fact, I asked the ROM images to Monte, and he kindly sent me a zip with these images.
Just before, I wrote a small C program (tested on Linux, but may be work on WIndows), to convert the .SRC (in fact .LST) to a ROM image. The result was good because my generated ROM and these received from Monte'zip have the same MD5 checksum.
Code:
#include <stdio.h>
#include <string.h>
#include <fcntl.h>
#include <stdlib.h>
int main( int argc, char **argv )
{
FILE *fdi; int fdo;
char bufs[1000];
char *p;
unsigned int addr, oaddr, opcode, line;
unsigned char rom[4096*2];
unsigned int cksm = 0;
unsigned char page = '0';
memset( rom, 0, sizeof(rom) );
if( (argc != 3) && (argc != 4) ) {
fprintf(stderr,"usage: %s file.SRC file.ROM [page]\n", argv[0] );
exit( 1 );
}
if( argc == 4 )
page = *argv[3];
if( NULL == (fdi = fopen( argv[1], "r" )) ) {
fprintf(stderr,"Unable to open SRC file '%s': %m\n", argv[1] );
exit( 1 );
}
if( 0 > (fdo = open( argv[2], O_WRONLY | O_CREAT | O_TRUNC, 0644 )) ) {
fprintf(stderr,"Unable to open ROM file '%s': %m\n", argv[2] );
fclose( fdi );
exit( 1 );
}
oaddr = addr = 0;
line = 0;
while( fgets( bufs, sizeof(bufs), fdi ) ) {
line ++;
if( NULL == (p = strtok( bufs, "\n\r" )) )
continue;
if( *p == '\0' )
continue;
if( NULL == (p = strtok( bufs, " \t" )) )
continue;
if( (*p == '*' && *(p+1) == page ) )
p++;
if( *p == page ) {
char strop[4];
oaddr = addr;
sscanf( p, "%0X", &addr );
addr &= 0xFFF;
if( oaddr != addr ) {
fprintf( stderr, "Ooops: (%u) Address mismatch: O %04X A %04X\n", line, oaddr, addr );
}
p = strtok( NULL, " \t" );
while( *p ) {
memset( strop, 0, sizeof(strop) );
memcpy( strop, p, 3 );
p += 3;
sscanf( strop, "%X", &opcode );
rom[(addr * 2)] = ((opcode >> 8) & 0xFF);
rom[(addr * 2)+1] = ((opcode) & 0xFF);
fprintf( stderr, "%04X %03X\n", addr, opcode );
addr ++;
}
}
}
fclose( fdi );
for( addr = 0; addr < 4095; addr++ )
{
cksm += ((rom[(addr * 2)] << 8) | (rom[(addr * 2)+1]));
if( 0x3FF < cksm )
cksm = (cksm & 0x3FF) + 1;
}
cksm = (~cksm + 1) & 0x3FF;
printf( "COMPUTED CKSM %03X\n", cksm );
if( rom[0x1FFE] == 0 && rom[0x1FFF] == 0 ) {
rom[0x1FFE] = ((cksm >> 8) & 0xFF);
rom[0x1FFF] = ((cksm) & 0xFF);
}
write( fdo, rom, sizeof(rom) );
close( fdo );
}