// Path: src/main/java/jace/Emulator.java
// public class Emulator {
// 
//     public static Emulator instance;
//     public static EmulatorUILogic logic = new EmulatorUILogic();
//     public static Thread mainThread;
// 
// //    public static void main(String... args) {
// //        mainThread = Thread.currentThread();
// //        instance = new Emulator(args);
// //    }
// 
//     public static Apple2e computer;
// 
//     /**
//      * Creates a new instance of Emulator
//      * @param args
//      */
//     public Emulator(List<String> args) {
//         instance = this;
//         computer = new Apple2e();
//         Configuration.buildTree();
//         Configuration.loadSettings();
//         mainThread = Thread.currentThread();
//         applyConfiguration(args);
//     }
// 
//     public void applyConfiguration(List<String> args) {
//         Map<String, String> settings = new LinkedHashMap<>();
//         if (args != null) {
//             for (int i = 0; i < args.size(); i++) {
//                 if (args.get(i).startsWith("-")) {
//                     String key = args.get(i).substring(1);
//                     if ((i + 1) < args.size()) {
//                         String val = args.get(i + 1);
//                         if (!val.startsWith("-")) {
//                             settings.put(key, val);
//                             i++;
//                         } else {
//                             settings.put(key, "true");
//                         }
//                     } else {
//                         settings.put(key, "true");
//                     }
//                 } else {
//                     System.err.println("Did not understand parameter " + args.get(i) + ", skipping.");
//                 }
//             }
//         }
//         Configuration.applySettings(settings);
// //        EmulatorUILogic.registerDebugger();
// //        computer.coldStart();
//     }
// 
//     public static void resizeVideo() {
// //        AbstractEmulatorFrame window = getFrame();
// //        if (window != null) {
// //            window.resizeVideo();
// //        }
//     }
// }


import jace.Emulator;
import jace.state.Stateful;
import jace.config.ConfigurableField;
import jace.config.InvokableAction;
import javafx.scene.image.Image;
import javafx.scene.image.WritableImage;

        // Caller must check result is <= 23, if so then they are in a screenhole!
        return (y >> 7) + (((y & 0x7f) / 40) << 3);
    }

    static public int identifyHiresRow(int y) {
        int blockOffset = identifyTextRow(y & 0x03ff);
        // Caller must check results is > 0, if not then they are in a screenhole!
        if (blockOffset > 23) {
            return -1;
        }
        return ((y >> 10) & 7) + (blockOffset << 3);
    }

    public abstract void doPostDraw();

    public byte getFloatingBus() {
        return floatingBus;
    }

    private void setFloatingBus(byte floatingBus) {
        this.floatingBus = floatingBus;
    }

    @InvokableAction(name = "Refresh screen",
            category = "display",
            description = "Marks screen contents as changed, forcing full screen redraw",
            alternatives = "redraw",
            defaultKeyMapping = {"ctrl+shift+r"})
    public static final void forceRefresh() {
        if (Emulator.computer != null && Emulator.computer.video != null) {

// Path: src/main/java/jace/Emulator.java
// public class Emulator {
// 
//     public static Emulator instance;
//     public static EmulatorUILogic logic = new EmulatorUILogic();
//     public static Thread mainThread;
// 
// //    public static void main(String... args) {
// //        mainThread = Thread.currentThread();
// //        instance = new Emulator(args);
// //    }
// 
//     public static Apple2e computer;
// 
//     /**
//      * Creates a new instance of Emulator
//      * @param args
//      */
//     public Emulator(List<String> args) {
//         instance = this;
//         computer = new Apple2e();
//         Configuration.buildTree();
//         Configuration.loadSettings();
//         mainThread = Thread.currentThread();
//         applyConfiguration(args);
//     }
// 
//     public void applyConfiguration(List<String> args) {
//         Map<String, String> settings = new LinkedHashMap<>();
//         if (args != null) {
//             for (int i = 0; i < args.size(); i++) {
//                 if (args.get(i).startsWith("-")) {
//                     String key = args.get(i).substring(1);
//                     if ((i + 1) < args.size()) {
//                         String val = args.get(i + 1);
//                         if (!val.startsWith("-")) {
//                             settings.put(key, val);
//                             i++;
//                         } else {
//                             settings.put(key, "true");
//                         }
//                     } else {
//                         settings.put(key, "true");
//                     }
//                 } else {
//                     System.err.println("Did not understand parameter " + args.get(i) + ", skipping.");
//                 }
//             }
//         }
//         Configuration.applySettings(settings);
// //        EmulatorUILogic.registerDebugger();
// //        computer.coldStart();
//     }
// 
//     public static void resizeVideo() {
// //        AbstractEmulatorFrame window = getFrame();
// //        if (window != null) {
// //            window.resizeVideo();
// //        }
//     }
// }


// Path: src/main/java/jace/core/Video.java
import jace.Emulator;
import jace.state.Stateful;
import jace.config.ConfigurableField;
import jace.config.InvokableAction;
import javafx.scene.image.Image;
import javafx.scene.image.WritableImage;

        // Caller must check result is <= 23, if so then they are in a screenhole!
        return (y >> 7) + (((y & 0x7f) / 40) << 3);
    }

    static public int identifyHiresRow(int y) {
        int blockOffset = identifyTextRow(y & 0x03ff);
        // Caller must check results is > 0, if not then they are in a screenhole!
        if (blockOffset > 23) {
            return -1;
        }
        return ((y >> 10) & 7) + (blockOffset << 3);
    }

    public abstract void doPostDraw();

    public byte getFloatingBus() {
        return floatingBus;
    }

    private void setFloatingBus(byte floatingBus) {
        this.floatingBus = floatingBus;
    }

    @InvokableAction(name = "Refresh screen",
            category = "display",
            description = "Marks screen contents as changed, forcing full screen redraw",
            alternatives = "redraw",
            defaultKeyMapping = {"ctrl+shift+r"})
    public static final void forceRefresh() {
        if (Emulator.computer != null && Emulator.computer.video != null) {

            Emulator.computer.video._forceRefresh();
