I have been investigating the possibility of adding an enhanced feature to a debug program. There does not seem to be anything specific about the concept, so it should be applicable to every current CPU in addition to most old CPUs.
The current syntax for many debuggers uses the letter "S" along with an optional value to specify a Single Step (or ONE instruction to be executed when the value is omitted) or a number of Single Steps (a number of instructions) equal to the optional value. Of the two different debuggers for the CPU, operating system and code which I use most of the time, both debuggers display the same information for each of the Single Steps, specifically the actual instruction that will executed and the values of the registers immediately before the instruction is executed. So if a total of 5 instructions are executed, the display is updated 5 times. For the debugger that I wish to enhance, the actual syntax is: value1,value2,value3;S and at present, value2 and value3 are ignored. My question concerns using value2 and value3 to specify the limits by which the stack pointer may change, specifically by adding data (also called a push) and subtracting data (also called a pop) to the stack in whatever manner the program uses to alter the value of the stack pointer register, respectively. Note that for many CPUs, adding values (a push) results in the stack pointer becoming numerically smaller (unsigned of course). Internally, the code would handle the actual arithmetic. For example, if the user specifies: 45,4,2;S then: (a) Up to 45 instructions are executed (b) If the stack has 4 or more pushes, instructions stop (c) If the stack has 2 or more pops, instructions stop Additional information: (a) Scroll / NoScroll is enabled, so the user can pause / resume at any time (b) Any single character by the user stops instructions (c) All pushes and pops are noted AFTER the current instruction is executed - which allows subroutine calls to be automatically handled as per the examples Defaults: (a) If no values are supplied (ONLY ";S"), then "1;S" is assumed and ONE instruction is executed (b) The debugger supports <ESC> in place of ";S" which supports Single Stepping with a single key (c) If any value is omitted, that limitation does not apply More Examples: ,,1;S instructions are executed until the code returns from the subroutine - IF the current instruction calls a subroutine ,,1;S instructions are executed until the code returns to the previous subroutine - IF the current instruction does NOT call a subroutine ,,1;S instructions are executed until the code restores the stack pointer - IF the current instruction does a push or creates space on the stack ,1,2;S instructions are executed until the code calls a second subroutine OR the code returns to the previous subroutine - IF the current code calls a subroutine 55,1,1;S 55 instructions are executed OR until the code calls a second subroutine OR the code returns to the current subroutine - IF the current instruction calls a subroutine 55,1,1;S 55 instructions are executed OR until the code calls a subroutine OR the code returns the the previous subroutine - IF the current instruction does NOT call a subroutine Many more examples could be considered, but that seems to be about the concept that I have. Please advise and comment. Please make any suggestions that would be any improvement and, most important, point out any problems that I have not considered. Jerome Fine