	.ORG $7F80
	.DB "NESM", $1A
	.DB 1
	.DB 1
	.DB 1
	.DW $8000
	.DW START
	.DW EXECUTE
	;    0123456789ABCDEF0123456789ABCDEF
	.DB 'Luka Luka Night Fever',0,'         ',0
	.DB 'Orig: samfree(RIP) / Cover: w7n',0
	.DB 'Tech demo by w7n',0,'              ',0
	.DW $3D09
	.DW 0,0,0,0
	.DW $3D09
	.DB 0,8
	.DW 0,0

	.pad $8000, $00

 .MACRO SKIP
   .DB $2C
 .ENDM
 
 .MACRO LEN x,y
 	.DB 128+x+y*16
 .ENDM
 
 .MACRO SQ1HI x,y
 	.DB x-8+(x-y)*16
 .ENDM
 
 .MACRO SQ1 x,y
 	.DB x+(x-y)*16
 .ENDM
 
 .MACRO ARP x,y
 	.DB x+y*8
 .ENDM
 
 .MACRO BI x,y
 	.DB x+y*16
 .ENDM
 
 .MACRO PERC x,y
 	.DB x*8+y
 .ENDM
 
 
Illegal EQU 1

;Variables
LoFrameCounter = $7F
SQ1addr=0
SQ2addr=2
NOIaddr=4
SQ1Offset=6
SQ2Offset=7
NOIOffset=8
SQ1Len=9
SQ2Len=10
NOILen=11
ShokiJoutai=12
SQ2Mode=13
NOIVolume=14
SQ1LoopsLeft=15
SQ1LoopLen=18
SQ1LoopBreak=21
SQ2LoopsLeft=16
SQ2LoopLen=19
SQ2LoopBreak=22
NOILoopsLeft=17
NOILoopLen=20
NOILoopBreak=23
SQ1Cut=24
SQ2Cut=25
SQ1Duration=26
SQ2Duration=27
SQ2BassNote=28
SQ2BassNote2=29
SQ2RowCount=30
NOIDecay=31

;Constants
Ax2=0
C3=1
Cx3=2
Dx3=3
E3=4
F3=5
G3=6
Gx3=7
Ax3=8
C4=9
Cx4=10
Dx4=11
E4=12
F4=13
G4=14
Gx4=15
Ax4=16
C5=17

ArpAxm=0
ArpCm=1
ArpC=2
ArpCsus4=3
ArpCx=4
ArpDx=5
ArpFm=6
ArpDx_2=7



START:
	LDX #$00
-:
	LDA ShokiRAMData,X
	STA $00,X
	DEX
	BNE -
	;LDA #$0F
	;STA $4015
	LDA #$30
	JSR InitSoundRAMs
	TXA
	INX
	STX $5015
	JSR InitSoundRAMs
	;LDX #3
	;JSR InitSoundRAMs
TriSettings:
	LDA #$7F
	STA $4008
	
	RTS
EXECUTE:
;Handles Noise Decay
	LDX NOIVolume
	BEQ +
	LDA LoFrameCounter
	AND NOIDecay
	BNE +
	DEX
	STX NOIVolume
+:
	TXA
	ORA #$30
	STA $400C
	
	DEC LoFrameCounter
	BMI +
	RTS
+:
	LDA #2
	STA LoFrameCounter
	INC SQ2RowCount
	
	;SQ1 music processing
	DEC SQ1Len
	BNE SQ2_ProcessData
	LDX #0
	JSR CheckToReadHeader
	BCC SQ1_ReadData
SQ1_ReadHeader:
	LDX #0
	JSR Common_ReadHeader
SQ1_ReadData:
IFDEF Illegal
	.DB $B3, SQ1addr  ;LAX (SQ1addr),Y
ELSE
	LDA (SQ1addr),Y
	TAX
ENDIF
	BPL SQ1_Note
	;NoteLen settings
	AND #$0F
	ASL
	BNE +
	LDA #1
+:
	STA SQ1Duration
	TXA
IFDEF Illegal
	.DB $4B, $70  ;ASR #$7E
ELSE
	AND #$70
	LSR
ENDIF
	LSR
	LSR
	CMP #$0E
	BNE +
	
	LDA #1
+:
	INY
	STA SQ1Cut
	BNE SQ1_ReadData
SQ1_Note:
	PHA
	AND #$0F
	CMP #$0F
	BEQ +
	LDX #0
	JSR GetNoteFreq
	LDA #$BA
	STA $4000
+:
	LDA SQ1Duration
	STA SQ1Len
	PLA
	LSR
	LSR
	LSR
	LSR
	BEQ SQ2_ProcessData-3
	TAX
	LDA MMC5DevTbl-1,X
	CLC
	ADC $82
	LDX #9
	JSR GetNoteFreq
	LDA #$B6
	STA $5000
	INY
	STY SQ1Offset
SQ2_ProcessData:
	;LDA SQ2LoopsLeft
	;BNE +
	LDA SQ2RowCount
	CMP SQ2LoopBreak
	BEQ SQ2_ReadHeader	
 ;+:
	DEC SQ2Len
	BEQ +
	JMP NOI_ProcessData
+:
	LDY SQ2Offset
	;INC SQ2Offset
	LDA ShokiJoutai
	BNE SQ2_ReadHeader
	CPY SQ2LoopLen
	BNE SQ2_ReadData
	DEC SQ2LoopsLeft
	LDY #0
	STY SQ2Offset
	BEQ SQ2_ReadData
SQ2_ReadHeader:
	LDY SQ2LoopLen
	LDA (SQ2addr),Y
	STA SQ2LoopLen
	INY
IFDEF Illegal
	.DB $B3, SQ2addr  ;LAX (SQ2addr),Y
ELSE
	LDA (SQ2addr),Y
	TAX
ENDIF
	AND #7
	STA SQ2Mode
	TXA
	LSR
	LSR
	LSR
	STA SQ2LoopsLeft
	INY
	LDA (SQ2addr),Y
	STA SQ2LoopBreak
	LDX #0
	STX SQ2RowCount
	LDX #2
	JSR UpdateAddr
SQ2_ReadData:
	LDA SQ2Mode
	CMP #03
	BCS +
	LDA #$20
	STA SQ2Len
IFDEF Illegal
	.DB $B3, SQ2addr  ;LAX (SQ2addr),Y
ELSE
	LDA (SQ2addr),Y
	TAX
ENDIF
	AND #7
	ASL
	ASL
	STA SQ2BassNote
	TXA
IFDEF Illegal
	.DB $4B, $38  ;ASR #$38
ELSE
	AND #$38
	LSR
ENDIF
	STA SQ2BassNote2
	BPL NOI_ProcessData-3 ;unconditional
+:
	BNE +
	LDA #$08
	LDX #$01
	BNE ++ ;unconditional
+:
	LDA SQ1Len
	LDX SQ1Cut
++:
	STA SQ2Len
	STX SQ2Cut
	LDA (SQ2addr),Y
	PHA
	LDX #4
	JSR GetNoteFreq
	PLA
	LDX #8
	JSR GetNoteFreq_HiBits
	;JSR TriSettings
	LDA #$B7
	STA $4004
	INY
	STY SQ2Offset
NOI_ProcessData:
	DEC NOILen
	BNE HandleRow
	LDX #2
	JSR CheckToReadHeader
	BCC NOI_ReadData	
NOI_ReadHeader:
	LDX #4
	JSR Common_ReadHeader
NOI_ReadData:
IFDEF Illegal
	.DB $B3, NOIaddr  ;LAX (NOIaddr),Y
ELSE
	LDA (NOIaddr),Y
	TAX
ENDIF
	INY
	STY NOIOffset
	AND #$07
	TAY
	LDA NOIInstrumentNote,Y
	STA $400E
	LDA NOIInstrumentVolume,Y
	STA NOIVolume
	STA $400F ;As long as the first write's high 5 bits is nonzero, it's fine
	ORA #$30
	STA $400C
	LDA NOIDecayTbl,Y
	STA NOIDecay
	TXA
	LSR
	LSR
	LSR
	STA NOILen


HandleRow:
	LDA #0
	STA ShokiJoutai
	LDX SQ2Mode
	LDA SQ1Cut
	CMP SQ1Len
	BCC HandleSQ2
	LDA #$30
	STA $4000
	STA $5000
	CPX #$04
	BNE HandleSQ2
	STA $4004
HaltTri:
	LDA #$00
	STA $400A
	STA $400B
	RTS
HandleSQ2:
	LDA SQ2RowCount
	CPX #$03
	BCS NormalSQ2Mode
	AND #$0F
	CMP #$0F
	BNE +
	LDY SQ2BassNote+1
	STY SQ2BassNote
+:
	AND #$07
	LSR
	TAY
	BCS HaltSQ2
	CPX #$02
	BEQ HaltSQ2
	ORA SQ2BassNote
	TAX
	LDA ArpTbl,X
	LDX #4
	JSR GetNoteFreq
	LDA SQ2Mode
	LSR
	ROR
	LSR
	ORA #$35
	SKIP
HaltSQ2:
	LDA #$30
	STA $4004
	TYA
	CMP #$03
	BEQ HaltTri
	AND #$02
	ASL
	ASL
	STA $80
	LDX SQ2BassNote
	LDA ArpTbl,X
	ORA $80
	LDX #8
	JSR GetNoteFreq
EndMusic:
	RTS
NormalSQ2Mode:
	LDA SQ2Cut
	CMP SQ2Len
	BCC EndMusic
	LDA #$30
	STA $4004
	BNE HaltTri

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

GetNoteFreq_HiBits:
	LSR
	LSR
	LSR
	LSR
GetNoteFreq: ;X=channel to store, 0=SQ1,4=SQ2,8=TRI, >8=MMC5
	AND #$0F
	STX $83
	DEX
	BPL + ;Check if x=0, i.e. SQ1
	LDX SQ1addr
	CPX #<SQ1Data2+3
	BNE +
	ADC #7 ; actually +8 since C is set
+:
	STA $82 ; In case the program needs it
	TAX

	LDA FreqTbl,X
	PHA
	LDA HiFreqTbl,X
	ORA #$08
	LDX $83
	CPX #$09
	BCS +
	STA $4003,X
	PLA
	STA $4002,X
	RTS
+:
	STA $5003
	PLA
	STA $5002
	RTS

Common_ReadHeader:
	LDA SQ1addr,X
	STA $80
	LDA SQ1addr+1,X
	STA $81
	TXA
	LSR
	TAX
	LDY SQ1LoopLen,X
	LDA ($80),Y
	BNE +
	PLA
	PLA
	JMP START ; ???
+:
	STA SQ1LoopLen,X
	STA SQ1LoopBreak,X
	INY
	LDA ($80),Y
	STA SQ1LoopsLeft,X
	BEQ +
	INY
	LDA ($80),Y
	STA SQ1LoopBreak,X
+:
	TXA
	ASL
	TAX
UpdateAddr:
	INY
	TYA
	CLC
	ADC SQ1addr,X
	STA SQ1addr,X
	LDA #0
	TAY
	ADC SQ1addr+1,X
	STA SQ1addr+1,X
	RTS



InitSoundRAMs:
	STA $4000,x
	STA $4004,x
	STA $5000,x
	STA $5004,x
	RTS

CheckToReadHeader:
	LDY SQ1Offset,X
	;INC SQ1Offset,X
	LDA ShokiJoutai
	BNE ReadHeader 
	LDA SQ1LoopsLeft,X
	BEQ +
	TYA
	CMP SQ1LoopLen,X
	BNE ReadData
	LDY #0
	STY SQ1Offset,X
	DEC SQ1LoopsLeft,X
	BEQ ReadData
+:
	TYA
	CMP SQ1LoopBreak,X
	BNE ReadData
ReadHeader:
	SEC
	RTS
ReadData:
	CLC
	RTS

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

;SQ1, NOI Block definition:
;Length - Loop count - Loop break offset - data. If Length=00, then reset everything;
;If loop count=0 then loop break offset is omitted(this doesn't apply to SQ2)

;SQ1 Note data struct:
;xyyyONNN

;O: Octave
;NNN: Note
;ONNN=1111: Silent note (SQ1 only)

;xyyy:
;If x=0, then start control MMC5, subtract yyy from the SQ1 note, and let MMC5 play this note.
;If xyyy >= 0101 however, xyyy+1 is ADDED to the MMC5 note; if xyyy=0000, do not control MMC5.

;If x=1: yyy=note silence time(*2, if yyy=111 then =1), NNNN=note duration(*2, if=0 then =1)
;Delayed note cut time is Duration - Note silence value

;SQ2 & TRI Block definition:
;Length(bytes) - Loop count(hi bits) & note type(lo 3 bits) - Loop break length(rows) - data
;Note type: 0 : V00, length=2; 1 : V01, length=2; 2: None, only TRI; 3: V02, length=8, delayed cut=7; 4: ignore length (length and delayed cut controlled by SQ1; V02)
;For 0,1,2, note type is:
;Arp base note1 + Arp base note2(Compressed, both 3 bits)
;For 3&4, note type is:
;SQ note + TRI note

;NOI Block definition:
;Length - Loop count - Loop break length - data
;NOI Note:
;xxxxxyyy, x=length, y=instrument

SQ1Data1:
	.DB SQ1Data2-SQ1Data1-2, 0
	LEN 4,1
	.DB $70+G3
	LEN 2,1
	.DB $70+Gx3, $70+G3, $70+Gx3
	LEN 8,4
	.DB $70+F3
SQ1Data2:
	.DB SQ1Data3-SQ1Data2-3, 1, SQ1Data3-SQ1Data2-3
	LEN 2,7
	SQ1HI C5,Gx4
	SQ1HI F4,C4
	SQ1HI F4,C4
	LEN 1,7
	SQ1HI Dx4,Ax3
	LEN 5,1
	SQ1HI F4,C4
	LEN 2,7
	SQ1HI Dx4,Ax3
	SQ1HI F4,C4
	LEN 1,7
	SQ1HI G4,Dx4
	SQ1HI G4,Dx4
	SQ1HI F4,C4
	SQ1HI F4,C4
	SQ1HI G4,Dx4
	SQ1HI G4,Dx4
	SQ1HI Gx4,F4
	SQ1HI Gx4,F4
	SQ1HI Ax4,G4
	SQ1HI Ax4,G4
	SQ1HI Gx4,F4
	SQ1HI Gx4,F4
	SQ1HI G4,Dx4
	SQ1HI G4,Dx4
	SQ1HI Gx4,F4
	SQ1HI Gx4,F4
	LEN 2,7
	SQ1HI C5,Gx4
	SQ1HI F4,C4
	SQ1HI F4,C4
	LEN 1,7
	SQ1HI Dx4,Ax3
	LEN 5,1
	SQ1HI F4,C4
	LEN 2,7
	SQ1HI Dx4,Ax3
	SQ1HI F4,C4
	LEN 2,1
	SQ1HI G4,Dx4
	SQ1HI G4,Dx4
	LEN 0,0
	SQ1HI Ax3,G3
	SQ1HI C4,Gx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, 4*8+0, 255
	ARP ArpCx, ArpDx
	ARP ArpCm, ArpFm



NOIData1:
	.DB 6, 0
	PERC 8,4
	PERC 4,4
	PERC 4,4
	PERC 4,4
	PERC 8,4
	PERC 8,5
NOIData2:
	.DB 6, 14, 6
	PERC 4,0
	PERC 2,1
	PERC 2,1
	PERC 4,3
	PERC 2,1
	PERC 2,1
NOIData3:
	.DB 2, 0
	PERC 8,4
	PERC 8,4
NOIData4:
	.DB 6, 14, 6
	PERC 4,0
	PERC 2,1
	PERC 2,1
	PERC 4,3
	PERC 2,1
	PERC 2,1
NOIData5:
	.DB 2, 0
	PERC 8,4
	PERC 8,4
NOIData6:
	.DB 6, 14, 6
	PERC 4,0
	PERC 2,1
	PERC 2,1
	PERC 4,3
	PERC 2,1
	PERC 2,1
NOIData7:
	.DB 2, 0
	PERC 8,4
	PERC 8,4
NOIData8:
	.DB 5, 13, 4
	PERC 2,0
	PERC 2,1
	PERC 4,2
	PERC 4,3
	PERC 4,2
NOIData9:
	.DB 6, 0
	PERC 8,4
	PERC 4,4
	PERC 4,4
	PERC 4,4
	PERC 8,4
	PERC 8,5
NOIData10:
	.DB 5, 14, 5
	PERC 2,0
	PERC 2,1
	PERC 4,2
	PERC 4,3
	PERC 4,2
NoiData11:
	.DB 2, 0
	PERC 8,4
	PERC 8,4
NOIData12:
	.DB 5, 255, 5
	PERC 2,0
	PERC 2,1
	PERC 4,2
	PERC 4,3
	PERC 4,2




;-----------------------------------------------------
;Data


FreqTbl:
	.DB $DF, $AB, $93, $67, $52, $3F, $1C, $0C
	.DB $EF, $D5, $C9, $B3, $A9, $9F, $8E, $86
	.DB $77, $6A
	;Contains only freq of:
	;A#2, C-3, C#3, D#3, E-3, F-3, G-3, G#3 and higher octaves

ArpTbl:
	.DB Ax2, Cx3, F3, Ax3
	.DB C3, Dx3, G3, C4
	.DB C3, E3, G3, C4
	.DB C3, F3, G3, C4
	.DB Cx3, F3, Gx3, Cx4
	.DB Dx3, G3, Ax3, Dx4
	.DB F3, Gx3, C4, F4
	.DB Ax2, Dx3, G3, Ax3
	
NOIInstrumentNote:
	.DB $C, $2, $2, $4, $4, $C 
NOIInstrumentVolume:
	.DB 7,7,9,9,12,14

;Bassdrum, hat, cymbal, drum, crash, drum2

MMC5DevTbl:
	.DB $FF, $FE, $FD, $FC, 2, 1, 8


ShokiRAMData:
	.DW SQ1Data1, SQ2Data1, NOIData1
;shares data with several tables
NOIDecayTbl:
	.DB 0,0,0
HiFreqTbl:
	.DB 1,1,1,1,1,1,1,1