scAFwATLxpKzRCmVaHv wrote:
I got a TI-84 Plus CE yesterday, which of course is programmed with eZ80 Assembly rather than Z80 Assembly. I am unfamiliar with eZ80 Assembly. I know that I have to change some of the addresses, but what else needs to be changed to get the password program to work on a TI-84 Plus CE?


Honestly, it really depends on how much you want to take advantage of the ez80. For your program, not much will need to change, but keep these in mind:

You will need spasm-ng, which you can get here:
https://github.com/alberthdev/spasm-ng/releases/tag/v0.5-beta.1

You will also need the updated (currently in progress) include file:
http://wikiti.brandonw.net/index.php?title=84PCE:OS:Include_File

And that's all that you really need for development. Now, your new program header will look something like this:

Code:
.nolist
#include "ti84pce.inc"
.list
 .org userMem-2
 .db tExtTok,tAsm84CeCmp

 ; Your code here

 ret


From there; you can just program how you would a z80. You will probably want to remain in ADL mode, which basically just means that address space is 24-bit; but don't worry about that too much.
Also, system calls are no longer needed to be bcalls(). So:

Code:
 bcall(_clrscrn)

is just

Code:
 call _clrscrn

Or you can use this simple macro if you prefer to distinguish between the two easier:

Code:
#macro bcall(x)
 call x
#endmacro


Also, loading and saving register pairs (hl,de,bc, etc.) is now operated in 24-bit (well, technically).

You can find out more by taking a look at the documentation:
http://myimages.wdfiles.com/local--files/start/UM0077.pdf

And also some of the programs in the archives:
http://www.cemetech.net/programs/index.php?mode=folder&path=/84pce/
Thanks! The thing you said about loading and saving register pairs is only in ADL mode though, right?

My program recompiled successfully, except I don't know the values of:

apdSubTimer
tExtTok
tAsm84CeCmp

ApdSubTimer might be unknown, but can anyone please tell me the values of the latter two?
scAFwATLxpKzRCmVaHv wrote:
Thanks! The thing you said about loading and saving register pairs is only in ADL mode though, right?

My program recompiled successfully, except I don't know the values of:

apdSubTimer
tExtTok
tAsm84CeCmp

ApdSubTimer might be unknown, but can anyone please tell me the values of the latter two?

Sure; I've actually updated the include file to have all three of those and a whole lot more. As for loading and saving in ADL mode; you will most likely want to remain in ADL mode for your entire program, as this will lead to less headaches (It is enabled by default when assembling, so nothing to worry about there). To store a 16-bit number to a 24-bit address, such as 'ld (penCol),hl', simply change this to 'ld.sis (penCol),hl'. The .sis part tells the CPU controller to only use 16bits of data, and that address should use MBASE, which is specified as 0D0h, or the RAM address equivalent. Hope this helps! Smile

Updated Include: http://wikiti.brandonw.net/index.php?title=84PCE:OS:Include_File#Equates
Thanks again. I believe you have forgotten to add tExtTok to the include file?
scAFwATLxpKzRCmVaHv wrote:
Thanks again. I believe you have forgotten to add tExtTok to the include file?

Whoops, yes; I changed some things. Razz Fixed. Smile
I have run the program multiple times on my calculator, but it resets the calculator's RAM each time, without displaying anything. I believe the problem is at the beginning of the program, with the APD-related code.

EDIT 1:The problem is not only with the APD. When I comment out the part of the code that turns the calculator off, the program still resets, without displaying anything.

Important EDIT 2: The problem could be how I'm compiling it. I downloaded Spasm64 from the link that you gave me. Do I still use "spasm64 password.asm password.8xp", or do I need to add stuff?

EDIT3: Yes, the problem is with one of four things:
How I'm compiling it (most likely)
_ClrScrnFull
_HomeUp
ld hl,text

I tried an Asm Hello World program and it reset the calculator.


Here is my code:
Code:
.nolist
   #include "ti84pce.inc"
   #define PutMapFlags $4A
   #define RED $F800
   #define NAVY $10
   #macro bcall(x)
      call x
   #endmacro

.list
   .org userMem-2
   .db tExtTok,tAsm84CeCmp

PasswordStart:
   bcall(_EnableAPD)
   ld a,1
   ld (apdTimer),a
   ld (apdSubTimer),a
   set apdRunning,(iy+apdFlags)
   bcall(_ClrScrnFull)
   bcall(_HomeUp)
   ld hl,PressText
   bcall(_PutS)
   bcall(_NewLine)
   bcall(_NewLine)
   ld de,RED
   bcall(_SetTextFGBGColors)
   bcall(_PutS)
   res 4,(iy+PutMapFlags)
   bcall(_NewLine)
   bcall(_PutS)
   ld bc,$500050
   ld (penCol),bc
   ld bc,NAVY
   ld (drawFGColor),bc
   bcall(_VPutS)
   ld bc,$400
   ld hl,Password
KeyPress:
   call GetKey
   cp (hl)
   inc hl
   jr z,Asterisk
   inc c
Asterisk:
   ld a,'*'
   bcall(_PutC)
   djnz KeyPress
   dec c
   inc c
   jr nz,WrongPassword
   bcall(_ClrScrnFull)
   ld hl,$E00005
   ld (hl),1
   ret
WrongPassword:
   ld hl,WrongPasswordMsg
   bcall(_NewLine)
   bcall(_PutS)
   bcall(_NewLine)
   bcall(_PutS)
   call GetKey
   jr PasswordStart

GetKey:
   push hl
   bcall(_GetCSC)
   pop hl
   or a
   jr z,GetKey
   ret

PressText:
   .db "This calculator belongs to****** ***********.",0
   .db "(***) ***-****",0
   .db "Password: ",0
   .db "******.***********@*******.com",0
WrongPasswordMsg:
   .db "Wrong password!",0
   .db "Press a key to turn off   the calculator.",0

Password:
   .db sk0
   .db sk0
   .db sk0
   .db sk0
MateoConLechuga wrote:
To store a 16-bit number to a 24-bit address, simply do 'ld.sis'

Please keep this in mind. Wink You cannot do ld (address),reg16 like you used to. Razz

Somethings:
_SetTextFGBGcolors: This is a one that I found; it stores the value in DE to textFGcolor, and the value in HL to textBGcolor, and then sets the PutMapUseColor flag. So in this case; it is being used inccorectly.
I really need to get around to writting this stuff up on WikiTI; just give me a bit. Smile
All you have to do is:

Code:
 ld de,RED
 ld.sis (textFGcolor),de
 set PutMapUseColor,(iy + PutMapFlags)


bcall(_VPutS) should be bcall(_PutS), if I'm not mistaken.

Also, I'm not quite sure what is going on here:

Code:
 ld hl,$E00005
 ld (hl),1

As those are MMIO address. So I just removed them for now.

Also, the way that you are powering down with the APD is okay; but it has to wait 1 second before you press the key in order to trigger the shutdown. I'll show you a better soultion in a bit.

In addition, I added 'res onInterrupt, (iy + onFlags)' to the end, as the user has to press the [ON] key to turn back on the calc, which triggers the interupt.

It also looks like I switched up naming FG and BG, because I moved some things around, so the lateset include file should fix that. Here you go:

Code:
textFGcolor      equ 0D02688h
textBGcolor      equ 0D0268Ah


And here is the updated code:

Code:
.nolist
   #include "ti84pce.inc"
   #define PutMapFlags $4A
   #define RED $F800
   #define NAVY $0010
   #macro bcall(x)
      call x
   #endmacro

.list
   .org userMem-2
   .db tExtTok,tAsm84CeCmp

PasswordStart:
   set apdAble, (iy + apdFlags)
   ld a,1
   ld (apdTimer),a
   ld (apdSubTimer),a
   set apdRunning,(iy+apdFlags) 
   bcall(_ClrScrnFull)
   bcall(_HomeUp)
   ld hl,PressText
   bcall(_PutS)
   bcall(_NewLine)
   bcall(_NewLine)
   ld de,RED
   ld.sis (textBGcolor), de
   set 4,(iy+PutMapFlags)
   bcall(_PutS)
   res 4,(iy+PutMapFlags)
   bcall(_NewLine)
   bcall(_PutS)
   ld bc,NAVY
   ld.sis (textBGColor),bc
   set 4,(iy+PutMapFlags)
   ld bc,$400
   ld hl,Password
KeyPress:
   call GetKey
   cp (hl)
   inc hl
   jr z,Asterisk
   inc c
Asterisk:
   ld a,'*'
   bcall(_PutC)
   djnz KeyPress
   dec c
   inc c
   jr nz,WrongPassword
   bcall(_ClrScrnFull)
   res onInterrupt, (iy + onFlags)
   ret
WrongPassword:
   ld hl,WrongPasswordMsg
   bcall(_NewLine)
   bcall(_PutS)
   bcall(_NewLine)
   bcall(_PutS)
   call GetKey
   jp PasswordStart

GetKey:
   push hl
   bcall(_GetCSC)
   pop hl
   or a
   jr z,GetKey
   ret

PressText:
   .db "This calculator belongs to****** ***********.",0
   .db "(***) ***-****",0
   .db "Password: ",0
   .db "******.***********@*******.com",0
WrongPasswordMsg:
   .db "Wrong password!",0
   .db "Press a key to turn off   the calculator.",0

Password:
   .db sk0
   .db sk0
   .db sk0
   .db sk0


This was compiled with the following command:

Code:
spasm64 -E Asm.ez80 Asm.8xp

Don't worry about the .ez80 extension, that's just what I like to call my files. Razz

This spasm is the one that you want:
https://github.com/alberthdev/spasm-ng/releases/tag/v0.5-beta.1
Thanks for your help!

When I tried ld.sis, the compiler says "value too large for 16-bits, truncation required". Should I just ignore it, or am I doing something wrong?

Why is _SetTextFGBGColors being used incorrectly? Because I don't have a background color?

I meant the _VPutS and all of the related commands, because I want my email to display in small, navy blue text.

The loading of 1 onto $E00005 was a trick that I have successfully tested to make the calculator run faster. It is from a program in Cemetech archives called "Faster". I also have a question about this: will long-term usage of this trick damage the calculator?

On the TI-84+CSE, the resetting of onInterrupt was unnecessary. Are you sure that it's necessary here?
scAFwATLxpKzRCmVaHv wrote:
Thanks for your help!

When I tried ld.sis, the compiler says "value too large for 16-bits, truncation required". Should I just ignore it, or am I doing something wrong?

Nah; that's just a native spasm thing. I'll ask calc84 about it.
EDIT: It might just be a better idea to just do this:

Code:
#define MBASE_OFFSET $D00000
; And usage example:
 ld.sis (drawFGcolor-MBASE_OFFSET),hl


scAFwATLxpKzRCmVaHv wrote:
Why is _SetTextFGBGColors being used incorrectly? Because I don't have a background color?

Yeah; that's about it. Razz Sorry; should have explained more.

scAFwATLxpKzRCmVaHv wrote:
I meant the _VPutS and all of the related commands, because I want my email to display in small, navy blue text.

Oh whoops; sorry about that! I wasn't quite sure what was happening. Razz I changed it back.

scAFwATLxpKzRCmVaHv wrote:
On the TI-84+CSE, the resetting of onInterrupt was unnecessary. Are you sure that it's necessary here?

No; it's not at all necessary; it just makes sure that the Err:Break message doesn't appear when exiting your program.

scAFwATLxpKzRCmVaHv wrote:
The loading of 1 onto $E00005 was a trick that I have successfully tested to make the calculator run faster. It is from a program in Cemetech archives called "Faster". I also have a question about this: will long-term usage of this trick damage the calculator?

No; there shouldn't be any adverse affects from this. DrDnar and his tricks. Razz

Also, please disregard my previous statements about penCol only being two bytes in width; I've spent too much time in the OS, and that is how TI loads it every time, which is rather silly. It's actually 24-bit, so you can save to it just fine. Of course, penRow is located at penCol+3 now. Razz *Mateo facepalms*

Anywho, here's some updated code: (You may want to update the include file; I fixed a couple things here and there)


Code:
.nolist
   #include "ti84pce.inc"
   #define PutMapFlags $4A
   #define RED $F800
   #define NAVY $0010
   #macro bcall(x)
      call x
   #endmacro
#define MBASE_OFFSET $D00000
.list
   .org userMem-2
   .db tExtTok,tAsm84CeCmp

PasswordStart:
   bcall(_EnableAPD)
   ld a,1
   ld (apdTimer),a
   ld (apdSubTimer),a
   set apdRunning,(iy+apdFlags)
   bcall(_ClrScrnFull)
   bcall(_HomeUp)
   ld hl,PressText
   bcall(_PutS)
   bcall(_NewLine)
   bcall(_NewLine)
   ld de,RED
   ld.sis (textBGcolor-MBASE_OFFSET), de
   set 4,(iy+PutMapFlags)
   bcall(_PutS)
   res 4,(iy+PutMapFlags)
   bcall(_NewLine)
   bcall(_PutS)
   ld bc,$03
   ld (penCol),bc
   ld a,$50
   ld (penRow),a
   ld bc,NAVY
   ld.sis (drawFGColor-MBASE_OFFSET),bc
   bcall(_vPutS)
   ld bc,$400
   ld hl,Password
KeyPress:
   call GetKey
   cp (hl)
   inc hl
   jr z,Asterisk
   inc c
Asterisk:
   ld a,'*'
   bcall(_PutC)
   djnz KeyPress
   dec c
   inc c
   jr nz,WrongPassword
   bcall(_ClrScrnFull)
   res onInterrupt, (iy + onFlags)
   ret
WrongPassword:
   ld hl,WrongPasswordMsg
   bcall(_NewLine)
   bcall(_PutS)
   bcall(_NewLine)
   bcall(_PutS)
   call GetKey
   jp PasswordStart

GetKey:
   push hl
   bcall(_GetCSC)
   pop hl
   or a
   jr z,GetKey
   ret

PressText:
   .db "This calculator belongs to****** ***********.",0
   .db "(***) ***-****",0
   .db "Password: ",0
   .db "******.***********@*******.com",0
WrongPasswordMsg:
   .db "Wrong password!",0
   .db "Press a key to turn off   the calculator.",0

Password:
   .db sk0
   .db sk0
   .db sk0
   .db sk0
Thank you very much! The password program now successfully works on the TI-84 Plus CE.

Make sure you remember to switch textFGcolor and textBGcolor in your next update of ti84pce.inc.
What does this password program do? I have always wanted to make a password program for my TI-84+CSE, but I only know Hybrid TI-Basic, so I can't or there is the On break.
What exactly does it do? Like does it prompt you to create a password, etc?
If I wanted this program for a TI-84 Plus C Silver Edition, what would I have to change?

Here's what I think:

Change the include file obviously
Change "tAsm84CECmp" to "tAsm84CCmp"
Change the "ld.sis" to something else (when I tried to compile, it showed error)

How would you print onto the screen in color?
Probably get rid of the "macro" in the beginning, right?
So I think it should look something like this:


Code:
.nolist
   #include "ti84pcse.inc"
   #define PutMapFlags $4A
   #define RED $F800
   #define NAVY $0010
.list
   .org userMem-2
   .db tExtTok,tAsm84CCmp

PasswordStart:
   bcall(_EnableAPD)
   ld a,1
   ld (apdTimer),a
   ld (apdSubTimer),a
   set apdRunning,(iy+apdFlags)
   bcall(_ClrScrnFull)
   bcall(_HomeUp)
   ld hl,PressText
   bcall(_PutS)
   bcall(_NewLine)
   bcall(_NewLine)
   ld de,RED
   ld (textBGcolor),de
   set 4,(iy+PutMapFlags)
   bcall(_PutS)
   res 4,(iy+PutMapFlags)
   bcall(_NewLine)
   bcall(_PutS)
   ld bc,$03
   ld (penCol),bc
   ld a,$50
   ld (penRow),a
   ld bc,NAVY
   ld (drawFGColor),bc
   bcall(_vPutS)
   ld bc,$400
   ld hl,Password
KeyPress:
   call GetKey
   cp (hl)
   inc hl
   jr z,Asterisk
   inc c
Asterisk:
   ld a,'*'
   bcall(_PutC)
   djnz KeyPress
   dec c
   inc c
   jr nz,WrongPassword
   bcall(_ClrScrnFull)
   res onInterrupt, (iy + onFlags)
   ret
WrongPassword:
   ld hl,WrongPasswordMsg
   bcall(_NewLine)
   bcall(_PutS)
   bcall(_NewLine)
   bcall(_PutS)
   call GetKey
   jp PasswordStart

GetKey:
   push hl
   bcall(_GetCSC)
   pop hl
   or a
   jr z,GetKey
   ret

PressText:
   .db "This calculator belongs to****** ***********.",0
   .db "(***) ***-****",0
   .db "Password: ",0
   .db "******.***********@*******.com",0
WrongPasswordMsg:
   .db "Wrong password!",0
   .db "Press a key to turn off   the calculator.",0

Password:
   .db sk0
   .db sk0
   .db sk0
   .db sk0
  
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 5 of 5
» 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