[TI-ASM] Hooks?!?
Moderator: MaxCoderz Staff
[TI-ASM] Hooks?!?
So, why I wait to get my USB cable, I decided to take a look into hooks. After a day or so of googleing and hours of banging my head trying to get it to work, I got no where... Right now I'm thinking that its not getting the Raw Key Hook initializing right. I was just hoping someone could give my a pointer.
- tr1p1ea
- Maxcoderz Staff
- Posts: 4141
- Joined: Thu 16 Dec, 2004 10:06 pm
- Location: I cant seem to get out of this cryogenic chamber!
- Contact:
You can find information about hooks here:
http://wikiti.denglend.net/index.php?ti ... ks:By_Name
Some examples too .
http://wikiti.denglend.net/index.php?ti ... ks:By_Name
Some examples too .
k, heres my code, that dosnt work:
My guess is that I'm using the wrong b-call (ChkFindSym). I don't know of any b-calls that will get the page that the app is on.
Code: Select all
include "../ti83plus.inc"
EXT_APP equ 1
cseg
; Header
StartApp:
B_CALL ChkFindSym
LD A, B
LD H, D
LD L, E
B_CALL RawKeyHook ;EQU 4F66h
B_JUMP JForceCmdNoChar
TestHook:
db 83h
cp kAppsMenu
jr z,AppsKey
cp kPrgm
ret nz
ld a,kAppsMenu
or a
ret
AppsKey:
ld a,kPrgm
or a
ret
-
- Calc King
- Posts: 2195
- Joined: Sun 27 Mar, 2005 4:06 am
- Location: sleeping
- Contact:
Code: Select all
ld a,kAppsMenu
or a
ret
- tr1p1ea
- Maxcoderz Staff
- Posts: 4141
- Joined: Thu 16 Dec, 2004 10:06 pm
- Location: I cant seem to get out of this cryogenic chamber!
- Contact:
Before the hook will install you need to pass to it the location in which it is stored. You are using ChkFindSym, however you arent giving it the appropriate information.
Better to use FindAPP:
That should be the correct setup, you will have to put your hook code in there of course.
Moved to Programming Help, seemed more fitting.
Better to use FindAPP:
Code: Select all
ld hl,AppName
B_CALL Mov9toOP1
B_CALL FindApp
jr c,Quit
ld hl,TestHook
B_CALL RawKeyHook
AppName:
.db AppObj,"TestHook",0 ; whatever your appname is
Moved to Programming Help, seemed more fitting.
-
- Calc King
- Posts: 1513
- Joined: Sat 05 Aug, 2006 7:22 am
Dulaithol, did you look at the examples, you can use in a,(6) to get the memorypage mapped to bank 1 which is normally at $4000, and that should be where your app is, therefore it should get the page your app is on.
and for de <-> hl there is ex de,hl
btw, don't pretend you're programming TI8x programs when you're making apps, they are not the same. ChkFindSym as first line will work in normal programs, not in apps. in a,(6) is not the right way to get the page of a program because programs are copied to $959D or something instead of memory mapped to $4000.
and for de <-> hl there is ex de,hl
Code: Select all
in a,(6)
ld hl,Hook
bcall(_setUpHook)
bjump(_JForceCmdNoChar)
Hook:
.db $83
;hook code
ret