I decided to create a topic for general discussion about general Hexadecimal Assembly programming. It is also a small tutorial and introduction.
What is hexadecimal?Hexadecimal is a numeration system just like the Arabic one (1,2,3,4,5,6,7,8,9.5,11,12,...) or the Roman one (I,II,III,IV,V,X,L,MCM,...).
So, a number like seven can have multiple representations, according to the system used, let's check the number 28:
28 // Arabic
XXVIII // Roman
1C // Hexadecimal
11100 // Binary
So, why don't we all use the same? It's hard for all of us to use the same and some are useful in some situations but terrible in others. For example, to make a sprite we use binary or hexadecimal, but to solve a giant equation using any of those would be a pain in the ass!
Now, when we make a Calculator Assembly program (ld hl,1 ....), it is written as a binary file (10010101011110101010...). Binary is hard to read, so we just use Hexadecimal.
So, why don't we just program in Assembly and leave the Hexadecimal alone?If we know how to code in Hexadecimal instead of using an assembler that makes our assembly code hexadecimal, we can program assembly on the calculator. Of course, with Mimas (and some others) we can also do it, and Mimas is quite good. However, I'm not sure if we can all use Mimas or if it has everything there is.
So, I assume you already know Assembly if you're reading this, and here's an Assembly program:
.nolist
#include "ti83plus.inc"
.list
.org $9D95-2
.db $BB, $6D
Start:
B_CALL (_ClrLCDFull)
ld hl,1
B_CALL (_DispHL)
B_CALL (_GetKey)
ret
This program will Clear the Screen, the set the hl registers to 1, then display "1" and wait for a key press until ending.
The hexadecimal code it creates (the data) is something like:
EF4045 // ClrLCDFull
210100 // Set hl registers to 1
EF0745 // Display the hl registers, so display "1"
EF7249 // Wait for key press
C9
Now, how do I know this is the hexadecimal code for it? One, I checked the
ti83plus.inc, I use
Assemblex and I learnt it with Xeda. Now, the ti83plus.inc has all the hexadecimal codes for BCalls. Assemblex converts hexadecimal to assembly and disassembles files which lets me learn it from other programs.
Also, for opcodes such as 210100, I check
this all the time!
How to program in my calculator?Press PRGM
Create a new PRGM
Call it whatever you want
Then make it like this:
AsmPrgm
EF4045
EF7045 // Turns the run diagnostic off B_CALL (_RunIndicOff)
FDCB00AE // Disables the 'Done' message when the program closes (res 5,(iy+0))
210100
EF0745
EF7249
C9
Never forget the ending C9 (ret), without it the calculator crashes!
Now you can run that program by typing
Asm(prgmNAME.
You can also compile it so you can run it in shells and it is a true Assembly program:
AsmComp(prgmNAME,prgmNAME2)Note, in AsmComp( the names have to be different. Also, press 2ND + 0 to access the catalog and use the Asm( and AsmPrgm and AsmComp( tokens, don't just type them.I hope more discussion comes, for now, skim through the pages I gave you and try and make something new.
Note: The language on this tutorial may be wrong. For example, I said that AsmComp( made it a real Assembly program, but it was already, it just compiles it.Also, concerning Assemblex, the last uploaded version is still not perfect, so you can have a demo here, but the 'Export to 8xp' isn't finished, so it does not count as an upload. Assemblex is what I use to program in Hexadecimal in my computer.
Discuss!
EDIT: You can also use brandonw's website for more bcalls and information, I think. The Z80 tables with opcodes can also be found in ticalc.org.
EDIT 2:
I have a lot to tell you yet, but for now, here's another program:
EF4045
3E01
C60A
2600
6F
EF0745
EF7249
EF4045
C9
Who guesses what this does?