im making a basic ASM simulator which runs in a datagridview, iv got most of it working like the add/sub/mul/div operators, but im having trouble with the jump function, the jump it self works, the simulator jumps but it still executes the next operator after the jump when its supposed to execute from operator/line its jumped too.
#1 - jmp : 3
#2 - mul : 5
#3 - add : 7
-- It should skip line two and start the simulation from line 3:
For Each row As DataGridViewRow In DataGridView2.Rows If row.Cells.Item("ColOperator").Value = "JMP" Then If row.Cells.Item("ColOperand").Value <> "" Then Dim s As String = row.Cells.Item("ColOperand").Value DataGridView2.ClearSelection() For x As Integer = 0 To DataGridView2.Rows.Count - 1 If CStr(DataGridView2.Rows(x).Cells(0).Value).StartsWith(s) Then DataGridView2.FirstDisplayedScrollingRowIndex = x DataGridView2.Item(0, x).Selected = True DataGridView2.Rows(x).Selected = True TxtPc.Text = x End If Next End If End If ' took out the other functions to make it cleaner, i can post all the code if needed. next
its got something to do with the for each loop, hmmm