Example #1
0
static bool ItemPut( address *addr, const item_mach *item, item_type typ )
{
    unsigned    size = Sizes[typ & IT_TYPE_MASK];

    if( typ & IT_DEC )
        addr->mach.offset -= size;
    if( typ & IT_IO ) {
        if( PortPoke( addr->mach.offset, item, size ) != size ) {
            if( typ & IT_ERR ) {
                Error( ERR_NONE, LIT_ENG( ERR_NO_WRITE_PORT ), *addr );
            }
            return( false );
        }
    } else {
        if( ChangeMem( *addr, item, size ) != size ) {
            if( typ & IT_ERR ) {
                Error( ERR_NONE, LIT_ENG( ERR_NO_WRITE_MEM ), *addr );
            }
            return( false );
        }
    }
    if( typ & IT_INC )
        addr->mach.offset += size;
    return( true );

}
Example #2
0
void ChangeMemUndoable( address addr, const void *data, size_t size )
{
    char                *p;
    char                *end;

    if( AdvMachState( ACTION_MODIFY_MEMORY ) ) {
        ChangeMem( addr, data, size );
        end = TxtBuff + TXT_LEN;
        p = Format( TxtBuff, "%s %A", GetCmdName( CMD_MODIFY ), addr );
        for( ; size > 0 && p < end - ( 2 + 8 ); --size ) {
            p = StrCopy( ", ", p );
            p = CnvULong( *(unsigned char *)data, p, end - p );
            data = (char *)data + 1;
        }
        RecordEvent( TxtBuff );
        DbgUpdate( UP_MEM_CHANGE );
        CollapseMachState();
    }
}
Example #3
0
void ChangeMemUndoable( address addr, const void *item, unsigned size )
{
    char                *p;
    const unsigned char *it;
    char                *end;

    if( AdvMachState( ACTION_MODIFY_MEMORY ) ) {
        ChangeMem( addr, item, size );
        it = item;
        end = TxtBuff + TXT_LEN;
        p = Format( TxtBuff, "%s %A", GetCmdName( CMD_MODIFY ), addr );
        for( ; size > 0; --size ) {
            p = StrCopy( ", ", p );
            p = CnvULong( *it++, p, end - p );
        }
        RecordEvent( TxtBuff );
        DbgUpdate( UP_MEM_CHANGE );
        CollapseMachState();
    }
}