Ejemplo n.º 1
0
        // TODO
        public override void Reset()
        {
            close_all_channels();

            byte[] buffer = Bam.AllocateBuffer();
            read_sector(18, 0, buffer);

            bam = new Bam(buffer);

            //cmd_len = 0;
            //for (int i = 0; i < buf_free.Length; i++)
            //    buf_free[i] = true;

            set_error(ErrorCode1541.ERR_STARTUP);
        }
Ejemplo n.º 2
0
        // TODO
        void execute_command(byte[] command)
        {
            UInt16 adr;
            int len;

            switch ((char)command[0])
            {
                case 'B':
                    if (command[1] != '-')
                        set_error(ErrorCode1541.ERR_SYNTAX30);
                    else
                        switch ((char)command[2])
                        {
                            case 'R':
                                block_read_cmd(command.CopySubset(3));
                                break;

                            case 'P':
                                buffer_ptr_cmd(command.CopySubset(3));
                                break;

                            case 'A':
                            case 'F':
                            case 'W':
                                set_error(ErrorCode1541.ERR_WRITEPROTECT);
                                break;

                            default:
                                set_error(ErrorCode1541.ERR_SYNTAX30);
                                break;
                        }
                    break;

                case 'M':
                    if (command[1] != '-')
                        set_error(ErrorCode1541.ERR_SYNTAX30);
                    else
                        switch ((char)command[2])
                        {
                            case 'R':
                                // TODO

                                //adr = (UInt16)(((byte)command[4] << 8) | ((byte)command[3]));
                                //error_ptr = (byte*)((byte*)_ram + (adr & 0x07ff));
                                //if ((error_len = (byte)command[5]) == 0)
                                //    error_len = 1;
                                adr = (UInt16)(((byte)command[4] << 8) | ((byte)command[3]));
                                //TODO

                                break;

                            case 'W':
                                adr = (UInt16)(((byte)command[4] << 8) | ((byte)command[3]));
                                len = (byte)command[5];
                                for (int i = 0; i < len; i++)
                                    _ram[adr + i] = (byte)command[i + 6];
                                break;

                            default:
                                set_error(ErrorCode1541.ERR_SYNTAX30);
                                break;
                        }
                    break;

                case 'I':
                    close_all_channels();

                    byte[] buffer = Bam.AllocateBuffer();
                    read_sector(18, 0, buffer);
                    bam = new Bam(buffer);

                    set_error(ErrorCode1541.ERR_OK);
                    break;

                case 'U':
                    switch (command[1] & 0x0f)
                    {
                        case 1:		// U1/UA: Block-Read
                            block_read_cmd(command.CopySubset(2));
                            break;

                        case 2:		// U2/UB: Block-Write
                            set_error(ErrorCode1541.ERR_WRITEPROTECT);
                            break;

                        case 10:	// U:/UJ: Reset
                            Reset();
                            break;

                        default:
                            set_error(ErrorCode1541.ERR_SYNTAX30);
                            break;
                    }
                    break;

                case 'G':
                    if (command[1] != ':')
                        set_error(ErrorCode1541.ERR_SYNTAX30);
                    else
                        chd64_cmd(command.CopySubset(2));
                    break;

                case 'C':
                case 'N':
                case 'R':
                case 'S':
                case 'V':
                    set_error(ErrorCode1541.ERR_WRITEPROTECT);
                    break;

                default:
                    set_error(ErrorCode1541.ERR_SYNTAX30);
                    break;
            }
        }