diff --git a/TRICKS.txt b/TRICKS.txt new file mode 100644 index 0000000..800b546 --- /dev/null +++ b/TRICKS.txt @@ -0,0 +1,15 @@ +This file describe tricks that are used throughout the code and might need +explanation. + +or a: Equivalent to "cp 0", but results in a shorter opcode. + +xor a: sets A to 0 more efficiently than ld a, 0 + +and 0xbf: Given a letter in the a-z range, changes it to its uppercase value +if it's already uppercased, then it stays that way. + +Z if almost always used as a success indicator for routines. Set for success, +Reset for failure. "xor a" (destroys A) and "cp a" (preserves A) are used to +ensure Z is set. To ensure that it is reset, it's a bit more complicated and +"unsetZ" routine exists for that, although that in certain circumstances, +"inc a \ dec a" or "or a" can work.