Re: A92: fixed code


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

Re: A92: fixed code




Thanks.  A couple of questions:
What exactly is a heap?  Isn't Fargo on top of the heap so that if I did what you are suggesting, I
would overwrite Fargo code?

And how exactly can I set the interupt to trigger the code at a preset interval?

Xavier VASSOR - The Doors Team wrote:

> >I want to do write a little utility that would display the amount of
> >free memory on the status bar.  It would be updated at a certain
> >interval.  The way I see it is this: an interrupt is set that at the
> >given interval would jump to the routine.  The problem is that programs
> >aren't fixed in memory.  Does anyone know how to place some code in the
> >memory and ensure that it won't be moved or deleted by TiOS?
>
> The only way is that you make a resident program which would be located at
> the top of the memory.
> Here is a piece of code which copies a program at the top of the memory and
> links it with auto-int1:
>
>         move.w          #$700,d0
>         trap            #1                      ;ints off
>         bclr.b          #1,$600001              ;memory protection off
>         move.l          $64,old_int             ;get the old auto-int handler adress and saves it in
> a long variable.
>         lea             tios::globals+$18F6,a0 ;a0 points to the adress of the Top of heap
>         move.l          #endprog-start,d1       ;d1 is the size of your resident code
>         sub.l           d1,(a0) ;diminuates the adress of the top of heap
>         move.L          (a0),a0 ;a0 now points to the top of heap and not its adress
>         lea             start(pc),a1    ;load the adress of your resident code
>         move.l          a0,$64          ;changes the auto-int1 handler
>
>         subq.l          #1,d1
> \cpy    move.b          (a1)+,(a0)+     ;copies the resident code at
>         dbra            d1,\cpy ;the top of memory
>
>         bset.b          #1,$600001      ;mem protect on
>         clr.w           d0
>         trap            #1              ;ints on
>
> notes: -endprog is the label located just after the end of the resindent code
>         -the size of the resident code MUST be an even adress, of course.
>         -this code should work on every ROM version (1.x & 2.1). It should work on
> a 92+ but I'm not sure (just replace 'tios::globals+$18F6' with $4C00+$18F6)
>
> I hope this can help.
>
> Xavier VASSOR
> ---The Doors Team
> E-mail:xvassor@mail.dotcom.fr
> Doors Homepage: http://doorshome.home.ml.org
> ICQ:10241721



--
Anton Ivanov
ivanova@ucs.orst.edu
http://www.geocities.com/CapeCanaveral/Hangar/9136



Follow-Ups: References: