4Data Telesoftware Adaptor Issue 1.2 | Routines |
Prev: 1034 | Up: Map | Next: 109C |
Portions of this routine are adapted from the BASIC ROM 'COPY_LINE' routine.
|
||||
1038 | LD HL,$45ED | Change routine at NMI_JUMP to 'RETN; NOP' to ignore NMI. | ||
103B | LD (NMI_JUMP),HL | |||
103E | LD B,$C0 | Set B to 192 as line counter. | ||
1040 | LD HL,$4000 | Set HL to start of display RAM. | ||
print_line | 1043 | PUSH HL | preserve registers. | |
1044 | PUSH BC | |||
1045 | LD A,B | If line number < 3 then A = $02 (motor slow) else A = $00 (motor fast). | ||
1046 | CP $03 | |||
1048 | SBC A,A | |||
1049 | AND $02 | |||
104B | OUT ($FB),A | Output byte in A to printer and store in D | ||
104D | LD D,A | |||
wait_for_stylus | 104E | IN A,($FB) | Read byte from printer into A and double it. | |
1050 | ADD A,A | |||
1051 | JP M,no_printer | If bit 7 set (D6 was set in input) then no printer present. Jump to no_printer. | ||
1054 | JR NC,wait_for_stylus | If carry flag not set (D7 was clear in input) then retry. | ||
1056 | LD C,$20 | Set C to 32 as column counter. | ||
print_byte | 1058 | LD E,(HL) | Load next bitmap into E from display address in HL and increment HL. | |
1059 | INC HL | |||
105A | LD B,$08 | Set B to 8 as bit counter. | ||
print_bit | 105C | RL D | Pre rotate D left. | |
105E | RL E | Rotate bitmap in E left. | ||
1060 | RR D | Rotate overflowed bit right into high bit of D (printer stylus power bit). | ||
wait_for_encoder | 1062 | IN A,($FB) | Read byte from printer into A loop until bit 0 (signal from encoder disc) is clear. | |
1064 | RRA | |||
1065 | JR NC,wait_for_encoder | |||
1067 | LD A,D | Output byte in D to printer. | ||
1068 | OUT ($FB),A | |||
106A | DJNZ print_bit | Decrement bit counter and loop back to print_bit until counter equals zero. | ||
106C | DEC C | Decrement column counter and loop back to print_byte until counter equals zero. | ||
106D | JR NZ,print_byte | |||
106F | POP BC | Restore registers. | ||
1070 | POP HL | |||
1071 | INC H | Increment high byte of display address (next line). | ||
1072 | LD A,H | If low 3 bits of H are not zero jump to same_third. | ||
1073 | AND $07 | |||
1075 | JR NZ,same_third | |||
1077 | LD A,L | Else add 32 to low byte of display address. | ||
1078 | ADD A,$20 | |||
107A | LD L,A | |||
107B | CCF | If result overflowed then subtract 8 from high byte of display address (by adding $F8) to rewind to correct row. | ||
107C | SBC A,A | |||
107D | AND $F8 | |||
107F | ADD A,H | |||
1080 | LD H,A | |||
same_third | 1081 | DJNZ print_line | Decrement line counter and loop back to print_line until counter equals zero. | |
This entry point is used by the routine at no_printer.
|
||||
print_0 | 1083 | LD BC,$0000 | Set BC to zero. | |
print_1 | 1086 | XOR A | ||
1087 | OUT ($FB),A | Output $00 to printer (motor fast). | ||
1089 | DEC BC | Decrement counter. | ||
108A | LD A,C | Loop back to print_1 until BC equals zero. | ||
108B | OR B | |||
108C | JR NZ,print_1 | |||
108E | LD A,$04 | Output $04 to printer (motor off). | ||
1090 | OUT ($FB),A | |||
1092 | LD HL,$69C3 | Change routine at NMI_JUMP to 'JP NMI_ISR' to re-enable normal NMI routine. | ||
1095 | LD (NMI_JUMP),HL | |||
1098 | CALL set_hardware_counter | Set hardware line counter ready for next video field and return. | ||
109B | RET |
Prev: 1034 | Up: Map | Next: 109C |