Omnimaga

Calculator Community => TI Calculators => ASM => Topic started by: Joshuasm32 on April 27, 2013, 02:17:48 pm

Title: [ON] Add
Post by: Joshuasm32 on April 27, 2013, 02:17:48 pm
I there a way to do this through ASM on the TI-84 Plus SE?

Code: [Select]
:ASM(prgmPRGMNAME
:If K=101  //Or whatever the keystroke is for [ON] in the program; Can it be stored to K instead of Ans?
:___

 :w00t:
Title: Re: [ON] Add
Post by: Matrefeytontias on April 27, 2013, 02:39:14 pm
Actually it's pretty easy, but I don't really have the time to put a prog right now :-X hopefully someone will notice this thread.
Title: Re: [ON] Add
Post by: aeTIos on April 27, 2013, 03:01:26 pm
What do you want to do actually? get a keystroke for On? or do you want to catch an [on] keypress in basic o.o
Title: Re: [ON] Add
Post by: Joshuasm32 on April 27, 2013, 03:09:51 pm
Can I keep [ON] from breaking the program and have it register as a keystroke in either variable K (preferred) or Ans by using an ASM sub-program?   ???
Title: Re: [ON] Add
Post by: Dapianokid on April 27, 2013, 04:01:20 pm
codebender, yes. If you know ASM, you can learn how to easily with tutorials on tifreak. However, if you do not, good luck searching for one.
The best I can do is give you onblock, but it doesn't have a keypress registry for ON
Title: Re: [ON] Add
Post by: dinosteven on April 27, 2013, 04:35:01 pm
Well, you could compile a program in Axe for NoShell:
Code: [Select]
:.KEY
:Repeat getKey //only use this if you want it to loop
:End
:getKey->Ans
And it will give you getKey codes in Ans, [ON] having a code of its own. (Ans is the only variable I know how to access with Axe.) Keycodes will be different from those in BASIC; look at
http://axe.eeems.ca/keycodes.png
Hope that works.
Title: Re: [ON] Add
Post by: Xeda112358 on April 27, 2013, 04:51:07 pm
The only trouble will be that you need to have a custom interrupt to make sure the OS doesn't throw an error. Hopefully somebody with time comes along to help :/ Essentially, you would need the ONBLOCK program active to prevent ON causing an error, then a separate program to scan for key presses and ON. That would essentially be:
Code: [Select]
AsmPrgm
DB03
E608
EE08
2003
3A3F84
EF8C47
EFBF4A
C9
It returns 8 if ON is pressed, else it returns the values in the link that dinosteven linked to.
Title: Re: [ON] Add
Post by: Dapianokid on April 27, 2013, 05:01:30 pm
Teach me hex, oh wise Xeda
Title: Re: [ON] Add
Post by: Streetwalrus on April 27, 2013, 05:09:21 pm
Dapianokid : just look at some z80 ASM reference, they often have opcodes. ;)
Title: Re: [ON] Add
Post by: Joshuasm32 on April 28, 2013, 08:12:33 am
Thank you!   :thumbsup:
Title: Re: [ON] Add
Post by: thepenguin77 on April 29, 2013, 09:13:18 pm
Well, I spent all day on this. But here's what I came up with:

Code: [Select]
ld a, $98
ld ($9900), a
inc a
ld i, a

ld h, a
ld d, h
ld bc, $100
ld l, c
ld e, b
ldir

ld a, e ; e is 1
bcall(_setXXOp1)
bcall(_decO1Exp)

ld hl, data
ld de, $9898
ld bc, dataEnd-data
ldir

im 2


bcall($4744) ; basic getkey, stores it in op2
in a, (04)
and 8
jr z, isOn
bcall(_zeroOp1)
isOn:
bcall(_fpAdd)
bcall(_stoAns)


ret



data:
ex af, af'
bit 1, (iy + 8)
jr nz, $+4
im 1
;$$:
in a, (04)
and 1
jr z, noProblemHere
xor a
out (03), a
ld a, %00001011
out (03), a
noProblemHere:
ex af, af'
rst 38h
ret

dataEnd:

If you wait a couple hours, someone will make this a lot smaller.

The way it works is that you call the program (attached) just like getKey, everything works exactly the same except that if ON is being pressed, it adds 0.1 to the number. You only have to call it once to block the ON button. It will unblock itself when your program quits (and it may even unblock in input, though, I haven't tried).

(The reason it took all day was because I had a rather fatal error in zStart that prevented this from working.)