Prev: 36551 Up: Map Next: 36599
36582: 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 32775.
PrintHandler_MaskParam 36582 LD HL,36323 Reset PrintState_Handler to PrintHandler (default handler).
36585 LD (32778),HL
36588 CP B Test whether the parameter (A) is within the valid range (B).
36589 JR C,PrintHandler_MaskParam_Mask If the parameter is within range, jump to PrintHandler_MaskParam_Mask.
36591 SET 0,(IX+7) Otherwise set the out-of-range flag (bit 0 of *32775).
PrintHandler_MaskParam_Mask 36595 DEC B Decrement B to form a bitmask (e.g. 8 → 7 = %00000111).
36596 AND B Mask A to the valid range.
36597 LD B,A B=masked parameter value.
36598 RET Return.
Prev: 36551 Up: Map Next: 36599