![]() |
Routines |
| Prev: 34850 | Up: Map | Next: 35704 |
|
Used by the routine at PrintWriteACharacterToTheScreen.
Copies eight pixel rows of the text line at 20512 to the ZX printer through port 251 when the printer-on flag at 46834 is set.
|
||||
| ZXPrinter | 35618 | LD A,(46834) | Read the printer-on flag at 46834. | |
| 35621 | AND A | Return if the printer is off. | ||
| 35622 | RET Z | |||
| 35623 | PUSH HL | Save the text pointer. The printer row count starts at 1. | ||
| 35624 | PUSH DE | |||
| 35625 | PUSH BC | |||
| 35626 | LD D,1 | |||
| 35628 | LD HL,20512 | Point HL at the text line. | ||
| 35631 | XOR A | Take zero for the first printer byte. | ||
| 35632 | LD E,A | Clear the marker's low byte. | ||
| ZXPrinter_WriteAByteToThePrinter | 35633 | OUT (251),A | Write a byte to the printer. | |
| ZXPrinter_Loop | 35635 | IN A,(251) | Read the printer port 251. | |
| 35637 | ADD A,A | Double the printer status. | ||
| 35638 | JP M,ZXPrinter_RestoreAndReturn | Jump to ZXPrinter_RestoreAndReturn if bit 6 of the printer port is set (no printer attached). | ||
| 35641 | JR NC,ZXPrinter_Loop | Jump back to ZXPrinter_Loop while bit 7 of the printer port is clear. | ||
| 35643 | PUSH HL | Save the line address and the marker, and take the row count into A. | ||
| 35644 | PUSH DE | |||
| 35645 | LD A,D | |||
| 35646 | CP 2 | Compare the printer row count with 2. | ||
| 35648 | SBC A,A | Make A 255 when that row count was below 2, and zero otherwise. | ||
| 35649 | AND E | Build the marker bit from E. | ||
| 35650 | RLCA | |||
| 35651 | AND E | |||
| 35652 | LD D,A | |||
| ZXPrinter_ReadAByteFromThePointer | 35653 | LD C,(HL) | Read a byte from the pointer into C. | |
| 35654 | PUSH HL | Count 8 passes. | ||
| 35655 | LD B,8 | |||
| ZXPrinter_TakeThePrinterByte | 35657 | LD A,D | Take the byte being sent to the printer. | |
| 35658 | RLC C | Rotate the next source bit into carry. | ||
| 35660 | RRA | Shift that bit into the byte for the printer. | ||
| 35661 | LD H,A | Remember the byte built so far. | ||
| ZXPrinter_WaitWhileThePrinterIsBusy | 35662 | IN A,(251) | Read the printer port 251. | |
| 35664 | RRA | Jump back to ZXPrinter_WaitWhileThePrinterIsBusy while the printer is busy. | ||
| 35665 | JR NC,ZXPrinter_WaitWhileThePrinterIsBusy | |||
| 35667 | LD A,H | Take the byte built for the printer. | ||
| 35668 | OUT (251),A | Write a byte to the printer. | ||
| 35670 | DJNZ ZXPrinter_TakeThePrinterByte | Loop back to ZXPrinter_TakeThePrinterByte until 8 runs out. | ||
| 35672 | POP HL | Step along the text line at 20512 and continue while a character remains. | ||
| 35673 | INC HL | |||
| 35674 | LD A,L | |||
| 35675 | AND 31 | |||
| 35677 | JR NZ,ZXPrinter_ReadAByteFromThePointer | |||
| ZXPrinter_WaitUntilThePrinterIsReady | 35679 | IN A,(251) | Read the printer port 251. | |
| 35681 | RRA | Wait until the printer is ready (bit 0 of port 251). | ||
| 35682 | JR NC,ZXPrinter_WaitUntilThePrinterIsReady | |||
| 35684 | LD A,D | Take the byte being sent to the printer. | ||
| 35685 | RRCA | Rotate the next bit out towards the printer. | ||
| 35686 | OUT (251),A | Write a byte to the printer. | ||
| 35688 | POP DE | Restore DE and HL from the stack, step to the next row, and jump back to ZXPrinter_WriteAByteToThePrinter if bit 3 of E is clear. | ||
| 35689 | POP HL | |||
| 35690 | INC H | |||
| 35691 | INC E | |||
| 35692 | BIT 3,E | |||
| 35694 | JR Z,ZXPrinter_WriteAByteToThePrinter | |||
| 35696 | LD A,4 | Send 4 to the printer port. | ||
| 35698 | OUT (251),A | Write a byte to the printer. | ||
|
Restore the registers saved for the printer.
|
||||
| ZXPrinter_RestoreAndReturn | 35700 | POP BC | Restore BC, DE and HL from the stack. | |
| 35701 | POP DE | |||
| 35702 | POP HL | |||
| 35703 | RET | Return. | ||
| Prev: 34850 | Up: Map | Next: 35704 |