TI-84 Built In Assembly Capabilities
Moderator: MaxCoderz Staff
TI-84 Built In Assembly Capabilities
I'm a new member to MaxCoderz; I am also a TI-BASIC programmer and have accomplished, using what I gather is a rather limited language, a lot of which I am proud. I have created multiple RPGs (emulating the overhead screen-by-screen style of the original Legend of Zelda; a side-scroller, like the original Super Mario Bro.s; a progressively saving overhead game with separate levels and a separate battle sequence), Tic-Tac-Toe and Connect Four, both with excellent CGIs and able to declare who wins or a cat's game, and all too numerous miscellaneous programs. I (as a BASIC programmer) think I have plenty of reason to be proud. I am attracted to BASIC programming from a romantic kind of sensibility: someone with just a calculator, relying on only a small set of commands and their own ingenuity, can create high level math functions, create great pranks or even create a game comparable to early professional video games. Now I would like to move on to Assembly programming
I would like to learn Assembly programming first of all because if it's versatility, but also because of the greater skill (and danger) involved in it. The thing is, however, that I want to be able to program in Asm without a computer, emulator or compiler. I want to manually create Asm Programs by entering the hex opcodes directly in a program (it's part of that romantic sensibility). As I understand, and have discovered in various ways, this is entirely possible on a TI-84, which I have. I've tried to find lists of the hex opcodes for different commands and what not, but quickly realized this was futile. In any event, I was wondering if anyone would help create a list of the different hex codes for me and the other various programmers out there with the same dream. Perhaps it would make a good community project, as there is no such list in existence. Please excuse my insanity, and please do not try to dissuade my ridiculous leanings: they are part of my romantic sensibilities.
I would like to learn Assembly programming first of all because if it's versatility, but also because of the greater skill (and danger) involved in it. The thing is, however, that I want to be able to program in Asm without a computer, emulator or compiler. I want to manually create Asm Programs by entering the hex opcodes directly in a program (it's part of that romantic sensibility). As I understand, and have discovered in various ways, this is entirely possible on a TI-84, which I have. I've tried to find lists of the hex opcodes for different commands and what not, but quickly realized this was futile. In any event, I was wondering if anyone would help create a list of the different hex codes for me and the other various programmers out there with the same dream. Perhaps it would make a good community project, as there is no such list in existence. Please excuse my insanity, and please do not try to dissuade my ridiculous leanings: they are part of my romantic sensibilities.
- benryves
- Maxcoderz Staff
- Posts: 3087
- Joined: Thu 16 Dec, 2004 10:06 pm
- Location: Croydon, England
- Contact:
Re: TI-84 Built In Assembly Capabilities
Welcome to MaxCoderz! Writing Z80 programs without an assembler is a fairly bizarre goal; there are assemblers that run on the calculator itself. The Z80 CPU User Manual lists all of the (documented) instructions and how they are formed in binary and hexadecimal (I'm not sure how you came to the conclusion that there was no such list in existence; how else would people write assemblers?)
Good luck with your project!
![Smile :-)](./images/smilies/grayscale_smile.gif)
Re: TI-84 Built In Assembly Capabilities
Well, I have to admit I only looked into it in a limited context (ie. only looking for things relating to the built in asm programming capabilities of the Ti-84) which I now am somewhat embarrassed about. Thank you for the prompt reply, by the way. Where exactly in this manual would I find the hexadecimal codes, and are there any particulars about creating asm programs that I should know before I start messing around in it? (I have CalcUtil on my TI-84, so I'm not afraid of my RAM being cleared. Everything's archived.)
Re: TI-84 Built In Assembly Capabilities
Actually, it looks like found it; I know now why my goal seems bizarre, and wow am I a novice. Perhaps you can also suggest a good tutorial that will explain to me the computer programming skills that I'll need to know and that I have absolutely no knowledge of because of my exclusive BASIC background?
Re: TI-84 Built In Assembly Capabilities
Actually I can't find the actual hexadecimal codes in this document. Where are they?
Re: TI-84 Built In Assembly Capabilities
http://group.revsoft.org/TASM80.TAB
Counting bytes (as would be necessary for typing hex) is not fun or romantic. You have to recount every time you modify instructions between a branch and its target. There is still plenty of challenge in writing assembly code.
Counting bytes (as would be necessary for typing hex) is not fun or romantic. You have to recount every time you modify instructions between a branch and its target. There is still plenty of challenge in writing assembly code.
-
- New Member
- Posts: 67
- Joined: Sun 09 Nov, 2008 1:56 pm
Re: TI-84 Built In Assembly Capabilities
http://www.ticalc.org/archives/files/fi ... 26877.htmlbongo wrote:Actually I can't find the actual hexadecimal codes in this document. Where are they?
![Very Happy :D](./images/smilies/grayscale_happy.gif)
- benryves
- Maxcoderz Staff
- Posts: 3087
- Joined: Thu 16 Dec, 2004 10:06 pm
- Location: Croydon, England
- Contact:
Re: TI-84 Built In Assembly Capabilities
Next to any of the instructions. For example, AND n can be found on page 172, and is E6 n (so AND $10 would be assembled as E6 10). Some instructions are shown in binary, for example LD r,r' (page 101) is 0,1,r,r,r,r',r',r'. You would need to consult the table underneath for the different registers (e.g. C is 001 and D is 010) so LD C,D would be assembled as 01001010 (binary) which is 4A in hex.bongo wrote:Actually I can't find the actual hexadecimal codes in this document. Where are they?
Learn TI-83 Plus Assembly In 28 Days is generally regarded as one of the best guides for learning TI-83+ assembly programming.
For what it's worth, the programming language that is built into the calculator doesn't have a formal name, and even though people generally call it TI-BASIC it is nothing like what is generally accepted as BASIC.
-
- New Member
- Posts: 3
- Joined: Sun 16 Nov, 2008 7:26 pm
Re: TI-84 Built In Assembly Capabilities
If you're still interested in assembling by hand, this is a good explanation. (To anyone: I started writing my own tutorial a while ago but never finished. Feel free to bug me to finish it if you think it could be useful.)
Here are some sort-of printer friendly files: Some things to note:
- Relative jumps (such as jr and djnz) are measured from the byte after the instruction, not the instruction itself (so jr +0 would execute what's after the jr)
- The set/res/bit instructions, which I think that TAB file explains fairly well
- Two-byte (word) values are in little-endian, so the number 0xABCD would be stored as $CD, $AB).
- (I think there were a few more, but I can't remember them right now)
It helps to write out as much code as you can before trying to actually assemble it, and using relative jumps where possible saves a lot of work.
[edit] I added the note about little-endian.
Here are some sort-of printer friendly files: Some things to note:
- Relative jumps (such as jr and djnz) are measured from the byte after the instruction, not the instruction itself (so jr +0 would execute what's after the jr)
- The set/res/bit instructions, which I think that TAB file explains fairly well
- Two-byte (word) values are in little-endian, so the number 0xABCD would be stored as $CD, $AB).
- (I think there were a few more, but I can't remember them right now)
It helps to write out as much code as you can before trying to actually assemble it, and using relative jumps where possible saves a lot of work.
[edit] I added the note about little-endian.
Last edited by simplethinker on Sat 09 Jan, 2010 10:08 pm, edited 1 time in total.
Re: TI-84 Built In Assembly Capabilities
Great! Thanks everyone! Just from the 13 hours or so that I've been a member, I already know this is a great community. Pardon how corny that just sounded.
So some general questions about this:
1.) I started looking at a tutorial on Asm programming (with an emulator and the rest, I've been skipping that stuff and directly entering hexadecimal codes using the site Spencer posted) but the examples in the tutorial which I've been copying don't work. I have two thoughts. First that no values were assigned to the variables and registers the examples use, although I don't know if that really matters. Second, I've been entering every command on a separate line; all the Asm programs I've seen, though, consist of lines only containing 8 hexadecimal values. Am I supposed to be entering code in 8-value lines regardless of the syntax of the examples?
2.) How do you store numbers to variables and registers in hexadecimal?
![Smile :)](./images/smilies/grayscale_smile.gif)
1.) I started looking at a tutorial on Asm programming (with an emulator and the rest, I've been skipping that stuff and directly entering hexadecimal codes using the site Spencer posted) but the examples in the tutorial which I've been copying don't work. I have two thoughts. First that no values were assigned to the variables and registers the examples use, although I don't know if that really matters. Second, I've been entering every command on a separate line; all the Asm programs I've seen, though, consist of lines only containing 8 hexadecimal values. Am I supposed to be entering code in 8-value lines regardless of the syntax of the examples?
2.) How do you store numbers to variables and registers in hexadecimal?
- benryves
- Maxcoderz Staff
- Posts: 3087
- Joined: Thu 16 Dec, 2004 10:06 pm
- Location: Croydon, England
- Contact:
Re: TI-84 Built In Assembly Capabilities
What's the code you're using? If it's 28 days, the first example has a bug in it (annoying, yes). The line ld (PenCol),hl should read ld (CurRow),hl.
How do you mean "no values were assigned to the variables"? Which variables do you mean, for that matter? "Variables" in assembly programs are usually just a region in memory that you read or write directly from (see the CurRow example above). To access TI-OS variables requires significantly more work; see the SDK documentation (chiefly the Developer Guide and System Routines).
You can enter each command on its own line. This takes up a little more space, but is easier to read.
How do you mean "no values were assigned to the variables"? Which variables do you mean, for that matter? "Variables" in assembly programs are usually just a region in memory that you read or write directly from (see the CurRow example above). To access TI-OS variables requires significantly more work; see the SDK documentation (chiefly the Developer Guide and System Routines).
You can enter each command on its own line. This takes up a little more space, but is easier to read.
Re: TI-84 Built In Assembly Capabilities
Actually I'm using a random guide which seemed to necessitate very little knowledge of programming. I don't know the link but I have it saved in word pad (so I didn't need to be online to use it). And apparently all the different file types I've tried are not allowed. Oh well. Should I just use 28 days?
Re: TI-84 Built In Assembly Capabilities
And for example, how would you assign a value to (CurRow) in hex (meaning in hex specificly)? It's not like there are special commands for a certain variables, you create your own, right? And somehow I doubt you just write the variable name with everything else being in hex.
- benryves
- Maxcoderz Staff
- Posts: 3087
- Joined: Thu 16 Dec, 2004 10:06 pm
- Location: Croydon, England
- Contact:
Re: TI-84 Built In Assembly Capabilities
CurRow is a name given to a particular address in memory that stores the cursor row; you can find its value in ti83plus.inc. If you wanted to set the cursor row to 3, you could load 3 into the accumulator A then copy the accumulator to the memory location represented by CurRow, 844B. That would be
in assembly, which assembles to:
Bear in mind that the Z80, like most Intel-like CPUs, is little-endian so the least significant byte comes first. This is why 844B turns into 4B84 in the code above.
Code: Select all
ld a,3
ld (CurRow),a
Code: Select all
3E03
324B84
Re: TI-84 Built In Assembly Capabilities
What if you wanted a completely arbitrary label?