Hey guys, I need some help with hooks!
My KeyHook is working fine, but for whatever reason the ParserHook doesn't enable.
The code for the parserHook is only so dummy-like so that i easily find it in the emulator debugger
Code:
EDIT: Nevermind, runer found the bug, I was missing a .db $83 to tell the os that this is a hook
EDIT2: Having the same issue now with token hooks, they don't get triggered
Code:
My KeyHook is working fine, but for whatever reason the ParserHook doesn't enable.
The code for the parserHook is only so dummy-like so that i easily find it in the emulator debugger
Code:
.export
.binarymode intel
.inclabels "ti8x.lbl" ; Label file containing equates
#define _EnableHomescreenHook $4FAB
#define _EnableRawKeyHook $4F66
#define _EnableParserHook $5026
#define _DispTail $495D
#define _DispHead $495A
.deflong bjump(label) ; Jump macro
call BRT_JUMP0
.dw label
.enddeflong
.deflong bcall(label) ; Call macro
rst rBR_CALL
.dw label
.enddeflong
.defpage 0, 16*1024, $4000 ; Page 0 definition
.page 0
#define APPNAME "Vectors "
#define APPNAMELEN 7
#define APPPAGES 1
#include header.asm
run:
ld hl,keyHook
in a,(6)
bcall(_EnableRawKeyHook)
ld hl,parserHook
in a,(6)
bcall(_EnableParserHook)
bjump(_JForceCmdNoChar) ; Exit
keyHook:
.db $83
cp kMul
jr z,_keyHook_mulKey
jr ReturnNZ
_keyHook_mulKey:
ld hl,(editCursor)
dec hl
dec hl
ld a,(hl)
bcall(_IsA2ByteTok)
jr z,_keyHook_mulKey_Exit
inc hl
ld a,(hl)
ld b,a
ld c,0
cp tMul
jr nz,{+1@}
ld b,tAdd
ld c,1
@:
cp tAdd
jr nz,{+1@}
ld b,tMul
ld c,1
@:
ld a,1
cp c
jr nz,_keyHook_mulKey_Exit
ld (hl),b
bcall(_DispHead)
ld (editCursor),hl
bcall(_DispTail)
xor a
jr ReturnZ
_keyHook_mulKey_Exit:
ld a,kMul
jr ReturnNZ
parserHook:
or a
jr nz,ReturnZ
ld a,a
ld a,a
ld a,a
ld a,a
ReturnNZ:
or a
ret
ReturnZ:
cp a
ret
EDIT: Nevermind, runer found the bug, I was missing a .db $83 to tell the os that this is a hook
EDIT2: Having the same issue now with token hooks, they don't get triggered
Code:
.export
.binarymode intel
.inclabels "ti8x.lbl" ; Label file containing equates
#include "extraequ.inc"
#define _EnableHomescreenHook $4FAB
#define _EnableRawKeyHook $4F66
#define _EnableParserHook $5026
#define _EnableTokenHook $9BC8
#define _DispTail $495D
#define _DispHead $495A
#define customTokenPrefix $62
#define tScalarProduct $6240
#define tScalarProductLower $40
#define tCrossProduct $6241
#define tCrossProductLower $41
.deflong bjump(label) ; Jump macro
call BRT_JUMP0
.dw label
.enddeflong
.deflong bcall(label) ; Call macro
rst rBR_CALL
.dw label
.enddeflong
.defpage 0, 16*1024, $4000 ; Page 0 definition
.page 0
#define APPNAME "Vectors "
#define APPNAMELEN 7
#define APPPAGES 1
#include header.asm
run:
ld hl,keyHook
in a,(6)
bcall(_EnableRawKeyHook)
ld hl,parserHook
in a,(6)
bcall(_EnableParserHook)
ld hl,tokenHook
in a,(6)
bcall(_EnableTokenHook)
bjump(_JForceCmdNoChar) ; Exit
*snip*
tokenHook:
.db $83
ld a,d
*snip*
ret
ReturnNZ:
or a
ret
ReturnZ:
cp a
ret