fixed that damn melody smashing bug by removing i from sram
This commit is contained in:
parent
71853df37d
commit
889e60aa07
102
avr/noiseplug.s
102
avr/noiseplug.s
|
@ -22,7 +22,6 @@ LEADINIT2 = 3571
|
||||||
.section .bss
|
.section .bss
|
||||||
|
|
||||||
.comm int_ctr, 1
|
.comm int_ctr, 1
|
||||||
.comm i, 3
|
|
||||||
|
|
||||||
.comm lead1, 4
|
.comm lead1, 4
|
||||||
.comm lead2, 4
|
.comm lead2, 4
|
||||||
|
@ -46,14 +45,14 @@ NULL:
|
||||||
.type __vector_4, @function
|
.type __vector_4, @function
|
||||||
__vector_4:
|
__vector_4:
|
||||||
push r16
|
push r16
|
||||||
push r24
|
|
||||||
in r16, SREG
|
in r16, SREG
|
||||||
lds r24,int_ctr
|
push r16
|
||||||
subi r24,lo8(-(1))
|
lds r16,int_ctr
|
||||||
andi r24,lo8(3)
|
subi r16, -1
|
||||||
sts int_ctr,r24
|
andi r16, 3
|
||||||
out SREG,r16
|
sts int_ctr, r16
|
||||||
pop r24
|
pop r16
|
||||||
|
out SREG, r16
|
||||||
pop r16
|
pop r16
|
||||||
reti
|
reti
|
||||||
.size __vector_4, .-__vector_4
|
.size __vector_4, .-__vector_4
|
||||||
|
@ -67,18 +66,18 @@ clear_sram:
|
||||||
sbrs r30, 5
|
sbrs r30, 5
|
||||||
rjmp clear_sram
|
rjmp clear_sram
|
||||||
|
|
||||||
ldi r18, 0;LEADSIZE
|
ldi r18, LEADSIZE
|
||||||
sts lead1, r18
|
sts lead1, r18
|
||||||
sts lead2, r18
|
sts lead2, r18
|
||||||
sts lead3, r18
|
sts lead3, r18
|
||||||
; ldi r18, hi8(LEADINIT1)
|
ldi r18, hi8(LEADINIT1)
|
||||||
; sts leadosc2, r18
|
sts lead2 + 2, r18
|
||||||
; ldi r18, lo8(LEADINIT1)
|
ldi r18, lo8(LEADINIT1)
|
||||||
; sts leadosc2 + 1, r18
|
sts lead2 + 3, r18
|
||||||
; ldi r18, hi8(LEADINIT2)
|
ldi r18, hi8(LEADINIT2)
|
||||||
; sts leadosc3, r18
|
sts lead3 + 2, r18
|
||||||
; ldi r18, lo8(LEADINIT2)
|
ldi r18, lo8(LEADINIT2)
|
||||||
; sts leadosc3 + 1, r18
|
sts lead3 + 3, r18
|
||||||
|
|
||||||
out CCP, r17
|
out CCP, r17
|
||||||
out CLKPSR, r16
|
out CLKPSR, r16
|
||||||
|
@ -94,19 +93,24 @@ clear_sram:
|
||||||
sei
|
sei
|
||||||
out TIFR0, r17
|
out TIFR0, r17
|
||||||
|
|
||||||
|
; YH and ZH never change
|
||||||
|
ldi r31, hi8(bassline+0x4000)
|
||||||
|
clr r29
|
||||||
|
|
||||||
|
; init i
|
||||||
|
ldi r17, 3
|
||||||
|
ldi r18, 0xF0
|
||||||
|
clr r19
|
||||||
|
|
||||||
mainloop:
|
mainloop:
|
||||||
sleep
|
sleep
|
||||||
clr r16
|
clr r16
|
||||||
lds r17, int_ctr
|
lds r20, int_ctr
|
||||||
tst r17
|
tst r20
|
||||||
brne mainloop
|
brne mainloop
|
||||||
|
|
||||||
sbi PORTB, 2
|
sbi PORTB, 2
|
||||||
|
|
||||||
lds r17, i
|
|
||||||
lds r18, i+1
|
|
||||||
lds r19, i+2
|
|
||||||
|
|
||||||
subi r19, 0xff
|
subi r19, 0xff
|
||||||
sbci r18, 0xff
|
sbci r18, 0xff
|
||||||
sbci r17, 0xff
|
sbci r17, 0xff
|
||||||
|
@ -123,9 +127,7 @@ mainloop:
|
||||||
clr r18
|
clr r18
|
||||||
|
|
||||||
norestart:
|
norestart:
|
||||||
sts i, r17
|
;rjmp noarp
|
||||||
sts i+1, r18
|
|
||||||
sts i+2, r19
|
|
||||||
|
|
||||||
; ==== BASS ====
|
; ==== BASS ====
|
||||||
; bassptr(r20) = (i >> 13) & 0xF
|
; bassptr(r20) = (i >> 13) & 0xF
|
||||||
|
@ -141,7 +143,6 @@ norestart:
|
||||||
ori r20, 0x10
|
ori r20, 0x10
|
||||||
|
|
||||||
; note = notes[bassline[bassptr]]
|
; note = notes[bassline[bassptr]]
|
||||||
ldi r31, hi8(bassline+0x4000)
|
|
||||||
ldi r30, lo8(bassline)
|
ldi r30, lo8(bassline)
|
||||||
add r30, r20
|
add r30, r20
|
||||||
ld r20, Z
|
ld r20, Z
|
||||||
|
@ -185,7 +186,7 @@ nobassbeat:
|
||||||
andi r22, 0x7F
|
andi r22, 0x7F
|
||||||
add r24, r22
|
add r24, r22
|
||||||
|
|
||||||
; if ((i >> 6) & 0xF) == 0xF: sample += (bass >> 2)
|
; if !((i >> 6) & 0xF) == 0xF: sample += (bass >> 2)
|
||||||
lsr r24
|
lsr r24
|
||||||
lsr r24
|
lsr r24
|
||||||
mov r20, r18
|
mov r20, r18
|
||||||
|
@ -284,30 +285,29 @@ arptiming_noshift:
|
||||||
noarp:
|
noarp:
|
||||||
|
|
||||||
; ==== LEAD ===
|
; ==== LEAD ===
|
||||||
clr r29
|
|
||||||
ldi r28, lead1
|
ldi r28, lead1
|
||||||
ldi r24, 0
|
ldi r24, 0
|
||||||
ldi r25, ~1
|
ldi r25, ~1
|
||||||
rcall lead_voice
|
rcall lead_voice
|
||||||
mov r16, r23
|
add r16, r23
|
||||||
|
|
||||||
;ldi r28, lead2
|
ldi r28, lead2
|
||||||
;ldi r24, 4
|
ldi r24, 4
|
||||||
;ldi r25, ~2
|
ldi r25, ~2
|
||||||
;rcall lead_voice
|
rcall lead_voice
|
||||||
;lsr r23
|
lsr r23
|
||||||
;lsr r23
|
lsr r23
|
||||||
;add r16, r23
|
add r16, r23
|
||||||
;lsr r23
|
lsr r23
|
||||||
;add r16, r23
|
add r16, r23
|
||||||
|
|
||||||
;ldi r28, lead3
|
ldi r28, lead3
|
||||||
;ldi r24, 8
|
ldi r24, 8
|
||||||
;ldi r25, ~4
|
ldi r25, ~4
|
||||||
;rcall lead_voice
|
rcall lead_voice
|
||||||
;lsr r23
|
lsr r23
|
||||||
;lsr r23
|
lsr r23
|
||||||
;add r16, r23
|
add r16, r23
|
||||||
|
|
||||||
out OCR0AL, r16
|
out OCR0AL, r16
|
||||||
|
|
||||||
|
@ -386,7 +386,7 @@ getleaddata:
|
||||||
ld r24, Z ; r24 = data!
|
ld r24, Z ; r24 = data!
|
||||||
|
|
||||||
; if (0 == leadtimer) {
|
; if (0 == leadtimer) {
|
||||||
neg r25
|
com r25
|
||||||
tst r27
|
tst r27
|
||||||
brne noleadupdate
|
brne noleadupdate
|
||||||
|
|
||||||
|
@ -435,10 +435,10 @@ noleadupdate:
|
||||||
and r26, r25
|
and r26, r25
|
||||||
brne noreduce
|
brne noreduce
|
||||||
|
|
||||||
lsr r23
|
; lsr r23
|
||||||
mov r22, r23
|
; mov r22, r23
|
||||||
lsr r23
|
; lsr r23
|
||||||
add r23, r22
|
; add r23, r22
|
||||||
|
|
||||||
noreduce:
|
noreduce:
|
||||||
; if (data == 0) return 0;
|
; if (data == 0) return 0;
|
||||||
|
|
Loading…
Reference in a new issue