Shows an arrow in front of a code line.
EdShowLine n
EdShowLine can only be used in a subroutine declared with Tron procname. Although EdShowLine can display the arrow before any line, it is most useful when the current executed line - returned in TraceLnr - is marked. Therefore, EdShowLine is mostly used together with TraceLnr.
OpenW 1, 0, 0, 400, 500
Global i%
Tron p
. mov eax, 10
. mov [i%], eax
~1
Troff
CloseW 1
Sub p
Local j%
Print "i ="; i; TraceLnr // Trace$
EdShowLine TraceLnr : Delay .5
If InStr(Trace$, "[i%]") Then {TraceReg + 7 * 4} = 123
EndSub
The main program consists of two assembler instructions. The first one moves the value 10 to the register eax, the second moves the contents of eax to the variable i% (the ~1 makes sure, that the last used floating point register is cleared, not relevant here, though.)
The Tron procedure p prints the contents of the variable i% followed by the current line number and source code text of that line. The command EdShowLine shows the normal Tron arrow in front of the actual line. A small delay makes it possible to notice the current line.
Finally, if the source code line contains "[i%]", the value 123 is written as integer into memory, which address is obtained using TraceReg+7*4.
As a complete debugger, Tron needs access to the processor registers. TraceReg returns the address of the memory range, where for the actual processor registers are placed in. With TraceReg+7*4 the seventh register (0,1,2,3,4,5,6,eax ) will be changed. As a result, 123 will placed in eax and thus in i%.
In a compiled program the debugging commands are removed.
ProcLineCnt(), ProcLnr(), SrcCode$(), Trace, Trace() TraceLnr, TraceReg, Tron, Troff
{Created by Sjouke Hamstra; Last updated: 03/10/2014 by James Gaite}