Re: A86: A86 : Protocol additions


[Prev][Next][Index][Thread]

Re: A86: A86 : Protocol additions



Dan Eble wrote:

>  No, the best protection would be a debugger that would pretend to execute
>  the program and make sure that it doesn't do undesirable stuff (like 
>  overwrite the stack).  A debugger should not be much more difficult to
>  write than a disassembler, and I already have one of those.  The question
>  is where to put the debugger so that _asm_exec_ram is free.  Ooo! I have
>  an idea:
>  
>     1. Relocate the debugger to some free space in RAM page 1.
>     2. Whenever the debuggee wants to access a different RAM page, switch
>        the $4000 page, do the dirty work, and switch it back.
>  
>  There are still some problems with this scheme.  For example, some of the
>  system calls change the $8000 page.  Those calls would have to be emulated
>  somehow, or thunked by a procedure somewhere above $C000.  Also, we still
>  don't know exactly how routines use RAM page 1.  It might not be a
>  suitable place.

That makes absolutely no sense.  How would a debugger know if the program is
trying to execute code that will screw up the calc?  And how would it keep
track of the pushes/pops, and the calc would have to run the asm program THRU
the debugger, using it as a shell/loader/whatever (not sure which it would
be?) and that would require it to be stored at _asm_exec_ram...  It would
also somewhat requre multitasking...  because the debugger would have to look
at each command before it runs it.  Actually, it COULD check the push/pops
somewhat, like this:

 pop hl
 ld (TopOfStack),hl
 push hl
 call ProgStart
 pop hl
 ld de,(TopOfStack)       ;I know this doesn't exist, but I don't feel like
writing it out...
 call _CP_HL_DE
 call nz, Fix
 push hl
 ret
Fix:
 pop hl
 ld de,(TopOfStack)       ;Same here
 call _CP_HL_DE
 jr nz, Fix
 ret

Maybe something like that?

~Stephen Hicks


Follow-Ups: