;```````````````````````````````````````
;1KB INTRO FOR FOREVER ?
;
;CODE:
; DETERGENT/BRISE
;
;TINYMSX: 'MYBLOCK'
; AGEMIXER/SKALARIA
;
; (USED WITHOUT PERMISSION)
;```````````````````````````````````````

CHADOR   = $04
IMLO     = $05
IMHI     = $06
COS      = $07
LO       = $08
HI       = $09
ZPĪMSX   = $24

DATA     = $2000
KOD      = $8400

BMP      = $4000
SC1      = $4400
SC2      = $4800

TD018    = $1000

CHESSMEM = $A000
CHESSĪLO = $1400
CHESSĪHI = $1500

         *= $0380

         JMP STARTĪBALL

         *= $080D
DOCYKL
         LDX #$2E
         CPX $D012
         BNE *-3
         JSR DOCYKLĪ
         BEQ *+4
         NOP
         NOP
         JSR DOCYKLĪ
         BEQ *+4
         BIT $EA
         JSR DOCYKLĪ+1
         BNE *+2
         RTS
PPROC                   ;X=#$31
         INC $D017-$31,X ;+1
         DEC $D017-$31,X ;+1
ADT0     LDA $1000,Y
         STA $D008-$31,X ;+1
ADT1     LDA $1020,Y
         STA $D00A-$31,X ;+1
ADT2     LDA $1040,Y
         STA $D00C-$31,X ;+1
ADT3     LDA $1060,Y
         STA $D00E-$31,X ;+1
                         ;+6 CYKLI!
DOCYKLĪ
         NOP
         NOP
         LDY #$08
         DEY
         BNE *-1
         INX
         CPX $D012
         RTS
LOOPĪR
         TYA
         PHA

         LDX #$3F
LOOPĪLC
         TXA
         AND #$1F
         CPX #$20
         BCS *+4
         EOR #$1F
         TAY
         LDA #$00
         STA $033F,X
         LDA SIN1X4,Y
         LSR A
         STA IMLO

;---- IMUL

         LDY #6
         STY $D020
IMULĪL0
         BCC *+6
         CLC
ADTABR   ADC TABĪR+49
         ROR A
         ROR IMLO
         DEY
         BPL IMULĪL0

         CPX #$20
         BCS *+4
         EOR #$FF
;----
         CLC
         ADC #128+24
ADD0     STA DATA,X
         STA DATA+$40,X
         DEX
         BPL LOOPĪLC

         INC ADD0+2
         INC ADD0+5
         PLA
         TAY
         LSR A
         BCS *+5
         DEC ADTABR+1
         DEY
         BPL LOOPĪR

         LDY #100
NY0
         JSR MAKE0
         INC WAD0+1
         DEY
         BNE NY0

         LDY #100
         STY $D021
NY1
         DEC WAD0+1
         JSR MAKE0
         DEY
         BNE NY1
         LDA #$60
         STA KOD+$1837  ;9CFE
         ASL A
         STA CHADOR
         STA $0340
         STY $3FFF
         STY $D010
         LDX #3
ISP00
         LDA #50
         STA $D009,Y
         LDA #13
         STA $07FC,X
         LDA #$01
         STA $D02B,X
         INY
         INY
         DEX
         BPL ISP00      ;-> X=#$FF
         STX $D017
         LDA #%11110000
         STA $D015
         LDX #<IRQ00
         LDY #>IRQ00
         JSR IIRQ
;```````````````````````````````````````
STARTĪCHESS
         LDA #$36
         STA $01
       ;DSP GENERATOR !!!
         LDX #4
         LDY #0
         LDA DSPROC,Y
ADK1     STA DSPROC+12
         INC ADK1+1
         INY
         CPY #12
         BNE ADK1-3
         DEX
         BPL ADK1-5
       ;--------
         LDY #$24
         STY DSPROC+70
         LDX #$00
         TXA
         STA CHESSMEM,X
         INX
         BNE *-4
         INC *-4
         DEY
         BNE *-11
MCHLP00
         TYA
         PHA

         LDA #$05
         STA CHADOP

         LDA CHAD00+1
         STA CHESSĪLO,Y
         LDA CHAD00+2
         STA CHESSĪHI,Y

         LDX #40
CHLC00   LDY #$01
CHAD00   LDA CHESSMEM
CHADOP   ORA CHADOR
CHAD01   STA CHESSMEM
         LSR CHADOR
         BCC CHL01
         ROR CHADOR
         INC CHAD00+1
         INC CHAD01+1
         BNE *+8
         INC CHAD00+2
         INC CHAD01+2
         DEX
         BEQ CHEXIT
CHL01
         DEY
         BNE CHAD00

         LDA #$21
         EOR CHADOP
         STA CHADOP
         BNE CHLC00
CHEXIT
         INC CHLC00+1
         PLA
         TAY
         INY
         CPY #202
         BNE MCHLP00

         LDX #40
CL00
         LDA #$3E        ;3E,26,A4
         STA SC2-1,X
         LDA #$D5        ;D5,20,70
         STA $D800-1,X
         STA SC1-1,X
         DEX
         BNE CL00
         STX $D011
         STX $D015
         STA $D020
         STA $D021

;```````````````````````````````````````
         DEC $DD00
         LDX #<IRQ01
         LDY #>IRQ01
         JSR IIRQ
NEXT
         LDY #200
CHLP00
         JSR GENĪCHESS
         INC MTLC+1
         DEY
         BNE CHLP00

         LDY #200
CHLP01
         JSR GENĪCHESS
         DEC MTLC+1
         DEY
         BNE CHLP01
         BEQ NEXT

MAKE0
         TYA
         PHA

         LDX #3
         LDY TAB,X
WAD0     LDA #>DATA
         STA ADT0+2,Y

     ;--RANDOM

         LDA COS
ADD      ADC $A100
         STA COS
         INC ADD+1

     ;--- END !

         AND #$3F
         STA ADT0+1,Y
         DEX
         BPL WAD0-3

         LDA PPROC,Y
ADKOD    STA KOD
         INC ADKOD+1
         BNE *+5
         INC ADKOD+2
         INY
         CPY #31
         BNE ADKOD-3

         PLA
         TAY
         RTS
SIN1X4
         .BYTE $03,$06,$0C,$12
         .BYTE $18,$1E,$24,$2A
         .BYTE $30,$36,$3B,$41
         .BYTE $46,$4B,$50,$55
         .BYTE $59,$5E,$62,$66
         .BYTE $69,$6C,$70,$72
         .BYTE $75,$77,$79,$7B
         .BYTE $7C,$7D,$7E,$7E

GENĪCHESS
         TYA
         PHA
         LDA #$10
         LDX #200
         STX LO
MTLC     LDY #1
         STA TD018-1,X
         DEX
         BEQ FBMP
         DEY
         BNE MTLC+2
         EOR #$30
         BPL MTLC
FBMP
                         ;LO=#$C8
         LDX MTLC+1
         LDA CHESSĪLO,X
         STA ANCH00+1
         LDA CHESSĪHI,X
         STA ANCH00+2

         LDA #>BMP
         STA HI
         LDY #$70
         LDX #39
ANCH00   LDA CHESSMEM,X
         STA (LO),Y
         SEC
         LDA LO
         SBC #8
         STA LO
         BCS *+4
         DEC HI
         DEX
         BPL ANCH00
         PLA
         TAY
         RTS
IIRQ
         LDA #$1B
         STA $D011
         STA $D012
         STX $0314
         STY $0315
         INC $D019
         CLI
         RTS
IRQ00
         JSR DOCYKL

BROT     LDA #$01
         INC BROT+1
         AND #$3F
         TAY
         JSR KOD

         LDA #$03
         LDY #$FA
         JSR SCD011

         LDY #$FF
         LDA #$0B
         JSR SCD011
         BPL IEND

SCD011
         CPY $D012
         BNE *-3
         STA $D011
         RTS

IRQ01
         JSR DOCYKL
FPROC
         LDA #$38
         STA $D011
         LDA TD018,Y
         STA $D018
         LDX #$18
         INY
         NOP
       ;----------------
DSPROC   INC $D011
         LDA TD018,Y
         STA $D018
         INY
         NOP
         NOP
    ;--------------------------------
    ;AREA 60 BYTES
TABĪR
         .BYTE $63,$63,$63,$63,$63,$63
         .BYTE $63,$62,$62,$62,$61,$61
         .BYTE $60,$60,$5F,$5F,$5E,$5D
         .BYTE $5C,$5C,$5B,$5A,$59,$58
         .BYTE $57,$56,$54,$53,$52,$50
         .BYTE $4F,$4D,$4B,$4A,$48,$46
         .BYTE $44,$42,$3F,$3D,$3A,$37
         .BYTE $34,$31,$2D,$29,$24,$1F
         .BYTE $18,$0E
    ;0-49 BAJTOW
TAB
         .BYTE 0,6,12,18
    ;50-53 BAJTY
STARTĪBALL

         SEI ;54
;```````````````````````````````````````
CALCĪTABĪX

         LDX #$24 ;55,56
         JMP INSTALLĪMSX ;57,58,59

    ;-------------------------------

         INC $D011
         LDA TD018,Y
         STA $D018
         INY
         CPY #(8*25)
         BNE FPROC
         STX $D011
IEND
         JSR ZPĪMSX
         INC $D019
         JMP $EA7E


;```````````````````````````````````````
;MUSIC
;```````````````````````````````````````

;```````````````````````````````````````
;MYBLOCK BY AGEMIXER
;
;TINYMSX COMPO 2005
;
;1BLOCK
;```````````````````````````````````````
INSTALLĪMSX
         LDA TINYMSX-$24,X
         STA $00,X
         INX
         BNE *-6
;INIT
         LDX #$17
         LDA $DF,X
         STA $D401,X
         DEX
         BNE *-6
         LDA #$01
         STA $D01A
         LDA #$7F
         STA $DC0D
         LDX #<IEND
         LDY #>IEND
         JSR IIRQ
         LDY #99
         JMP LOOPĪR
;```````````````````````````````````````
TINYMSX
         LDY #$00
         TYA
         AND #$1F
         CMP #$10
         BCC A5
         LDX $0A
         LDA $AA,X
         STA $D400
         LDA $B2,X
A4       STA $D401
         JMP $45
A5       EOR #$0F
         LSR A
         STA $D401
         STA $D400
         TYA
         AND #$0F
         NOP
         ASL A
         ASL A
         ASL A
         EOR #$7F
         STA $D416
         TYA
         AND #$04
         LSR A
         LSR A
         EOR #$81
         STA $D40B
         TYA
         LSR A
         LSR A
         STA $D411
         ROR $D410
         LSR A
         AND #$03
         TAX
         LDA $A6,X
         STA $6F
         LDX $0A
         LDA $C1,X
         TAX
         LDA $BA,X
         STA $D40E
         LDA $D9,X
         STA $D40F
         INY
         TYA
         AND #$3F
         BNE A7
         INC $84
         LDA #$00
         AND #$0F
         BNE A6
         TAX
         LDA $5D
         EOR #$A0
         STA $5D
         TXA
A6       AND #$07
         STA $0A
         BNE A7
         LDA $47
         EOR #$08
         STA $47
         LDA $48
         EOR #$E0
         STA $48
A7       STY $25
         RTS
         .BYTE $D1,$C1,$D1,$C9,$00,$56
         .BYTE $FF,$7C,$00,$56,$FE,$20
         .BYTE $08,$05,$02,$04,$04,$05
         .BYTE $05,$07,$00,$F6,$06,$5B
         .BYTE $F9,$E9,$82,$00,$03,$01
         .BYTE $01,$00,$00,$01,$01,$02
         .BYTE $05,$04,$03,$02,$03,$04
         .BYTE $03,$04,$07,$06,$05,$04
         .BYTE $05,$06,$06,$10,$11,$13
         .BYTE $15,$17,$1A,$1C,$20,$0A
         .BYTE $41,$09,$E9,$FE,$FF,$09
         .BYTE $09,$08,$02,$35,$00,$00
         .BYTE $09,$09,$41,$FF,$7F,$00
         .BYTE $00,$C1,$1F
TINYMSXĪ
;```````````````````````````````````````

