Prev: 185A Up: Map Next: 1938
18ED: download_data: Download data from page into memory specified in nibbles at row 23, column 8.
Used by the routine at telesoftware_main.
download_data 18ED LD HL,(page_receive_buffer_pointer) Set DE to page_receive_buffer_pointer + 928 (row 23, column 8).
18F0 LD DE,$03A0
18F3 ADD HL,DE
18F4 EX DE,HL
18F5 LD HL,download_pointer Set HL to address of download_pointer.
18F8 CALL load_nibbles Call load_nibbles to set download_pointer.
18FB LD HL,(page_receive_buffer_pointer) Set HL to page_receive_buffer_pointer + 40 (row 1, column 0).
18FE LD DE,$0028
1901 ADD HL,DE
1902 LD DE,(download_pointer) Load download_pointer into DE.
1906 LD B,$DC Set B to 220 as loop counter.
download_data_0 1908 PUSH BC Preserve outer loop counter.
1909 LD A,(HL) Load next byte (byte n) and strip parity bit.
190A AND $7F
190C CP $20 If character is $20 (space) skip to download_data_3.
190E JR Z,download_data_3
1910 LD BC,$0003 Else copy next three bytes (n+0 to n+2) to address in DE.
1913 LDIR
1915 DEC DE Rewind address in DE.
1916 DEC DE
1917 DEC DE
1918 LD B,$03 Set B to 3 as inner loop counter.
download_data_1 191A RLC (HL) Rotate next byte (n+3) left 2 bits
191C RLC (HL)
191E LD A,(DE) Load lower 6 bits from address in DE into C.
191F AND $3F
1921 LD C,A
1922 LD A,(HL) OR with high 2 bits in byte (n+3).
1923 AND $C0
1925 OR C
1926 LD (DE),A Store result at address in DE.
1927 INC DE Loop through three bytes.
1928 DJNZ download_data_1
192A RLC (HL) Rotate next byte (n+3) left 2 bits, back to original position.
192C RLC (HL)
download_data_2 192E INC HL Move on to next four bytes.
192F POP BC Restore outer loop counter.
1930 DJNZ download_data_0 Loop through 22 rows (220 * 4 bytes) and return.
1932 RET
download_data_3 1933 INC HL Skip over three bytes.
1934 INC HL
1935 INC HL
1936 JR download_data_2
Prev: 185A Up: Map Next: 1938