| 165 | } |
| 166 | |
| 167 | func getNextExecutableInstructionLoc(currentOffset uint16, currentInstrIndex int, instructions []Instruction) uint16 { |
| 168 | // if at the end then just return the location outside the loop |
| 169 | if currentInstrIndex == (len(instructions) - 1) { |
| 170 | return uint16(currentOffset + uint16(instructions[currentInstrIndex].Size())) |
| 171 | } |
| 172 | |
| 173 | nextInstructionPos := 0 |
| 174 | |
| 175 | for i := currentInstrIndex; i < len(instructions); i++ { |
| 176 | instruction := instructions[i] |
| 177 | if _, ok := instruction.(DEFLABEL); ok { |
| 178 | continue |
| 179 | } else if _, ok := instruction.(DEFSYMBOL); ok { |
| 180 | continue |
| 181 | } else { |
| 182 | if currentInstrIndex == i { |
| 183 | nextInstructionPos += instruction.Size() |
| 184 | } else { |
| 185 | break |
| 186 | } |
| 187 | } |
| 188 | |
| 189 | } |
| 190 | return uint16(currentOffset) + uint16(nextInstructionPos) |
| 191 | } |