// ** ポルタメント ケイサン ** // IN: HL<={CG}ダッタラ GノテキストADR // EXIT: DE<=Mコマンドノ 3バンメ ノ ヘンカリョウ // Zフラグ=1 ナラ ヘンカシナイ public void CULPTM() { Z80.DE = Mem.LD_16(MDATA); Mem.stack.Push(Z80.DE); msub.STTONE(); Z80.DE = Mem.stack.Pop(); Mem.LD_16(MDATA, Z80.DE); if (!Z80.Carry) { goto CPT2; } Z80.Carry = true; // SCF return; // RET CPT2: Mem.stack.Push(Z80.HL); Z80.C = Z80.A; CULP2(); Mem.stack.Push(Z80.AF); Z80.A = Mem.LD_8(BEFCO + 1); Z80.E = Z80.A; Z80.D = 0; msub.DIV(); Z80.C = Z80.E; Z80.B = Z80.D; Z80.EX_DE_HL(); Z80.AF = Mem.stack.Pop(); Z80.HL = Mem.stack.Pop(); if (!Z80.Carry) { return; } Mem.stack.Push(Z80.HL); Z80.HL = 0; Z80.A &= Z80.A; Z80.HL -= Z80.DE; Z80.EX_DE_HL(); Z80.HL = Mem.stack.Pop(); Z80.A &= Z80.A; Z80.Carry = false; return;// RET }
// *** データ ヨミコミ ルーチン(2 BYTE) *** // IN : HL<= TEXT ADR // EXIT : DE<= DATA : HL<= NEXT TEXT ADR // : NON DATA ナラ SET CARRYシテ Aニ ツギ ノ モジレツ // : ERROR...A=1 : NON ERROR...A=0 // exam : c16 ナラ 16 ヲ ヨンデ DE ニ カエス public void REDATA() { Mem.stack.Push(Z80.BC); Mem.stack.Push(Z80.HL); //Z80.HL = SCORE; //Z80.DE = SCORE + 1; //Mem.LD_8(Z80.HL, 0); //Z80.BC = 5; //Z80.LDIR();// INIT SCORE for (int i = 0; i < SCORE.Length; i++) { SCORE[i] = 0; } Z80.HL = Mem.stack.Pop(); Z80.B = 5; // 5ケタ マデ Z80.A ^= Z80.A; Mem.LD_8(HEXFG, Z80.A); Mem.LD_8(MINUSF, Z80.A); READ0: // FIRST CHECK Z80.A = Mem.LD_8(Z80.HL); if (Z80.A - 0x20 == 0) { goto RE01; } if (Z80.A - 0x24 == 0)//0x24 = '$' { goto READH; } if (Z80.A - 0x2d == 0)//0x2d = '-' { goto READ9; } if (Z80.A - 0x30 < 0) //0x30 = '0' { goto READE; //0イジョウ ノ キャラクタナラ ツギ } if (Z80.A - 0x3A >= 0) //0x3A = ':' :は9の次に定義されている文字 { goto READE; //9イカナラ ツギ } goto READ7; RE01: Z80.HL++; goto READ0; READH: Z80.HL++; Z80.A = 1; Mem.LD_8(HEXFG, Z80.A); goto READ7; READ9: // MINUS CHECK Z80.HL++; Z80.A = Mem.LD_8(Z80.HL); if (Z80.A - 0x30 < 0) //0x30 = '0' { goto READE; //0イジョウ ノ キャラクタナラ ツギ } if (Z80.A - 0x3A >= 0) //0x3A = ':' :は9の次に定義されている文字 { goto READE; //9イカナラ ツギ } Z80.A = 1; Mem.LD_8(MINUSF, Z80.A); // SET MINUS FLAG READ7: do { Z80.A = Mem.LD_8(Z80.HL); // SECOND CHECK Z80.D = Z80.A; Z80.A = Mem.LD_8(HEXFG); Z80.A |= Z80.A; Z80.Zero = (Z80.A == 0); Z80.A = Z80.D; if (Z80.Zero) { goto READC; } if (Z80.A - 0x61 < 0)//0x61 = 'a' { goto READG; } if (Z80.A - 0x67 >= 0)//0x67 = 'g' { goto READG; } Z80.A -= 32; READG: if (Z80.A - 0x41 < 0)//0x61 = 'A' { goto READC; } if (Z80.A - 0x47 >= 0)//0x67 = 'G' { goto READC; } Z80.A -= 7; goto READF; READC: if (Z80.A - 0x30 < 0) //0x30 = '0' { goto READ1; //0イジョウ ノ キャラクタナラ ツギ } if (Z80.A - 0x3A >= 0) //0x3A = ':' :は9の次に定義されている文字 { goto READ1; //9イカナラ ツギ } READF: Mem.stack.Push(Z80.HL); Mem.stack.Push(Z80.BC); //Z80.HL = SCORE + 1; //Z80.DE = SCORE; //Z80.BC = 5; //Z80.LDIR(); SCORE[0] = SCORE[1]; SCORE[1] = SCORE[2]; SCORE[2] = SCORE[3]; SCORE[3] = SCORE[4]; SCORE[4] = SCORE[5]; Z80.BC = Mem.stack.Pop(); Z80.HL = Mem.stack.Pop(); Z80.A -= 0x30;// A= 0 - 9 //Mem.LD_8(SCORE + 4, Z80.A); SCORE[4] = Z80.A; Z80.HL++; // NEXT TEXT Z80.B--; } while (Z80.B != 0); Z80.A = Mem.LD_8(Z80.HL); // THIRD CHECK if (Z80.A - 0x30 < 0) //0x30 = '0' { goto READ1; //0イジョウ ノ キャラクタナラ ツギ } if (Z80.A - 0x3A >= 0) //0x3A = ':' :は9の次に定義されている文字 { goto READ1; //9イカナラ ツギ } //READ8: Z80.A &= Z80.A; // CY=0 Z80.A = 1; // ERROR SIGN Z80.BC = Mem.stack.Pop(); return; //RET ; 7ケタイジョウ ハ エラー READ1: Z80.A = Mem.LD_8(HEXFG); Z80.A |= Z80.A; if (Z80.A == 0) { goto READD; } //Z80.A = Mem.LD_8(SCORE + 1); Z80.A = SCORE[1]; Z80.RLCA(); Z80.RLCA(); Z80.RLCA(); Z80.RLCA(); Z80.D = Z80.A; //Z80.A = Mem.LD_8(SCORE + 2); Z80.A = SCORE[2]; Z80.A |= Z80.D; Z80.D = Z80.A; //Z80.A = Mem.LD_8(SCORE + 3); Z80.A = SCORE[3]; Z80.RLCA(); Z80.RLCA(); Z80.RLCA(); Z80.RLCA(); Z80.E = Z80.A; //Z80.A = Mem.LD_8(SCORE + 4); Z80.A = SCORE[4]; Z80.A |= Z80.E; Z80.E = Z80.A; goto READA; READD: Mem.stack.Push(Z80.HL); Z80.HL = 0; Z80.DE = 10000; // 10000 ノ ケタ //Z80.A = Mem.LD_8(SCORE); Z80.A = SCORE[0]; Z80.A |= Z80.A; if (Z80.A == 0) { goto READSEN; } Z80.B = Z80.A; //READMAN: do { Z80.HL += Z80.DE; Z80.B--; } while (Z80.B != 0); READSEN: Z80.DE = 1000; //Z80.A = Mem.LD_8(SCORE + 1);// 1000 ノ ケタ Z80.A = SCORE[1];// 1000 ノ ケタ Z80.A |= Z80.A; if (Z80.A == 0) { goto READHYAKU; } Z80.B = Z80.A; //READSEN2: do { Z80.HL += Z80.DE; Z80.B--; } while (Z80.B != 0); READHYAKU: Z80.DE = 100; //Z80.A = Mem.LD_8(SCORE + 2);// 100 ノ ケタ Z80.A = SCORE[2];// 100 ノ ケタ Z80.A |= Z80.A; if (Z80.A == 0) { goto READ4; } Z80.B = Z80.A; //READ2: do { Z80.HL += Z80.DE; Z80.B--; } while (Z80.B != 0); READ4: //Z80.A = Mem.LD_8(SCORE + 3);// 10 ノ ケタ Z80.A = SCORE[3];// 10 ノ ケタ Z80.A |= Z80.A; if (Z80.A == 0) { goto READ5; } Z80.B = Z80.A; Z80.A = 0; Z80.C = 10; //READ3: do { Z80.A += Z80.C; Z80.B--; } while (Z80.B != 0); Z80.C = Z80.A; goto READ6; READ5: Z80.C = 0; READ6: //Z80.A = Mem.LD_8(SCORE + 4);// 1 ノ ケタ Z80.A = SCORE[4];// 1 ノ ケタ Z80.A += Z80.C; Z80.Carry = (Z80.A + Z80.L > 0xff); Z80.A += Z80.L; Z80.L = Z80.A; Z80.A += (byte)(Z80.H + (Z80.Carry ? 1 : 0)); Z80.A -= Z80.L; Z80.H = Z80.A; Z80.EX_DE_HL(); Z80.HL = Mem.stack.Pop(); Z80.A = Mem.LD_8(MINUSF);// CHECK MINUS FLAG Z80.A |= Z80.A; if (Z80.A == 0) { goto READA;// NON MINUS } Mem.stack.Push(Z80.HL); Z80.A ^= Z80.A; // CY=0 Z80.HL = 0; Z80.HL -= Z80.DE; // DE ノ ホスウ ヲ トル Z80.EX_DE_HL(); Z80.HL = Mem.stack.Pop(); READA: Z80.A ^= Z80.A; //CY=0 Z80.Carry = false; Z80.BC = Mem.stack.Pop(); return;// RET READE: Mem.LD_8(SECCOM, Z80.A); Z80.Carry = true; // NON DATA Z80.BC = Mem.stack.Pop(); // RET }
// JP PRNWK // JP PRNWKI // JP CONVERT // JP CONVERT2 // JP GETPARA // JP OPEX public void PRNWK() { byte[] buf = Encoding.UTF8.GetBytes(CHCHR); Z80.B = 11; Z80.A = 0x41;// 'A'; //Mem.LD_8(CHCHR, Z80.A); CHCHR = "A"; Z80.A = 1; //Mem.LD_8(CHNUM, Z80.A); CHNUM = 1; Z80.HL = 0x104; Mem.LD_16(XY, Z80.HL); PRNWK2: Mem.stack.Push(Z80.BC); Z80.HL = Mem.LD_16(XY); PC88.CALL(0x429D); Z80.EX_DE_HL(); Z80.HL = 0;// CHCHR; Z80.LDI(buf); Z80.HL--; //Mem.LD_8(Z80.HL, (byte)(Mem.LD_8(Z80.HL) + 1)); buf[0]++; Z80.A = Mem.LD_8(CHNUM); Z80.B = Z80.A; PC88.CALL(WKGET); Z80.A = 3; LOC(); Z80.Zero = (Mem.LD_8((ushort)(Z80.IX + 31)) & 0x08) == 0; ONOFF(); Z80.C = Mem.LD_8((ushort)(Z80.IX + 6)); Z80.A = Mem.LD_8(CHNUM); if (Z80.A - 7 == 0) { goto PRNW4; } if (Z80.A - 11 == 0) { goto PRNW4; } Z80.A -= 4; if (Z80.A - 3 < 0) { goto PRNW3; } Z80.A = Z80.C; Z80.A -= 4; Z80.C = Z80.A; goto PRNW4; PRNW3: Z80.A = Z80.C; Z80.A &= 0b0000_1111; Z80.C = Z80.A; PRNW4: Z80.A = 7; LOC(); Z80.EX_DE_HL(); Z80.L = Z80.C; PRNSUB(); Z80.A = 36; LOC(); Z80.EX_DE_HL(); Z80.L = Mem.LD_8((ushort)(Z80.IX + 18)); PRNSUB(); Z80.A = 11; LOC(); Z80.EX_DE_HL(); Z80.L = Mem.LD_8((ushort)(Z80.IX + 9)); Z80.H = Mem.LD_8((ushort)(Z80.IX + 10)); PRNS1(); Z80.A = 17; LOC(); Z80.EX_DE_HL(); Z80.L = Mem.LD_8((ushort)(Z80.IX + 2)); Z80.H = Mem.LD_8((ushort)(Z80.IX + 3)); PRNS2(); Z80.A = Mem.LD_8((ushort)(Z80.IX + 32)); Mem.stack.Push(Z80.AF); Z80.A &= 0x0F0; Z80.RRCA(); Z80.RRCA(); Z80.RRCA(); Z80.RRCA(); Z80.A++; Z80.A += 0x30; Mem.stack.Push(Z80.AF); Z80.A = 22; LOC(); PC88.CALL(0x429D); Z80.AF = Mem.stack.Pop(); Mem.LD_8(Z80.HL, Z80.A); Z80.AF = Mem.stack.Pop(); Z80.A &= 0x0F; Z80.HL = 0;// KEYD; Z80.A += Z80.A; Z80.D = 0; Z80.E = Z80.A; Z80.HL += Z80.DE; Mem.stack.Push(Z80.HL); Z80.A = 23; LOC(); PC88.CALL(0x429D); Z80.EX_DE_HL(); Z80.HL = Mem.stack.Pop(); byte[] buf1 = Encoding.UTF8.GetBytes(KEYD[Z80.HL / 2]); Z80.HL = 0; Z80.LDI(); Z80.LDI(); Z80.A = 26; LOC(); Z80.Zero = (Mem.LD_8((ushort)(Z80.IX + 31)) & 0x80) == 0; ONOFF(); Z80.A = 30; LOC(); Z80.Zero = (Mem.LD_8((ushort)(Z80.IX + 33)) & 0x20) == 0; ONOFF(); Z80.B = 1; PC88.CALL(WKGET); Mem.stack.Push(Z80.IX); Z80.HL = Mem.stack.Pop(); Z80.DE = 8; Z80.A &= Z80.A; Z80.HL -= Z80.DE;// L/R DATA AREA Z80.A = Mem.LD_8(CHNUM); Z80.A--; if (Z80.A - 3 < 0) { goto PRNW5; } Z80.A -= 3; if (Z80.A - 4 < 0) { goto PRNW6; } Z80.A -= 4; Z80.A += 4; PRNW5: Z80.E = Z80.A; Z80.D = 0; Z80.HL += Z80.DE; Z80.A = Mem.LD_8(CHNUM); if (Z80.A - 11 != 0) { goto PRNW50; } Z80.A = Mem.LD_8(Z80.HL); Z80.RRCA(); Z80.RRCA(); goto PRNW51; PRNW50: Z80.A = Mem.LD_8(Z80.HL); PRNW51: Z80.A &= 0b1100_0000; if (Z80.A == 0) { goto PRNW6; } if (Z80.A - 0xc0 == 0) { goto PRNW6; } Z80.Zero = (Z80.A & 0x80) == 0; if (!Z80.Zero) { goto PRNW52; } Z80.A = 0x52;// 'R'; goto PRNW7; PRNW52: Z80.A = 0x4c;// 'L'; goto PRNW7; PRNW6: Z80.A = 0x43;// 'C'; PRNW7: Mem.stack.Push(Z80.AF); Z80.A = 34; LOC(); PC88.CALL(0x429D); Z80.AF = Mem.stack.Pop(); Mem.LD_8(Z80.HL, Z80.A); // -- MUTE CHECK -- Z80.BC = 0; //Z80.HL = BEFK; expand.KEYCHK(ref BEFK[0]);// PC88.CALL(KEYCHK); if (!Z80.Zero) { goto PRNW71; } Z80.BC = 0xf801; //Z80.HL = BEFK + 1; expand.KEYCHK(ref BEFK[1]); //PC88.CALL(KEYCHK); if (Z80.Zero) { goto PRNW9; } Z80.C = 9; goto PRNW72; PRNW71: Z80.C = 1; PRNW72: Z80.B = 8; //PRNW73: do { Z80.RRCA(); if (!Z80.Carry) { goto PRNW74; } Z80.C++; Z80.B--; } while (Z80.B != 0); goto PRNW9; PRNW74: Z80.B = Z80.C; PC88.CALL(WKGET); Z80.Zero = (Mem.LD_8((ushort)(Z80.IX + 31)) & 0x08) == 0; if (!Z80.Zero) { goto PRNW8; } Mem.LD_8((ushort)(Z80.IX + 31), (byte)(Mem.LD_8((ushort)(Z80.IX + 31)) | 0x08)); goto PRNW9; PRNW8: Mem.LD_8((ushort)(Z80.IX + 31), (byte)(Mem.LD_8((ushort)(Z80.IX + 31)) & 0xf7)); PRNW9: Z80.DE = Mem.LD_16(XY); Z80.E++; Mem.LD_16(XY, Z80.DE); Z80.A = Mem.LD_8(CHNUM); Z80.A++; Mem.LD_8(CHNUM, Z80.A); Z80.BC = Mem.stack.Pop(); Z80.B--; if (Z80.B != 0) { goto PRNWK2; } // -- RETKEY CHCEK -- Z80.HL = RETK; Z80.BC = 0x7f01; PC88.CALL(KEYCHK); if (Z80.Zero) { goto PRNWA; } Z80.Zero = (Z80.A & 0x08) == 0; if (!Z80.Zero) { goto PRNWA; } // DI PC88.CALL(DRIVE); // EI // -- F5 CHECK -- PRNWA: Z80.HL = F5K; Z80.BC = 0xdf09; PC88.CALL(KEYCHK); if (Z80.Zero) { goto PRNWB; } Z80.Zero = (Z80.A & 0x20) == 0; if (!Z80.Zero) { goto PRNWB; } Z80.A ^= Z80.A; PC88.CALL(MSTART); PRNWB: FMPUT(); // -- オンショクナンバー ヒョウジ -- Z80.A = 1; Z80.B = 6; Z80.DE = 6 * 256 + 17; //OPUT0: do { Mem.stack.Push(Z80.BC); Mem.stack.Push(Z80.AF); if (Z80.A - 4 != 0) { goto OPUT1; } Z80.AF = Mem.stack.Pop(); Z80.A += 4; Mem.stack.Push(Z80.AF); OPUT1: Z80.B = Z80.A; PC88.CALL(WKGET); Z80.C = Mem.LD_8((ushort)(Z80.IX + 1)); // Z80.C--; Z80.B = 0; Z80.HL = DEFVOICE; Z80.HL += Z80.BC; Z80.L = Mem.LD_8(Z80.HL); Z80.L--; Mem.stack.Push(Z80.DE); PRNSUB(); Z80.DE = Mem.stack.Pop(); Z80.A = Z80.D; Z80.A += 13; Z80.D = Z80.A; Z80.AF = Mem.stack.Pop(); Z80.A++; Z80.BC = Mem.stack.Pop(); Z80.B--; } while (Z80.B != 0); // RET }