Unimportant part of the post

Hello, all! Some of you probably remember me from way back in December 2014. I had a busy life after that, and was forced to cease all programming projects. However, with the end of the school year, I can now resume.

I have decided to abandon the fake reset program, perhaps to be continued at some later date. In addition, I have decided to keep the password program as it is, without automatically running when the calculator is turned off, which would involve turning the program into an app. However, the password program will eventually be posted on Cemetech archives.

In addition, I no longer use Spasm, but rather the online assembler that Kerm made.

Important part of the post

To get familiar once again with Z80 ASM for the TI-84+CSE, I am making a program that changes the background/foreground color of text on the home screen. I have already done this with the Hello World program; the problem is not the color change itself.

The program should work by reading Ans, which will be a string. The first character will be 0-E, colors for the foreground (based on the color menu on the TI-84+CSE). The second character will be 0-E, colors for the background (also based on the menu).

Thus, in a TI-BASIC program, to display green text on the screen, one would do:

"5A":Asm(prgmCOLOR

And to switch back to normal:

"3A":Asm(prgmCOLOR

My question is: how does one find Ans? I think that I can figure out how to read Ans, but not how to find it in the first place.
I believe the easiest way to find Ans is to do the following:
Code:
bcall(_AnsName)
rst rFINDSYM ;thanks, Runer
That loads the name of the Ans var into OP1, then finds it. It returns c set if the variable was not found, or hl -> VAT entry, de -> start of variable, b = page if it was found.
Can Ans actually be archived? I imagine it'll always be in RAM (so you probably don't need to worry about the value of b/it being archived). Generally it's easier to work with hl, so you'll ex de,hl to put the start of the variable data in hl.

EDIT: Also, nice to see you back sc...err, yeah!
With the help of Kerm and Runer112, I have decided to revise the input system. The input will still be in Ans; however, instead of a string with two hex digits, the format will now be a complex number, in which the imaginary part is the background color, and the real part is the foreground color. This way, I can use bcall(_RclAns), and the foreground color will be in OP1, while the background color will be in OP2. In addition, colors can now be inputted as colors.

For example, to change to a blue background and green foreground, the TI-BASIC code would be:

BLUEi+GREEN
Asm(prgmCOLOR
I apologize for double-posting, but I have a progress update.

I got the foreground color change working. Here is my ASM code:

Code:
.nolist
#include "ti84pcse.inc"
#define PutMapFlags $4a
#define PutMapUseColor 4
.list
   .org UserMem-2
   .db tExtTok,tAsm84CCmp
   
   bcall(_RclAns)
   bcall(_ConvOP1)
   sub a,9
   bcall(_GetColorValue)
   ld (textFGcolor),de
   set PutMapUseColor,(iy+PutMapFlags)
   ret


And I tested it the TI-BASIC prgmSTUF:

Code:
BLUE
Asm(prgmCOLOR
Disp "H


Here is how it turned out:



This is the first time that an ASM program has ever worked the first time for me. However, I am still not finished: I must now do the background color. I will post in Cemetech archives when I am finished.

Update:
I have gotten background color working, too. That program was much easier than I expected it to be. Here is the code:

Code:
.nolist
#include "ti84pcse.inc"
#define PutMapFlags $4a
#define PutMapUseColor 4
.list
   .org UserMem-2
   .db tExtTok,tAsm84CCmp
   
   bcall(_RclAns)
   call Ready
   ld (textFGcolor),de
   bcall(_OP2ToOP1)
   call Ready
   ld (textBGcolor),de
   set PutMapUseColor,(iy+PutMapFlags)
   ret
Ready:
   bcall(_ConvOP1)
   sub a,9
   bcall(_GetColorValue)
   ret


Since the code works perfectly, I won't bother including a screenshot. I'm about to upload to ticalc.org and Cemetech archives.
I suppose I'm a bit late, and the complex number system is probably easier to use, anyway, but I've already written programs that accept input from Ans as a string. I think my detokenizer Axiom https://www.omnimaga.org/the-axe-parser-project/%28axiom%29-detokenize-routine-for-axe-input-command/msg330465/#msg330465 shows how to do it somewhere in that thread. Also, robotfindskitten http://www.ticalc.org/archives/files/fileinfo/457/45783.html can do it, too, because it can accept the name of an external NKIs list. Both programs have source code included.

EDIT: Why can't I make URLs work?

Edit by admin: Use %28 and %29 instead of ( and ) in URLs. ( and ) are not technically valid URL characters.
  
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