OEL TTX2000 Issue 2.3 | Routines |
Prev: 0066 | Up: Map | Next: 027A |
Used by the routines at NMI_VECTOR and NMI_JUMP.
|
||||
NMI_ISR | 0069 | EXX | Switch to shadow register set. | |
006A | EX AF,AF' | |||
006B | PUSH HL | Preserve HL on the stack (i.e. HL'). | ||
006C | LD A,(ignore_packets_flag) | If ignore_packets_flag is set jump to all_packets_read. | ||
006F | AND A | |||
0070 | JP NZ,all_packets_read | |||
0073 | XOR A | Else clear field_header_flag. | ||
0074 | LD (field_header_flag),A | |||
0077 | LD HL,decoder_RAM | Set HL to start of packet buffer in SRAM and store in packet_data_pointer | ||
007A | LD (packet_data_pointer),HL | |||
007D | LD A,(page_found_flag) | If page_found_flag is set jump to row_search. | ||
0080 | AND A | |||
0081 | JP NZ,row_search | |||
header_search | 0084 | LD A,$27 | If byte at address in HL equals $27 (teletext framing code) jump forwards to packet_found. | |
0086 | CP (HL) | |||
0087 | JR Z,packet_found | |||
This entry point is used by the routine at store_packet_30.
|
||||
not_header | 0089 | LD HL,(packet_data_pointer) | Add 64 to address in packet_data_pointer. | |
008C | LD DE,$0040 | |||
008F | ADD HL,DE | |||
0090 | LD (packet_data_pointer),HL | |||
0093 | LD A,$24 | Loop back to header_search until high byte of address equals $24 (loop over 1kB of decoder RAM). | ||
0095 | CP H | |||
0096 | JR NZ,header_search | |||
0098 | JP all_packets_read | Jump to all_packets_read. | ||
packet_found | 009B | LD (HL),$00 | Overwrite framing code with 0 and increment HL (point to first byte of packet address). | |
009D | INC HL | |||
009E | CALL decode_packet_number | Get packet number (HL now points to second byte of packet address). | ||
00A1 | LD A,$1E | If packet number equals 30, jump to store_packet_30. | ||
00A3 | CP B | |||
00A4 | JP Z,store_packet_30 | |||
00A7 | XOR A | Else if packet number is not 0, jump back to not_header. | ||
00A8 | CP B | |||
00A9 | JR NZ,not_header | |||
00AB | DEC HL | Else decrement HL (point at first byte of packet address). | ||
00AC | CALL decode_magazine_number | Get magazine number. | ||
00AF | LD A,(magazine_number) | If magazine number is not magazine_number, jump to wrong_magazine. | ||
00B2 | CP B | |||
00B3 | JP NZ,wrong_magazine | |||
00B6 | INC HL | Point HL at page tens. | ||
00B7 | INC HL | |||
00B8 | INC HL | |||
00B9 | CALL hamming_decode_hl | Hamming 8/4 decode byte at address in HL. | ||
00BC | LD A,(page_tens) | If decoded nibble is not equal to page_tens, jump to wrong_page. | ||
00BF | CP B | |||
00C0 | JP NZ,wrong_page | |||
00C3 | DEC HL | Else decrement HL (point to page units). | ||
00C4 | CALL hamming_decode_hl | Hamming 8/4 decode byte at address in HL. | ||
00C7 | LD A,(page_units) | If decoded nibble is not equal to page_units, jump to wrong_page. | ||
00CA | CP B | |||
00CB | JP NZ,wrong_page | |||
00CE | LD A,(subpage_search_flag) | If subpage_search_flag is clear jump to ignore_subcode. | ||
00D1 | AND A | |||
00D2 | JP Z,ignore_subcode | |||
00D5 | INC HL | Point HL at Subcode S1. | ||
00D6 | INC HL | |||
00D7 | CALL hamming_decode_hl | Hamming 8/4 decode byte at address in HL. | ||
00DA | LD A,(subcode_S1) | If decoded nibble is not equal to subcode_S1, jump to wrong_page. | ||
00DD | CP B | |||
00DE | JP NZ,wrong_page | |||
00E1 | INC HL | Point HL at Subcode S2. | ||
00E2 | CALL hamming_decode_hl | Hamming 8/4 decode byte at address in HL. | ||
00E5 | LD A,B | If lower three bits of decoded nibble is not equal to subcode_S2, jump to wrong_page. | ||
00E6 | AND $07 | |||
00E8 | LD B,A | |||
00E9 | LD A,(subcode_S2) | |||
00EC | CP B | |||
00ED | JP NZ,wrong_page | |||
00F0 | INC HL | Point HL at Subcode S3. | ||
00F1 | CALL hamming_decode_hl | Hamming 8/4 decode byte at address in HL. | ||
00F4 | LD A,(subcode_S3) | If decoded nibble is not equal to subcode_S3, jump to wrong_page. | ||
00F7 | CP B | |||
00F8 | JP NZ,wrong_page | |||
00FB | INC HL | Point HL at Subcode S4 | ||
00FC | CALL hamming_decode_hl | Hamming 8/4 decode byte at address in HL | ||
00FF | LD A,B | If lower two bits of decoded nibble is not equal to subcode_S4, jump to wrong_page. | ||
0100 | AND $03 | |||
0102 | LD B,A | |||
0103 | LD A,(subcode_S4) | |||
0106 | CP B | |||
0107 | JP NZ,wrong_page | |||
This entry point is used by the routine at ignore_subcode.
|
||||
page_found | 010A | INC HL | Point HL at Control Bits C7-C10. | |
010B | CALL hamming_decode_hl | Hamming 8/4 decode byte at address in HL. | ||
010E | LD A,B | If byte is corrupt, jump to copy_header_text. | ||
010F | INC B | |||
0110 | JR Z,copy_header_text | |||
0112 | BIT 3,A | Else if C10 (inhibit display) is clear, jump to inhibit_display_clear. | ||
0114 | JP Z,inhibit_display_clear | |||
0117 | LD (inhibit_display),A | Else store value in inhibit_display. | ||
011A | LD HL,exit_pointer_RET | Set exit_pointer to exit_pointer_RET (address of RET instruction at end of hamming_decode_hl). This prevents exiting to basic when a page with C10 set is loaded. | ||
011D | LD (exit_pointer),HL | |||
This entry point is used by the routine at inhibit_display_clear.
|
||||
copy_header_text | 0120 | LD HL,(packet_data_pointer) | Copy 32 bytes from packet_data_pointer + 11 to page_receive_buffer_pointer + 8 (the header text). | |
0123 | LD DE,$000B | |||
0126 | ADD HL,DE | |||
0127 | EX DE,HL | |||
0128 | LD HL,(page_receive_buffer_pointer) | |||
012B | LD BC,$0008 | |||
012E | ADD HL,BC | |||
012F | EX DE,HL | |||
0130 | LD BC,$0020 | |||
0133 | LDIR | |||
0135 | LD A,(field_header_flag) | If field_header_flag is set, a header for this page has already been recieved during this field. Jump to no_erase_page. | ||
0138 | AND A | |||
0139 | JR NZ,no_erase_page | |||
013B | LD A,$01 | Else set field_header_flag. | ||
013D | LD (field_header_flag),A | |||
0140 | LD HL,(packet_data_pointer) | Eet HL to packet_data_pointer + 6 (Subcode S2 and C4). | ||
0143 | LD BC,$0006 | |||
0146 | ADD HL,BC | |||
0147 | CALL hamming_decode_hl | Hamming 8/4 decode byte at address in HL | ||
014A | LD A,B | If byte is corrupt, or C4 (erase page) is clear, jump to no_erase_page. | ||
014B | CP $FF | |||
014D | JR Z,no_erase_page | |||
014F | BIT 3,A | |||
0151 | JR Z,no_erase_page | |||
erase_page | 0153 | LD HL,(page_receive_buffer_pointer) | Fill 1080 bytes with $20 (space character) at page_receive_buffer_pointer + 40. (clear rows 1-27). | |
0156 | LD BC,$0028 | |||
0159 | ADD HL,BC | |||
015A | LD D,H | |||
015B | LD E,L | |||
015C | INC DE | |||
015D | LD BC,$0437 | |||
0160 | LD (HL),$20 | |||
0162 | LDIR | |||
no_erase_page | 0164 | LD A,$01 | Set page_found_flag and jump to next_packet. | |
0166 | LD (page_found_flag),A | |||
0169 | JP next_packet | |||
wrong_magazine | 016C | LD A,B | If value in B (first nibble of packet address) is corrupt, jump to not_header. | |
016D | CP $FF | |||
016F | JP Z,not_header | |||
0172 | LD HL,(page_display_buffer_pointer) | Else if byte at address in page_display_buffer_pointer equals $43 ('C' character), jump to copy_rolling_header to aid tuning. | ||
0175 | LD A,$43 | |||
0177 | CP (HL) | |||
0178 | JP Z,copy_rolling_header | |||
017B | LD HL,(packet_data_pointer) | Set HL to packet_data_pointer + 10 (Control bits C11-C14). | ||
017E | LD BC,$000A | |||
0181 | ADD HL,BC | |||
0182 | CALL hamming_decode_hl | Hamming 8/4 decode byte at address in HL. | ||
0185 | LD A,B | If byte is corrupt, jump to not_header. | ||
0186 | CP $FF | |||
0188 | JP Z,not_header | |||
018B | BIT 0,A | Else if C11 (magazine serial) is clear, jump to copy_rolling_clock. | ||
018D | JR Z,copy_rolling_clock | |||
018F | DEC HL | Point HL at Control bits C7-C10. | ||
0190 | CALL hamming_decode_hl | Hamming 8/4 decode byte at address in HL. | ||
0193 | LD A,B | If byte is corrupt or C7 (suppress header) is clear, jump to copy_rolling_header. | ||
0194 | INC B | |||
0195 | JR Z,copy_rolling_header | |||
0197 | BIT 0,A | |||
0199 | JR Z,copy_rolling_header | |||
019B | JR copy_rolling_clock | Else jump to copy_rolling_clock. | ||
wrong_page | 019D | LD A,(disable_rolling_headers) | If disable_rolling_headers is set, jump to copy_rolling_clock. | |
01A0 | AND A | |||
01A1 | JR NZ,copy_rolling_clock | |||
01A3 | LD HL,(packet_data_pointer) | Set HL to packet_data_pointer + 9 (Control bits C7-C10). | ||
01A6 | LD BC,$0009 | |||
01A9 | ADD HL,BC | |||
01AA | CALL hamming_decode_hl | Hamming 8/4 decode byte at address in HL. | ||
01AD | LD A,B | If byte is corrupt, or C7 (suppress header) is set, or C9 (interrupted sequence) is set, jump to not_header. | ||
01AE | CP $FF | |||
01B0 | JP Z,not_header | |||
01B3 | BIT 2,A | |||
01B5 | JP NZ,not_header | |||
01B8 | BIT 0,A | |||
01BA | JP NZ,not_header | |||
copy_rolling_header | 01BD | LD HL,(packet_data_pointer) | Copy 32 bytes from packet_data_pointer + 11 to page_receive_buffer_pointer + 8 (the header text). | |
01C0 | LD DE,$000B | |||
01C3 | ADD HL,DE | |||
01C4 | EX DE,HL | |||
01C5 | LD HL,(page_receive_buffer_pointer) | |||
01C8 | LD BC,$0008 | |||
01CB | ADD HL,BC | |||
01CC | EX DE,HL | |||
01CD | LD BC,$0020 | |||
01D0 | LDIR | |||
01D2 | JP not_header | Jump to not_header. | ||
copy_rolling_clock | 01D5 | LD HL,(packet_data_pointer) | Copy 8 bytes from packet_data_pointer + 35 to page_receive_buffer_pointer + 32 (the clock text). | |
01D8 | LD DE,$0023 | |||
01DB | ADD HL,DE | |||
01DC | EX DE,HL | |||
01DD | LD HL,(page_receive_buffer_pointer) | |||
01E0 | LD BC,$0020 | |||
01E3 | ADD HL,BC | |||
01E4 | EX DE,HL | |||
01E5 | LD BC,$0008 | |||
01E8 | LDIR | |||
01EA | JP not_header | Jump to not_header. | ||
row_search | 01ED | LD HL,(packet_data_pointer) | If byte at address in packet_data_pointer is not $27, (teletext framing code) jump to next_packet. | |
01F0 | LD A,$27 | |||
01F2 | CP (HL) | |||
01F3 | JR NZ,next_packet | |||
01F5 | LD (HL),$00 | Else overwrite framing code with 0 and increment HL (point to first byte of packet address). | ||
01F7 | INC HL | |||
01F8 | CALL decode_packet_number | Get packet number (HL now points to second byte of packet address). | ||
01FB | XOR A | If packet number equals zero, jump to header_found. | ||
01FC | CP B | |||
01FD | JR Z,header_found | |||
01FF | DEC HL | Else decrement HL (point at first byte of packet address). | ||
0200 | CALL decode_magazine_number | Get magazine number. | ||
0203 | LD A,(magazine_number) | If magazine number is not equal to magazine_number, jump to next_packet. | ||
0206 | CP B | |||
0207 | JR NZ,next_packet | |||
0209 | PUSH HL | Preserve HL. | ||
020A | CALL decode_packet_number | Get packet number (HL now points to second byte .of packet address) | ||
020D | LD A,B | If packet number is 0, or is greater than 30, jump to bad_row. | ||
020E | AND A | |||
020F | JR Z,bad_row | |||
0211 | CP $1F | |||
0213 | JR NC,bad_row | |||
0215 | ADD A,A | Else multiply packet number by 40. | ||
0216 | ADD A,A | |||
0217 | ADD A,B | |||
0218 | LD H,$00 | |||
021A | LD L,A | |||
021B | ADD HL,HL | |||
021C | ADD HL,HL | |||
021D | ADD HL,HL | |||
021E | LD DE,(page_receive_buffer_pointer) | Add to address in page_receive_buffer_pointer and store result in DE. | ||
0222 | ADD HL,DE | |||
0223 | EX DE,HL | |||
0224 | POP HL | Restore HL and move forward 2 (start of 40 byte packet data). | ||
0225 | INC HL | |||
0226 | INC HL | |||
0227 | LD BC,$0028 | Copy 40 bytes to address in DE and jump to next_packet. | ||
022A | LDIR | |||
022C | JR next_packet | |||
bad_row | 022E | POP HL | Balance stack. | |
next_packet | 022F | LD HL,(packet_data_pointer) | Add 64 to address in packet_data_pointer. | |
0232 | LD DE,$0040 | |||
0235 | ADD HL,DE | |||
0236 | LD (packet_data_pointer),HL | |||
0239 | LD A,$24 | Loop back to row_search until high byte of address equals $24 (loop over 1kB of decoder RAM). | ||
023B | CP H | |||
023C | JR NZ,row_search | |||
all_packets_read | 023E | CALL set_hardware_counter | Set hardware line counter ready for next video field. | |
0241 | POP HL | Restore HL from stack (stored HL' register value). | ||
0242 | EXX | Switch back to main register set and return from NMI service routine. | ||
0243 | EX AF,AF' | |||
0244 | RETN | |||
header_found | 0246 | DEC HL | Decrement HL (point at first byte of packet address). | |
0247 | CALL decode_magazine_number | Get magazine number. | ||
024A | LD A,(magazine_number) | If magazine number is not equal to magazine_number, jump to next_packet. | ||
024D | CP B | |||
024E | JP NZ,next_packet | |||
0251 | INC HL | Move HL forward by 2 (point to page units). | ||
0252 | INC HL | |||
0253 | CALL hamming_decode_hl | Hamming 8/4 decode byte at address in HL. | ||
0256 | LD A,(page_units) | If page units is not equal to page_units, jump to next_header. | ||
0259 | CP B | |||
025A | JR NZ,next_header | |||
025C | INC HL | Increment HL (point to page tens). | ||
025D | CALL hamming_decode_hl | Hamming 8/4 decode byte at address in HL. | ||
0260 | LD A,(page_tens) | If page units is not equal to page_tens, jump to next_header. | ||
0263 | CP B | |||
0264 | JR NZ,next_header | |||
0266 | LD HL,(packet_data_pointer) | Else set HL to packet_data_pointer and jump to packet_found. | ||
0269 | JP packet_found | |||
next_header | 026C | XOR A | Clear page_found_flag. | |
026D | LD (page_found_flag),A | |||
0270 | LD (reveal_flag),A | Clear reveal_flag. | ||
0273 | INC A | Set page_ready_flag. | ||
0274 | LD (page_ready_flag),A | |||
0277 | JP not_header | Jump to not_header. |
Prev: 0066 | Up: Map | Next: 027A |