I want to build an E Reader application for the Ti 84 +cse. How would you suggest going about this?

How do I access AppVars in an Assembly Program? Additionally, how do i access keystrokes?

Thanks,
Oda Hideyoshi
Dunno about Appvars, but keystrokes can be accessed in one of two (three?) ways.
The first is using one of the two bcalls made for this purpose:

Code:
bcall(_GetKey) ;//pauses the program until a key is pressed, then resumes program execution. Returns a key code in the A register.
bcall(_GetCSC) ;//functions like TI-BASIC's getKey command; it momentarily checks for a keypress, then almost immediately resumes program execution (regardless of whether a key was pressed or not). Returns a scan code in the A register.


The second method involves directly communicating with the hardware keypad. I don't know much about this, so someone else could probably explain it better. If this is your first ASM program and you're not worried about speed (and from your description of the program, it doesn't sound like you are) I'd recommend using a bcall.
How do I access (read/write) text data from/to AppVars on a Ti 84 + CSE
How do I create AppVars containing text on my Computer to be uploaded to my calc?
Here's my code from Buttonz for reading/creating a highscore app var:

Code:

;*Load High Scores*
Load:
;before we do anything crazy, get a pointer to the high score data
 ld hl,VarName ;find or create high score appvar
 bcall(_Mov9ToOP1)
 bcall(_ChkFindSym)
 jr nc,VarFound
CreateVar:
 ld hl,VarName
 bcall(_Mov9ToOP1)
 ld hl,70 ;high score app var is 70 bytes long (old = 65)
 bcall(_CreateAppVar) ;expecting os to handle a memory error
 push de
 inc de
 inc de
 ld hl,InitHighScoreData
 ld bc,70
 ldir
 pop de
 jr VarInRam
VarFound:
 ld a,b
 or a
 jr z,VarInRam
 ld hl,VarName
 bcall(_Mov9ToOP1)
 bcall(_Arc_Unarc) ;expecting os to handle a memory error
 jr Load ;find again in ram
VarInRam:
 inc de ;skip over size
 inc de
 ld (HighScoreTable),de ;store pointer to HighScoreTable


;Appvar info
VarName:
.db $15,"ButtonzD",0
InitHighScoreData:
.db "ASM BANDIT",0
.dw 9936
.db 11
.db "**********", 0,0,0,0
.db "**********", 0,0,0,0
.db "**********", 0,0,0,0
.db "**********", 0,0,0,0

HighScoreTable: ;points to start of high score data
.dw 0



Here's my code from Buttonz for reading keystrokes:

Code:

;--- UpdateKeys ---
;Stores pressed keys to KeyFlag
;doesnt allow repeating keypresses
 ld a,$fe   ; a=(||||,up,right,left,down)
 out (KeypadPort),a
 nop
 nop
 nop
 nop
 nop
 nop
 nop
 nop
 in a,(KeypadPort)
 and $06    ; a=(|||||,right,left,|)
 rra ; a=(||||||,right,left)
 ld b,a
 ld a,$ff
 out (KeypadPort),a
 nop
 nop
 nop
 nop
 nop
 nop
 nop
 nop
 ld a,$bf   ; a=(||,2nd,f1,f2,f3,f4,f5)
 out (KeypadPort),a
 nop
 nop
 nop
 nop
 nop
 nop
 nop
 nop
 in a,(KeypadPort)
 rla
 rla
 rla ; a=(f1,f2,f3,f4,f5,|||)
 rl b ; b=(|||||,right,left,2nd)
 and $f8
 or b       ; a=(f1,f2,f3,f4,f5,right,left,2nd)
 ld b,a    ;reset bit = button pressed
 ld a,$ff
 out (KeypadPort),a
 ld a,(OldKey)
 xor 255
 or b ;ignore key while held down
 ld c,a
 ld a,(KeyFlag)
 and c ;keep key clear if not acknowledged but add any new presses
 ld (KeyFlag),a ;reset bit = button pressed
 ld a,b
 ld (OldKey),a
 reti ;performed during interrupt (doesn't have to be though!)




MainKeyLoop:
 xor a
 ei
 halt
 di
 or a
 jp nz,Exit
 in a,(IntStatusPort) ;have on button exit immediately out of program
 bit 3,a
 jp z,Exit
 ld a,(KeyFlag)
 bit KF1,a
 call z,C1Press ;use calls to read simultaneous presses must save a!
 bit KF2,a
 call z,C2Press
 bit KF3,a
 call z,C3Press
 bit KF4,a
 call z,C4Press
 bit KF5,a
 call z,C5Press
 bit KLeft,a
 call z,ShiftLeft
 bit KRight,a
 call z,ShiftRight
 bit K2nd,a
 call z,IncreaseLevel ;2nd now skips level
 ld a,(UpdateFlag)
 or a
 call nz,UpdateBlocks ;addblock is called during update if needed
 ld a,(DrawFlag)
 or a
 call nz,DrawBlocks
 jr MainKeyLoop



KeyFlag: ;read to get keypresses
.db 0
OldKey: ;prevents buttons from being held down
.db 0



For the computer app I would write a program using VC++ where I could enter text that would save it as an appvar (basically just create a file header, throw in the text, write the checksum).
[/code]
Thank you very much! However, I am now a bit confused. Are there any good sources for learning how to work with AppVars?
  
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
Page 1 of 1
» All times are UTC - 5 Hours
 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

 

Advertisement