HP9866 Control State Machine ---------------------------- ** Character Entry ** 00 : 20 if(Stb/) goto (00,02) , ClrFlg Start of main loop (also entry point on power on). Clear interface flag (not busy) Wait for strobe pulse on interface 02 : 2B goto (06) 06 : C2 if(PrtChar) goto (12,11) , InClk Load chracter into input register, set interface flag flip-flop (indicating printer busy). Test if it is a printable character (including linefeed). If not, ignore it. 12 : F4 if(LF/) goto (19,1B) Is it a linefeed? 1B : CF if(Empty/) goto (17,15) Input character is a linefeed. Is the line buffer empty? If so, just feed the paper, if not, do a full print cycle. 19 : C1 if(Start/) goto (14,11) It's not a linefeed. Is the line buffer full (that is character counter = 0 and empty/ flip-flop set). If so, ignore it (truncate the line) 14 : 9D goto (0D) , SClk Line buffer is not full, store new character in the shift register 0D : C4 goto (11) , PHOut Increment the character counter, set empty/ flip-flop, and end this character 11 : C0 if(Stb/) goto (10,11) End of character processing. Loop until strobe is inactive 10 : 00 goto (00) , ClrFlg Clear interface flag and round again. ** Print cycle ** Now to actually print a line. Begin by filling the unused space in the data shift register with spaces 17 : 89 if(Start/) goto (04,05) , ForceSpace Set the data input flip-flops to a space character. Exit from loop when the line buffer is full (effectively a while(buffer not full) loop). 04 : 10 goto (08) , SClk Load a space into the next buffer location 08 : EF goto (17) , PHClk Increment character counter and round again. The line buffer is now ready, so print it. 05 : E6 goto (13) , Autofeed Advance the paper one dot line 13 : E3 if(Timing) goto (16,13) Loop until U26b times out to give the motor time to move 16 : 3E if(Row7) goto (0B,0E) , InClk Is this the end of the printed character (7 rows of dots printed)? If so, goto the paper feed routine, starting by incrementing the row counter. 0B : 7B goto (1E) 1E : 84 goto (01) , RowClk Increment row counter. This also controls the RotEn line so as to go into printing mode 01 : 50 goto (18) 18 : BF goto (0F) , PHClk Clock the 5 bits for the current row of the current character into the printhead shift registers. 0F : DA if(char0/) goto (1A,1D) Is the line completed? This will skip the 4-chracter rotation at the end of the complete print line, so as to leave the line buffer in the same state at the start and end of a line. Thus each row of dots comes from the same chracters in the same positions. 1A : AF goto (07) 07 : 59 goto (1C) , ForceSpace No, start to roate the line buffer by 4 characters. Now ForceSpace/ had a second meaning. It increments the '4 character' counter U17a/b 1C : A7 if(LnFlg) goto (07,03) , SClk Rotate the line buffer and round again if it's not been done 4 times (print every 4th character on each pass) 03 : D8 if(newbank/) goto (18,1D) Has a complete bank been loaded? If not, go back and load the next character. 1D : 32 goto (0A) , PHOut A complete bank has been loaded, so trigger printhead timing monostable and print this bank of dots. 0A : 31 if(Timing) goto (0C,0A) Wait for U26a to time out (this bank has been printed). 0C : 8C if(firstbank/) goto (01,05) , SClk Rotate the line buffer by one character to get the next quarter of a line into postion. Has the character counter wrapped around so all banks have been done? If so, back round, advance the paper and start the next dot line. If not, then round again to start the next bank of data ** Paper feed ** This routine advances the paper by enough dot lines to complete the character and inter-row space 15 : 94 goto (09) , Autofeed Clock the stepper motor counter 09 : 93 if(Timing) goto (0E,09) Loop until monostable U26b times out (to give motor time to move) 0E : FF goto (1F) , RowClk Increment dot row counter 1F : C5 if(RotEn) goto (15,11) Round again if dot row counter has not got back to 0 (RotEn = 1). Otherwise go to end of character processing