// Path: src/main/java/com/amanvishnani/sim8085/domain/IAddress.java
// public interface IAddress {
//     String hexValue();
//     Integer intValue();
//     IData getLSB();
//     IData getMSB();
//     IData getData();
//     void setData(IData data);
//     static IAddress ZERO = Address.from(0);
//     static IAddress FFFF = Address.from("FFFF");
// }
// 
// Path: src/main/java/com/amanvishnani/sim8085/domain/IData.java
// public interface IData {
//     IData ZERO = Data.from("00");
//     String hexValue();
//     Integer intValue();
//     IOperationResult add(IData data);
//     IOperationResult add(IData data, Integer carry);
//     IOperationResult minus(IData data);
//     IRegister toRegister();
//     public IData getLSB();
// }
// 
// Path: src/main/java/com/amanvishnani/sim8085/domain/IOpcode.java
// public interface IOpcode {
//     String getInstruction();
//     IData getOpcodeData();
//     Integer getOpcodeLength();
// }


import com.amanvishnani.sim8085.domain.IAddress;
import com.amanvishnani.sim8085.domain.IData;
import com.amanvishnani.sim8085.domain.IOpcode;
import java.util.*;

    private void resetParams() {
        instructionRowMap = new HashMap<>();
        labelMap = new HashMap<>();
    }

    private void passOne(List<String> instructions) {
        int localPointer = 0;
        for (String lineInstruction :
                instructions) {

            // Get Opcode
            IOpcode opcode = parser.getOpcode(lineInstruction);

            // extract label
            String label = parser.extractLabel(lineInstruction);
            if(!label.isEmpty()) {
                labelMap.put(label, localPointer);
            }

            InstructionRow row = InstructionRow.createInstructionRow(localPointer);
            row.setData(opcode.getOpcodeData());
            row.setLabel(label);
            row.setInstruction(opcode.getInstruction());
            instructionRowMap.put(localPointer, row);
            localPointer = localPointer + 1;

            // Opcode length = 2
            if (opcode.getOpcodeLength() == 2) {
                // Data flow
// Path: src/main/java/com/amanvishnani/sim8085/domain/IAddress.java
// public interface IAddress {
//     String hexValue();
//     Integer intValue();
//     IData getLSB();
//     IData getMSB();
//     IData getData();
//     void setData(IData data);
//     static IAddress ZERO = Address.from(0);
//     static IAddress FFFF = Address.from("FFFF");
// }
// 
// Path: src/main/java/com/amanvishnani/sim8085/domain/IData.java
// public interface IData {
//     IData ZERO = Data.from("00");
//     String hexValue();
//     Integer intValue();
//     IOperationResult add(IData data);
//     IOperationResult add(IData data, Integer carry);
//     IOperationResult minus(IData data);
//     IRegister toRegister();
//     public IData getLSB();
// }
// 
// Path: src/main/java/com/amanvishnani/sim8085/domain/IOpcode.java
// public interface IOpcode {
//     String getInstruction();
//     IData getOpcodeData();
//     Integer getOpcodeLength();
// }


// Path: src/main/java/com/amanvishnani/sim8085/domain/Impl/Compiler.java
import com.amanvishnani.sim8085.domain.IAddress;
import com.amanvishnani.sim8085.domain.IData;
import com.amanvishnani.sim8085.domain.IOpcode;
import java.util.*;


    private void resetParams() {
        instructionRowMap = new HashMap<>();
        labelMap = new HashMap<>();
    }

    private void passOne(List<String> instructions) {
        int localPointer = 0;
        for (String lineInstruction :
                instructions) {

            // Get Opcode
            IOpcode opcode = parser.getOpcode(lineInstruction);

            // extract label
            String label = parser.extractLabel(lineInstruction);
            if(!label.isEmpty()) {
                labelMap.put(label, localPointer);
            }

            InstructionRow row = InstructionRow.createInstructionRow(localPointer);
            row.setData(opcode.getOpcodeData());
            row.setLabel(label);
            row.setInstruction(opcode.getInstruction());
            instructionRowMap.put(localPointer, row);
            localPointer = localPointer + 1;

            // Opcode length = 2
            if (opcode.getOpcodeLength() == 2) {
                // Data flow
                IData data = parser.extractData(lineInstruction);