Prev: 8EC7 Up: Map Next: 8EF7
8EE6: Print Handler: Mask Parameter
Parameter mask and validation utility. Called by control code parameter handlers before processing their byte. Resets PrintState_Handler to the default handler (PrintHandler), then masks A to the valid range defined by B (which must be a power of two). If the parameter is out of range, sets a flag in 8007.
PrintHandler_MaskParam 8EE6 LD HL,$8DE3 Reset PrintState_Handler to PrintHandler (default handler).
8EE9 LD ($800A),HL
8EEC CP B Test whether the parameter (A) is within the valid range (B).
8EED JR C,PrintHandler_MaskParam_Mask If the parameter is within range, jump to PrintHandler_MaskParam_Mask.
8EEF SET 0,(IX+$07) Otherwise set the out-of-range flag (bit 0 of *8007).
PrintHandler_MaskParam_Mask 8EF3 DEC B Decrement B to form a bitmask (e.g. 08 → 07 = %00000111).
8EF4 AND B Mask A to the valid range.
8EF5 LD B,A B=masked parameter value.
8EF6 RET Return.
Prev: 8EC7 Up: Map Next: 8EF7