Prev: 920D Up: Map Next: 924E
921F: Decompress and upload patterns
Decompress and upload patterns to VDP buffer at $1400. Used by the routine at start_screen.
decompress_patterns 921F LD HL,$0279 Number of bytes in block at $9475
9222 LD (decoder_length),HL Save it
9225 XOR A A = 0
9226 LD (decoder_bits_left),A Save it
9229 LD HL,L9474 planet_graphics - 1
922C LD DE,$1400 Destination address in VDP RAM
This entry point is used by the routine at decompress_write_byte.
decompress_patterns_0 922F LD A,($726B) MSB of counter
9232 OR A Test MSB
9233 RET M Return when MSB is negative
9234 LD B,$01 Read 1 bit
9236 CALL read_b_bits_into_a_0 Read it into A
9239 OR A If zero, write multiple bytes
923A JR NZ,decompress_write_byte Otherwise jump to write a single byte
923C LD B,$05 Read 5 bits
923E CALL read_b_bits_into_a_0 Read them into A
9241 ADD A,$02 Add 2 as the base
9243 PUSH AF Save number of repeats
9244 CALL read_b_bits_into_a Get byte to write in A
9247 POP BC Restore number of repeats
decompress_patterns_1 9248 RST $10 Write VDP byte in A to DE
9249 INC DE Next VDP address
924A DJNZ decompress_patterns_1 Loop B times
924C JR decompress_patterns_0 Loop
Prev: 920D Up: Map Next: 924E