Let's disassemble the first part:
8000: A0 00 LDY #$00 or
LDY #$27
8002: A9 00 LOOP5 LDA #$00
8004: 85 F9 STA $F9
8006: A9 00 LOOP3 LDA #$00
8008: 85 FA STA $FA
800A: 85 FB STA $FB
800C: A9 00 LOOP2 LDA #$00
800E: 85 FC STA $FC
8010: 85 FD STA $FD
8012: A9 00 LOOP1 LDA #$00
8014: 85 06 STA $06
8016: A5 FE LDA $FE
8018: 85 07 STA $07
801A: 18 CLC
801B: A5 06 LDA $06
801D: 65 F9 ADC $F9
801F: 85 06 STA $06
8021: A5 07 LDA $07
8023: 69 00 ADC #$00
8025: 85 07 STA $07
8027: 18 CLC
8028: A5 06 LDA $06
802A: 65 FA ADC $FA
802C: 85 06 STA $06
802E: A5 07 LDA $07
8030: 65 FB ADC $FB
8032: 85 07 STA $07
8034: 18 CLC
8035: A5 06 LDA $06
8037: 65 FC ADC $FC
8039: 85 06 STA $06
803B: 85 08 STA $08
803D: A5 07 LDA $07
803F: 65 FD ADC $FD
8041: 85 07 STA $07
8043: 18 CLC
8044: 65 FF ADC $FF
8046: 85 09 STA $09
8048: B1 00 LDA ($00),Y or
LDA $#00 or
LDA ($08),Y
804A: 91 06 STA ($06),Y
804C: 18 CLC
804D: A5 FD LDA $FD
804F: 69 04 ADC #$04
8051: 85 FD STA $FD
8053: C9 20 CMP #$20
8055: D0 BB BNE LOOP1
8057: 18 CLC
8058: A5 FA LDA $FA
805A: 69 80 ADC #$80
805C: 85 FA STA $FA
805E: A5 FB LDA $FB
8060: 69 00 ADC #$00
8062: 85 FB STA $FB
8064: C9 04 CMP #$04
8066: D0 A4 BNE LOOP2
8068: 18 CLC
8069: A5 F9 LDA $F9
806B: 69 28 ADC #$28
806D: 85 F9 STA $F9
806F: C9 78 CMP #$78
8071: D0 93 BNE LOOP3
8073: A2 00 LDX #$00
8075: CA LOOP4 DEX
8076: D0 FD BNE LOOP4
8078: C8 INY or
DEY
8079: C0 28 CPY #$28 or
CPY #$FF
807B: D0 85 BNE LOOP5
807D: 60 RTS