Malfunction.java
     1: //========================================================================================
     2: //  Malfunction.java
     3: //    en:Malfunction reproduction
     4: //    ja:故障再現
     5: //  Copyright (C) 2003-2026 Makoto Kamada
     6: //
     7: //  This file is part of the XEiJ (X68000 Emulator in Java).
     8: //  You can use, modify and redistribute the XEiJ if the conditions are met.
     9: //  Read the XEiJ License for more details.
    10: //  https://stdkmd.net/xeij/
    11: //========================================================================================
    12: 
    13: package xeij;
    14: 
    15: class Malfunction {
    16: 
    17:   public static final boolean MLF_ON = false;
    18: 
    19:   //mlfRaster (dataY)
    20:   //  TVRAMのプレーン0のbit15-12を担当するマルチポートRAM(XVIで言うとIC56)のデータを暴れさせる
    21:   //  drawRaster (dataY, screenY, false)の直前に呼び出す
    22:   public static void mlfRaster (int dataY) {
    23:     int my = (CRTC.crtR11TxYZero + dataY) & 1023;  //メモリY座標
    24:     final int ba = 0x00e00000 + (0 << 17);  //ベースアドレス。プレーン0
    25:     int sa = ba + 128 * my;  //開始アドレス
    26:     int ea = sa + 128;  //終了アドレス
    27:     for (int a = sa; a < ea; a += 2) {
    28:       MainMemory.mmrM8[a] = (byte) (((random () >>> 24) & 0xf0) |  //bit15-12をノイズに
    29:                                     (MainMemory.mmrM8[a] & 0x0f));  //bit11-8はそのまま
    30:     }
    31:   }  //mlfRaster
    32: 
    33:   private static int x = 123456789;
    34:   private static int y = 362436069;
    35:   private static int z = 521288629;
    36:   private static int w = 88675123;
    37:   private static int random () {
    38:     int t = x ^ (x << 11);
    39:     x = y;
    40:     y = z;
    41:     z = w;
    42:     return w = (w ^ (w >>> 19)) ^ (t ^ (t >>> 8));
    43:   }  //random
    44: 
    45: }  //class Malfunction