Prev: 8E82 Up: Map Next: 8EAA
8E92: Print Handler: Tab
TAB parameter handler. Called on the byte immediately following a 17 (TAB) control code. Sets the X position (8001) to the parameter value. If the parameter is less than the current X position (i.e., the cursor would move left), the Y position advances to the next row.
PrintHandler_Tab 8E92 LD HL,$8DE3 Reset PrintState_Handler to PrintHandler (default handler).
8E95 LD ($800A),HL
8E98 LD C,A C=target X position (the TAB parameter).
8E99 LD A,($8001) B=*PrintState_X (current X position).
8E9C LD B,A
8E9D LD A,C A=target X; write target X to *PrintState_X.
8E9E LD ($8001),A
8EA1 SUB B A=target X − current X.
8EA2 RET NC Return if the cursor moved right or stayed (no row advance needed).
8EA3 LD HL,$8000 HL=8000 (Y position pointer).
8EA6 CALL PrintHandler_AdvanceRow Call PrintHandler_AdvanceRow to advance the Y position by one line.
8EA9 RET Return.
Prev: 8E82 Up: Map Next: 8EAA