;============================================================================== ; stub.asm: Stub added at the beginning of the patched program. ; ; $Id: stub.asm,v 1.5 2004/06/07 14:24:06 Olivier Exp $ ; ; - GhostBuster for TI89 Titanium - ; Copyright (C) 2004 Olivier Armand ; and Kevin Kofler ; ; This program is free software; you can redistribute it and/or modify it ; under the terms of the GNU General Public License as published by the Free ; Software Foundation; either version 2 of the License, or (at your option) ; any later version. ; ; This program is distributed in the hope that it will be useful, but WITHOUT ; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or ; FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for ; more details. ; ; You should have received a copy of the GNU General Public License along with ; this program; if not, write to the Free Software Foundation, Inc., 59 Temple ; Place - Suite 330, Boston, MA 02111-1307, USA. ; ; In addition, as a special exception, Olivier Armand and Kevin Kofler give ; permission to link the code of this program with the ttunpack decompression ; library by the TI-Chess Team, and distribute linked combinations including ; the two. You must obey the GNU General Public License in all respects for ; all of the code used other than the ttunpack decompression library. If you ; modify this program, you may extend this exception to your version of the ; program, but you are not obligated to do so. If you do not wish to do so, ; delete this exception statement from your version. ; ;============================================================================== xdef STUB_SIZE xdef StubHead xdef StubRunPrgm ; to patch the stub of kernel-based programs ; #include "patch.h" STUB_SIZE dc.l StubTail-StubHead ; This stub is executed before the patched program's code. ; It must not contain any relocation, and must be optimized as much as ; possible because all the patched programs have to carry it. ; The code works both for nostub and kernel-based programs, with a few ; patches. The bsr of the kernel stub code of kernel-based programs should not ; return, so tricks must be used to fool this stub and the loader code if ; instructions have to be executed after the program's execution. ; Note the nostub comments of a patched program won't be seen anymore, but ; only few of these programs have comments. StubHead: ; <-- Code can be added here --> StubRunPrgm: ; caution, the offset of the following bsr will be patched in kernel-based programs ;bra.w StubTail ; run the real program ; Constants are used instead of the assembly instruction to avoid linker-side branches ; optimization that would convert the bra.w into a bra.s dc.w $6000 dc.w StubTail-* StubTail: ; The real program follows in nostub programs...