// Path: SimulatorsPackage/src/main/java/Hack/VMEmulator/TerminateVMProgramThrowable.java
// public class TerminateVMProgramThrowable extends Throwable
// {
//     /**
//      * Constructs a new TerminateVMProgramThrowable with the given message.
// 	 * Don't allow builtins (which are outside this package) to construct.
//      */
//     TerminateVMProgramThrowable(String message) {
//         super(message);
//     }
// 
//     /**
//      * Constructs a new TerminateVMProgramThrowable with no message
// 	 * Don't allow builtins (which are outside this package) to construct.
//      */
//     TerminateVMProgramThrowable() {
//         super();
//     }
// 
// }


import Hack.VMEmulator.TerminateVMProgramThrowable;
    }

    private static void updateLocation(int address, int mask) throws TerminateVMProgramThrowable {
        address += SCREEN_START_ADDRESS;
        int value = readMemory(address);
        if (black)
            value |= mask;
        else
            value &= ~mask;
        writeMemory(address, value);
    }

    public static void setColor(short color) {
        black = (color != 0);
    }

    public static void drawPixel(short x, short y) throws TerminateVMProgramThrowable {
        if (x < 0 || x >= SCREEN_WIDTH || y < 0 || y >= SCREEN_HEIGHT)
            callFunction("Sys.error", SCREEN_DRAWPIXEL_ILLEGAL_COORDS);

        updateLocation((y * SCREEN_WIDTH + x) >> 4, 1 << (x & 15));
    }

    private static void drawConditional(int x, int y, boolean exchange) throws TerminateVMProgramThrowable {
        if (exchange)
            updateLocation((x * SCREEN_WIDTH + y) >> 4, 1 << (y & 15));
        else
            updateLocation((y * SCREEN_WIDTH + x) >> 4, 1 << (x & 15));
    }

// Path: SimulatorsPackage/src/main/java/Hack/VMEmulator/TerminateVMProgramThrowable.java
// public class TerminateVMProgramThrowable extends Throwable
// {
//     /**
//      * Constructs a new TerminateVMProgramThrowable with the given message.
// 	 * Don't allow builtins (which are outside this package) to construct.
//      */
//     TerminateVMProgramThrowable(String message) {
//         super(message);
//     }
// 
//     /**
//      * Constructs a new TerminateVMProgramThrowable with no message
// 	 * Don't allow builtins (which are outside this package) to construct.
//      */
//     TerminateVMProgramThrowable() {
//         super();
//     }
// 
// }


// Path: BuiltInVMCode/src/main/java/builtInVMCode/Jack_Screen.java
import Hack.VMEmulator.TerminateVMProgramThrowable;

    }

    private static void updateLocation(int address, int mask) throws TerminateVMProgramThrowable {
        address += SCREEN_START_ADDRESS;
        int value = readMemory(address);
        if (black)
            value |= mask;
        else
            value &= ~mask;
        writeMemory(address, value);
    }

    public static void setColor(short color) {
        black = (color != 0);
    }

    public static void drawPixel(short x, short y) throws TerminateVMProgramThrowable {
        if (x < 0 || x >= SCREEN_WIDTH || y < 0 || y >= SCREEN_HEIGHT)
            callFunction("Sys.error", SCREEN_DRAWPIXEL_ILLEGAL_COORDS);

        updateLocation((y * SCREEN_WIDTH + x) >> 4, 1 << (x & 15));
    }

    private static void drawConditional(int x, int y, boolean exchange) throws TerminateVMProgramThrowable {
        if (exchange)
            updateLocation((x * SCREEN_WIDTH + y) >> 4, 1 << (y & 15));
        else
            updateLocation((y * SCREEN_WIDTH + x) >> 4, 1 << (x & 15));
    }

    public static void drawLine(short x1, short y1, short x2, short y2) throws TerminateVMProgramThrowable {