Prev: 36717 Up: Map Next: 36793
36763: ScriptNibbleToDirection
Maps a 4-bit ROM-script command (in A, from AdvanceScriptPtr) to one of 5 direction-class codes: 0-2 → 0 (no direction), 3-5 → 1, 6-8 → 2, 9-11 → 3, 12-15 → 4. Used to translate the deterministic ROM-byte stream into AI movement decisions.
Used by the routines at 36717, 36859, 37018 and 39256.
36763 CP 3 nibble 0..2?
36765 JR NC,36769
36767 XOR A → direction 0
36768 RET
36769 CP 6 nibble 3..5?
36771 JR NC,36776
36773 LD A,1 → direction 1
36775 RET
36776 CP 9 nibble 6..8?
36778 JR NC,36783
36780 LD A,2 → direction 2
36782 RET
36783 CP 12 nibble 9..11?
36785 JR NC,36790
36787 LD A,3 → direction 3
36789 RET
36790 LD A,4 default (12..15) → direction 4
36792 RET
Prev: 36717 Up: Map Next: 36793