[A89] Re: aaaaaaaaaaaaaaaaaarrrrrrrrrrrrrrrrrrrrrrrrgggggggggggggggghhhh


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

[A89] Re: aaaaaaaaaaaaaaaaaarrrrrrrrrrrrrrrrrrrrrrrrgggggggggggggggghhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh!!!!




Here is how I debug complete and my other tsrs.  I have a macro called 
debug:

Debug MACRO
 move #1,ccr
\loop
 bcs \loop


It puts the calc into an endless loop.  I then right click on vti and 
select "enter debugger" and wallah I am in this loop.  using vti i unset 
the carry flag and I step through the code.  But sometimes vti puts me in 
the code of autointerupt 1.

I suggest you do this and watch how the registers get modified.

Good day.


-Samuel






Quoting Greg <newstome2001@yahoo.com>:

> 
> no, I'm not trying to take advantage of that buffer problem in
> outlook :) I AM
> fustrated though!
> 
> ok, I've got  this sample tsr that some of you no doubt have heard
> or even
> possibly seen...
> I want to get rid of the fixed-a2 flag or whatever...
> 
> to do that, when I call the next event hook in line, I need to
> push the event
> pointer to the stack and also place it in a2... easy right? I
> can't get it to
> work... I am beginning to hate C because it does stupid things...
> I like asm
> when it works... but of course assembly language never worked in
> the first
> place; someone just said it did and everyone else followed so they
> wouldn't look
> dumb... ok maybe not really... anyway...
> 
> here is the complete event handler from the sample tsr on my
> website. The rest
> can be found in my sample tsr at:
> http://www.geocities.com/gdietsche/index.html
> if you want/need to look at it.
> 
> I'll gladly take any optimizations, bug fixes, rants, raves,
> ideas, or help....
> 
> Thanks,
> Greg
> 
> p.s. what is the nbitem parameter stored in d2.b in the function
> userlib::smallmenu? Also, is it just me or is userlib buggy
> depending upon ams
> kernel etc...?
> 
> ___________________________________________
> // C Header File
> // Created 2/12/01; 9:18:22 PM
> 
> #ifndef __Handlerh__
> #define __Handlerh__
> 
> //function prototype(s)
> void AFunction(void);
> 
> ///////////////////////////////////////////////////////////////////////
> //the actual event handler... it is the first to recieve an event 
>  //
> //the _main function of event handlers in C if you will...        
> //
> ////////////////////////////////////////////////////////////////////
> void EventHandler(EVENT *ev)
> {
>  #ifdef OPTIMIZE_ROM_CALLS
>   asm("move.l %a5,-(%sp) /*support for OPTIMIZE_ROM_CALLS*/");
>   asm("move.l 0xC8,%a5 /*support for OPTIMIZE_ROM_CALLS*/");
>  #endif
> 
> ////////////////////////////////
> //Event Handler Starts here  //
> //////////////////////////////
>  if(ev->Type==CM_KEYPRESS)
>  {
>   //this is a lame example (good april fools joke though)
>    if(ev->extra.Key.Code=='a')
>    {
>      ev->extra.Key.Code='A';
> 
>     //proof that you can call functions
>      AFunction();
>    }
>  }
> //////////////////////////////
> //End of the event handler //
> ////////////////////////////
> //let the problems begin!!!
> asm("
>  move.l %1,%%a0    /*get the pointer to the next event hook in
> a0*/
>  /*move.l (%%a0),%%a0*/
>  tst.l (%%a0)      /*is it zero ?*/
>  jbeq FinishUp    /*it was zero so goto FinishUp*/
>  move.l %0,%%a2     /*Pass the pointer to the event in a2 for
> TEOS*/
>  move.l %%a2,-(%%sp) /*Pass the pointer to the event on the stack
> for most other
> event hooks*/
>  jsr (%%a0)       /*Run the event hook*/
>  addq.l #4,%%sp     /*Restore the stack*/
> FinishUp:         /*The exit point when there is no event hook to
> call*/
> "::"p"(ev),"g"(gpOldHandler):"a0","a2");
>  #ifdef OPTIMIZE_ROM_CALLS
>   asm("move.l (%sp)+,%a5 /*support for OPTIMIZE_ROM_CALLS*/");
>  #endif
>  /*
>  the inline asm takes the place of this code:
> 
>  the main reason for the inline asm is to make a2 contain the
> pointer to
>  the event as well as pushing it to the stack.
> 
>  void (*OldHook)(EVENT*);
>  ...
>  //get the address of the next TSR in line to be executed NULL if
> there is none
>   (unsigned long*)OldHook=*((unsigned long*)gpOldHandler);
> 
> //Call the old hook if there is one to be called
>   if(OldHook)
>    OldHook(ev);
> 
>    */
> }
> 
> 
> 
//////////////////////////////////////////////////////////////////////////
/
> //A Small function to prove that it is possible to call other
> functions //
> 
/////////////////////////////////////////////////////////////////////////
> void AFunction(void)
> {
>  ST_helpMsg("April Fools!");
> }
> 
> #endif
> 
> ___________________________________
> 
> 
> _________________________________________________________
> Do You Yahoo!?
> Get your free @yahoo.com address at http://mail.yahoo.com
> 
> 
> 



23 He (Elisha) went up from there to Bethel; and while he was going up on 
the way, some small boys came out of the city and jeered at him saying, 
"Go away, baldhead!  Go away, baldhead!  24 When he turned around and saw 
them, he cursed them in the name of the lord.  Then two she-bears came 
out 
of the woods and mauled forty-two of the boys.  25 From there he went on 
to Mount Carmel, and then returned to Samaria.

	- 2 Kings 2: 23-25



References: