From 1f26879cd33b8a9e3fd1ca424ccf50135c7bd303 Mon Sep 17 00:00:00 2001 From: Virgil Dupras Date: Wed, 30 Oct 2019 21:00:10 -0400 Subject: [PATCH] Add TRICKS.txt --- TRICKS.txt | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 TRICKS.txt 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.