diff --git a/Programs/CosmOS/Apps/Break.asm b/Programs/CosmOS/Apps/Break.asm index fd61c93..50efcb6 100644 --- a/Programs/CosmOS/Apps/Break.asm +++ b/Programs/CosmOS/Apps/Break.asm @@ -17,6 +17,23 @@ ; Correct output is two stops. A and B differ between them, the addresses differ, and the ; Stack Pointer differs too, because the second one is inside a subroutine and a call has ; put ten bytes down by then. +; +; EVERY POINTER IS SET BEFORE EACH STOP, and the three this program owns are rotated +; between the two so that all of them visibly change. +; +; This program used to leave DP1 and DP2 alone, and what a stop then showed for them was +; whatever the shell happened to have left there. That is a real thing about the machine - +; a program is handed the pointers as it finds them - but it is not this program's to +; demonstrate, and it made what this program prints depend on where CosmOS's code happens +; to sit. The recorded output had to be taken again four times in one day's work, every +; time for a value nothing should ever depend on. +; +; A demonstration of what the registers were should show registers somebody chose. Then +; every line of it is being asserted rather than merely observed. +; +; DP3 is deliberately still the system's. It is where the program was entered, which is the +; one thing here worth seeing that this program did not choose, and it is steady because it +; is this program's own base. #Include services.asm @@ -31,6 +48,8 @@ start: INIA 0d17 INIB 0d34 SETD.0 Marker + SETD.1 Banner + SETD.2 DoneText SWI osBreak ; The second stop is inside a subroutine, so that the Stack Pointer is visibly not where @@ -45,6 +64,8 @@ deeper: INIA 0d68 INIB 0d85 SETD.0 Banner + SETD.1 DoneText + SETD.2 Marker SWI osBreak RET diff --git a/Tests/expected/cosmosBreak.out b/Tests/expected/cosmosBreak.out index 6dce33c..b017de8 100644 --- a/Tests/expected/cosmosBreak.out +++ b/Tests/expected/cosmosBreak.out @@ -1,13 +1,13 @@ CosmOS > loaded, starting at 4000 > two stops, and what the registers were at each -break at 400E +break at 4016 A 11 B 22 Q 00 status 00 -DP0 2030 DP1 09F7 DP2 0000 DP3 4000 SP FFFF +DP0 2030 DP1 2000 DP2 2037 DP3 4000 SP FFFF press a key -break at 4023 +break at 4033 A 44 B 55 Q 00 status 00 -DP0 2000 DP1 09F7 DP2 0000 DP3 4000 SP FFF5 +DP0 2000 DP1 2037 DP2 2030 DP3 4000 SP FFF5 press a key carried on to the end finished diff --git a/Tests/expected/cosmosMonitor.out b/Tests/expected/cosmosMonitor.out index 5650ba7..e870c94 100644 --- a/Tests/expected/cosmosMonitor.out +++ b/Tests/expected/cosmosMonitor.out @@ -66,7 +66,7 @@ Life.sbx 1411 Snake.sbx 2175 Keys.sbx 663 Say.sbx 155 -Break.sbx 132 +Break.sbx 148 notes.txt 21 8 files > halted diff --git a/Tests/expected/cosmosRun.out b/Tests/expected/cosmosRun.out index 9f83022..8fbbfd9 100644 --- a/Tests/expected/cosmosRun.out +++ b/Tests/expected/cosmosRun.out @@ -6,7 +6,7 @@ Life.sbx 1411 Snake.sbx 2175 Keys.sbx 663 Say.sbx 155 -Break.sbx 132 +Break.sbx 148 notes.txt 21 8 files > load what? diff --git a/Tests/manifest b/Tests/manifest index 1925873..a083bf4 100644 --- a/Tests/manifest +++ b/Tests/manifest @@ -285,7 +285,12 @@ cosmosSay | CosmOS/Source/cosmos.asm | run | cosmosSay # design and one that overwrites an instruction, since an overwritten instruction has to be # put back to continue and putting it back is the same act as disarming the breakpoint. # Every value shown comes out of the interrupt frame rather than the registers, because by -# the time the handler runs the registers are the handler's. +# the time the handler runs the registers are the handler's. Break sets all three of the +# pointers it owns and rotates them between the two stops, so every value recorded here is +# one something chose - it used to leave two of them holding whatever the shell had left, +# which tied this record to where CosmOS's code sits and made it churn on changes that had +# nothing to do with breakpoints. DP3 is left as the system set it, being where the program +# was entered. cosmosBreak | CosmOS/Source/cosmos.asm | run | cosmosBreak.in | - | disks/cosmos.img # The editor, which is the first program on this machine that makes a file a person typed: # every byte on every other image here was put there by the host tool. It is run twice in