Пример #1
0
        //IN:A<=ERROR CODE

        public void ERROR()
        {
            Mem.LD_16(0x0EFBA, Z80.HL);
            Z80.EX_AF_AF();
            Z80.A ^= Z80.A;

            Mem.LD_8(COMNOW, Z80.A);
            Z80.HL = Mem.LD_16(MDATA);
            Mem.LD_8(Z80.HL, Z80.A);

            Z80.HL = Mem.LD_16(MDATA + 2);
            Mem.LD_16(MDATA, Z80.HL);

            Z80.HL = Mem.LD_16(LINE);
            Z80.E  = Mem.LD_8(Z80.HL);
            Z80.HL++;
            Z80.D = Mem.LD_8(Z80.HL);// DE AS ERROR LINE

            Mem.LD_16(ERRORLINE, Z80.DE);

            ROM();

            Z80.HL = Mem.stack.Pop();

            Mem.stack.Push(Z80.HL);
            Z80.HL = Mem.LD_16(0x0EF86);
            Mem.stack.Push(Z80.HL);// STORE CURSOR

            Z80.HL = 0x0F3C8;
            Z80.DE = 0x0F3C9;
            Mem.LD_8(Z80.HL, 0);
            Z80.BC = 79;

            Z80.LDIR();

            Z80.EX_AF_AF();// A as ERROR CODE
            Z80.A += Z80.A;

            Z80.HL  = ERRORTBL;
            Z80.E   = Z80.A;
            Z80.D   = 0;
            Z80.HL += Z80.DE;
            Z80.A   = Mem.LD_8(Z80.HL);
            Z80.HL++;
            Z80.H  = Mem.LD_8(Z80.HL);
            Z80.L  = Z80.A;
            Z80.DE = 16 * 256 + 1;
            Mem.LD_16(0x0EF86, Z80.DE);
            PC88.CALL(0x5550);

            Z80.DE = 1 * 256 + 1;// CURSOR X, Y

            Mem.LD_16(0x0EF86, Z80.DE);
            //TODO:
            //Z80.HL = ERRORMSG;
            PC88.CALL(0x5550);

            Z80.HL = Mem.LD_16(ERRORLINE);
            Mem.LD_16(0x0E656, Z80.HL);

            Z80.HL = Mem.stack.Pop();
            Mem.LD_16(0x0EF86, Z80.HL);
            Z80.HL = Mem.stack.Pop();
            Z80.E  = 2;// ERROR CODE

            //TODO:
            //goto 0x03B3;// ERROR PROCESS
            //    RET
            PC88.CALL(0x3b3);
        }