Does anyone know a great place to learn Assembly Programming for the Ti-84+CE? Also, how do you incorporate hexadecimal code into a regular Ti-BASIC program on the Ti-84+CE?
The documentation is not complete, but you can look at sites such as eZ80 Heaven or ce-programming.github.io which should introduce to you what you need to set up the environment. Development for the CE is almost identical to the PCSE. If you're not comfortable with ASM, you also have the choice of developing in C as well. For inline ASM in your BASIC program, you'll want the Doors CS/xLIBC libraries. Good luck!
Doors CS doesn't work on the Ti-84pce. I have to wait for Doors CE 9 to come out. But thanks for the advice.
Oh, I almost forgot Doors CE wasn't out yet Rolling Eyes
seanlego23 wrote:
Does anyone know a great place to learn Assembly Programming for the Ti-84+CE?


Assembly on the TI-84+CE is pretty similar to on older devices. There's just a few important bits you need to remember and you can apply them to tutorials for the older model calculators and get the same code to work. Also, I recommend using SPASM for compilation of eZ80 assembly code.

First off, remember that your two-byte registers now hold three bytes. HL, for example, no longer has a maximum value of 2^16-1, but now has a maximum value of 2^24-1. If you're reading from memory into HL, such as, "ld hl, (de)", remember that HL is loading three bytes at that address into HL and not just two.

The second big thing you have to remember is that memory addresses are now all 3-bytes instead of 2-bytes. This is called "ADL mode" or "address and data long mode", basically meaning what it says, data and addresses can now be longer.

If you're writing hex codes, these things become most apparent. For example, "21" still is the hex code to load something into the HL register, but now you have to type three bytes after it to get it to work. "2101000" loads "1" into the HL register (000001 is reversed to 010000 because Z80 is little Endian). Forgetting to type the third value will probably cause your calculator to crash.

You can't use IN/OUT instructions, but you don't need them anyways. The I/O port was removed, you can easily modify the LCD display via vRAM (which is much faster), and you'll just have to settle with _GetCSC for keys.

Another thing to remember: you use CALL instead of BCALL (RST $28) now. Just type "call _GetCSC" instead of "bcall(_GetCSC)".

Graphics on the screen is pretty straight-forwards. The LCD is all mapped to a section in RAM called vRAM located between address $D40000 and $D65800. If you subtract the two, you get 153600, that's because the screen is 320x240 and each pixel is mapped to two bytes, so 320x240x2 = 153600. So any given pixel data will be located in RAM at 2(320y+x)+vRAM.

Other than that, you can quite often just go off of old Z80 assembly tutorials and they'll work fine. eZ80 assembly isn't so different that you need to learn it from scratch. A lot of the times, when I'm trying to figure out how to do something not documented for the TI-84+CE, I will just look at the documentation for the TI-84+ or TI-84+CSE and often it will still work.

Check WikiTI for some good documentation.
Z80-Heaven is useful as well.

You're also going to need the include file as well. But if you're following any generic calc Z80 tutorial, they will probably tell you about needing an include file.

Also, check out the eZ80 CPU user manual. Near the bottom is an op-code reference chart. There are some changes, so if you're writing hex codes, go off of that and not a Z80 chart. It's kinda long, but if you read some of the manual it's pretty helpful.

If you own a TI-83+, TI-84+ or TI-84+SE, I'd recommend learning Z80 Assembly for those first if you don't know it already, as there's plenty of resources out there for those. When you do get decent at it, you can quite easily transition to the eZ80 TI-84+CE.

Quote:
Also, how do you incorporate hexadecimal code into a regular Ti-BASIC program on the Ti-84+CE?


There are two ways to do this.

First, you can write your hex code in another program. Then call the program using "Asm(prgmNAME". You can also have the program take arguments by having it read variables you can set in your code before calling the program.

Second, is you can have a single central program called prgmHEX that you can send hex strings to from your TI-BASIC code and it will execute. That's a bit more complicated, I can tell you how to do that if you want.

In the end, though, writing hex codes is just coding Assembly while looking at a table. So you need to get a grasp on Assembly before you can write hex codes, unless you're just going to user other people's hex codes.

I actually recently posted a "Hello, world!" example here. That's just an example of how to write and run hex codes on the calculator itself.

Although, I'd recommend getting an emulator and not experimenting too much on the calc itself when it comes to hex codes, as they could do some damage if you make a mistake. CEmu is the one I use.

oldmud0's links are good if you want tutorials very specific to TI-84+CE, and some go into good detail on TI-84+CE specific things as well. But many of these tutorials are limited, so you will want to reference regular Z80 tutorials as well to get a full understanding of how to program in assembly for the TI-84+CE.

Read documentation, tutorials, source code, read read read, and you will learn.
amihart wrote:
You can't use IN/OUT instructions, but you don't need them anyways. The I/O port was removed, you can easily modify the LCD display via vRAM (which is much faster), and you'll just have to settle with _GetCSC for keys.
Nice post Very Happy If you want the equivalent of direct input for the CE, many ports are mapped to RAM addresses which you can read/write to, WikiTI has a nice section on the key port:
http://wikiti.brandonw.net/index.php?title=84PCE:Ports:A000

seanlego23, there are some code samples floating around as well as other people's source if you don't care to work with GetCSC.
oldmud0 wrote:
The documentation is not complete, but you can look at sites such as eZ80 Heaven
Thanks oldmud0 for the shoutout! Maybe we'll finish it some day but I haven't seen Hactar in months. The preferred documentation link is
http://ez80.github.io just for future reference Smile
KingInfinity wrote:
oldmud0 wrote:
The documentation is not complete, but you can look at sites such as eZ80 Heaven
Thanks oldmud0 for the shoutout! Maybe we'll finish it some day but I haven't seen Hactar in months. The preferred documentation link is
http://ez80.github.io just for future reference Smile

Thanks. Been slowly trying to understand some things. Fortunately I have a lot of things to do, so I read like one little section of a day and mull over it for a while and figure it out. So I'm on Day 5 right now of Asm in 28 days.
seanlego23 wrote:
Thanks. Been slowly trying to understand some things. Fortunately I have a lot of things to do, so I read like one little section of a day and mull over it for a while and figure it out. So I'm on Day 5 right now of Asm in 28 days.

Everyone that knows assembly, as you probably know, has had to learn it some way. Cemetech is a useful resource because people can share their tips and tricks with you about how they began to understand the concepts, which are quite challenging but in the end make a lot of sense. I'm no assembly expert, but I'm here to help if you need it
You might also check out TI-Basic Developer's Page on CSE Hexcodes. I know that the CSE is not the same as the CE but the page does mention both calculators. You might need to do a little investigagtion as to whether they work on both calculators. Its not finished yet, but it might still be helpful.
Kydapoot wrote:
You might also check out TI-Basic Developer's Page on CSE Hexcodes. I know that the CSE is not the same as the CE but the page does mention both calculators. You might need to do a little investigagtion as to whether they work on both calculators. Its not finished yet, but it might still be helpful.

That's a good idea. I'll try that when I have more time. Probably after CC17 is over.
Kydapoot wrote:
You might also check out TI-Basic Developer's Page on CSE Hexcodes. I know that the CSE is not the same as the CE but the page does mention both calculators. You might need to do a little investigagtion as to whether they work on both calculators. Its not finished yet, but it might still be helpful.

Also, and yet another plug for eZ80 Heaven, we are working on a hexcode list for the CE, available here
Oh cool! Will these be adden to TI|BD when finished? It would be cool to have all of these resources in one place.
I agree. All of the hex codes are not updated and it makes it hard on us who don't know a lot of ez80 programming to use the hex codes for TI-Basic.
Kydapoot wrote:
Oh cool! Will these be adden to TI|BD when finished? It would be cool to have all of these resources in one place.

Not sure where we're going from here, or if eZ80 Heaven will be continued by me alone, but hexcodes are fairly easy to port. Cemetech will host eZ80 Heaven if we ever finish, however, and it will be up to these admins to license the content.
I finally finished Asm in 28 days and learned some of the differences between z80 and ez80. It's not as hard as I thought it would be, but still challenging. Something I have noticed though, mainly in Mateo's libraries, is this
Code:
\.r
I don't know or understand what this does or means. Can anyone clarify?

Edit:
Oops. Meant \.r
I fixed it above.
It's a macro used for adding entries to the relocation table to later be relocated into some arbitrary address.


Code:
#macro relocate()
 #define numrelocations numrelocations+1
 
 #define offset eval($-3)
 .echo >> relocation_table " .dl ",offset,"\n"
#endmacro
#define .r relocate()
Ok thank you.
Can anyone explain to me how to use the floating-point variables? I believe they are OP1-OP9 or something like that. I don't understand how they are stored to, how instructions are done with them, or how to output them on the screen. If anyone could fully explain them, that'd be great. TI-84PCE

Also, sometimes I see something like this:

Code:
jr nz,$+3

What does $ mean?
seanlego23 wrote:
Can anyone explain to me how to use the floating-point variables? I believe they are OP1-OP9 or something like that. I don't understand how they are stored to, how instructions are done with them, or how to output them on the screen. If anyone could fully explain them, that'd be great. TI-84PCE


You'd have to wait for someone else to give you the specific differences, but I'd assume you were looking here for that information. I suppose the tutorial kind of expects you to have a basic idea of what a floating point number is and why they're used. TI uses its own format and provides its own system calls to mess with them. OP1 through OP6 are 11 byte (each) chunks of RAM that the OS uses to store and manipulate floating point numbers (among other things).

Quote:
Also, sometimes I see something like this:

Code:
jr nz,$+3

What does $ mean?

$ means something like "Current PC as measured from the start of the instruction"
In the instance of "jr nz,$+3", it jumps forward 3 bytes (two of which is the JR instruction itself).
Another example: "jr $+0" jumps to itself, resulting in an infinite loop.
  
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 2
» 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