changeset 1997:7a139783c287

Code added to modify MD
author boisy
date Sun, 19 Feb 2006 17:37:48 +0000
parents abf447bacf71
children 31ec6767f46c
files 3rdparty/p2mods/noice/calldbg.asm 3rdparty/p2mods/noice/noice.asm
diffstat 2 files changed, 11 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/3rdparty/p2mods/noice/calldbg.asm	Sun Feb 19 17:10:26 2006 +0000
+++ b/3rdparty/p2mods/noice/calldbg.asm	Sun Feb 19 17:37:48 2006 +0000
@@ -31,6 +31,7 @@
          fcb   edition
 
 message1 fcc   /Execution halted/
+         fcb   C$CR
 message2 fcc   /Execution resumed/
          fcb   C$CR
 start
--- a/3rdparty/p2mods/noice/noice.asm	Sun Feb 19 17:10:26 2006 +0000
+++ b/3rdparty/p2mods/noice/noice.asm	Sun Feb 19 17:37:48 2006 +0000
@@ -465,7 +465,7 @@
 
                ldd       R$PC,y
                exg       a,b
-               std       ,x++                PC
+               std       ,x                  PC
                ldy       <D.Proc             get SP from proc desc
                ldd       P$SP,y
                exg       a,b
@@ -503,7 +503,15 @@
                stb       R$CC,y
 
                IFNE      H6309
-               ldb       ,x+              MD register
+* Note: because the only way to write to the MD register is via immediate mode,
+* we must build a "ldmd #XX; rts" instruction on the stack then execute it in order
+* to avoid "self modifying" code.
+               ldd       #$113D           "ldmd" instruction
+               std       -6,s
+               lda       ,x+              MD register
+               ldb       #$39             "rts" instruction
+               std       -4,s
+               jsr       -6,s             call code on stack to modify MD
 
                ldd       ,x++
                exg       a,b