version= echo $Id: pmars.mac,v 1.1.1.1 2000/08/18 14:34:50 iltzu Exp $ pmars.mac: default macro file for pmars (version 0.5+) The macros below include bindings for DOS extended keys; e.g. pressing the "F10" function key executes the "shell" command (the space before "sh" prevents it from being repeated by ). To change the key bindings, simply edit the command chain after the equal sign. Additional macros (up to 100) can be added. Recognized "hot-key" names apart from those below are "alt-a" thru "alt-z" and "ctrl-a" thru "ctrl-z". You can also invoke these macros "manually" as you would any other macro, e.g. "macro f1". This works also for non-PCs. The cdb macro language supports macro nesting, loops, conditional (if-) statements. For a complicated macro, see "check" below. key-x macros: issued from the coreviewer Displays info and continues: key-p= progress~registers~go key-l= m f5~go PC function keys f1= close~cls~help f2= write pmars.log f3= write f4= @skip 1000~m f5~! f5= switch 2~@step~cls~l pc2-6,pc2+6~switch~@step~cls~l pc1-6,pc1+6 f6= switch 1~m f7~swi~cls~echo @a~m @a_f~l-1,+1~echo @b~m @b_f~l-1,+1 f7= @s~cls~l-5,+5~ech a~m a_f~l-1,+1~ech b~m b_f~l-1,+1~@l pc f8= m f7~swi~m f7~swi f9= progress~go f10= sh The mouse click executes this macro mousel= cls~l ,+lines-4 mousem= m mousel mouser= cls~l ,+lines-4~@l -lines+4 mouse= m mousel Replacements for "step", "go", .., using the two-panel display alt-g= sw 2~@go~m d_env alt-s= sw 2~@step~m d_env alt-c= sw 2~@con~m d_env alt-t= sw 2~@thread~m d_env d_env=cls~-5,+5~echo A,B:~m a_f~.~m b_f~.~echo @A,@B:~m d_env2 d_env2= m @a_f~.~m @b_f~.~echo *A,*B:~m *a_f~.~m *b_f~.~sw 1~l pc Accessories, set the current address to A/B-pointer a_f= @l pc~@l .+a b_f= @l pc~@l .+b @a_f= m a_f~@l .+b @b_f= m b_f~@l .+b j~reset~if d<30~ca i,j%c~@ca i=i+1 -------------------------------------- pcur - count number of processes pointing to the current address pcur= m _pstep~if.==z~@ca n=n+1~m _pend These two (sub)macros are shared code: _pstep=@ca z=.,c=n=0~!!~@pq~@l c=(c+1)%($+1)~@pq off _pend=if c!=0~!~ca n~@l z -------------------------------------- pseg - calculates how many processes are operating inside segment [x,y] pseg= m _pstep~m _ptest~m _pend _ptest= if y>=x && x<=. && y>=. || y=.)~@ca n=n+1 -------------------------------------- stone-debug executes until code is executed that has been modified by the stone's MOV instruction. This may be a self-modification in which case this macro is useful for optimizing the stone's constants. stone-debug= @$~if !o~@ca o=-1~se mov.i<*t~if .==$~m _sde~mov on~@ca m=.~m _sd Message: MOV is not traced _sde= echo Trace the stone "MOV <" instruction before calling stone-debug~res Main loop: executes until the next trace. If this isn't the MOV address, we have modified ourselves. Else, if the MOV instruction points to itself, we are about to modify ourselves. Else, trace the addresses referenced by the MOV and continue. _sd=!!~@go~t o~if(n=.)!=m,x=+a~!!~u.~m _sdf~!1~m _sds~t c~@ca o=n+x~m _sdt~! Test whether MOV points to itself. Remove the d comparison if B-mode is direct _sdt= @l n~if A==0||B==0||c==n||d==n~m _sdf Save indirect A and B address in c and d. Change: A-mode B-mode < @a_f >$ @b_f _sds= m