This is work in progress... This tutorial is planned to start in 2020
Despite it's failure in the market the TMS9900 is a fascinating chip, it has virtually no registers, instead using 'Workspaces'... banks of 32 bytes that make the 16 regsiters (like a zeropage)... it also has no stack! When a function is called, one register is used as a 'Link pointer'  pointing to the return address... if we need new registers for our subroutine, we allocate another 'workspace' giving us a new set of registers  when we're done we restore the original workspace.
Systems covered in these tutorials
What
is the TMS9900 and what are 8 'bits' You can skip this if
you know about binary and Hex (This is a copy of the same section in the
Z80 tutorial)
The TMS9900 is an 16Bit processor with a 15 bit Address bus! What's 8 bit... well, one 'Bit' can be 1 or 0 four bits make a Nibble (015) two nibbles (8 bits) make a byte (0255) two bytes (16 bits) make a word (065535) And what is 65535? well that's 64 kilobytes ... in computers 'Kilo' is 1024, because binary works in powers of 2, and 2^10 is 1024 64 kilobytes is the amount of memory a basic 8bit system can access 6502 is 8 bit so it's best at numbers less than 256... it can do numbers up to 65535 too more slowly... and really big numbers will be much harder to do!  we can design our game round small numbers so these limits aren't a problem.
Numbers in Assembly can be represented in different ways. A 'Nibble' (half a byte) can be represented as Binary (00001111) , Decimal (015) or Hexadecimal (0F)... unfortunately, you'll need to learn all three for programming! Also a letter can be a number... Capital 'A' is stored in the computer as number 65! Think of Hexadecimal as being the number system invented by someone wit h 15 fingers, ABCDEF are just numbers above 9! Decimal is just the same, it only has 1 and 0.
ASW and Byte definitions
Be careful with BYTE definitions  they are
automatically Word aligned... EG
BYTE 1
BYTE 2
Will produce data 1,0,2,0 ... You probably
want
BYTE 1,2
instead which will result in 1,2
Another way to think of binary is think what each digit is 'Worth' ... each digit in a number has it's own value... lets take a look at %11001100 in detail and add up it's total
If a binary number is small, it may be shown as %11 ... this is the same as %00000011 Also notice in the chart above, each bit has a number, the bit on the far right is no 0, and the far left is 7... don't worry about it now, but you will need it one day!
But wait! I said a Byte could go from 0255 before, well what happens if you add 1 to 255? Well it overflows, and goes back to 0!... The same happens if we add 2 to 254... if we add 2 to 255, we will end up with 1 this is actually usefull, as if we want to subtract a number, we can use this to work out what number to add to get the effect we want
The TMS9900 is a BIG
ENDIAN machine... what's stranger is that byte operations (like
MOVB) work with the TOP BYTE of the register.
The TMS9900 Addressing Modes The TMS9900 has 8 different addressing modes... many are similar to much later systems... in addition it has 4 'effective modes' which are defined by using Reg 7 as a parameter 'Deferred' addressing is known as indirect
addressing on other systems

If you want to support my work, please consider backing me on patreon! Buy ChibiAkuma(s) games now! If you want to support my work, please consider backing me on patreon! Buy ChibiAkuma(s) games now! If you want to support my work, please consider backing me on patreon! Buy ChibiAkuma(s) games now! 