10
20
30 FORQ%=0TO2STEP2:P%=&900:[OPTQ%
40 .rmck%LDA&F4:PHA:JSR strm%:LDX#0:TXA:JSR rmsl%:LDY#0:STY&F6:LDA#&80:STA&F7:.rmc0%LDA(&F6),Y:PHA:EOR#&FF:STA(&F6),Y:EOR(&F6),Y:STA&E6:PLA:STA(&F6),Y
50 LDA&F7:EOR#&80:ORA&F6:EQUW&4D0:LDA&E6:STA&AC:LDA&AC:EOR&E6:EQUW&AD0:INC&F6:BNE rmc0%:INC&F7:BIT&F7:BVC rmc0%
60 TXA:JSR hxac%:LDA&F7:JSR phex%:LDA&F6:JSR phex%:LDA&AC:JSR phex%:LDA&E6:JSR phex%:JSR&FFE7:INX:CPX#16:BNE rmck%+8:PLA:JMP edrm%
70 .phex%PHA:LSRA:LSRA:LSRA:LSRA:JSR hxac%:PLA:AND#15:.hxac%SED:CMP#10:ADC#48:CLD:JMP&FFEE
80 .strm%LDA#&81:LDX#0:LDY#&FF:JSR&FFF4:LDA#5:DEX:EQUW&BF0:LDA#0:JSR&FFF4:TXA:EQUW&1D0:INX:LDA#&30:LDY#&60:CPX#1:EQUW&CD0:LDY&FE60:STY&AD:LDY&FE62:STY&AE
90 LDY#&C9:STA rmsl%+10:STX&AF:STY rmsl%+12:RTS:.edrm%JSR rmsl%:LDX&AF:CPX#1:BNE edrm%-1:LDY&AE:STY&FE62:LDY&AD:STY&FE60:RTS:.rmsl%PHA:LDA#&C:JSR rmsl%+7:PLA
100 STA&F4:STA&FE30:CMP#16:BCS rmsl%+44:PHA:TXA:PHA:LDX&F4:STA&FF30,X:LDA#&F:CPX#8:EQUW&2B0:LDX#3:STA&FE62:STX&FE60:PLA:TAX:PLA:STA&FE32:RTS
110 .cpy%PHA:JSR strm%:LDY&F4:PLA:JSR rmsl%:TYA:PHA:LDY#0:STY&F6:STY&F8:LDA#&80:STA&F7:LSRA:STA&F9
120 .cpy0%LDA(&F6),Y:STA(&F8),Y
130 INY:BNE cpy0%:INC&F7:INC&F9:BIT&F7:BVC cpy0%:PLA:JMP edrm%
140 ]:NEXT:CALL&900