Пример #1
0
t_stat mt_boot (int32 unitno, DEVICE *dptr)
{
extern DIB sch_dib;
uint32 sch_dev;

if (decrom[0xD5] & dec_flgs)                            /* AL defined? */
    return SCPE_NOFNC;
sim_tape_rewind (&mt_unit[unitno]);                     /* rewind */
sch_dev = sch_dib.dno + mt_dib.sch;                     /* sch dev # */
IOWriteBlk (BOOT_START, BOOT_LEN, boot_rom);            /* copy boot */
IOWriteB (AL_DEV, mt_dib.dno + (unitno * o_MT0));       /* set dev no for unit */
IOWriteB (AL_IOC, 0xA1);                                /* set dev cmd */
IOWriteB (AL_SCH, sch_dev);                             /* set dev no for chan */
PC = BOOT_START;
return SCPE_OK;
}
Пример #2
0
Файл: io.c Проект: GYGit/reactos
VOID
IOWriteW(USHORT Port,
         USHORT Buffer)
{
    if (IoPortProc[Port].hVdd == INVALID_HANDLE_VALUE &&
        IoPortProc[Port].IoHandlers.OutW)
    {
        IoPortProc[Port].IoHandlers.OutW(Port, Buffer);
    }
    else if (IoPortProc[Port].hVdd != NULL && IoPortProc[Port].hVdd != INVALID_HANDLE_VALUE &&
             IoPortProc[Port].VddIoHandlers.outw_handler)
    {
        ASSERT(Port <= MAXWORD);
        IoPortProc[Port].VddIoHandlers.outw_handler(Port, Buffer);
    }
    else
    {
        // FIXME: Is it ok on Little endian and Big endian ??
        IOWriteB(Port, LOBYTE(Buffer));
        IOWriteB(Port + sizeof(UCHAR), HIBYTE(Buffer));
    }
}
Пример #3
0
Файл: io.c Проект: GYGit/reactos
VOID
IOWriteStrB(USHORT Port,
            PUCHAR Buffer,
            ULONG  Count)
{
    if (IoPortProc[Port].hVdd == INVALID_HANDLE_VALUE &&
        IoPortProc[Port].IoHandlers.OutsB)
    {
        IoPortProc[Port].IoHandlers.OutsB(Port, Buffer, Count);
    }
    else if (IoPortProc[Port].hVdd != NULL && IoPortProc[Port].hVdd != INVALID_HANDLE_VALUE &&
             IoPortProc[Port].VddIoHandlers.outsb_handler)
    {
        ASSERT(Port  <= MAXWORD);
        ASSERT(Count <= MAXWORD);
        IoPortProc[Port].VddIoHandlers.outsb_handler(Port, Buffer, (WORD)Count);
    }
    else
    {
        while (Count--) IOWriteB(Port, *Buffer++);
    }
}
Пример #4
0
Файл: io.c Проект: GYGit/reactos
VOID FASTCALL
EmulatorWriteIo(PFAST486_STATE State,
                USHORT Port,
                PVOID Buffer,
                ULONG DataCount,
                UCHAR DataSize)
{
    UNREFERENCED_PARAMETER(State);

    if (DataSize == 0 || DataCount == 0) return;

    if (DataSize == sizeof(UCHAR))
    {
        if (DataCount == 1)
            IOWriteB(Port, *(PUCHAR)Buffer);
        else
            IOWriteStrB(Port, Buffer, DataCount);
    }
    else if (DataSize == sizeof(USHORT))
    {
        if (DataCount == 1)
            IOWriteW(Port, *(PUSHORT)Buffer);
        else
            IOWriteStrW(Port, Buffer, DataCount);
    }
    else if (DataSize == sizeof(ULONG))
    {
        if (DataCount == 1)
            IOWriteD(Port, *(PULONG)Buffer);
        else
            IOWriteStrD(Port, Buffer, DataCount);
    }
    else
    {
        PUCHAR Address = (PUCHAR)Buffer;

        while (DataCount--)
        {
            ULONG CurrentPort = Port;
            ULONG Count;
            UCHAR NewDataSize = DataSize;

            /* Write dword */
            Count       = NewDataSize >> 2; // NewDataSize / sizeof(ULONG);
            NewDataSize = NewDataSize  & 3; // NewDataSize % sizeof(ULONG);
            while (Count--)
            {
                IOWriteD(CurrentPort, *(PULONG)Address);
                CurrentPort += sizeof(ULONG);
                Address     += sizeof(ULONG);
            }

            /* Write word */
            Count       = NewDataSize >> 1; // NewDataSize / sizeof(USHORT);
            NewDataSize = NewDataSize  & 1; // NewDataSize % sizeof(USHORT);
            while (Count--)
            {
                IOWriteW(CurrentPort, *(PUSHORT)Address);
                CurrentPort += sizeof(USHORT);
                Address     += sizeof(USHORT);
            }

            /* Write byte */
            Count       = NewDataSize; // NewDataSize / sizeof(UCHAR);
            // NewDataSize = NewDataSize % sizeof(UCHAR);
            while (Count--)
            {
                IOWriteB(CurrentPort, *(PUCHAR)Address);
                CurrentPort += sizeof(UCHAR);
                Address     += sizeof(UCHAR);
            }
        }
    }
}