Omnimaga

Calculator Community => TI Calculators => ASM => Topic started by: DarkLechuga on January 31, 2012, 07:31:19 pm

Title: Asm for the TI84+
Post by: DarkLechuga on January 31, 2012, 07:31:19 pm
I have a TI84+, and want to learn how to program games for it in Asm. So far i haven't been able to find a tutorial for Asm programming for TI84+, so i've been using a cpl different tutorials for the 83+. Everything i've read says programs for the 83+ should run just fine on the 84+, but i've been having some minor difficulties. All i've done so far is make a few extremely simple programs clear the screen, move to a new line, display the "Done" message, and display text. When i run these programs thru the TI Flash Debugger for 83+, they run the way i intend, but when i send them to my calc and run them, they act funny. A program made to produce a few lines of text followed by a blank line runs fine on the debugger, but when on the actual calc, the text displays but then the "Done" message appears on top of (and obscuring) the text on the top right of the screen, and the cursor ends up over the text on the left hand side of the second row. It seems that on the 83+, when a program finishes, the cursor stays where the program left it, but on the 84+ it automatically reverts to left hand second row. Any ways to fix this??? Anything else i should know that differs between 83+ asm and 84+???
Title: Re: Asm for the TI84+
Post by: Yeong on January 31, 2012, 07:34:20 pm
maybe fiddle with CurCol and CurRow?
Title: Re: Asm for the TI84+
Post by: Deep Toaster on January 31, 2012, 07:53:43 pm
Hi and welcome, DarkLechuga. TI-84 Plus assembly should be identical in most ways, and since you're asking about text on the home screen, I'll point you to this lesson (http://eeems.omnimaga.org/files/Resources/Tutorials/ASMin28Days/lesson/day11.html) in the 28 Days tutorial. Good luck!
Title: Re: Asm for the TI84+
Post by: Juju on January 31, 2012, 08:36:33 pm
Yeah, the TI-84+ is backwards compatible with the 83+, the only thing that differs is that the 84+ has additional BCALLs for the additional hardware, the rest should be the same as the 83+. And the .org value too, if I'm right?
Title: Re: Asm for the TI84+
Post by: Geekboy1011 on January 31, 2012, 08:38:16 pm
Yeah, the TI-84+ is backwards compatible with the 83+, the only thing that differs is that the 84+ has additional BCALLs for the additional hardware, the rest should be the same as the 83+. And the .org value too, if I'm right?

na teh .org value is the same. the only differance is the bcalls for the hardware and the ability to use 15mhz speed instead of 6
Title: Re: Asm for the TI84+
Post by: DJ Omnimaga on January 31, 2012, 08:43:32 pm
Also on the 84+, there is extra RAM too (hidden from the user). It's 16 KB of extra space on models from April 2007 and later and 80 KB for 2004-March 2007 models. I don't recommend using the extra RAM, the crystal timers nor the clock, though, if you plan to reach a larger audience of TI-83 Plus owners, unless your game is just too much for the 6 MHz models and you only plan a TI-84 Plus release.

Welcome here by the way. Good luck with ASM programming. :)
Title: Re: Asm for the TI84+
Post by: DarkLechuga on January 31, 2012, 08:57:44 pm
I've fiddled with Currow and Curcol some, it still resets to the aforementioned cursor position when the program finishes. I seriously hope i'm not the only one with this problem... Read thru the 28 days tutorial page Deep Thought linked, i'm actually using both 28 days alongside another tutorial (i believe by someone named jeff chai) to learn. Thanks for the warm welcome everyone!
Title: Re: Asm for the TI84+
Post by: Geekboy1011 on January 31, 2012, 09:01:23 pm
mind pasting your source code? i can take a look and try to help ^^
Title: Re: Asm for the TI84+
Post by: DarkLechuga on January 31, 2012, 09:24:45 pm
Here it is:

.nolist
   #include "ti83plus.inc"
.list

.org $9D93
.db t2ByteTok, tAsmCmp
   b_call(_ClrLCDFull)
   ld hl,0
   ld (CURCOL),hl
   ld hl,0
   ld (CURROW),hl
   ld hl,txtMsg
   b_call(_PutS)
   b_call(_NewLine)
   ret
txtMsg:
   .db "Displaying text "
   .db "on the home page"
   .db "using a new call"
   .db "that may or may "
   .db "not work.       ",0
.end
.end

This program displayed fine on the debugger with the "Done" and cursor below all the text when the program finished, but on my 84+ the "Done" and cursor were on the first and second rows on top of my text.
Any advice is welcome here (although preferably pertaining to the original question), i'm thoroughly new to Asm and need all the help i can get. Thanks again!
Title: Re: Asm for the TI84+
Post by: Quigibo on January 31, 2012, 09:28:35 pm
I think the "Done" covering the text is the normal behavior and that the emulator you are using is incorrect.  Regardless, I would add a res 5,(iy+0) to the beginning of the program which tells the OS to not display "Done" at the end.  Also, I recommend WabbitEmu instead as it has more features and emulates more accurately.
Title: Re: Asm for the TI84+
Post by: ralphdspam on January 31, 2012, 10:06:17 pm
I think the "Done" covering the text is the normal behavior and that the emulator you are using is incorrect.  Regardless, I would add a res 5,(iy+0) to the beginning of the program which tells the OS to not display "Done" at the end.  Also, I recommend WabbitEmu instead as it has more features and emulates more accurately.
Also on the topic of text display, some BCALLs, like DispHL, do not work in mathprint mode.
Title: Re: Asm for the TI84+
Post by: chickendude on February 01, 2012, 07:38:40 am
Be careful using HL to store one byte into an address, when you're storing HL into CURCOL, you're also updating CUROFFSET. Check out ti83plus.inc:
Quote from: ti83plus.inc
curRow               EQU  844Bh
curCol                EQU  844Ch
curOffset            EQU  844Dh
As HL is a 2-byte register, you load the value of L into CURCOL ($844C) and the value of H into CURCOL+1 ($844D aka CUROFFSET). You could use the accumulator (A) instead, or just load HL into CURROW to update both CURROW and CURCOL.
Title: Re: Asm for the TI84+
Post by: DarkLechuga on February 01, 2012, 08:40:18 am
Quigibo: My little brother has an 83+, i put the program on it and ran it and it worked okay, with the cursor below all the text. It seems the 84+ automatically resets the cursor while the 83+ just picks it up where the program left it (which is what i want). Any way to make it not reset the cursor? Also, when you say "the beginning of the program" where exactly do you mean?

Chickendude: Thanks for the tip, I'm still getting the hang of registers. What does CUROFFSET do? Also, what exactly does HomeUp do?
Title: Re: Asm for the TI84+
Post by: chickendude on February 01, 2012, 02:09:47 pm
To be honest, i have no idea what curOffset is, it may have something to do with text input but i'm not sure. _HomeUp should set curRow/curCol to 0 ( ld hl,0 / ld (curRow),hl ). A common "trick" is to pause the program (_getKey) before ending. Apart from that, you can try changing curRow/curCol before exiting, it might just be a change in your OS version (what version OS do you use?). Maybe you could try getting a ROM from your calc and see if it still displays differently? And the TI Flash debugger pretty much sucks, it's slow and not very accurate. Try WabbitEmu/TiEmu, both have nice debuggers and are much more accurate.
Title: Re: Asm for the TI84+
Post by: DarkLechuga on February 01, 2012, 04:58:41 pm
My 84+ has v2.53MP. Downloaded WabbitEmu, i'll take it for a spin tonight if i have the time. And what exactly do you mean, get a ROM from my calc, and how do i do that? Sorry if that's a stupid question :|
Title: Re: Asm for the TI84+
Post by: chickendude on February 01, 2012, 05:29:02 pm
Well, to use an emulator you need a ROM. I'm not sure if WabbitEmu includes a ROM dumper or not. The ROM dumper is what you use to get a copy of your 84+'s ROM onto your computer. I'm pretty sure VTI came with one, though i'm not sure if it'll work for the 84. If not search ticalc, (i found this one: http://www.ticalc.org/archives/files/fileinfo/373/37341.html), and that should help you get started.
Title: Re: Asm for the TI84+
Post by: DarkLechuga on February 01, 2012, 08:04:28 pm
Got WabbitEmu up and running (it did indeed include a ROM dumper). Ran the text display program whose source code i posted earlier, results are in the attached screenshot.

Also, i modified the program to set the cursor in the bottom left of the screen right before the program finished, but when the program was done the cursor still reset itself to the position seen in the screenshot.
Title: Re: Asm for the TI84+
Post by: thydowulays on February 01, 2012, 08:07:50 pm
Hmm, I think I know what the problem is. On your calc, on the home screen, press MODE then scroll down to the option that says MathPrint or Classic. Change it to classic.
Title: Re: Asm for the TI84+
Post by: DarkLechuga on February 02, 2012, 12:49:28 pm
Seems to have fixed the problem. Many thanks! What exactly does changing that setting do?
Title: Re: Asm for the TI84+
Post by: thydowulays on February 02, 2012, 03:48:24 pm
Well, in the newer operating systems, (the ones with the MP after them), when you type text, by default it keeps the text on the same line.

Meaning if you type something thats too big to fit on the screen, it won't move down a line, it will stay on the same line but it will have an arrow after it and you can see the rest of it.

When you change it to classic, and type something, the word "wraps" or moves to the next line by default.
Title: Re: Asm for the TI84+
Post by: Deep Toaster on February 02, 2012, 11:15:39 pm
DarkLechuga, the reason the code they gave you uses HL to store 0 to (CurRow)—and not (CurCol)—is exactly as chickendude said: HL stores two bytes, so by storing two bytes of zero to (CurRow), you're really storing one null byte to (CurRow) and another null byte to the byte right after it, which happens to be (CurCol), effectively setting the x- and y-coordinates of the cursor to zero at once.

So you shouldn't take another few instructions to store another two bytes of zero starting at (CurCol), because
Title: Re: Asm for the TI84+
Post by: DarkLechuga on February 10, 2012, 07:37:03 am
Where can i find a complete list of all b_calls, with descriptions of each?
Title: Re: Asm for the TI84+
Post by: Xeda112358 on February 10, 2012, 08:23:10 am
You can download the TI-83+ SDK from education.ti to get a good number of bcalls and what they do. As well, you can use this site to get the details of a large number of otherwise undocumented bcalls:
http://wikiti.brandonw.net/index.php?title=Category:83Plus:BCALLs:By_Name
Title: Re: Asm for the TI84+
Post by: DarkLechuga on February 10, 2012, 04:45:33 pm
Many thanks Xeda.
Title: Re: Asm for the TI84+
Post by: Xeda112358 on February 10, 2012, 07:43:40 pm
No problem :) I had similar troubles, too, and I could not find the documentation :/