[TI-ASM] GetCSC hoook

Got questions? Got answers? Go here for both.

Moderator: MaxCoderz Staff

Post Reply
LolBbq
New Member
Posts: 20
Joined: Thu 23 Nov, 2006 3:01 pm

[TI-ASM] GetCSC hoook

Post by LolBbq »

I'm trying to make the GetCSC hook record a keypress if a keypress is detected, but exit if no keypress is detected. It may seem easy, but I think it's a bit harder than it seems. Once in A=$1b mode, a ld a,b and then or a can easily determine whether there was a keypress. However, such code makes the cursor flash repeatedly (it sort of becomes grayscale-esque). Any suggestions?
User avatar
Dwedit
Maxcoderz Staff
Posts: 579
Joined: Wed 15 Dec, 2004 6:06 am
Location: Chicago!
Contact:

Post by Dwedit »

Try not destroying any registers!
You know your hexadecimal output routine is broken when it displays the character 'G'.
King Harold
Calc King
Posts: 1513
Joined: Sat 05 Aug, 2006 7:22 am

Post by King Harold »

this page says: "Return with NZ set"

which does not make any sense to me, NZ means that the Z flag is NOT set, so NZ is never set.

I'd try returning Z and see what happens..
LolBbq
New Member
Posts: 20
Joined: Thu 23 Nov, 2006 3:01 pm

Post by LolBbq »

Code: Select all

GetCSCHook:
	.db $83
	cp $1b
	ret nz
	di
	exx
	ld a,(Counter-$9d95+AppBackUpScreen)
	or a
	jp m,SetNormalKey-$9d95+AppBackUpScreen
	dec a
	ld (Counter-$9d95+AppBackUpScreen),a
	ld h,0
	ld l,a
	ld de,OrderOfKeys-$9d95+AppBackUpScreen
	add hl,de
	ld a,(hl)
	or a
	exx
	ei
	ret
SetNormalKey:
	ld a,b
	or a
	jr z,NoKeyPressed
	exx
	ei
	ret
NoKeyPressed:
	xor a
	exx
	ei
	ret
Counter:
	.db 10
OrderOfKeys:
	.db sk5,sk3,sk5,sk6,sk2,sk9,sk5,sk4,sk1,skDecPnt,sk3
EndGetCSCHook:
At least it doesn't cause the cursor to flash, but now it just displays an 'E' and stops.
King Harold
Calc King
Posts: 1513
Joined: Sat 05 Aug, 2006 7:22 am

Post by King Harold »

why do you move that OrderOfKeys to appbackup? did you know $9d95 has nothing to do with it? it is for programs and hooks do not run well from programs (theoretically they could.. but don't.).
LolBbq
New Member
Posts: 20
Joined: Thu 23 Nov, 2006 3:01 pm

Post by LolBbq »

This is why:

Code: Select all

	ld hl,AppBackUpScreen
	in a,(6)
	bcall($4f7b)
King Harold
Calc King
Posts: 1513
Joined: Sat 05 Aug, 2006 7:22 am

Post by King Harold »

that is going to annoy you, because it will be swapped in at $4000 afaik, so you'll have to relocate to $4000 + (appbackup-$8000) + offeset which is (appbackup - $4000) + offset
King Harold
Calc King
Posts: 1513
Joined: Sat 05 Aug, 2006 7:22 am

Post by King Harold »

forgot to mention you'll have to IN A,(7)..

and you'll crash the calc if something overwrites the hook someway halfway in it and leaves the $83 so it will be a "valid" hook..
Post Reply