📄 compword.c
字号:
/* compword.c
wcompare -> addr1 & addr2 increment
wcompare_1 -> addr1 stays same, addr2
All have same...
Entry:
Exit: <> if OK.
*/
#include <stdtypes.h>
#include <clib1.h>
#include <string.h>
#include <stdio.h>
int wcompare(LONG length, VOID *addr1, VOID *addr2, \
CHAR *err_string, WORD max_err_length)
/* Word compare both addresses increment.
*/
{
register VWORD *sptr = addr1, *dptr = addr2;
register LONG counter = length/2;
CHAR local_str[80];
while( counter )
{
if ( *dptr++ != *sptr++ )
{
sprintf( local_str, "WORD miscompare offset $%8.8lx bytes.\n", length - (counter * 2) );
strmcat( err_string, max_err_length, local_str );
sprintf( local_str, "SB: $%4x, WS: $%4x.\n", *(sptr - 1), *(dptr - 1) );
strmcat( err_string, max_err_length, local_str );
return(0);
}
counter--;
}
return(1);
}
int wcompare_1( LONG length, VOID *addr1, VOID *addr2, \
CHAR *err_string, WORD max_err_length)
/* Word compare, addr1 does not increment.
*/
{
register VWORD *sptr = addr1, *dptr = addr2;
register LONG counter = length/2;
register WORD data;
CHAR local_str[80];
while( counter )
{
data = *sptr;
if ( data != *dptr++ )
{
sprintf( local_str, "WORD miscompare offset $%8.8lx bytes.\n", length - (counter * 2) );
strmcat( err_string, max_err_length, local_str );
sprintf( local_str, "SB: $%4x, WS: $%4x.\n", *(dptr - 1), data );
strmcat( err_string, max_err_length, local_str );
return(0);
}
counter--;
}
return(1);
}
int physical_wcompare(LONG length, UINT32 addr1, UINT32 addr2, \
CHAR *err_string, WORD max_err_length)
/* Word compare both addresses increment.
*/
{
register LONG counter = length/2;
register UINT16 sbdata, wsdata;
CHAR local_str[80];
while( counter )
{
sbdata = xpeek16( addr1 );
addr1 += 2;
wsdata = xpeek16( addr2 );
addr2 += 2;
if ( sbdata != wsdata )
{
sprintf( local_str, "WORD miscompare offset $%8.8lx bytes.\n", length - (counter * 2) );
strmcat( err_string, max_err_length, local_str );
sprintf( local_str, "SB: $%4x, WS: $%4x.\n", sbdata, wsdata );
strmcat( err_string, max_err_length, local_str );
return(0);
}
counter--;
}
return(1);
}
int physical_wcompare_1( LONG length, UINT32 addr1, UINT32 addr2, \
CHAR *err_string, WORD max_err_length)
/* Word compare, addr1 does not increment.
*/
{
register LONG counter = length/2;
register UINT16 sbdata, wsdata;
CHAR local_str[80];
while( counter )
{
sbdata = xpeek16( addr1 );
wsdata = xpeek16( addr2 );
addr2 += 2;
if ( sbdata != wsdata )
{
sprintf( local_str, "WORD miscompare offset $%8.8lx bytes.\n", length - (counter * 2) );
strmcat( err_string, max_err_length, local_str );
sprintf( local_str, "SB: $%4x, WS: $%4x.\n", sbdata, wsdata );
strmcat( err_string, max_err_length, local_str );
return(0);
}
counter--;
}
return(1);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -