Just as a bit of background I just finished my A Levels studying Computer Science which was all in Python, so I don't really have much experience with low-level coding or coding in general, but I have dabbled in C# and (very little) C++, and I've made some basic websites from scratch.
I'm not a fan of Python (whitespace as syntax seems insane to me) but from what I can tell without a Googling spree, your project looks really impressive for school. It looks like you understand how to deal with logic which is most of the challenge in learning to program. I have no idea how experinced you are with programming in general. Unless you correct me, I am going to assume that you are experienced enough to be able to code (with Googling as needed) anything you want in high level languages like Python and understand the concept of pointers but haven't worked too much with them.
I am planning on learning ASM using the Sean McLaughlin Z80 in 28 Days website.
That's a good tutorial. But, before you jump into asm, you should make sure that you are very comfortable dealing with pointers and memory. A good way to do so is to make a doubly linked list in Axe. It doesn't need to be efficient but it will force you to work a lot with pointers. The hardest part will probably be allocating memory. A simple way to do that is to allocate a large block of data with GetCalc() and put your list entrys in there, keeping track of free space as you allocate and deallocate list entries. If you can do that, you are ready for asm.
E37 Can I ask how you learned assembly? Just curious how you got to be so proficient at it. I do think dedicating my time to creating some USB Axiom would be a worthwhile thing, especially as it would benefit future developers whatwith the link cable being so iffy, but I obviously need to learn some asm first
A USB axiom would be less about learning asm and more about figuring out how the USB port works. All you should need is a couple asm snippets that let you read and write to the various ports. Once you have it all figured out (which will almost certainly be very difficult - I counted 31 USB related ports!) there will be time to figure out how to turn it into an Axiom. Here: ':X:Asm(7DD3(123))' writes the lower 8 bits of X to port 123. And ':Asm(DB(123)6F2600)->X' sets X to the 8 bit value read from port 123. In both, the port number can't be a variable. The little documentation that exists for the USB ports is is
here. You could also look at USB related BCALLS (and disassemble them) to see how Ti-OS does communication but that would involve learning assembly and trying to figure what Ti was doing when they wrote the OS is not very high on my list of fun activities.
I learned by writing short Asm snippits, converting them to hex and sticking them in my Axe projects. One of the most important tools I had was a little Axe program that took any program and converted its bytes into hex. It is pretty simple to write, just loop over every byte in order, convert it into hex and dump that hex into an output program. I used that program a lot when I was learning asm. Any time I wanted to know how Axe did something, I would make the shortest possible Axe program that did the thing, compile it and then turn that compiled program into hex. I then used
this to (manually) decode the hex to actually readable asm. It was very useful for figuring out all the basics. The compiled code that Axe produces is a lot worse than what an experienced asm programmer could make but it also happens to be alot easier to follow the flow of logic since it doesn't do any super advanced tricks. An important thing to remember is that Axe puts all of its built in functions like Pt-On() at the very end of the program (right before data like strings and sprites). Since Axe's built in functions are written in asm and very heavily hand optimized, they are very diffuclt to follow. If you want to see all of Axe's built in functions check out the Developers/Commands.inc file in the Axe Parser download. (
shortcut) Some have comments but unless you are looking for something very specific or very general, you probably won't learn much.
When you are debugging, it is super helpful to see register values. If you are programming on the computer, Wabbitemu has some super helpful tools for just that. If not, you can set the value of one of Axe's variables to the value of the register and use Disp to print it out. Just remember that Disp modifies the contents of all the registers so you need to push all the ones you care about before calling Disp and pop them after.
Axe puts the results of its calculations in the HL register. So the line 'X+5' would put the result of X+5 in HL. the line '->X' would store the value currently in HL to X. This is useful as you can do Asm(<some hex>)->X and it would put whatever the final value of HL was in X. The line 'X:Asm(23)->X' Is the same as doing 'X++'. A nice way to verify this is to make an Axe program that is just the line X++ and then disassembling its compiled output. Knowing how to interface with Axe isn't needed when learning but it can make your life a lot easier, especially if you want to skip writing boring calculations in asm or use one of Axe's built in funcitons. Playing around with push hl and pop hl to save variables is a fun starting task and one feature that I think Axe is missing. For example ':X:Asm(E5):SomeFuncitonThatModifiesX():Asm(E1)->X' would let you preserve the value of X. I use that so often in my own Axe code that I made a basic axiom to do just that.
When you are ready to write more complex asm code,
Mimas is the best on-calc tool I have found. I did notice that it corrupts the program rarely if you leave it alone for long enough to shut down so make sure to save and quit before leaving your calc. It also comes with handy utilities for converting to and from its internal format and text based asm files you can read and modify on your pc. Of course, there are quite a few PC based tools. I use
spasm-ng. (for no other reason than that is what Axe was written in - I didn't do a comprehensive study) Different assemblers may use slightly different syntax for things like macros so if your assembler refuses to compile a some code you found on the internet, that could be why.
Learning asm is not an easy task. Luckily, z80 asm is (in my opinion) one of the easiest ways to learn asm. It has a fairly good suite of instructions without any of the complexities that come with a modern architecture like i386. Schools seem to usually teach RISC based instruction sets which can be easier to learn but are (again, my opinion) much more work to use as they only support a couple very simple instructions. Plus z80 doesn't make you deal with relative addressing that many architectures have. It is important to remember that different architectures have their own quirks and tricks from one may not carry over to another. It was a huge shock going from low level calc programming to low level pc programming. Things like cache and speculative execution take the nice optimization strategy of just counting instruction cycles and throw it out the window and SIMD is there to offer great performance at the cost of learning way more instructions. I have been programming for 8 years and the only constant has always been that me from 6 months ago had no idea what they were doing.
@Xeda112358 is way better at asm than me and might have some suggestions for stuff that I missed.