[TI-ASM] Hooks?!?

Got questions? Got answers? Go here for both.

Moderator: MaxCoderz Staff

Post Reply
Dulaithol
New Member
Posts: 5
Joined: Sat 27 Jan, 2007 6:08 pm
Location: Ohio

[TI-ASM] Hooks?!?

Post by Dulaithol »

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.
User avatar
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:

Post by tr1p1ea »

You can find information about hooks here:

http://wikiti.denglend.net/index.php?ti ... ks:By_Name

Some examples too :).
"My world is Black & White. But if I blink fast enough, I see it in Grayscale."
Image
Image
Dulaithol
New Member
Posts: 5
Joined: Sat 27 Jan, 2007 6:08 pm
Location: Ohio

Post by Dulaithol »

k, heres my code, that dosnt work:

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
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.
threefingeredguy
Calc King
Posts: 2195
Joined: Sun 27 Mar, 2005 4:06 am
Location: sleeping
Contact:

Post by threefingeredguy »

Code: Select all

        ld a,kAppsMenu 
        or a 
        ret
Why do you bother doing or a?
Image
LolBbq
New Member
Posts: 20
Joined: Thu 23 Nov, 2006 3:01 pm

Post by LolBbq »

To return a nz condition before exiting.
User avatar
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:

Post by tr1p1ea »

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:

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
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.
"My world is Black & White. But if I blink fast enough, I see it in Grayscale."
Image
Image
King Harold
Calc King
Posts: 1513
Joined: Sat 05 Aug, 2006 7:22 am

Post by King Harold »

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

Code: Select all

   in a,(6)
   ld hl,Hook
   bcall(_setUpHook)
   bjump(_JForceCmdNoChar)
Hook:
   .db $83
   ;hook code
   ret
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.
Post Reply