content
stringlengths 2
1.05M
| avg_line_length
float64 1
696k
| max_line_length
int64 1
943k
| alphanum_fraction
float64 0
1
| licenses
sequence | repository_name
stringlengths 4
119
| path
stringlengths 3
297
| size
int64 2
1.05M
| lang
stringclasses 30
values | cluster
int64 0
29
|
---|---|---|---|---|---|---|---|---|---|
.global s_prepare_buffers
s_prepare_buffers:
push %r10
push %r11
push %r13
push %r15
push %r9
push %rbx
push %rcx
push %rdi
push %rsi
lea addresses_D_ht+0x1532, %rbx
nop
sub %r15, %r15
movw $0x6162, (%rbx)
nop
nop
nop
nop
nop
add %r13, %r13
lea addresses_UC_ht+0xac72, %rcx
nop
nop
nop
nop
nop
xor $63492, %r10
movw $0x6162, (%rcx)
nop
nop
cmp $52783, %r15
lea addresses_A_ht+0xd7f2, %r9
clflush (%r9)
nop
nop
nop
nop
nop
xor %rcx, %rcx
mov (%r9), %r11d
nop
nop
nop
nop
nop
cmp %rcx, %rcx
lea addresses_normal_ht+0x1a2aa, %r13
cmp $31476, %rcx
movb $0x61, (%r13)
nop
nop
add %r10, %r10
lea addresses_UC_ht+0x672, %rsi
lea addresses_UC_ht+0x1e272, %rdi
clflush (%rdi)
nop
nop
nop
nop
inc %r11
mov $39, %rcx
rep movsw
nop
xor %r11, %r11
lea addresses_A_ht+0x2372, %rsi
lea addresses_D_ht+0x1ed88, %rdi
cmp $43777, %rbx
mov $68, %rcx
rep movsb
nop
add %r13, %r13
lea addresses_WT_ht+0x8172, %rcx
nop
nop
nop
nop
cmp %rbx, %rbx
movb $0x61, (%rcx)
sub $64440, %rdi
lea addresses_normal_ht+0x13ffc, %rcx
inc %rdi
mov (%rcx), %r10d
nop
nop
nop
and %r11, %r11
lea addresses_WC_ht+0x11090, %r11
sub %r9, %r9
movb (%r11), %bl
nop
nop
nop
nop
xor $39997, %rbx
lea addresses_WC_ht+0x7e72, %rdi
nop
nop
nop
nop
nop
cmp $36803, %rbx
movw $0x6162, (%rdi)
nop
nop
nop
nop
and %r10, %r10
pop %rsi
pop %rdi
pop %rcx
pop %rbx
pop %r9
pop %r15
pop %r13
pop %r11
pop %r10
ret
.global s_faulty_load
s_faulty_load:
push %r12
push %r14
push %r9
push %rax
push %rcx
push %rsi
// Faulty Load
lea addresses_WC+0x4672, %rsi
nop
nop
nop
nop
nop
xor $8376, %rax
movb (%rsi), %r9b
lea oracles, %r14
and $0xff, %r9
shlq $12, %r9
mov (%r14,%r9,1), %r9
pop %rsi
pop %rcx
pop %rax
pop %r9
pop %r14
pop %r12
ret
/*
<gen_faulty_load>
[REF]
{'src': {'same': True, 'congruent': 0, 'NT': False, 'type': 'addresses_WC', 'size': 1, 'AVXalign': False}, 'OP': 'LOAD'}
[Faulty Load]
{'src': {'same': True, 'congruent': 0, 'NT': False, 'type': 'addresses_WC', 'size': 1, 'AVXalign': False}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'OP': 'STOR', 'dst': {'same': False, 'congruent': 4, 'NT': False, 'type': 'addresses_D_ht', 'size': 2, 'AVXalign': False}}
{'OP': 'STOR', 'dst': {'same': False, 'congruent': 7, 'NT': False, 'type': 'addresses_UC_ht', 'size': 2, 'AVXalign': False}}
{'src': {'same': False, 'congruent': 7, 'NT': False, 'type': 'addresses_A_ht', 'size': 4, 'AVXalign': True}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'same': False, 'congruent': 3, 'NT': False, 'type': 'addresses_normal_ht', 'size': 1, 'AVXalign': False}}
{'src': {'type': 'addresses_UC_ht', 'congruent': 11, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_UC_ht', 'congruent': 7, 'same': False}}
{'src': {'type': 'addresses_A_ht', 'congruent': 8, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_D_ht', 'congruent': 1, 'same': False}}
{'OP': 'STOR', 'dst': {'same': False, 'congruent': 8, 'NT': False, 'type': 'addresses_WT_ht', 'size': 1, 'AVXalign': False}}
{'src': {'same': False, 'congruent': 1, 'NT': False, 'type': 'addresses_normal_ht', 'size': 4, 'AVXalign': False}, 'OP': 'LOAD'}
{'src': {'same': False, 'congruent': 0, 'NT': False, 'type': 'addresses_WC_ht', 'size': 1, 'AVXalign': False}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'same': False, 'congruent': 10, 'NT': False, 'type': 'addresses_WC_ht', 'size': 2, 'AVXalign': False}}
{'38': 21829}
38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38
*/
| 37.1 | 2,999 | 0.655621 | [
"MIT"
] | danielmgmi/medusa | Transynther/_processed/NONE/_xt_/i3-7100_9_0xca_notsx.log_21829_842.asm | 6,307 | Assembly | 4 |
;******************************************************************************
;* Copyright (c) 2012 Michael Niedermayer
;*
;* This file is part of FFmpeg.
;*
;* FFmpeg is free software; you can redistribute it and/or
;* modify it under the terms of the GNU Lesser General Public
;* License as published by the Free Software Foundation; either
;* version 2.1 of the License, or (at your option) any later version.
;*
;* FFmpeg is distributed in the hope that it will be useful,
;* but WITHOUT ANY WARRANTY; without even the implied warranty of
;* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
;* Lesser General Public License for more details.
;*
;* You should have received a copy of the GNU Lesser General Public
;* License along with FFmpeg; if not, write to the Free Software
;* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
;******************************************************************************
%include "libavutil/x86/x86util.asm"
SECTION_RODATA 32
dw1: times 8 dd 1
w1 : times 16 dw 1
SECTION .text
%macro MIX2_FLT 1
cglobal mix_2_1_%1_float, 7, 7, 6, out, in1, in2, coeffp, index1, index2, len
%ifidn %1, a
test in1q, mmsize-1
jne mix_2_1_float_u_int %+ SUFFIX
test in2q, mmsize-1
jne mix_2_1_float_u_int %+ SUFFIX
test outq, mmsize-1
jne mix_2_1_float_u_int %+ SUFFIX
%else
mix_2_1_float_u_int %+ SUFFIX:
%endif
VBROADCASTSS m4, [coeffpq + 4*index1q]
VBROADCASTSS m5, [coeffpq + 4*index2q]
shl lend , 2
add in1q , lenq
add in2q , lenq
add outq , lenq
neg lenq
.next:
%ifidn %1, a
mulps m0, m4, [in1q + lenq ]
mulps m1, m5, [in2q + lenq ]
mulps m2, m4, [in1q + lenq + mmsize]
mulps m3, m5, [in2q + lenq + mmsize]
%else
movu m0, [in1q + lenq ]
movu m1, [in2q + lenq ]
movu m2, [in1q + lenq + mmsize]
movu m3, [in2q + lenq + mmsize]
mulps m0, m0, m4
mulps m1, m1, m5
mulps m2, m2, m4
mulps m3, m3, m5
%endif
addps m0, m0, m1
addps m2, m2, m3
mov%1 [outq + lenq ], m0
mov%1 [outq + lenq + mmsize], m2
add lenq, mmsize*2
jl .next
REP_RET
%endmacro
%macro MIX1_FLT 1
cglobal mix_1_1_%1_float, 5, 5, 3, out, in, coeffp, index, len
%ifidn %1, a
test inq, mmsize-1
jne mix_1_1_float_u_int %+ SUFFIX
test outq, mmsize-1
jne mix_1_1_float_u_int %+ SUFFIX
%else
mix_1_1_float_u_int %+ SUFFIX:
%endif
VBROADCASTSS m2, [coeffpq + 4*indexq]
shl lenq , 2
add inq , lenq
add outq , lenq
neg lenq
.next:
%ifidn %1, a
mulps m0, m2, [inq + lenq ]
mulps m1, m2, [inq + lenq + mmsize]
%else
movu m0, [inq + lenq ]
movu m1, [inq + lenq + mmsize]
mulps m0, m0, m2
mulps m1, m1, m2
%endif
mov%1 [outq + lenq ], m0
mov%1 [outq + lenq + mmsize], m1
add lenq, mmsize*2
jl .next
REP_RET
%endmacro
%macro MIX1_INT16 1
cglobal mix_1_1_%1_int16, 5, 5, 6, out, in, coeffp, index, len
%ifidn %1, a
test inq, mmsize-1
jne mix_1_1_int16_u_int %+ SUFFIX
test outq, mmsize-1
jne mix_1_1_int16_u_int %+ SUFFIX
%else
mix_1_1_int16_u_int %+ SUFFIX:
%endif
movd m4, [coeffpq + 4*indexq]
SPLATW m5, m4
psllq m4, 32
psrlq m4, 48
mova m0, [w1]
psllw m0, m4
psrlw m0, 1
punpcklwd m5, m0
add lenq , lenq
add inq , lenq
add outq , lenq
neg lenq
.next:
mov%1 m0, [inq + lenq ]
mov%1 m2, [inq + lenq + mmsize]
mova m1, m0
mova m3, m2
punpcklwd m0, [w1]
punpckhwd m1, [w1]
punpcklwd m2, [w1]
punpckhwd m3, [w1]
pmaddwd m0, m5
pmaddwd m1, m5
pmaddwd m2, m5
pmaddwd m3, m5
psrad m0, m4
psrad m1, m4
psrad m2, m4
psrad m3, m4
packssdw m0, m1
packssdw m2, m3
mov%1 [outq + lenq ], m0
mov%1 [outq + lenq + mmsize], m2
add lenq, mmsize*2
jl .next
%if mmsize == 8
emms
RET
%else
REP_RET
%endif
%endmacro
%macro MIX2_INT16 1
cglobal mix_2_1_%1_int16, 7, 7, 8, out, in1, in2, coeffp, index1, index2, len
%ifidn %1, a
test in1q, mmsize-1
jne mix_2_1_int16_u_int %+ SUFFIX
test in2q, mmsize-1
jne mix_2_1_int16_u_int %+ SUFFIX
test outq, mmsize-1
jne mix_2_1_int16_u_int %+ SUFFIX
%else
mix_2_1_int16_u_int %+ SUFFIX:
%endif
movd m4, [coeffpq + 4*index1q]
movd m6, [coeffpq + 4*index2q]
SPLATW m5, m4
SPLATW m6, m6
psllq m4, 32
psrlq m4, 48
mova m7, [dw1]
pslld m7, m4
psrld m7, 1
punpcklwd m5, m6
add lend , lend
add in1q , lenq
add in2q , lenq
add outq , lenq
neg lenq
.next:
mov%1 m0, [in1q + lenq ]
mov%1 m2, [in2q + lenq ]
mova m1, m0
punpcklwd m0, m2
punpckhwd m1, m2
mov%1 m2, [in1q + lenq + mmsize]
mov%1 m6, [in2q + lenq + mmsize]
mova m3, m2
punpcklwd m2, m6
punpckhwd m3, m6
pmaddwd m0, m5
pmaddwd m1, m5
pmaddwd m2, m5
pmaddwd m3, m5
paddd m0, m7
paddd m1, m7
paddd m2, m7
paddd m3, m7
psrad m0, m4
psrad m1, m4
psrad m2, m4
psrad m3, m4
packssdw m0, m1
packssdw m2, m3
mov%1 [outq + lenq ], m0
mov%1 [outq + lenq + mmsize], m2
add lenq, mmsize*2
jl .next
%if mmsize == 8
emms
RET
%else
REP_RET
%endif
%endmacro
INIT_MMX mmx
MIX1_INT16 u
MIX1_INT16 a
MIX2_INT16 u
MIX2_INT16 a
INIT_XMM sse
MIX2_FLT u
MIX2_FLT a
MIX1_FLT u
MIX1_FLT a
INIT_XMM sse2
MIX1_INT16 u
MIX1_INT16 a
MIX2_INT16 u
MIX2_INT16 a
%if HAVE_AVX_EXTERNAL
INIT_YMM avx
MIX2_FLT u
MIX2_FLT a
MIX1_FLT u
MIX1_FLT a
%endif
| 24.478088 | 79 | 0.550944 | [
"MIT"
] | 0xsky/srs | trunk/3rdparty/ffmpeg-4-fit/libswresample/x86/rematrix.asm | 6,144 | Assembly | 0 |
.file "a30.c"
.text
.globl main
.type main, @function
main:
subl $4, %esp
movl 12(%esp), %eax
movl (%eax), %eax
movl %eax, (%esp)
call toto
.L08048311:
addl $4, %esp
ret
.size main, .-main
# ----------------------
.L08048315:
.p2align 3
# ----------------------
.local func1
.type func1, @function
func1:
rep; ret
.size func1, .-func1
# ----------------------
.L080483D2:
.p2align 4
# ----------------------
.local func2
.type func2, @function
func2:
rep; ret
.size func2, .-func2
# ----------------------
.L080483E2:
.p2align 4
# ----------------------
.globl toto
.type toto, @function
toto:
subl $8, %esp
movl $68, %eax
movl %edi, 4(%esp)
movl 12(%esp), %edi
movl %esi, (%esp)
movl $init, %esi
testl $1, %edi
jne .L08048448
.L08048410:
testl $2, %edi
jne .L08048468
.L08048418:
movl %eax, %ecx
xorl %edx, %edx
shrl $2, %ecx
testb $2, %al
rep movsl
je .L08048430
.L08048425:
movzwl (%esi), %edx
movw %dx, (%edi)
movl $2, %edx
.L08048430:
testb $1, %al
je .L0804843B
.L08048434:
movzbl (%esi,%edx), %eax
movb %al, (%edi,%edx)
.L0804843B:
movl (%esp), %esi
movl 4(%esp), %edi
addl $8, %esp
ret
.L08048446:
.p2align 3
.L08048448:
movzbl init, %eax
movl $init+1, %esi
movb %al, (%edi)
addl $1, %edi
movl $67, %eax
testl $2, %edi
je .L08048418
.L08048466:
.p2align 3
.L08048468:
movzwl (%esi), %edx
subl $2, %eax
addl $2, %esi
movw %dx, (%edi)
addl $2, %edi
jmp .L08048418
.size toto, .-toto
# ----------------------
.data
.LD0804A028:
.zero 24
# ----------------------
.local init
.type init, @object
init:
.long 1
.long value
.long func1
.long func2
.long 0
.long 0
.long 0
.long 0
.long 0
.long 0
.long 0
.long 0
.long 0
.long 0
.long 0
.long 0
.long 0
.size init, 68
# ----------------------
.bss
.align 32
.globl value
.type value, @object
value:
.zero 68
.size value, 68
# ----------------------
.ident "GCC: (Ubuntu/Linaro 4.6.3-1ubuntu5) 4.6.3"
.section .note.GNU-stack,"",@progbits
| 17.192308 | 51 | 0.486801 | [
"Apache-2.0"
] | LRGH/plasmasm | non_regression/other_x86_linux.out.asm | 2,235 | Assembly | 4 |
;*******************************************************************************
; MSP430x24x Demo - USCI_A0, UART 9600 Full-Duplex Transceiver, 32kHz ACLK
;
; Description: USCI_A0 communicates continously as fast as possible full-
; duplex with another device. Normal mode is LPM3, with activity only during
; RX and TX ISR's. The TX ISR indicates the USCI_A0 is ready to send another
; character. The RX ISR indicates the USCI_A0 has received a character. At
; 9600 baud, a full character is tranceived ~1ms.
; The levels on P1.4/5 are TX'ed. RX'ed value is displayed on P1.0/1.
; ACLK = BRCLK = LFXT1 = 32768, MCLK = SMCLK = DCO ~1.045MHz
; Baud rate divider with 32768Hz XTAL @9600 = 32768Hz/9600 = 3.41
; //* An external watch crystal is required on XIN XOUT for ACLK *//
;
; MSP430F249 MSP430F249
; ----------------- -----------------
; | XIN|- /|\| XIN|-
; | | 32kHz | | | 32kHz
; | XOUT|- --|RST XOUT|-
; | | /|\ | |
; | RST|--- | |
; | | | |
; ->|P1.4 | | P1.0|-> LED
; ->|P1.5 | | P1.1|-> LED
; LED <-|P1.0 | | P1.4|<-
; LED <-|P1.1 | | P1.5|<-
; | UCA0TXD/P3.4|--------->|P3.5 |
; | | 9600 | |
; | UCA0RXD/P3.5|<---------|P3.4 |
;
;
; JL Bile
; Texas Instruments Inc.
; May 2008
; Built Code Composer Essentials: v3 FET
;*******************************************************************************
.cdecls C,LIST, "msp430x24x.h"
;-------------------------------------------------------------------------------
.text ;Program Start
;-------------------------------------------------------------------------------
RESET mov.w #0500h,SP ; Initialize stackpointer
StopWDT mov.w #WDTPW+WDTHOLD,&WDTCTL ; Stop watchdog timer
SetupP1 mov.b #000h,&P1OUT ; P1.0/1 setup for LED output
bis.b #003h,&P1DIR ;
SetupP3 bis.b #030h,&P3SEL ; Use P3.4/P3.5 for USCI_A0
SetupUSCI0 bis.b #UCSSEL_1,&UCA0CTL1 ; CLK = ACLK
mov.b #03h,&UCA0BR0 ; 32kHz/9600 = 3.41
mov.b #00h,&UCA0BR1 ;
mov.b #UCBRS1+UCBRS0,&UCA0MCTL; Modulation UCBRSx = 3
bic.b #UCSWRST,&UCA0CTL1 ; **Initialize USCI state machine**
bis.b #UCA0RXIE+UCA0TXIE,&IE2 ; Enable USCI_A0 TX/RX interrupt
;
Mainloop bis.b #LPM3+GIE,SR ; Enter LPM3 w/ interrupts enabled
nop ; Required for debugger only
;
;-------------------------------------------------------------------------------
USCI0TX_ISR;
;-------------------------------------------------------------------------------
mov.b &P1IN,R4 ;
rrc.b R4 ; Justify 4x right
rrc.b R4 ;
rrc.b R4 ;
rrc.b R4 ;
and.b #03h,R4 ;
mov.b R4,&UCA0TXBUF ; Transmit character
reti ; Exit ISR
;-------------------------------------------------------------------------------
USCI0RX_ISR;
;-------------------------------------------------------------------------------
mov.b &UCA0RXBUF,&P1OUT ; Display RX'ed charater
reti ; Exit ISR
;
;-------------------------------------------------------------------------------
; Interrupt Vectors
;-------------------------------------------------------------------------------
.sect ".int23" ;
.short USCI0RX_ISR ; USCI0 transmit
.sect ".int22" ;
.short USCI0TX_ISR ; USCI0 receive
.sect ".reset" ;
.short RESET ; POR, ext. Reset, Watchdog
.end
| 56.463415 | 81 | 0.323974 | [
"BSD-3-Clause"
] | tp-freeforall/breakfast | apps/breakfast/pde_fw/toast/examples/Assembly (CCE)/msp430x24x_uscia0_uart_08_9600.asm | 4,630 | Assembly | 4 |
COMMENT }%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Copyright (c) Berkeley Softworks 1993 -- All Rights Reserved
PROJECT: PC GEOS
MODULE: printer drivers
FILE: pageEnd.asm
AUTHOR: Dave Durran
ROUTINES:
Name Description
---- -----------
PrintEndPage Tidy up the page-related variables, called once/page
by EXTERNAL at end of page.
REVISION HISTORY:
Name Date Description
---- ---- -----------
Dave 2/93 initial version
DESCRIPTION:
$Id: pageEnd.asm,v 1.1 97/04/18 11:51:42 newdeal Exp $
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%}
COMMENT }%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
PrintEndPage
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Use PrFormFeed to get to the next TOF, clean up , and exit page.
CALLED BY: GLOBAL
PASS: bp - PSTATE segment address.
cl - Suppress form feed flag, C_FF is FF non-suppressed
RETURN:
DESTROYED:
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
nothing
REVISION HISTORY:
Name Date Description
---- ---- -----------
Dave 2/93 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%}
PrintEndPage proc far
uses ax,cx, es, dx
.enter
mov es, bp
;get rid of more than 1 integral form length.
clr ax
mov dx,es:PS_customHeight ;get the paper size in Y.
call PrConvertToDriverCoordinates
mov ax,es:PS_cursorPos.P_y ;get the current Y pos.
checkIfMoreThanPage:
sub ax,dx ;subtract a paper size
js nosub
mov es:PS_cursorPos.P_y,ax ;set the current Y pos.
jmp checkIfMoreThanPage
nosub:
; make sure all the styles are reset at the printer for
; the next page. Use version that doesn't care about
; NLQ mode, since we want to biff it
call PrintClearStyles ; set clear styles @ printer
jc exit
; see if the spooler is in the suppress formfeed mode.
cmp cl,C_FF
clc
jne exit
call PrFormFeed ;execute this printer's specific FF
;routine.
jc exit
exit:
.leave
ret
PrintEndPage endp
| 22.163265 | 79 | 0.55709 | [
"Apache-2.0"
] | BOBBYWY/pcgeos | Driver/Printer/PrintCom/Page/pageEnd.asm | 2,172 | Assembly | 1 |
; A124502: a(1)=a(2)=1; thereafter, a(n+1) = a(n) + a(n-1) + 1 if n is a multiple of 5, otherwise a(n+1) = a(n) + a(n-1).
; 1,1,2,3,5,9,14,23,37,60,98,158,256,414,670,1085,1755,2840,4595,7435,12031,19466,31497,50963,82460,133424,215884,349308,565192,914500,1479693,2394193,3873886,6268079,10141965,16410045,26552010,42962055,69514065,112476120
add $0,1
lpb $0
mov $2,$0
trn $0,5
seq $2,22354 ; Fibonacci sequence beginning 0, 20.
add $1,$2
lpe
div $1,20
mov $0,$1
| 36.384615 | 221 | 0.678647 | [
"Apache-2.0"
] | ckrause/cm | programs/oeis/124/A124502.asm | 473 | Assembly | 19 |
; A038571: Number of times n must be differentiated to reach 0.
; 0,1,2,1,3,2,2,1,4,3,2,3,3,2,2,1,5,4,4,3,3,2,3,4,4,3,2,3,3,2,2,1,6,5,4,5,4,5,3,4,4,3,2,3,3,4,4,5,5,4,4,3,3,2,3,4,4,3,2,3,3,2,2,1,7,6,6,5,4,5,6,5,4,5,6,5,3,4,4,5,5,4,4,3,3,2,3,4,4,3,5,4,5,4,5,6,6,5,4,5
lpb $0
mov $2,$0
seq $2,38554 ; Derivative of n: write n in binary, replace each pair of adjacent bits with their mod 2 sum (a(0)=a(1)=0 by convention). Also n XOR (n shift 1).
mov $0,$2
add $3,243
lpe
mov $0,$3
div $0,243
| 41.5 | 201 | 0.598394 | [
"Apache-2.0"
] | ckrause/loda-programs | oeis/038/A038571.asm | 498 | Assembly | 19 |
.thumb
.org 0x0
mov r3,#0
ldr r0,NewTSA
ldr r1,BG1MapBuffer
loop:
ldr r2,[r0]
str r2,[r1]
add r0,#4
add r1,#4
add r3,#1
ldr r2,=0x200
cmp r3,r2
bhs stoploop
b loop
stoploop:
ldr r0,=0x0809C676|1
bx r0
.align
.ltorg
BG1MapBuffer:
.long 0x020234A8
NewTSA:
| 10.384615 | 21 | 0.681481 | [
"CC0-1.0"
] | sme23/Christmas2 | Engine Hacks/Strmag/Str Mag Split/Prep Screen and Mag Booster/New TSA.asm | 270 | Assembly | 4 |
%include 'textmode.h'
; Make the whole screen purple
xor di, di
mov cx, 0x07d0
mov ah, 0x99
rep stosw
mov si, brick
mov di, 272
call drawsprite
mov di, 1536
call drawsprite
mov di, 1552
call drawsprite
mov di, 1566
call drawsprite
floor:
mov di, 2720
add word [floor + 1], 16
call drawsprite
cmp word [floor + 1], 2880
jne floor
mov si, c_cactus
mov di, 0
call drawsprite
mov di, 32
call drawsprite
mov di, 1312
call drawsprite
mov si, a_cactus
mov di, 16
call drawsprite
mov si, t_cactus
mov di, 48
call drawsprite
mov si, u_cactus
mov di, 64
call drawsprite
mov si, s_cactus
mov di, 78
call drawsprite
mov si, o_cactus
mov di, 1328
call drawsprite
mov si, n_cactus
mov di, 1344
call drawsprite
mov si, cactus
mov di, 1446
call drawsprite
jmp end
%include 'drawsprite_8x8_4c.h'
end:
jmp end
;first 2 bytes is the color scheme (each nibble picks a color)
;imagedata
cactus:
db 0x49, 0xA0, 0x01, 0x40, 0x05, 0x50, 0x46, 0x91, 0x57, 0xD5, 0x05, 0x50, 0x05, 0x54, 0x05, 0x45, 0x54, 0x01
brick:
db 0x06, 0x70, 0x15, 0xD4, 0x40, 0xD3, 0x40, 0xCC, 0x40, 0xD7, 0x40, 0xD3, 0xF0, 0xC3, 0x5F, 0x43, 0x33, 0x7C
c_cactus:
db 0x0E, 0x28, 0x00, 0x00, 0x01, 0x54, 0x05, 0x54, 0x05, 0x00, 0x05, 0x00, 0x09, 0x54, 0x09, 0x54, 0x02, 0xA8
a_cactus:
db 0x0E, 0xF8, 0x01, 0x00, 0x05, 0x40, 0x15, 0x50, 0x16, 0x58, 0x15, 0x58, 0x16, 0x58, 0x16, 0x58, 0x0A, 0x28
t_cactus:
db 0x0E, 0x58, 0x00, 0x00, 0x15, 0x54, 0x09, 0x68, 0x01, 0x60, 0x01, 0x60, 0x01, 0x60, 0x01, 0x60, 0x00, 0xA0
u_cactus:
db 0x0E, 0xB8, 0x00, 0x00, 0x05, 0x14, 0x05, 0x14, 0x05, 0x14, 0x05, 0x14, 0x05, 0x14, 0x01, 0x58, 0x00, 0xA0
s_cactus:
db 0x0E, 0xC8, 0x00, 0x00, 0x01, 0x40, 0x06, 0x90, 0x05, 0xA0, 0x02, 0x40, 0x05, 0x50, 0x01, 0x60, 0x02, 0x80
o_cactus:
db 0x0E, 0xD8, 0x00, 0x00, 0x01, 0x50, 0x05, 0x54, 0x05, 0x94, 0x05, 0x14, 0x05, 0x54, 0x09, 0x58, 0x02, 0xA0
n_cactus:
db 0x0E, 0x38, 0x00, 0x00, 0x10, 0x10, 0x15, 0x18, 0x15, 0x58, 0x16, 0x58, 0x16, 0x58, 0x26, 0x98, 0x0A, 0x20
;BIOS sig and padding
times 510-($-$$) db 0
dw 0xAA55
| 22.522222 | 111 | 0.704983 | [
"BSD-2-Clause"
] | XlogicX/CactusCon2017 | SLIDE_Title.asm | 2,027 | Assembly | 1 |
; A184063: Number of (n+1) X 2 binary arrays with rows and columns in nondecreasing order and with no 2 X 2 subblock sum differing from a horizontal or vertical neighbor subblock sum by more than one.
; 7,11,20,34,54,81,116,160,214,279,356,446,550,669,804,956,1126,1315,1524,1754,2006,2281,2580,2904,3254,3631,4036,4470,4934,5429,5956,6516,7110,7739,8404,9106,9846,10625,11444,12304,13206,14151,15140,16174,17254,18381,19556,20780,22054,23379,24756,26186,27670,29209,30804,32456,34166,35935,37764,39654,41606,43621,45700,47844,50054,52331,54676,57090,59574,62129,64756,67456,70230,73079,76004,79006,82086,85245,88484,91804,95206,98691,102260,105914,109654,113481,117396,121400,125494,129679,133956
mov $1,5
add $1,$0
bin $1,2
mul $1,$0
sub $1,2
div $1,3
add $1,7
mov $0,$1
| 64.5 | 496 | 0.777778 | [
"Apache-2.0"
] | ckrause/loda-programs | oeis/184/A184063.asm | 774 | Assembly | 19 |
;
; FibonacciAsm.asm
;
; Created: 9/17/2021 9:14:24 AM
; Author : Harish
;
;Assembly Code to store first 10 numbers of Fibonacci Series(Starting with 0,1) in Registers R11 to R20.
.CSEG
LDI R21, LOW(RAMEND)
OUT SPL, R21
LDI R21, HIGH(RAMEND)
OUT SPH, R21
LDI ZL, LOW(NUM<<1)
LDI ZH, HIGH(NUM<<1)
LPM R1, Z+
LPM R2, Z
LDI ZL, 0x0B
LDI ZH, 0x00
LDI R23, 0x0A
loop: PUSH R2
ADD R2, R1
ST Z+, R1
POP R1
DEC R23
BRNE loop
vetti: RJMP vetti
NUM: .DB 0x00, 0x01
| 13.552632 | 105 | 0.615534 | [
"MIT"
] | HR-1-1/CourseWork | EE2016/MISCELS/FibonacciNum.asm | 515 | Assembly | 4 |
; A022976: 20-n.
; 20,19,18,17,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0,-1,-2,-3,-4,-5,-6,-7,-8,-9,-10,-11,-12,-13,-14,-15,-16,-17,-18,-19,-20,-21,-22,-23,-24,-25,-26,-27,-28,-29,-30,-31,-32,-33,-34,-35,-36,-37,-38,-39,-40
sub $0,20
mul $0,-120259084286
mov $1,$0
div $1,120259084286
| 35.625 | 205 | 0.547368 | [
"Apache-2.0"
] | jmorken/loda | programs/oeis/022/A022976.asm | 285 | Assembly | 19 |
Codigo Segment
public delay1,delay2
Assume cs:codigo
Delay1 proc Far
eti:
loop eti
ret
Delay1 endP
Delay2 proc Far ;como estan en otro segmento de codigo tiene que ser Far
mov bp,sp
mov cx,2*2[bp]
eti1:
loop eti1
ret 2 ;hace pop cx
Delay2 endP
Codigo EndS
End | 14.47619 | 73 | 0.667763 | [
"MIT"
] | TEC-2014092195/IC3101-Arquitectura_De_Computadores | Tareas/Ensamblador/Librerias y procedimientos/libpro(1).asm | 304 | Assembly | 4 |
; A168175: Expansion of 1/(1 - 4*x + 7*x^2).
; Submitted by Jon Maiga
; 1,4,9,8,-31,-180,-503,-752,513,7316,25673,51480,26209,-255524,-1205559,-3033568,-3695359,6453540,51681673,161551912,284435937,6880364,-1963530103,-7902282960,-17864421119,-16141703756,60484132809,354928457528,996324900449,1500800399100,-971072706743,-14389893620672,-50762065535487,-102319006797244,-53941568440567,500466773818440,2379458074357729,6014564880701836,7402053002303241,-12493742155699888,-101789339638922239,-319701163465789740,-566279276390703287,-27208961302284968,3855119089525783137
add $0,1
mov $2,1
lpb $0
sub $0,1
mov $1,$2
add $3,$2
mul $2,3
sub $2,$3
mul $3,2
add $3,$1
lpe
mov $0,$3
div $0,3
| 39 | 501 | 0.767806 | [
"Apache-2.0"
] | ckrause/loda-programs | oeis/168/A168175.asm | 702 | Assembly | 19 |
; A047229: Numbers that are congruent to {0, 2, 3, 4} mod 6.
; 0,2,3,4,6,8,9,10,12,14,15,16,18,20,21,22,24,26,27,28,30,32,33,34,36,38,39,40,42,44,45,46,48,50,51,52,54,56,57,58,60,62,63,64,66,68,69,70,72,74,75,76,78,80,81,82,84,86,87,88,90,92,93,94,96,98,99,100,102,104,105,106,108,110,111,112,114,116,117,118,120,122,123,124,126,128,129,130,132,134,135,136,138,140,141,142,144,146,147,148,150,152,153,154,156,158,159,160,162,164,165,166,168,170,171,172,174,176,177,178,180,182,183,184,186,188,189,190,192,194,195,196,198,200,201,202,204,206,207,208,210,212,213,214,216,218,219,220,222,224,225,226,228,230,231,232,234,236,237,238,240,242,243,244,246,248,249,250,252,254,255,256,258,260,261,262,264,266,267,268,270,272,273,274,276,278,279,280,282,284,285,286,288,290,291,292,294,296,297,298,300,302,303,304,306,308,309,310,312,314,315,316,318,320,321,322,324,326,327,328,330,332,333,334,336,338,339,340,342,344,345,346,348,350,351,352,354,356,357,358,360,362,363,364,366,368,369,370,372,374
mov $1,$0
add $0,14
mod $0,4
mul $1,6
add $1,$0
div $1,4
| 104.7 | 927 | 0.713467 | [
"Apache-2.0"
] | jmorken/loda | programs/oeis/047/A047229.asm | 1,047 | Assembly | 19 |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Copyright(c) 2011-2016 Intel Corporation All rights reserved.
;
; Redistribution and use in source and binary forms, with or without
; modification, are permitted provided that the following conditions
; are met:
; * Redistributions of source code must retain the above copyright
; notice, this list of conditions and the following disclaimer.
; * Redistributions in binary form must reproduce the above copyright
; notice, this list of conditions and the following disclaimer in
; the documentation and/or other materials provided with the
; distribution.
; * Neither the name of Intel Corporation nor the names of its
; contributors may be used to endorse or promote products derived
; from this software without specific prior written permission.
;
; THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
; "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
; LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
; A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
; OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
; SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
; LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
; DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
; THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
; (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
; OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
default rel
[bits 64]
%include "reg_sizes.asm"
extern isal_deflate_body_base
extern isal_deflate_body_01
extern isal_deflate_body_02
extern isal_deflate_body_04
extern isal_deflate_finish_base
extern isal_deflate_finish_01
extern isal_deflate_icf_body_hash_hist_base
extern isal_deflate_icf_body_hash_hist_01
extern isal_deflate_icf_body_hash_hist_02
extern isal_deflate_icf_body_hash_hist_04
extern isal_deflate_icf_finish_hash_hist_base
extern isal_deflate_icf_finish_hash_hist_01
extern isal_deflate_icf_finish_hash_map_base
extern isal_update_histogram_base
extern isal_update_histogram_01
extern isal_update_histogram_04
extern gen_icf_map_h1_base
extern gen_icf_map_lh1_04
extern encode_deflate_icf_base
extern encode_deflate_icf_04
extern set_long_icf_fg_base
extern set_long_icf_fg_04
%ifdef HAVE_AS_KNOWS_AVX512
extern encode_deflate_icf_06
extern set_long_icf_fg_06
extern gen_icf_map_lh1_06
%endif
extern adler32_base
extern adler32_avx2_4
extern adler32_sse
extern isal_deflate_hash_base
extern isal_deflate_hash_crc_01
extern isal_deflate_hash_mad_base
extern icf_body_hash1_fillgreedy_lazy
extern icf_body_lazyhash1_fillgreedy_greedy
section .text
%include "multibinary.asm"
mbin_interface isal_deflate_body
mbin_dispatch_init5 isal_deflate_body, isal_deflate_body_base, isal_deflate_body_01, isal_deflate_body_02, isal_deflate_body_04
mbin_interface isal_deflate_finish
mbin_dispatch_init5 isal_deflate_finish, isal_deflate_finish_base, isal_deflate_finish_01, isal_deflate_finish_01, isal_deflate_finish_01
mbin_interface isal_deflate_icf_body_lvl1
mbin_dispatch_init5 isal_deflate_icf_body_lvl1, isal_deflate_icf_body_hash_hist_base, isal_deflate_icf_body_hash_hist_01, isal_deflate_icf_body_hash_hist_02, isal_deflate_icf_body_hash_hist_04
mbin_interface isal_deflate_icf_body_lvl2
mbin_dispatch_init5 isal_deflate_icf_body_lvl2, isal_deflate_icf_body_hash_hist_base, isal_deflate_icf_body_hash_hist_01, isal_deflate_icf_body_hash_hist_02, isal_deflate_icf_body_hash_hist_04
mbin_interface isal_deflate_icf_body_lvl3
mbin_dispatch_init5 isal_deflate_icf_body_lvl3, icf_body_hash1_fillgreedy_lazy, icf_body_hash1_fillgreedy_lazy, icf_body_hash1_fillgreedy_lazy, icf_body_lazyhash1_fillgreedy_greedy
mbin_interface isal_deflate_icf_finish_lvl1
mbin_dispatch_init5 isal_deflate_icf_finish_lvl1, isal_deflate_icf_finish_hash_hist_base, isal_deflate_icf_finish_hash_hist_01, isal_deflate_icf_finish_hash_hist_01, isal_deflate_icf_finish_hash_hist_01
mbin_interface isal_deflate_icf_finish_lvl2
mbin_dispatch_init5 isal_deflate_icf_finish_lvl2, isal_deflate_icf_finish_hash_hist_base, isal_deflate_icf_finish_hash_hist_01, isal_deflate_icf_finish_hash_hist_01, isal_deflate_icf_finish_hash_hist_01
mbin_interface isal_deflate_icf_finish_lvl3
mbin_dispatch_init5 isal_deflate_icf_finish_lvl3, isal_deflate_icf_finish_hash_map_base, isal_deflate_icf_finish_hash_map_base, isal_deflate_icf_finish_hash_map_base, isal_deflate_icf_finish_hash_map_base
mbin_interface isal_update_histogram
mbin_dispatch_init5 isal_update_histogram, isal_update_histogram_base, isal_update_histogram_01, isal_update_histogram_01, isal_update_histogram_04
mbin_interface encode_deflate_icf
mbin_dispatch_init6 encode_deflate_icf, encode_deflate_icf_base, encode_deflate_icf_base, encode_deflate_icf_base, encode_deflate_icf_04, encode_deflate_icf_06
mbin_interface set_long_icf_fg
mbin_dispatch_init6 set_long_icf_fg, set_long_icf_fg_base, set_long_icf_fg_base, set_long_icf_fg_base, set_long_icf_fg_04, set_long_icf_fg_06
mbin_interface gen_icf_map_lh1
mbin_dispatch_init6 gen_icf_map_lh1, gen_icf_map_h1_base, gen_icf_map_h1_base, gen_icf_map_h1_base, gen_icf_map_lh1_04, gen_icf_map_lh1_06
mbin_interface isal_adler32
mbin_dispatch_init5 isal_adler32, adler32_base, adler32_sse, adler32_sse, adler32_avx2_4
mbin_interface isal_deflate_hash_lvl0
mbin_dispatch_init5 isal_deflate_hash_lvl0, isal_deflate_hash_base, isal_deflate_hash_crc_01, isal_deflate_hash_crc_01, isal_deflate_hash_crc_01
mbin_interface isal_deflate_hash_lvl1
mbin_dispatch_init5 isal_deflate_hash_lvl1, isal_deflate_hash_base, isal_deflate_hash_crc_01, isal_deflate_hash_crc_01, isal_deflate_hash_crc_01
mbin_interface isal_deflate_hash_lvl2
mbin_dispatch_init5 isal_deflate_hash_lvl2, isal_deflate_hash_base, isal_deflate_hash_crc_01, isal_deflate_hash_crc_01, isal_deflate_hash_crc_01
mbin_interface isal_deflate_hash_lvl3
mbin_dispatch_init5 isal_deflate_hash_lvl3, isal_deflate_hash_base, isal_deflate_hash_base, isal_deflate_hash_base, isal_deflate_hash_mad_base
| 46.725926 | 204 | 0.862555 | [
"BSD-3-Clause"
] | 01org/isa-l | igzip/igzip_multibinary.asm | 6,308 | Assembly | 21 |
<%
from pwnlib.shellcraft.arm.linux import syscall
%>
<%page args="file, tvp"/>
<%docstring>
Invokes the syscall utimes. See 'man 2 utimes' for more information.
Arguments:
file(char): file
tvp(timeval): tvp
</%docstring>
${syscall('SYS_utimes', file, tvp)}
| 19.785714 | 69 | 0.67148 | [
"MIT"
] | IMULMUL/python3-pwntools | pwnlib/shellcraft/templates/arm/android/utimes.asm | 277 | Assembly | 20 |
; A313682: Coordination sequence Gal.5.55.4 where G.u.t.v denotes the coordination sequence for a vertex of type v in tiling number t in the Galebach list of u-uniform tilings.
; 1,5,10,15,19,23,27,31,36,41,46,51,56,61,65,69,73,77,82,87,92,97,102,107,111,115,119,123,128,133,138,143,148,153,157,161,165,169,174,179,184,189,194,199,203,207,211,215,220,225
mov $2,3
sub $2,$0
trn $2,2
mov $5,$0
mov $6,$0
add $0,3
mul $0,2
mov $1,$6
sub $1,1
add $2,$0
add $2,4
lpb $0
sub $2,4
mov $4,$0
mov $0,1
add $3,$4
sub $3,$1
mov $4,4
trn $4,$3
sub $3,1
add $4,$2
add $0,$4
sub $0,4
mov $1,$4
add $1,6
lpe
mov $1,$4
lpb $5
add $1,3
sub $5,1
lpe
sub $1,6
| 18.694444 | 177 | 0.622585 | [
"Apache-2.0"
] | jmorken/loda | programs/oeis/313/A313682.asm | 673 | Assembly | 19 |
; A226555: Numerators of row sums of the triangular enumeration of rational numbers A226314(n,k) / A054531(n,k), 1 <= k <= n.
; Submitted by Simon Strandgaard
; 1,5,4,13,7,25,10,33,17,45,16,69,19,65,38,81,25,109,28,125,55,105,34,177,53,125,68,181,43,241,46,193,89,165,100,301,55,185,106,321,61,349,64,293,167,225,70,433,109,341,140,349,79,433,162,465,157,285,88,661,91,305,242,449,193,565,100,461,191,633,106,769,109,365,288,517,235,673,118,785,257,405,124,957,255,425,242,753,133,1045,280,629,259,465,286,1025,145,701,392,941
mov $1,$0
seq $0,18804 ; Pillai's arithmetical function: Sum_{k=1..n} gcd(k, n).
sub $1,$0
sub $0,$1
dif $0,2
| 63.8 | 367 | 0.706897 | [
"Apache-2.0"
] | ckrause/loda-programs | oeis/226/A226555.asm | 638 | Assembly | 19 |
; A119575: Binomial(2*n,n)*(n+3)^2/(n+1).
; Submitted by Jamie Morken(s2)
; 9,16,50,180,686,2688,10692,42900,173030,700128,2838524,11522056,46802700,190182400,772913160,3141129780,12764118870,51857916000,210638666700,855355383960,3472419702180,14092569803520,57176602275000
mov $2,$0
seq $0,108 ; Catalan numbers: C(n) = binomial(2n,n)/(n+1) = (2n)!/(n!(n+1)!).
add $2,3
pow $2,2
mul $0,$2
| 39.1 | 199 | 0.723785 | [
"Apache-2.0"
] | ckrause/loda-programs | oeis/119/A119575.asm | 391 | Assembly | 19 |
; A170209: Number of reduced words of length n in Coxeter group on 8 generators S_i with relations (S_i)^2 = (S_i S_j)^40 = I.
; 1,8,56,392,2744,19208,134456,941192,6588344,46118408,322828856,2259801992,15818613944,110730297608,775112083256,5425784582792,37980492079544,265863444556808,1861044111897656,13027308783283592
mov $1,7
pow $1,$0
add $1,2
mul $1,8
div $1,7
sub $1,2
mov $0,$1
| 35.181818 | 193 | 0.77261 | [
"Apache-2.0"
] | ckrause/cm | programs/oeis/170/A170209.asm | 387 | Assembly | 19 |
; void *sms_set_vram(unsigned char c, unsigned int n)
SECTION code_clib
SECTION code_crt_common
PUBLIC _sms_set_vram_callee
EXTERN asm_sms_set_vram
_sms_set_vram_callee:
pop hl
dec sp
pop af
pop bc
push hl
jp asm_sms_set_vram
| 13.157895 | 53 | 0.764 | [
"BSD-2-Clause"
] | ByteProject/Puddle-BuildTools | FictionTools/z88dk/libsrc/_DEVELOPMENT/arch/sms/vram/c/sdcc/sms_set_vram_callee.asm | 250 | Assembly | 4 |
INCLUDE "SoundSystemNotes.inc"
INCLUDE "SoundSystem.def"
INCLUDE "SoundSystem.inc"
; tabs=8,hard
;***************************************************************************************************************************
;* default behaviors
;***************************************************************************************************************************
; force support for color gameboy-specific roms to be disabled if not user-specified
IF !DEF(SOUNDSYSTEM_GBC_COMPATIBLE)
SOUNDSYSTEM_GBC_COMPATIBLE EQU 0
ENDC
; force support for banking if not user-specified
IF !DEF(SOUNDSYSTEM_ROM_BANKING)
SOUNDSYSTEM_ROM_BANKING EQU 1
ENDC
; force support for large roms to be disabled if not user-specified
IF !DEF(SOUNDSYSTEM_LARGE_ROM)
SOUNDSYSTEM_LARGE_ROM EQU 0
ENDC
; force the code to reside in bank 0 if not user-specified
IF !DEF(SOUNDSYSTEM_CODE_BANK)
SOUNDSYSTEM_CODE_BANK EQU 0
ENDC
; force the variables to reside in wram bank 0 if not user-specified
IF !DEF(SOUNDSYSTEM_WRAM_BANK)
SOUNDSYSTEM_WRAM_BANK EQU 0
ENDC
; force the sfx to be enabled if not user-specified
if !DEF(SOUNDSYSTEM_ENABLE_SFX)
SOUNDSYSTEM_ENABLE_SFX EQU 1
ENDC
; force the vu meters to be disabled if not user-specified
if !DEF(SOUNDSYSTEM_ENABLE_VUM)
SOUNDSYSTEM_ENABLE_VUM EQU 0
ENDC
; force certain settings if the rom is not specific to color gameboy
IF (SOUNDSYSTEM_GBC_COMPATIBLE == 0)
PURGE SOUNDSYSTEM_WRAM_BANK
SOUNDSYSTEM_WRAM_BANK EQU 0
ENDC
; do some sanity checking
IF (SOUNDSYSTEM_GBC_COMPATIBLE != 0)
ASSERT(SOUNDSYSTEM_WRAM_BANK < 8)
; force boolean
PURGE SOUNDSYSTEM_GBC_COMPATIBLE
SOUNDSYSTEM_GBC_COMPATIBLE EQU 1
ENDC
IF (SOUNDSYSTEM_LARGE_ROM != 0)
ASSERT(SOUNDSYSTEM_ROM_BANKING != 0)
ASSERT(SOUNDSYSTEM_CODE_BANK < 512)
; force boolean
PURGE SOUNDSYSTEM_LARGE_ROM
SOUNDSYSTEM_LARGE_ROM EQU 1
ENDC
IF (SOUNDSYSTEM_ENABLE_SFX != 0)
; force boolean
PURGE SOUNDSYSTEM_ENABLE_SFX
SOUNDSYSTEM_ENABLE_SFX EQU 1
ENDC
IF (SOUNDSYSTEM_ENABLE_VUM != 0)
; force boolean
PURGE SOUNDSYSTEM_ENABLE_VUM
SOUNDSYSTEM_ENABLE_VUM EQU 1
ENDC
sizeof_BANK_VAR = 1+SOUNDSYSTEM_LARGE_ROM ; the size, in bytes, of the bank variables
; display the configuration
PRINTLN "SoundSystem Configuration:"
IF (SOUNDSYSTEM_GBC_COMPATIBLE == 0)
PRINTLN " GBC Only: no"
ELSE
PRINTLN " GBC Only: YES"
ENDC
IF (SOUNDSYSTEM_LARGE_ROM == 0)
PRINTLN " Large ROM: no"
ELSE
PRINTLN " Large ROM: YES"
ENDC
PRINTLN " Code Bank: {SOUNDSYSTEM_CODE_BANK}"
PRINTLN " WRAM Bank: {SOUNDSYSTEM_WRAM_BANK}"
IF (SOUNDSYSTEM_ROM_BANKING == 0)
PRINTLN " ROM Banking: disabled"
ELSE
PRINTLN " ROM Banking: ENABLED"
ENDC
IF (SOUNDSYSTEM_ENABLE_SFX == 0)
PRINTLN " SFX: disabled"
ELSE
PRINTLN " SFX: ENABLED"
ENDC
IF (SOUNDSYSTEM_ENABLE_VUM == 0)
PRINTLN " VU Meters: disabled"
ELSE
PRINTLN " VU Meters: ENABLED"
ENDC
;***************************************************************************************************************************
;* hardware registers
;***************************************************************************************************************************
rROMB0 EQU $2000 ; $2000->$2FFF
rROMB1 EQU $3000 ; $3000->$3FFF - If more than 256 ROM banks are present.
rSVBK EQU $FF70
rAUD1SWEEP EQU $FF10
rAUD1LEN EQU $FF11
rAUD1ENV EQU $FF12
rAUD1LOW EQU $FF13
rAUD1HIGH EQU $FF14
rAUD2LEN EQU $FF16
rAUD2ENV EQU $FF17
rAUD2LOW EQU $FF18
rAUD2HIGH EQU $FF19
rAUD3ENA EQU $FF1A
rAUD3LEN EQU $FF1B
rAUD3LEVEL EQU $FF1C
rAUD3LOW EQU $FF1D
rAUD3HIGH EQU $FF1E
rAUD4LEN EQU $FF20
rAUD4ENV EQU $FF21
rAUD4POLY EQU $FF22
rAUD4GO EQU $FF23
rAUDVOL EQU $FF24
rAUDTERM EQU $FF25
rAUDENA EQU $FF26
_AUD3WAVERAM EQU $FF30 ; $FF30->$FF3F
; values for rAUD1LEN, rAUD2LEN
AUDLEN_DUTY_75 EQU %11000000 ; 75%
AUDLEN_DUTY_50 EQU %10000000 ; 50%
AUDLEN_DUTY_25 EQU %01000000 ; 25%
AUDLEN_DUTY_12_5 EQU %00000000 ; 12.5%
AUDLEN_LENGTHMASK EQU %00111111
; values for rAUD1HIGH, rAUD2HIGH, rAUD3HIGH
AUDHIGH_RESTART EQU %10000000
AUDHIGH_LENGTH_ON EQU %01000000
AUDHIGH_LENGTH_OFF EQU %00000000
; values for rAUD3ENA
AUD3ENA_ON EQU %10000000
; values for rAUDVOL
AUDVOL_VIN_LEFT EQU %10000000 ; SO2
AUDVOL_VIN_RIGHT EQU %00001000 ; SO1
; values for rAUDTERM
; SO2
AUDTERM_4_LEFT EQU %10000000
AUDTERM_3_LEFT EQU %01000000
AUDTERM_2_LEFT EQU %00100000
AUDTERM_1_LEFT EQU %00010000
; SO1
AUDTERM_4_RIGHT EQU %00001000
AUDTERM_3_RIGHT EQU %00000100
AUDTERM_2_RIGHT EQU %00000010
AUDTERM_1_RIGHT EQU %00000001
AUDTERM_ALL EQU $FF ; shorthand instead of ORing all the EQUs together
;***************************************************************************************************************************
;* supported music commands
;***************************************************************************************************************************
RSSET 0
MUSIC_CMD_ENDOFFRAME RB 1
MUSIC_CMD_PLAYINSTNOTE RB 1
MUSIC_CMD_PLAYINST RB 1
MUSIC_CMD_SETVOLUME RB 1
MUSIC_CMD_VIBRATO_ON RB 1
MUSIC_CMD_EFFECT_OFF RB 1
MUSIC_CMD_SYNCFLAG RB 1
MUSIC_CMD_ENDOFPATTERN RB 1
MUSIC_CMD_GOTOORDER RB 1
MUSIC_CMD_ENDOFSONG RB 1
MUSIC_CMD_SETSPEED RB 1
MUSIC_CMD_ENDOFFRAME1X RB 1
MUSIC_CMD_ENDOFFRAME2X RB 1
MUSIC_CMD_ENDOFFRAME3X RB 1
MUSIC_CMD_ENDOFFRAME4X RB 1
MUSIC_CMD_PITCHUP_ON RB 1
MUSIC_CMD_PITCHDOWN_ON RB 1
MUSIC_CMD_TRIPLENOTE_ON RB 1
MUSIC_CMD_EXTRA RB 1
;***************************************************************************************************************************
;* supported music effects
;***************************************************************************************************************************
RSRESET
MUSIC_FX_NONE RB 1
MUSIC_FX_VIB1 RB 1
MUSIC_FX_VIB2 RB 1
MUSIC_FX_TRIPLEFREQ1 RB 1
MUSIC_FX_TRIPLEFREQ2 RB 1
MUSIC_FX_TRIPLEFREQ3 RB 1
MUSIC_FX_PITCHUP RB 1
MUSIC_FX_PITCHDOWN RB 1
;***************************************************************************************************************************
;* supported instrument commands
;***************************************************************************************************************************
RSRESET
; common commands
MUSIC_INSTCMD_X_FRAMEEND RB 1
MUSIC_INSTCMD_X_START RB 1
MUSIC_INSTCMD_X_END RB 1
MUSIC_INSTCMD_X_ENVELOPE RB 1
MUSIC_INSTCMD_X_STARTFREQ RB 1
MUSIC_INSTCMD_X_ENVELOPEVOL RB 1
MUSIC_INSTCMD_X_STARTENVVOLFREQ RB 1
MUSIC_INSTCMD_X_PANMID RB 1
MUSIC_INSTCMD_X_PANRIGHT RB 1
MUSIC_INSTCMD_X_PANLEFT RB 1
; count of common instrument commands
MUSIC_INSTCMD_COMMONCOUNT RB 0
; specific commands
; channels 1 and 2
RSSET MUSIC_INSTCMD_COMMONCOUNT
MUSIC_INSTCMD_12_PULSELEN RB 1
MUSIC_INSTCMD_1_SWEEP RB 1
; channel 3
RSSET MUSIC_INSTCMD_COMMONCOUNT
MUSIC_INSTCMD_3_WAVE RB 1
MUSIC_INSTCMD_3_LEN RB 1
; channel 4
RSSET MUSIC_INSTCMD_COMMONCOUNT
MUSIC_INSTCMD_4_POLYLOAD RB 1
MUSIC_INSTCMD_4_LEN RB 1
;***************************************************************************************************************************
;* wSoundFXLock bit definitions
;***************************************************************************************************************************
SFXLOCKF_4_LEFT EQU AUDTERM_4_LEFT
SFXLOCKF_3_LEFT EQU AUDTERM_3_LEFT
SFXLOCKF_2_LEFT EQU AUDTERM_2_LEFT
SFXLOCKF_1_LEFT EQU AUDTERM_1_LEFT
SFXLOCKF_4_RIGHT EQU AUDTERM_4_RIGHT
SFXLOCKF_3_RIGHT EQU AUDTERM_3_RIGHT
SFXLOCKF_2_RIGHT EQU AUDTERM_2_RIGHT
SFXLOCKF_1_RIGHT EQU AUDTERM_1_RIGHT
SFXLOCKB_CHANNEL4 EQU 3
SFXLOCKB_CHANNEL3 EQU 2
SFXLOCKB_CHANNEL2 EQU 1
SFXLOCKB_CHANNEL1 EQU 0
;***************************************************************************************************************************
;* work ram
;***************************************************************************************************************************
IF (SOUNDSYSTEM_WRAM_BANK == 0)
SECTION "SoundSystem Variables",WRAM0,ALIGN[7]
ELSE
SECTION "SoundSystem Variables",WRAMX,BANK[SOUNDSYSTEM_WRAM_BANK],ALIGN[7]
ENDC
wMusicSyncData:: DS 1 ; arbitrary value set by the song to sync visual effects with bg music
; soundfx variables
wSoundFXLock: DS 1 ; bitfield (see above), 1 = Music, 0 = SFX Locked
wSoundFXTable: DS 2 ; table of soundfx pointers
IF (SOUNDSYSTEM_ROM_BANKING != 0)
wSoundFXBank: DS sizeof_BANK_VAR ; bank of soundfxs
ENDC
wSoundFXStart: DS 4 ; sound fx to start
wSoundFXNote: DS 1 ; sound fx's start note
; music/sfx shared variables
wMusicSFXPanning: DS 1
wMusicSFXInstPause1: DS 1 ; frames left before instrument/soundfx update for channel 1
wMusicSFXInstPause2: DS 1 ; frames left before instrument/soundfx update for channel 2
wMusicSFXInstPause3: DS 1 ; frames left before instrument/soundfx update for channel 3
wMusicSFXInstPause4: DS 1 ; frames left before instrument/soundfx update for channel 4
wMusicSFXInstPtr1: DS 2 ; pointer to playing instrument/soundfx for channel 1
wMusicSFXInstPtr2: DS 2 ; pointer to playing instrument/soundfx for channel 2
wMusicSFXInstPtr3: DS 2 ; pointer to playing instrument/soundfx for channel 3
wMusicSFXInstPtr4: DS 2 ; pointer to playing instrument/soundfx for channel 4
IF (SOUNDSYSTEM_ROM_BANKING != 0)
wMusicSFXInstBank1: DS sizeof_BANK_VAR ; bank of active instrument for channel 1
wMusicSFXInstBank2: DS sizeof_BANK_VAR ; bank of active instrument for channel 2
wMusicSFXInstBank3: DS sizeof_BANK_VAR ; bank of active instrument for channel 3
wMusicSFXInstBank4: DS sizeof_BANK_VAR ; bank of active instrument for channel 4
ENDC
wMusicSFXInstChnl3WaveID: DS 1 ; current waveid loaded, IDs of 255 in instruments will load, whatever the value here
wMusicSFXInstChnl3Lock: DS 1 ; 0 = no lock, 1 = external lock
; music variables
wMusicPlayState:: DS 1 ; current music playback state, 0 = stopped, 1 = playing
wMusicNextFrame: DS 1 ; number of frames until the next music commands
wMusicCommandPtr: DS 2 ; position of playing music
IF (SOUNDSYSTEM_ROM_BANKING != 0)
wMusicCommandBank: DS sizeof_BANK_VAR ; bank of playing music
ENDC
wMusicOrderPtr: DS 2 ; position of pattern order list (list of pointers to start of patterns)
IF (SOUNDSYSTEM_ROM_BANKING != 0)
wMusicOrderBank: DS sizeof_BANK_VAR ; bank of order list
ENDC
wMusicInstrumentTable: DS 2 ; table of instrument pointers
IF (SOUNDSYSTEM_ROM_BANKING != 0)
wMusicInstrumentBank: DS sizeof_BANK_VAR ; bank of instruments
ENDC
; miscellaneous variables
wChannelMusicFreq1: DS 2 ; GB frequency of channel 1 for music backup
wChannelMusicFreq2: DS 2 ; GB frequency of channel 2 for music backup
wChannelMusicFreq3: DS 2 ; GB frequency of channel 3 for music backup
wChannelMusicFreq4: DS 2 ; GB frequency of channel 4 for music backup
wChannelMusicNote1: DS 1 ; note of channel 1 for music backup
wChannelMusicNote2: DS 1 ; note of channel 2 for music backup
wChannelMusicNote3: DS 1 ; note of channel 3 for music backup
wChannelMusicNote4: DS 1 ; note of channel 4 for music backup
wChannelFreq1: DS 2 ; GB frequency of channel 1
wChannelFreq2: DS 2 ; GB frequency of channel 2
wChannelFreq3: DS 2 ; GB frequency of channel 3
wChannelFreq4: DS 2 ; GB frequency of channel 4
wChannelVol1: DS 1 ; volumes of channel 1, byte[4:VOL,4:xxxx]
wChannelVol2: DS 1 ; volumes of channel 2, byte[4:VOL,4:xxxx]
wChannelVol3: DS 1 ; volumes of channel 3, byte[4:VOL,4:xxxx]
wChannelVol4: DS 1 ; volumes of channel 4, byte[4:VOL,4:xxxx]
wMusicSpeed: DS 1 ; speed
; effect variables
wChannelMusicEffect1: DS 1 ; active effect for channel 1, 0 = none
wChannelMusicEffect2: DS 1 ; active effect for channel 2, 0 = none
wChannelMusicEffect3: DS 1 ; active effect for channel 3, 0 = none
wChannelMusicEffect4: DS 1 ; active effect for channel 4, 0 = none
wChannelMusicFXParamA1: DS 2 ; effect parameters for channel 1
wChannelMusicFXParamA2: DS 2 ; effect parameters for channel 2
wChannelMusicFXParamA3: DS 2 ; effect parameters for channel 3
wChannelMusicFXParamA4: DS 2 ; effect parameters for channel 4
wChannelMusicFXParamB1: DS 2 ; effect parameters for channel 1
wChannelMusicFXParamB2: DS 2 ; effect parameters for channel 2
wChannelMusicFXParamB3: DS 2 ; effect parameters for channel 3
wChannelMusicFXParamB4: DS 2 ; effect parameters for channel 4
wTemp: DS 2 ; temporary storage for player calcs
IF (SOUNDSYSTEM_ENABLE_VUM)
wVUMeter1:: DS 1 ; vu meter data for channel 1
wVUMeter2:: DS 1 ; vu meter data for channel 2
wVUMeter3:: DS 1 ; vu meter data for channel 3
wVUMeter4:: DS 1 ; vu meter data for channel 4
ENDC
;***************************************************************************************************************************
;* Identification
;***************************************************************************************************************************
IF (SOUNDSYSTEM_CODE_BANK == 0)
SECTION "SoundSystem_Identity",ROM0
ELSE
SECTION "SoundSystem_Identity",ROMX,BANK[SOUNDSYSTEM_CODE_BANK]
ENDC
SoundSystem_Version::
DB "SoundSystem v20.249",$00
SoundSystem_Author::
DB "Code: S. Hockenhull",$00
;***************************************************************************************************************************
;* SoundSystem_Init
;***************************************************************************************************************************
IF (SOUNDSYSTEM_CODE_BANK == 0)
SECTION "SoundSystem_Init",ROM0
ELSE
SECTION "SoundSystem_Init",ROMX,BANK[SOUNDSYSTEM_CODE_BANK]
ENDC
SoundSystem_Init::
IF (SOUNDSYSTEM_WRAM_BANK != 0)
ld a,SOUNDSYSTEM_WRAM_BANK
ldh [rSVBK],a
ENDC
; set all channel samples to 'stop'
ld hl,wMusicSFXInstPtr1
ld e,4
.instptrloop:
ld a,LOW(Music_InstrumentEnd)
ld [hl+],a
ld a,HIGH(Music_InstrumentEnd)
ld [hl+],a
dec e
jr nz,.instptrloop
IF (SOUNDSYSTEM_ROM_BANKING != 0)
; set all channel banks to be the bank with the stop instrument
ld hl,wMusicSFXInstBank1
ld e,4
IF (SOUNDSYSTEM_LARGE_ROM)
.instbankloop:
ld a,LOW(BANK(Music_InstrumentEnd))
ld [hl+],a
ld a,HIGH(BANK(Music_InstrumentEnd))
ld [hl+],a
dec e
jr nz,.instbankloop
ELSE
ld a,BANK(Music_InstrumentEnd)
.instbankloop:
ld [hl+],a
dec e
jr nz,.instbankloop
ENDC
ENDC
; set all channel volumes to 8
ld a,$80
ld hl,wChannelVol1
REPT 4
ld [hl+],a
ENDR
; set all channel sfxs to unused (etc.)
ld a,$FF
ld hl,wSoundFXStart
REPT 4
ld [hl+],a
ENDR
ld [wSoundFXLock],a
ld [wMusicSFXPanning],a
ld [wMusicSFXInstChnl3WaveID],a
; clear all channel music effects
xor a
ld hl,wChannelMusicEffect1
REPT 4
ld [hl+],a
ENDR
ld [wMusicSFXInstChnl3Lock],a
; clear all sfx pause timers
ld hl,wMusicSFXInstPause1
REPT 4
ld [hl+],a
ENDR
; clear all channel music frequencies
ld hl,wChannelMusicFreq1
REPT 8
ld [hl+],a
ENDR
IF (SOUNDSYSTEM_ENABLE_VUM)
; clear all vu meter values
ld hl,wVUMeter1
REPT 4
ld [hl+],a
ENDR
ENDC
; enable sound
ld a,AUD3ENA_ON
ldh [rAUDENA],a
; channel 1
xor a
ldh [rAUD1SWEEP],a
; all channels off
call Music_Pause
; general
ld a,(AUDVOL_VIN_LEFT|AUDVOL_VIN_RIGHT) ^ $FF ; same as ~(), but ~ here triggers a false warning
ldh [rAUDVOL],a
ld a,AUDTERM_ALL
ldh [rAUDTERM],a
ret
; dummy instrument to init/clear instrument pointers
Music_InstrumentEnd:
DB MUSIC_INSTCMD_X_END
;***************************************************************************************************************************
;* SoundSystem_Process
;***************************************************************************************************************************
IF (SOUNDSYSTEM_CODE_BANK == 0)
SECTION "SoundSystem_Process",ROM0
ELSE
SECTION "SoundSystem_Process",ROMX,BANK[SOUNDSYSTEM_CODE_BANK]
ENDC
SoundSystem_Process::
IF (SOUNDSYSTEM_WRAM_BANK != 0)
ld a,SOUNDSYSTEM_WRAM_BANK
ldh [rSVBK],a
ENDC
IF (SOUNDSYSTEM_ENABLE_SFX)
; sfx start process
ld hl,wSoundFXStart
ld c,4
.multisfx:
ld a,[hl]
push hl
push bc
xor $FF
jp z,.nonewsfx
ld b,a ; save
IF (SOUNDSYSTEM_ROM_BANKING != 0)
; change the rom bank
ld a,[wSoundFXBank]
ld [rROMB0],a
IF (SOUNDSYSTEM_LARGE_ROM != 0)
ld a,[wSoundFXBank+1]
ld [rROMB1],a
ENDC
ENDC
; lock & update SFX
ld a,b ; restore
cpl
; calculate table plus index address
ld b,a ;save
ld a,[wSoundFXTable]
ld e,a
ld a,[wSoundFXTable+1]
ld d,a
ld a,b ;restore
ld b,0
add a
rl b
add a
rl b
add a ; 4 words
rl b
add e
ld l,a
ld a,0 ; can't xor a here becuase of the adc
adc d
add b
ld h,a
push hl
ld a,[wSoundFXNote]
add a
ld l,a
ld h,HIGH(FrequencyTable)
ASSERT LOW(FrequencyTable) == 0
ld a,[hl+]
ld [wTemp],a
ld a,[hl]
ld [wTemp+1],a ; store note freq
pop hl
; update wSoundFXLock
ld a,[wSoundFXLock]
ld d,a
; load channel 1
ld a,[hl+]
ld c,a
ld a,[hl+]
ld b,a
or c
jr z,.nosfxchnl1
ld a,c
ld [wMusicSFXInstPtr1],a
ld a,b
ld [wMusicSFXInstPtr1+1],a
IF (SOUNDSYSTEM_ROM_BANKING != 0)
; update the rom bank
ld a,[wSoundFXBank]
ld [wMusicSFXInstBank1],a
IF (SOUNDSYSTEM_LARGE_ROM != 0)
ld a,[wSoundFXBank+1]
ld [wMusicSFXInstBank1+1],a
ENDC
ENDC
ld a,[wTemp]
ld [wChannelFreq1],a
ld a,[wTemp+1]
ld [wChannelFreq1+1],a
ld a,d
and ~(SFXLOCKF_1_LEFT|SFXLOCKF_1_RIGHT)
ld d,a
ld a,1 ; set counter to immediate start
ld [wMusicSFXInstPause1],a
.nosfxchnl1:
; load channel 2
ld a,[hl+]
ld c,a
ld a,[hl+]
ld b,a
or c
jr z,.nosfxchnl2
ld a,c
ld [wMusicSFXInstPtr2],a
ld a,b
ld [wMusicSFXInstPtr2+1],a
IF (SOUNDSYSTEM_ROM_BANKING != 0)
; update the rom bank
ld a,[wSoundFXBank]
ld [wMusicSFXInstBank2],a
IF (SOUNDSYSTEM_LARGE_ROM != 0)
ld a,[wSoundFXBank+1]
ld [wMusicSFXInstBank2+1],a
ENDC
ENDC
ld a,[wTemp]
ld [wChannelFreq2],a
ld a,[wTemp+1]
ld [wChannelFreq2+1],a
ld a,d
and ~(SFXLOCKF_2_LEFT|SFXLOCKF_2_RIGHT)
ld d,a
ld a,1 ; set counter to immediate start
ld [wMusicSFXInstPause2],a
.nosfxchnl2:
; load channel 3
ld a,[hl+]
ld c,a
ld a,[hl+]
ld b,a
or c
jr z,.nosfxchnl3
ld a,[wMusicSFXInstChnl3Lock]
or a
jr nz,.nosfxchnl3
ld a,c
ld [wMusicSFXInstPtr3],a
ld a,b
ld [wMusicSFXInstPtr3+1],a
IF (SOUNDSYSTEM_ROM_BANKING != 0)
; update the rom bank
ld a,[wSoundFXBank]
ld [wMusicSFXInstBank3],a
IF (SOUNDSYSTEM_LARGE_ROM != 0)
ld a,[wSoundFXBank+1]
ld [wMusicSFXInstBank3+1],a
ENDC
ENDC
ld a,[wTemp]
ld [wChannelFreq3],a
ld a,[wTemp+1]
ld [wChannelFreq3+1],a
ld a,d
and ~(SFXLOCKF_3_LEFT|SFXLOCKF_3_RIGHT)
ld d,a
ld a,1 ; set counter to immediate start
ld [wMusicSFXInstPause3],a
.nosfxchnl3:
; load channel 4
ld a,[hl+]
ld c,a
ld a,[hl+]
ld b,a
or c
jr z,.nosfxchnl4
ld a,c
ld [wMusicSFXInstPtr4],a
ld a,b
ld [wMusicSFXInstPtr4+1],a
IF (SOUNDSYSTEM_ROM_BANKING != 0)
; update the rom bank
ld a,[wSoundFXBank]
ld [wMusicSFXInstBank4],a
IF (SOUNDSYSTEM_LARGE_ROM != 0)
ld a,[wSoundFXBank+1]
ld [wMusicSFXInstBank4+1],a
ENDC
ENDC
ld a,d
and (SFXLOCKF_4_LEFT|SFXLOCKF_4_RIGHT) ^ $FF ; same as ~(), but ~ here triggers a false warning
ld d,a
ld a,1 ; set counter to immediate start
ld [wMusicSFXInstPause4],a
.nosfxchnl4:
pop bc
pop hl
; update wSoundFXLock
ld a,d
ld [wSoundFXLock],a
; de-flag sfx start
ld a,$FF
ld [hl+],a
dec c
jp nz,.multisfx
jr .newsfxdone
.nonewsfx:
add sp,4
.newsfxdone:
ENDC
;-------------------------------
; instruments and SFX process
;-------------------------------
; channel 1
ld hl,wMusicSFXInstPause1
dec [hl]
jr nz,SSFP_Inst1UpdateDone
IF (SOUNDSYSTEM_ROM_BANKING != 0)
; change the rom bank
ld a,[wMusicSFXInstBank1]
ld [rROMB0],a
IF (SOUNDSYSTEM_LARGE_ROM != 0)
ld a,[wMusicSFXInstBank1+1]
ld [rROMB1],a
ENDC
ENDC
ld hl,wMusicSFXInstPtr1
ld a,[hl+]
ld d,[hl]
ld e,a
jp SSFP_Inst1Update
SSFP_Inst1UpdateFrameEnd:
; save back
ld hl,wMusicSFXInstPtr1
ld a,e
ld [hl+],a
ld [hl],d
SSFP_Inst1UpdateDone:
;-------------------------------
; channel 2
ld hl,wMusicSFXInstPause2
dec [hl]
jr nz,SSFP_Inst2UpdateDone
IF (SOUNDSYSTEM_ROM_BANKING != 0)
; change the rom bank
ld a,[wMusicSFXInstBank2]
ld [rROMB0],a
IF (SOUNDSYSTEM_LARGE_ROM != 0)
ld a,[wMusicSFXInstBank2+1]
ld [rROMB1],a
ENDC
ENDC
ld hl,wMusicSFXInstPtr2
ld a,[hl+]
ld d,[hl]
ld e,a
jp SSFP_Inst2Update
SSFP_Inst2UpdateFrameEnd:
; save back
ld hl,wMusicSFXInstPtr2
ld a,e
ld [hl+],a
ld [hl],d
SSFP_Inst2UpdateDone:
;-------------------------------
; channel 3
ld hl,wMusicSFXInstPause3
dec [hl]
jr nz,SSFP_Inst3UpdateDone
IF (SOUNDSYSTEM_ROM_BANKING != 0)
; change the rom bank
ld a,[wMusicSFXInstBank3]
ld [rROMB0],a
IF (SOUNDSYSTEM_LARGE_ROM != 0)
ld a,[wMusicSFXInstBank3+1]
ld [rROMB1],a
ENDC
ENDC
ld hl,wMusicSFXInstPtr3
ld a,[hl+]
ld d,[hl]
ld e,a
jp SSFP_Inst3Update
SSFP_Inst3UpdateFrameEnd:
; save back
ld hl,wMusicSFXInstPtr3
ld a,e
ld [hl+],a
ld [hl],d
SSFP_Inst3UpdateDone:
;-------------------------------
; channel 4
ld hl,wMusicSFXInstPause4
dec [hl]
jr nz,SSFP_Inst4UpdateDone
IF (SOUNDSYSTEM_ROM_BANKING != 0)
; change the rom bank
ld a,[wMusicSFXInstBank4]
ld [rROMB0],a
IF (SOUNDSYSTEM_LARGE_ROM != 0)
ld a,[wMusicSFXInstBank4+1]
ld [rROMB1],a
ENDC
ENDC
ld hl,wMusicSFXInstPtr4
ld a,[hl+]
ld d,[hl]
ld e,a
jp SSFP_Inst4Update
SSFP_Inst4UpdateFrameEnd:
; save back
ld hl,wMusicSFXInstPtr4
ld a,e
ld [hl+],a
ld [hl],d
SSFP_Inst4UpdateDone:
;-------------------------------
; process music
ld a,[wMusicPlayState]
or a ; is music playing?
ret z ; no, exit early (nothing to do)
;-------------------------------
; update music effects
;-------------------------------
; channel 1
ld a,[wChannelMusicEffect1]
or a ; is channel 1 playing music fx?
jr z,SSFP_MusicFX_Done1 ; no, skip to the next channel
; check if sound effect active (no music fx then)
ld b,a
ld a,[wSoundFXLock]
bit SFXLOCKB_CHANNEL1,a ; is channel 1 playing fx?
jr z,SSFP_MusicFX_Done1 ; no, skip to the next channel
; call the fx handler
ld a,b
ld hl,SSFP_MusicFX_JumpTable1
add a
add l
ld l,a
ld a,[hl+]
ld h,[hl]
ld l,a
jp hl
SSFP_MusicFX_Done1: ; some handlers return here
;-------------------------------
; channel 2
ld a,[wChannelMusicEffect2]
or a ; is channel 2 playing music fx?
jr z,SSFP_MusicFX_Done2 ; no, skip to the next channel
; check if sound effect active (no music fx then)
ld b,a
ld a,[wSoundFXLock]
bit SFXLOCKB_CHANNEL2,a ; is channel 2 playing fx?
jr z,SSFP_MusicFX_Done2 ; no, skip to the next channel
; call the fx handler
ld a,b
ld hl,SSFP_MusicFX_JumpTable2
add a
add l
ld l,a
ld a,[hl+]
ld h,[hl]
ld l,a
jp hl
SSFP_MusicFX_Done2: ; some handlers return here
;-------------------------------
; channel 3
ld a,[wChannelMusicEffect3]
or a ; is channel 3 playing music fx?
jr z,SSFP_MusicFX_Done3 ; no, skip to the next channel
; check if sound effect active (no music fx then)
ld b,a
ld a,[wSoundFXLock]
bit SFXLOCKB_CHANNEL3,a ; is channel 3 playing fx?
jr z,SSFP_MusicFX_Done3 ; no, skip to the next channel
; call the fx handler
ld a,b
ld hl,SSFP_MusicFX_JumpTable3
add a
add l
ld l,a
ld a,[hl+]
ld h,[hl]
ld l,a
jp hl
SSFP_MusicFX_Done3: ; some handlers return here
;-------------------------------
; update music
; determine if music should update this frame
ld a,[wMusicNextFrame]
dec a
ld [wMusicNextFrame],a
ret nz ; no update needed
IF (SOUNDSYSTEM_ROM_BANKING != 0)
; change the rom bank
ld a,[wMusicCommandBank]
ld [rROMB0],a
IF (SOUNDSYSTEM_LARGE_ROM != 0)
ld a,[wMusicCommandBank+1]
ld [rROMB1],a
ENDC
ENDC
; put the music command handler in de
ld hl,wMusicCommandPtr
ld a,[hl+]
ld e,a
ld d,[hl]
;-------------------------------
SSFP_MusicUpdate: ; some handlers return here
ld a,[de]
inc de
ld hl,SSFP_Music_JumpTable
add a
add l
ld l,a
ld a,[hl+]
ld h,[hl]
ld l,a
jp hl
;-------------------------------
SSFP_MusicUpdateFrameEnd: ; some handlers return here
; update the ptr for next time
ld hl,wMusicCommandPtr
ld a,e
ld [hl+],a
ld [hl],d
ret
;***************************************************************************************************************************
;* Music_PrepareInst
;***************************************************************************************************************************
IF (SOUNDSYSTEM_CODE_BANK == 0)
SECTION "SoundSystem_Music_PrepareInst",ROM0
ELSE
SECTION "SoundSystem_Music_PrepareInst",ROMX,BANK[SOUNDSYSTEM_CODE_BANK]
ENDC
Music_PrepareInst::
IF (SOUNDSYSTEM_WRAM_BANK != 0)
ld a,SOUNDSYSTEM_WRAM_BANK
ldh [rSVBK],a
ENDC
ld hl,wMusicInstrumentTable
ld a,e
ld [hl+],a
ld a,d
ld [hl+],a ; hl = wMusicInstrumentBank
IF (SOUNDSYSTEM_ROM_BANKING != 0)
ASSERT wMusicInstrumentBank == wMusicInstrumentTable+2
ld a,c
ld [hl+],a
IF (SOUNDSYSTEM_LARGE_ROM != 0)
ld a,b
ld [hl],a
ENDC
ENDC
ret
;***************************************************************************************************************************
;* Music_Play
;***************************************************************************************************************************
IF (SOUNDSYSTEM_CODE_BANK == 0)
SECTION "SoundSystem_Music_Play",ROM0
ELSE
SECTION "SoundSystem_Music_Play",ROMX,BANK[SOUNDSYSTEM_CODE_BANK]
ENDC
Music_Play::
IF (SOUNDSYSTEM_ROM_BANKING != 0)
push bc
ENDC
call Music_Pause
IF (SOUNDSYSTEM_ROM_BANKING != 0)
pop bc
ENDC
IF (SOUNDSYSTEM_WRAM_BANK != 0)
ld a,SOUNDSYSTEM_WRAM_BANK
ldh [rSVBK],a
ENDC
IF (SOUNDSYSTEM_ROM_BANKING != 0)
; change to the rom bank containting the order list
ld a,c
ld [wMusicOrderBank],a
ld [rROMB0],a
IF (SOUNDSYSTEM_LARGE_ROM != 0)
ld a,b
ld [wMusicOrderBank+1],a
ld [rROMB1],a
ENDC
ENDC
; set to advance on next frame
ld a,1
ld [wMusicNextFrame],a
; clear misc variables
xor a
ld [wMusicSyncData],a
; clear effects
ld hl,wChannelMusicEffect1
ld [hl+],a
ld [hl+],a
ld [hl+],a
ld [hl],a
; set command pointer to value of first order
ld h,d
ld l,e
ld a,[hl+]
ld [wMusicCommandPtr],a
ld a,[hl+]
ld [wMusicCommandPtr+1],a
IF (SOUNDSYSTEM_ROM_BANKING != 0)
ld a,[hl+]
ld [wMusicCommandBank],a
IF (SOUNDSYSTEM_LARGE_ROM != 0)
ld a,[hl]
ld [wMusicCommandBank+1],a
ENDC
ENDC
; set order pointer to next order
ld a,e
add 4
ld [wMusicOrderPtr],a
ld a,d
adc 0
ld [wMusicOrderPtr+1],a
; turn on the music
ld a,MUSIC_STATE_PLAYING
ld [wMusicPlayState],a
ret
;***************************************************************************************************************************
;* Music_Pause
;***************************************************************************************************************************
IF (SOUNDSYSTEM_CODE_BANK == 0)
SECTION "SoundSystem_Music_Pause",ROM0
ELSE
SECTION "SoundSystem_Music_Pause",ROMX,BANK[SOUNDSYSTEM_CODE_BANK]
ENDC
Music_Pause::
IF (SOUNDSYSTEM_WRAM_BANK != 0)
ld a,SOUNDSYSTEM_WRAM_BANK
ldh [rSVBK],a
ENDC
; stop playing
xor a
ld [wMusicPlayState],a
; turn off channels used by music
ld a,[wSoundFXLock]
ld b,a
ld c,AUDHIGH_RESTART
;-------------------------------
; channel 1
bit SFXLOCKB_CHANNEL1,b ; is channel 1 playing music?
jr z,.nomusic1 ; no, skip to the next channel
; clear the channel 1 registers
xor a
ldh [rAUD1ENV],a
ld a,c
ldh [rAUD1HIGH],a
; set the stop command
ld hl,wMusicSFXInstPtr1
ld [hl],LOW(Music_InstrumentEnd)
inc l
ld [hl],HIGH(Music_InstrumentEnd)
.nomusic1:
;-------------------------------
; channel 2
bit SFXLOCKB_CHANNEL2,b ; is channel 2 playing music?
jr z,.nomusic2 ; no, skip to the next channel
; clear the channel 2 registers
xor a
ldh [rAUD2ENV],a
ld a,c
ldh [rAUD2HIGH],a
; set the stop command
ld hl,wMusicSFXInstPtr2
ld [hl],LOW(Music_InstrumentEnd)
inc l
ld [hl],HIGH(Music_InstrumentEnd)
.nomusic2:
;-------------------------------
; channel 3
bit SFXLOCKB_CHANNEL3,b ; is channel 3 playing music?
jr z,.nomusic3 ; no, skip to the next channel
; clear the channel 3 registers
xor a
ldh [rAUD3ENA],a
; set the stop command
ld hl,wMusicSFXInstPtr3
ld [hl],LOW(Music_InstrumentEnd)
inc l
ld [hl],HIGH(Music_InstrumentEnd)
.nomusic3:
;-------------------------------
; channel 4
bit SFXLOCKB_CHANNEL4,b ; is channel 4 playing music?
ret z ; no, exit
; clear the channel 4 registers
xor a
ldh [rAUD4ENV],a
ld a,c
ldh [rAUD4GO],a
; set the stop command
ld hl,wMusicSFXInstPtr4
ld [hl],LOW(Music_InstrumentEnd)
inc l
ld [hl],HIGH(Music_InstrumentEnd)
ret
;***************************************************************************************************************************
;* Music_Resume
;***************************************************************************************************************************
IF (SOUNDSYSTEM_CODE_BANK == 0)
SECTION "SoundSystem_Music_Resume",ROM0
ELSE
SECTION "SoundSystem_Music_Resume",ROMX,BANK[SOUNDSYSTEM_CODE_BANK]
ENDC
Music_Resume::
IF (SOUNDSYSTEM_WRAM_BANK != 0)
ld a,SOUNDSYSTEM_WRAM_BANK
ldh [rSVBK],a
ENDC
ld a,MUSIC_STATE_PLAYING
ld [wMusicPlayState],a
ret
;***************************************************************************************************************************
;* SFX_Prepare
;***************************************************************************************************************************
IF (SOUNDSYSTEM_ENABLE_SFX)
IF (SOUNDSYSTEM_CODE_BANK == 0)
SECTION "SoundSystem_SFX_Prepare",ROM0
ELSE
SECTION "SoundSystem_SFX_Prepare",ROMX,BANK[SOUNDSYSTEM_CODE_BANK]
ENDC
SFX_Prepare::
IF (SOUNDSYSTEM_WRAM_BANK != 0)
ld a,SOUNDSYSTEM_WRAM_BANK
ldh [rSVBK],a
ENDC
ld hl,wSoundFXTable
ld a,e
ld [hl+],a
ld a,d
ld [hl+],a ; hl = wSoundFXBank here
IF (SOUNDSYSTEM_ROM_BANKING != 0)
ASSERT wSoundFXBank == wSoundFXTable+2
ld a,c
ld [hl+],a
IF (SOUNDSYSTEM_LARGE_ROM != 0)
ld a,b
ld [hl],a
ENDC
ENDC
ret
ENDC
;***************************************************************************************************************************
;* SFX_Play
;***************************************************************************************************************************
IF (SOUNDSYSTEM_ENABLE_SFX)
IF (SOUNDSYSTEM_CODE_BANK == 0)
SECTION "SoundSystem_SFX_Play",ROM0
ELSE
SECTION "SoundSystem_SFX_Play",ROMX,BANK[SOUNDSYSTEM_CODE_BANK]
ENDC
SFX_Play::
IF (SOUNDSYSTEM_WRAM_BANK != 0)
ld a,SOUNDSYSTEM_WRAM_BANK
ldh [rSVBK],a
ENDC
; find an open channel, else put it on channel 4
ld hl,wSoundFXStart
ld d,4
.loop:
ld a,[hl]
xor $FF ; is this channel open?
jr z,.found ; yes, store the sfx data
inc hl
dec d
jr nz,.loop
.found:
ld a,b
ld [hl],a
ld a,c
ld [wSoundFXNote],a
ret
ENDC
;***************************************************************************************************************************
;* SFX_Stop
;***************************************************************************************************************************
IF (SOUNDSYSTEM_ENABLE_SFX)
IF (SOUNDSYSTEM_CODE_BANK == 0)
SECTION "SoundSystem_SFX_Stop",ROM0
ELSE
SECTION "SoundSystem_SFX_Stop",ROMX,BANK[SOUNDSYSTEM_CODE_BANK]
ENDC
SFX_Stop::
IF (SOUNDSYSTEM_WRAM_BANK != 0)
ld a,SOUNDSYSTEM_WRAM_BANK
ldh [rSVBK],a
ENDC
; turn off channels used by sfx
ld a,[wSoundFXLock]
ld b,a
ld c,AUDHIGH_RESTART
; channel 1
bit SFXLOCKB_CHANNEL1,b ; is channel 1 playing sfx?
jr nz,.nosfx1 ; no, skip to the next channel
xor a
ld [rAUD1ENV],a
ld a,c
ld [rAUD1HIGH],a
ld hl,wMusicSFXInstPtr1
ld [hl],LOW(Music_InstrumentEnd)
inc l
ld [hl],HIGH(Music_InstrumentEnd)
.nosfx1:
; channel 2
bit SFXLOCKB_CHANNEL2,b ; is channel 2 playing sfx?
jr nz,.nosfx2 ; no, skip to the next channel
xor a
ld [rAUD2ENV],a
ld a,c
ld [rAUD2HIGH],a
ld hl,wMusicSFXInstPtr2
ld [hl],LOW(Music_InstrumentEnd)
inc l
ld [hl],HIGH(Music_InstrumentEnd)
.nosfx2:
; channel 3
bit SFXLOCKB_CHANNEL3,b ; is channel 3 playing sfx?
jr nz,.nosfx3 ; no, skip to the next channel
ld a,[wMusicSFXInstChnl3Lock]
or a
jr nz,.nosfx3
ld [rAUD3ENA],a ; a = 0 here
ld hl,wMusicSFXInstPtr3
ld [hl],LOW(Music_InstrumentEnd)
inc l
ld [hl],HIGH(Music_InstrumentEnd)
.nosfx3:
; channel 4
bit SFXLOCKB_CHANNEL4,b ; is channel 4 playing sfx?
ret nz ; no, exit
xor a
ld [rAUD4ENV],a
ld a,c
ld [rAUD4GO],a
ld hl,wMusicSFXInstPtr4
ld [hl],LOW(Music_InstrumentEnd)
inc l
ld [hl],HIGH(Music_InstrumentEnd)
ret
ENDC
;***************************************************************************************************************************
;* SFX_LockChannel3
;***************************************************************************************************************************
IF (SOUNDSYSTEM_ENABLE_SFX)
IF (SOUNDSYSTEM_CODE_BANK == 0)
SECTION "SoundSystem_SFX_LockChannel3",ROM0
ELSE
SECTION "SoundSystem_SFX_LockChannel3",ROMX,BANK[SOUNDSYSTEM_CODE_BANK]
ENDC
SFX_LockChannel3::
IF (SOUNDSYSTEM_WRAM_BANK != 0)
ld a,SOUNDSYSTEM_WRAM_BANK
ldh [rSVBK],a
ENDC
ld a,1
ld [wMusicSFXInstChnl3Lock],a
ld a,[wSoundFXLock]
and ~(SFXLOCKF_3_LEFT|SFXLOCKF_3_RIGHT)
ld [wSoundFXLock],a
ld hl,wMusicSFXInstPtr1
ld a,LOW(Music_InstrumentEnd)
ld [hl+],a
ld a,HIGH(Music_InstrumentEnd)
ld [hl],a
ret
ENDC
;***************************************************************************************************************************
;* SFX_UnlockChannel3
;***************************************************************************************************************************
IF (SOUNDSYSTEM_ENABLE_SFX)
IF (SOUNDSYSTEM_CODE_BANK == 0)
SECTION "SoundSystem_SFX_UnlockChannel3",ROM0
ELSE
SECTION "SoundSystem_SFX_UnlockChannel3",ROMX,BANK[SOUNDSYSTEM_CODE_BANK]
ENDC
SFX_UnlockChannel3::
IF (SOUNDSYSTEM_WRAM_BANK != 0)
ld a,SOUNDSYSTEM_WRAM_BANK
ldh [rSVBK],a
ENDC
xor a
ld [wMusicSFXInstChnl3Lock],a
ld a,[wSoundFXLock]
or SFXLOCKF_3_LEFT|SFXLOCKF_3_RIGHT
ld [wSoundFXLock],a
ret
ENDC
;***************************************************************************************************************************
;* music fx handlers
;***************************************************************************************************************************
; channel 1
IF (SOUNDSYSTEM_CODE_BANK == 0)
SECTION "SoundSystem_SSFP_MUSIC_FX1_VIB1",ROM0
ELSE
SECTION "SoundSystem_SSFP_MUSIC_FX1_VIB1",ROMX,BANK[SOUNDSYSTEM_CODE_BANK]
ENDC
SSFP_MUSIC_FX1_VIB1:
ld hl,wChannelFreq1
ld a,[hl]
add 1 ; can't use inc a here because of the adc
ld [hl+],a
ldh [rAUD1LOW],a
ld a,[hl]
adc 0
and $07
ld [hl],a
ldh [rAUD1HIGH],a
ld hl,wChannelMusicFXParamA1+1
dec [hl]
dec hl
jp nz,SSFP_MusicFX_Done1
ld a,[hl+]
ld [hl],a
; store the fx id
ld a,MUSIC_FX_VIB2
ld [wChannelMusicEffect1],a
jp SSFP_MusicFX_Done1
; --------------------------------------------------------------------------------------------------------------------------
IF (SOUNDSYSTEM_CODE_BANK == 0)
SECTION "SoundSystem_SSFP_MUSIC_FX1_VIB2",ROM0
ELSE
SECTION "SoundSystem_SSFP_MUSIC_FX1_VIB2",ROMX,BANK[SOUNDSYSTEM_CODE_BANK]
ENDC
SSFP_MUSIC_FX1_VIB2:
ld hl,wChannelFreq1
ld a,[hl]
add $FF ; can't use dec a here because of the adc
ld [hl+],a
ldh [rAUD1LOW],a
ld a,[hl]
adc $FF
and $07
ld [hl],a
ldh [rAUD1HIGH],a
ld hl,wChannelMusicFXParamA1+1
dec [hl]
dec hl
jp nz,SSFP_MusicFX_Done1
ld a,[hl+]
ld [hl],a
; store the fx id
ld a,MUSIC_FX_VIB1
ld [wChannelMusicEffect1],a
jp SSFP_MusicFX_Done1
; --------------------------------------------------------------------------------------------------------------------------
IF (SOUNDSYSTEM_CODE_BANK == 0)
SECTION "SoundSystem_SSFP_MUSIC_FX1_TF1",ROM0
ELSE
SECTION "SoundSystem_SSFP_MUSIC_FX1_TF1",ROMX,BANK[SOUNDSYSTEM_CODE_BANK]
ENDC
SSFP_MUSIC_FX1_TF1:
ld hl,FrequencyTable
ASSERT LOW(FrequencyTable) == 0
ld a,[wChannelMusicNote1]
ld c,a
ld a,[wChannelMusicFXParamA1]
add c
cp NUM_NOTES
jr c,.noteok
ld a,NUM_NOTES-1
.noteok:
add a
ld l,a
ld a,[hl+]
ldh [rAUD1LOW],a
ld a,[hl]
ldh [rAUD1HIGH],a
; store the fx id
ld a,MUSIC_FX_TRIPLEFREQ2
ld [wChannelMusicEffect1],a
jp SSFP_MusicFX_Done1
; --------------------------------------------------------------------------------------------------------------------------
IF (SOUNDSYSTEM_CODE_BANK == 0)
SECTION "SoundSystem_SSFP_MUSIC_FX1_TF2",ROM0
ELSE
SECTION "SoundSystem_SSFP_MUSIC_FX1_TF2",ROMX,BANK[SOUNDSYSTEM_CODE_BANK]
ENDC
SSFP_MUSIC_FX1_TF2:
ld hl,FrequencyTable
ASSERT LOW(FrequencyTable) == 0
ld a,[wChannelMusicNote1]
ld c,a
ld a,[wChannelMusicFXParamA1+1]
add c
cp NUM_NOTES
jr c,.noteok
ld a,NUM_NOTES-1
.noteok:
add a
ld l,a
ld a,[hl+]
ldh [rAUD1LOW],a
ld a,[hl]
ldh [rAUD1HIGH],a
; store the fx id
ld a,MUSIC_FX_TRIPLEFREQ3
ld [wChannelMusicEffect1],a
jp SSFP_MusicFX_Done1
; --------------------------------------------------------------------------------------------------------------------------
IF (SOUNDSYSTEM_CODE_BANK == 0)
SECTION "SoundSystem_SSFP_MUSIC_FX1_TF3",ROM0
ELSE
SECTION "SoundSystem_SSFP_MUSIC_FX1_TF3",ROMX,BANK[SOUNDSYSTEM_CODE_BANK]
ENDC
SSFP_MUSIC_FX1_TF3:
ld hl,FrequencyTable
ASSERT LOW(FrequencyTable) == 0
ld a,[wChannelMusicNote1]
add a
ld l,a
ld a,[hl+]
ldh [rAUD1LOW],a
ld a,[hl]
ldh [rAUD1HIGH],a
; store the fx id
ld a,MUSIC_FX_TRIPLEFREQ1
ld [wChannelMusicEffect1],a
jp SSFP_MusicFX_Done1
; --------------------------------------------------------------------------------------------------------------------------
IF (SOUNDSYSTEM_CODE_BANK == 0)
SECTION "SoundSystem_SSFP_MUSIC_FX1_PITCHUP",ROM0
ELSE
SECTION "SoundSystem_SSFP_MUSIC_FX1_PITCHUP",ROMX,BANK[SOUNDSYSTEM_CODE_BANK]
ENDC
SSFP_MUSIC_FX1_PITCHUP:
ld hl,wChannelMusicFXParamA1
ld a,[hl]
dec a
ld [hl+],a
jp nz,SSFP_MusicFX_Done1
ld a,[hl-]
ld [hl],a
ld hl,wChannelMusicFXParamB1
ld b,[hl]
ld hl,wChannelFreq1
ld a,[hl]
add b
ld [hl+],a
ldh [rAUD1LOW],a
ld a,[hl]
adc 0
and $07
ld [hl],a
ldh [rAUD1HIGH],a
jp SSFP_MusicFX_Done1
; --------------------------------------------------------------------------------------------------------------------------
IF (SOUNDSYSTEM_CODE_BANK == 0)
SECTION "SoundSystem_SSFP_MUSIC_FX1_PITCHDOWN",ROM0
ELSE
SECTION "SoundSystem_SSFP_MUSIC_FX1_PITCHDOWN",ROMX,BANK[SOUNDSYSTEM_CODE_BANK]
ENDC
SSFP_MUSIC_FX1_PITCHDOWN:
ld hl,wChannelMusicFXParamA1
ld a,[hl]
dec a
ld [hl+],a
jp nz,SSFP_MusicFX_Done1
ld a,[hl-]
ld [hl],a
ld hl,wChannelMusicFXParamB1
ld b,[hl]
ld hl,wChannelFreq1
ld a,[hl]
sub b
ld [hl+],a
ldh [rAUD1LOW],a
ld a,[hl]
sbc 0
and $07
ld [hl],a
ldh [rAUD1HIGH],a
jp SSFP_MusicFX_Done1
; ==========================================================================================================================
; channel 2
IF (SOUNDSYSTEM_CODE_BANK == 0)
SECTION "SoundSystem_SSFP_MUSIC_FX2_VIB1",ROM0
ELSE
SECTION "SoundSystem_SSFP_MUSIC_FX2_VIB1",ROMX,BANK[SOUNDSYSTEM_CODE_BANK]
ENDC
SSFP_MUSIC_FX2_VIB1:
ld hl,wChannelFreq2
ld a,[hl]
add 1 ; can't use inc a here because of the adc
ld [hl+],a
ldh [rAUD2LOW],a
ld a,[hl]
adc 0
and $07
ld [hl],a
ldh [rAUD2HIGH],a
ld hl,wChannelMusicFXParamA2+1
dec [hl]
dec hl
jp nz,SSFP_MusicFX_Done2
ld a,[hl+]
ld [hl],a
; store the fx id
ld a,MUSIC_FX_VIB2
ld [wChannelMusicEffect2],a
jp SSFP_MusicFX_Done2
; --------------------------------------------------------------------------------------------------------------------------
IF (SOUNDSYSTEM_CODE_BANK == 0)
SECTION "SoundSystem_SSFP_MUSIC_FX2_VIB2",ROM0
ELSE
SECTION "SoundSystem_SSFP_MUSIC_FX2_VIB2",ROMX,BANK[SOUNDSYSTEM_CODE_BANK]
ENDC
SSFP_MUSIC_FX2_VIB2:
ld hl,wChannelFreq2
ld a,[hl]
add $FF ; can't use dec a here because of the adc
ld [hl+],a
ldh [rAUD2LOW],a
ld a,[hl]
adc $FF
and $07
ld [hl],a
ldh [rAUD2HIGH],a
ld hl,wChannelMusicFXParamA2+1
dec [hl]
dec hl
jp nz,SSFP_MusicFX_Done2
ld a,[hl+]
ld [hl],a
; store the fx id
ld a,MUSIC_FX_VIB1
ld [wChannelMusicEffect2],a
jp SSFP_MusicFX_Done2
; --------------------------------------------------------------------------------------------------------------------------
IF (SOUNDSYSTEM_CODE_BANK == 0)
SECTION "SoundSystem_SSFP_MUSIC_FX2_TF1",ROM0
ELSE
SECTION "SoundSystem_SSFP_MUSIC_FX2_TF1",ROMX,BANK[SOUNDSYSTEM_CODE_BANK]
ENDC
SSFP_MUSIC_FX2_TF1:
ld hl,FrequencyTable
ASSERT LOW(FrequencyTable) == 0
ld a,[wChannelMusicNote2]
ld c,a
ld a,[wChannelMusicFXParamA2]
add c
cp NUM_NOTES
jr c,.noteok
ld a,NUM_NOTES-1
.noteok:
add a
ld l,a
ld a,[hl+]
ldh [rAUD2LOW],a
ld a,[hl]
ldh [rAUD2HIGH],a
; store the fx id
ld a,MUSIC_FX_TRIPLEFREQ2
ld [wChannelMusicEffect2],a
jp SSFP_MusicFX_Done2
; --------------------------------------------------------------------------------------------------------------------------
IF (SOUNDSYSTEM_CODE_BANK == 0)
SECTION "SoundSystem_SSFP_MUSIC_FX2_TF2",ROM0
ELSE
SECTION "SoundSystem_SSFP_MUSIC_FX2_TF2",ROMX,BANK[SOUNDSYSTEM_CODE_BANK]
ENDC
SSFP_MUSIC_FX2_TF2:
ld hl,FrequencyTable
ASSERT LOW(FrequencyTable) == 0
ld a,[wChannelMusicNote2]
ld c,a
ld a,[wChannelMusicFXParamA2+1]
add c
cp NUM_NOTES
jr c,.noteok
ld a,NUM_NOTES-1
.noteok:
add a
ld l,a
ld a,[hl+]
ldh [rAUD2LOW],a
ld a,[hl]
ldh [rAUD2HIGH],a
; store the fx id
ld a,MUSIC_FX_TRIPLEFREQ3
ld [wChannelMusicEffect2],a
jp SSFP_MusicFX_Done2
; --------------------------------------------------------------------------------------------------------------------------
IF (SOUNDSYSTEM_CODE_BANK == 0)
SECTION "SoundSystem_SSFP_MUSIC_FX2_TF3",ROM0
ELSE
SECTION "SoundSystem_SSFP_MUSIC_FX2_TF3",ROMX,BANK[SOUNDSYSTEM_CODE_BANK]
ENDC
SSFP_MUSIC_FX2_TF3:
ld hl,FrequencyTable
ASSERT LOW(FrequencyTable) == 0
ld a,[wChannelMusicNote2]
add a
ld l,a
ld a,[hl+]
ldh [rAUD2LOW],a
ld a,[hl]
ldh [rAUD2HIGH],a
; store the fx id
ld a,MUSIC_FX_TRIPLEFREQ1
ld [wChannelMusicEffect2],a
jp SSFP_MusicFX_Done2
; --------------------------------------------------------------------------------------------------------------------------
IF (SOUNDSYSTEM_CODE_BANK == 0)
SECTION "SoundSystem_SSFP_MUSIC_FX2_PITCHUP",ROM0
ELSE
SECTION "SoundSystem_SSFP_MUSIC_FX2_PITCHUP",ROMX,BANK[SOUNDSYSTEM_CODE_BANK]
ENDC
SSFP_MUSIC_FX2_PITCHUP:
ld hl,wChannelMusicFXParamA2
ld a,[hl]
dec a
ld [hl+],a
jp nz,SSFP_MusicFX_Done2
ld a,[hl-]
ld [hl],a
ld hl,wChannelMusicFXParamB2
ld b,[hl]
ld hl,wChannelFreq2
ld a,[hl]
add b
ld [hl+],a
ldh [rAUD2LOW],a
ld a,[hl]
adc 0
and $07
ld [hl],a
ldh [rAUD2HIGH],a
jp SSFP_MusicFX_Done2
; --------------------------------------------------------------------------------------------------------------------------
IF (SOUNDSYSTEM_CODE_BANK == 0)
SECTION "SoundSystem_SSFP_MUSIC_FX2_PITCHDOWN",ROM0
ELSE
SECTION "SoundSystem_SSFP_MUSIC_FX2_PITCHDOWN",ROMX,BANK[SOUNDSYSTEM_CODE_BANK]
ENDC
SSFP_MUSIC_FX2_PITCHDOWN:
ld hl,wChannelMusicFXParamA2
ld a,[hl]
dec a
ld [hl+],a
jp nz,SSFP_MusicFX_Done2
ld a,[hl-]
ld [hl],a
ld hl,wChannelMusicFXParamB2
ld b,[hl]
ld hl,wChannelFreq2
ld a,[hl]
sub b
ld [hl+],a
ldh [rAUD2LOW],a
ld a,[hl]
sbc 0
and $07
ld [hl],a
ldh [rAUD2HIGH],a
jp SSFP_MusicFX_Done2
; ==========================================================================================================================
; channel 3
IF (SOUNDSYSTEM_CODE_BANK == 0)
SECTION "SoundSystem_SSFP_MUSIC_FX3_VIB1",ROM0
ELSE
SECTION "SoundSystem_SSFP_MUSIC_FX3_VIB1",ROMX,BANK[SOUNDSYSTEM_CODE_BANK]
ENDC
SSFP_MUSIC_FX3_VIB1:
ld hl,wChannelFreq3
ld a,[hl]
add 1 ; can't use inc a here because of the adc
ld [hl+],a
ldh [rAUD3LOW],a
ld a,[hl]
adc 0
and $07
ld [hl],a
ldh [rAUD3HIGH],a
ld hl,wChannelMusicFXParamA3+1
dec [hl]
dec hl
jp nz,SSFP_MusicFX_Done3
ld a,[hl+]
ld [hl],a
; store the fx id
ld a,MUSIC_FX_VIB2
ld [wChannelMusicEffect3],a
jp SSFP_MusicFX_Done3
; --------------------------------------------------------------------------------------------------------------------------
IF (SOUNDSYSTEM_CODE_BANK == 0)
SECTION "SoundSystem_SSFP_MUSIC_FX3_VIB2",ROM0
ELSE
SECTION "SoundSystem_SSFP_MUSIC_FX3_VIB2",ROMX,BANK[SOUNDSYSTEM_CODE_BANK]
ENDC
SSFP_MUSIC_FX3_VIB2:
ld hl,wChannelFreq3
ld a,[hl]
add $FF ; can't use dec a here because of the adc
ld [hl+],a
ldh [rAUD3LOW],a
ld a,[hl]
adc $FF
and $07
ld [hl],a
ldh [rAUD3HIGH],a
ld hl,wChannelMusicFXParamA3+1
dec [hl]
dec hl
jp nz,SSFP_MusicFX_Done3
ld a,[hl+]
ld [hl],a
; store the fx id
ld a,MUSIC_FX_VIB1
ld [wChannelMusicEffect3],a
jp SSFP_MusicFX_Done3
; --------------------------------------------------------------------------------------------------------------------------
IF (SOUNDSYSTEM_CODE_BANK == 0)
SECTION "SoundSystem_SSFP_MUSIC_FX3_TF1",ROM0
ELSE
SECTION "SoundSystem_SSFP_MUSIC_FX3_TF1",ROMX,BANK[SOUNDSYSTEM_CODE_BANK]
ENDC
SSFP_MUSIC_FX3_TF1:
ld hl,FrequencyTable
ASSERT LOW(FrequencyTable) == 0
ld a,[wChannelMusicNote3]
ld c,a
ld a,[wChannelMusicFXParamA3]
add c
cp NUM_NOTES
jr c,.noteok
ld a,NUM_NOTES-1
.noteok:
add a
ld l,a
ld a,[hl+]
ldh [rAUD3LOW],a
ld a,[hl]
ldh [rAUD3HIGH],a
; store the fx id
ld a,MUSIC_FX_TRIPLEFREQ2
ld [wChannelMusicEffect3],a
jp SSFP_MusicFX_Done3
; --------------------------------------------------------------------------------------------------------------------------
IF (SOUNDSYSTEM_CODE_BANK == 0)
SECTION "SoundSystem_SSFP_MUSIC_FX3_TF2",ROM0
ELSE
SECTION "SoundSystem_SSFP_MUSIC_FX3_TF2",ROMX,BANK[SOUNDSYSTEM_CODE_BANK]
ENDC
SSFP_MUSIC_FX3_TF2:
ld hl,FrequencyTable
ASSERT LOW(FrequencyTable) == 0
ld a,[wChannelMusicNote3]
ld c,a
ld a,[wChannelMusicFXParamA3+1]
add c
cp NUM_NOTES
jr c,.noteok
ld a,NUM_NOTES-1
.noteok:
add a
ld l,a
ld a,[hl+]
ldh [rAUD3LOW],a
ld a,[hl]
ldh [rAUD3HIGH],a
; store the fx id
ld a,MUSIC_FX_TRIPLEFREQ3
ld [wChannelMusicEffect3],a
jp SSFP_MusicFX_Done3
; --------------------------------------------------------------------------------------------------------------------------
IF (SOUNDSYSTEM_CODE_BANK == 0)
SECTION "SoundSystem_SSFP_MUSIC_FX3_TF3",ROM0
ELSE
SECTION "SoundSystem_SSFP_MUSIC_FX3_TF3",ROMX,BANK[SOUNDSYSTEM_CODE_BANK]
ENDC
SSFP_MUSIC_FX3_TF3:
ld hl,FrequencyTable
ASSERT LOW(FrequencyTable) == 0
ld a,[wChannelMusicNote3]
add a
ld l,a
ld a,[hl+]
ldh [rAUD3LOW],a
ld a,[hl]
ldh [rAUD3HIGH],a
; store the fx id
ld a,MUSIC_FX_TRIPLEFREQ1
ld [wChannelMusicEffect3],a
jp SSFP_MusicFX_Done3
; --------------------------------------------------------------------------------------------------------------------------
IF (SOUNDSYSTEM_CODE_BANK == 0)
SECTION "SoundSystem_SSFP_MUSIC_FX3_PITCHUP",ROM0
ELSE
SECTION "SoundSystem_SSFP_MUSIC_FX3_PITCHUP",ROMX,BANK[SOUNDSYSTEM_CODE_BANK]
ENDC
SSFP_MUSIC_FX3_PITCHUP:
ld hl,wChannelMusicFXParamA3
ld a,[hl]
dec a
ld [hl+],a
jp nz,SSFP_MusicFX_Done3
ld a,[hl-]
ld [hl],a
ld hl,wChannelMusicFXParamB3
ld b,[hl]
ld hl,wChannelFreq3
ld a,[hl]
add b
ld [hl+],a
ldh [rAUD3LOW],a
ld a,[hl]
adc 0
and $07
ld [hl],a
ldh [rAUD3HIGH],a
jp SSFP_MusicFX_Done3
; --------------------------------------------------------------------------------------------------------------------------
IF (SOUNDSYSTEM_CODE_BANK == 0)
SECTION "SoundSystem_SSFP_MUSIC_FX3_PITCHDOWN",ROM0
ELSE
SECTION "SoundSystem_SSFP_MUSIC_FX3_PITCHDOWN",ROMX,BANK[SOUNDSYSTEM_CODE_BANK]
ENDC
SSFP_MUSIC_FX3_PITCHDOWN:
ld hl,wChannelMusicFXParamA3
ld a,[hl]
dec a
ld [hl+],a
jp nz,SSFP_MusicFX_Done3
ld a,[hl-]
ld [hl],a
ld hl,wChannelMusicFXParamB3
ld b,[hl]
ld hl,wChannelFreq3
ld a,[hl]
sub b
ld [hl+],a
ldh [rAUD3LOW],a
ld a,[hl]
sbc 0
and $07
ld [hl],a
ldh [rAUD3HIGH],a
jp SSFP_MusicFX_Done3
;***************************************************************************************************************************
;* music command handlers
;***************************************************************************************************************************
IF (SOUNDSYSTEM_CODE_BANK == 0)
SECTION "SoundSystem_SSFP_MUSIC_CMD_ENDOFFRAME",ROM0
ELSE
SECTION "SoundSystem_SSFP_MUSIC_CMD_ENDOFFRAME",ROMX,BANK[SOUNDSYSTEM_CODE_BANK]
ENDC
SSFP_MUSIC_CMD_ENDOFFRAME:
ld a,[de]
inc de
ld [wMusicNextFrame],a
jp SSFP_MusicUpdateFrameEnd
; --------------------------------------------------------------------------------------------------------------------------
IF (SOUNDSYSTEM_CODE_BANK == 0)
SECTION "SoundSystem_SSFP_MUSIC_CMD_PLAYINST/NOTE",ROM0
ELSE
SECTION "SoundSystem_SSFP_MUSIC_CMD_PLAYINST/NOTE",ROMX,BANK[SOUNDSYSTEM_CODE_BANK]
ENDC
SSFP_MUSIC_CMD_PLAYINSTNOTE:
ld a,[de]
inc de
ld l,a
ld a,[de]
and $03
ld b,HIGH(wChannelMusicNote1)
add LOW(wChannelMusicNote1)
ld c,a
ld a,l
ld [bc],a
ld a,l
add a
ld l,a
ld h,HIGH(FrequencyTable)
ASSERT LOW(FrequencyTable) == 0
ld b,HIGH(wChannelMusicFreq1)
ld a,[de]
and $03
add a
add LOW(wChannelMusicFreq1)
ld c,a
ld a,[hl+]
ld [bc],a
inc c
ld a,[hl]
ld [bc],a ; store note freq
; fall-through
; --------------------------------------------------------------------------------------------------------------------------
SSFP_MUSIC_CMD_PLAYINST:
ld a,[de]
inc de
ld b,a ;save
and $FC
srl a
ld c,a
ld hl,wMusicInstrumentTable
ld a,[hl+]
add c
ld c,a
ld a,[hl]
adc 0
ld h,a
ld l,c
; check for lock
ld a,[wSoundFXLock]
ld c,a
ld a,b ;restore
and $03
jp z,.playchannel1
dec a
jr z,.playchannel2
dec a
jr z,.playchannel3
.playchannel4:
bit SFXLOCKB_CHANNEL4,c
jp z,.channeldone
IF (SOUNDSYSTEM_ROM_BANKING != 0)
; change the rom bank
ld a,[wMusicInstrumentBank]
ld [rROMB0],a
IF (SOUNDSYSTEM_LARGE_ROM != 0)
ld a,[wMusicInstrumentBank+1]
ld [rROMB1],a
ENDC
ENDC
ld a,[hl+]
ld [wMusicSFXInstPtr4],a
ld a,[hl]
ld [wMusicSFXInstPtr4+1],a
ld a,1
ld [wMusicSFXInstPause4],a
IF (SOUNDSYSTEM_ROM_BANKING != 0)
; update the rom bank
ld a,[wMusicInstrumentBank]
ld [wMusicSFXInstBank4],a
IF (SOUNDSYSTEM_LARGE_ROM != 0)
ld a,[wMusicInstrumentBank+1]
ld [wMusicSFXInstBank4+1],a
ENDC
ENDC
ld hl,wChannelMusicFreq4
ld bc,wChannelFreq4
ld a,[hl+]
ld [bc],a
inc c
ld a,[hl]
ld [bc],a
jr .channeldone
.playchannel2:
bit SFXLOCKB_CHANNEL2,c
jr z,.channeldone
IF (SOUNDSYSTEM_ROM_BANKING != 0)
; change the rom bank
ld a,[wMusicInstrumentBank]
ld [rROMB0],a
IF (SOUNDSYSTEM_LARGE_ROM != 0)
ld a,[wMusicInstrumentBank+1]
ld [rROMB1],a
ENDC
ENDC
ld a,[hl+]
ld [wMusicSFXInstPtr2],a
ld a,[hl]
ld [wMusicSFXInstPtr2+1],a
ld a,1
ld [wMusicSFXInstPause2],a
IF (SOUNDSYSTEM_ROM_BANKING != 0)
; update the rom bank
ld a,[wMusicInstrumentBank]
ld [wMusicSFXInstBank2],a
IF (SOUNDSYSTEM_LARGE_ROM != 0)
ld a,[wMusicInstrumentBank+1]
ld [wMusicSFXInstBank2+1],a
ENDC
ENDC
ld hl,wChannelMusicFreq2
ld bc,wChannelFreq2
ld a,[hl+]
ld [bc],a
inc c
ld a,[hl]
ld [bc],a
jr .channeldone
.playchannel3:
bit SFXLOCKB_CHANNEL3,c
jr z,.channeldone
IF (SOUNDSYSTEM_ROM_BANKING != 0)
; change the rom bank
ld a,[wMusicInstrumentBank]
ld [rROMB0],a
IF (SOUNDSYSTEM_LARGE_ROM != 0)
ld a,[wMusicInstrumentBank+1]
ld [rROMB1],a
ENDC
ENDC
ld a,[hl+]
ld [wMusicSFXInstPtr3],a
ld a,[hl]
ld [wMusicSFXInstPtr3+1],a
ld a,1
ld [wMusicSFXInstPause3],a
IF (SOUNDSYSTEM_ROM_BANKING != 0)
; update the rom bank
ld a,[wMusicInstrumentBank]
ld [wMusicSFXInstBank3],a
IF (SOUNDSYSTEM_LARGE_ROM != 0)
ld a,[wMusicInstrumentBank+1]
ld [wMusicSFXInstBank3+1],a
ENDC
ENDC
ld hl,wChannelMusicFreq3
ld bc,wChannelFreq3
ld a,[hl+]
ld [bc],a
inc c
ld a,[hl]
ld [bc],a
jr .channeldone
.playchannel1:
bit SFXLOCKB_CHANNEL1,c
jr z,.channeldone
IF (SOUNDSYSTEM_ROM_BANKING != 0)
; change the rom bank
ld a,[wMusicInstrumentBank]
ld [rROMB0],a
IF (SOUNDSYSTEM_LARGE_ROM != 0)
ld a,[wMusicInstrumentBank+1]
ld [rROMB1],a
ENDC
ENDC
ld a,[hl+]
ld [wMusicSFXInstPtr1],a
ld a,[hl]
ld [wMusicSFXInstPtr1+1],a
ld a,1
ld [wMusicSFXInstPause1],a
IF (SOUNDSYSTEM_ROM_BANKING != 0)
; update the rom bank
ld a,[wMusicInstrumentBank]
ld [wMusicSFXInstBank1],a
IF (SOUNDSYSTEM_LARGE_ROM != 0)
ld a,[wMusicInstrumentBank+1]
ld [wMusicSFXInstBank1+1],a
ENDC
ENDC
ld hl,wChannelMusicFreq1
ld bc,wChannelFreq1
ld a,[hl+]
ld [bc],a
inc c
ld a,[hl]
ld [bc],a
.channeldone:
IF (SOUNDSYSTEM_ROM_BANKING != 0)
; change the rom bank
ld a,[wMusicCommandBank]
ld [rROMB0],a
IF (SOUNDSYSTEM_LARGE_ROM != 0)
ld a,[wMusicCommandBank+1]
ld [rROMB1],a
ENDC
ENDC
jp SSFP_MusicUpdate
; --------------------------------------------------------------------------------------------------------------------------
IF (SOUNDSYSTEM_CODE_BANK == 0)
SECTION "SoundSystem_SSFP_MUSIC_CMD_SETVOLUME",ROM0
ELSE
SECTION "SoundSystem_SSFP_MUSIC_CMD_SETVOLUME",ROMX,BANK[SOUNDSYSTEM_CODE_BANK]
ENDC
SSFP_MUSIC_CMD_SETVOLUME:
ld a,[de]
inc de
ld c,a
and $03
add LOW(wChannelVol1)
ld l,a
ld a,HIGH(wChannelVol1)
adc 0
ld h,a
ld a,c
and $F0
ld [hl],a
jp SSFP_MusicUpdate
; --------------------------------------------------------------------------------------------------------------------------
IF (SOUNDSYSTEM_CODE_BANK == 0)
SECTION "SoundSystem_SSFP_MUSIC_CMD_VIBRATO_ON",ROM0
ELSE
SECTION "SoundSystem_SSFP_MUSIC_CMD_VIBRATO_ON",ROMX,BANK[SOUNDSYSTEM_CODE_BANK]
ENDC
SSFP_MUSIC_CMD_VIBRATO_ON:
ld a,[de]
ld c,a
and $03
add LOW(wChannelMusicEffect1)
ld h,HIGH(wChannelMusicEffect1)
ld l,a
ld [hl],MUSIC_FX_VIB1
sub LOW(wChannelMusicEffect1)
add a
add LOW(wChannelMusicFXParamA1)
ld c,a
ld b,HIGH(wChannelMusicFXParamA1)
ld a,[de]
swap a
and $0F
ld [bc],a ; store max
inc bc
ld l,a
and $01
srl l
or l
ld [bc],a ; store max
inc de
jp SSFP_MusicUpdate
; --------------------------------------------------------------------------------------------------------------------------
IF (SOUNDSYSTEM_CODE_BANK == 0)
SECTION "SoundSystem_SSFP_MUSIC_CMD_EFFECT_OFF",ROM0
ELSE
SECTION "SoundSystem_SSFP_MUSIC_CMD_EFFECT_OFF",ROMX,BANK[SOUNDSYSTEM_CODE_BANK]
ENDC
SSFP_MUSIC_CMD_EFFECT_OFF:
ld a,[de]
inc de
add LOW(wChannelMusicEffect1)
ld h,HIGH(wChannelMusicEffect1)
ld l,a
ld [hl],MUSIC_FX_NONE
jp SSFP_MusicUpdate
; --------------------------------------------------------------------------------------------------------------------------
IF (SOUNDSYSTEM_CODE_BANK == 0)
SECTION "SoundSystem_SSFP_MUSIC_CMD_SYNCFLAG",ROM0
ELSE
SECTION "SoundSystem_SSFP_MUSIC_CMD_SYNCFLAG",ROMX,BANK[SOUNDSYSTEM_CODE_BANK]
ENDC
SSFP_MUSIC_CMD_SYNCFLAG:
ld a,[de]
inc de
ld [wMusicSyncData],a
jp SSFP_MusicUpdate
; --------------------------------------------------------------------------------------------------------------------------
IF (SOUNDSYSTEM_CODE_BANK == 0)
SECTION "SoundSystem_SSFP_MUSIC_CMD_ENDOFPATTERN",ROM0
ELSE
SECTION "SoundSystem_SSFP_MUSIC_CMD_ENDOFPATTERN",ROMX,BANK[SOUNDSYSTEM_CODE_BANK]
ENDC
SSFP_MUSIC_CMD_ENDOFPATTERN:
IF (SOUNDSYSTEM_ROM_BANKING != 0)
; change the rom bank
ld a,[wMusicOrderBank]
ld [rROMB0],a
IF (SOUNDSYSTEM_LARGE_ROM != 0)
ld a,[wMusicOrderBank+1]
ld [rROMB1],a
ENDC
ENDC
ld hl,wMusicOrderPtr
ld a,[hl+]
ld h,[hl]
ld l,a
add 4
ld [wMusicOrderPtr],a
ld a,h
adc 0
ld [wMusicOrderPtr+1],a
ld a,[hl+]
ld e,a
ld a,[hl+]
ld d,a
IF (SOUNDSYSTEM_ROM_BANKING != 0)
; change and update the rom bank
ld a,[hl+]
ld [wMusicCommandBank],a
ld [rROMB0],a
IF (SOUNDSYSTEM_LARGE_ROM != 0)
ld a,[hl]
ld [wMusicCommandBank+1],a
ld [rROMB1],a
ENDC
ENDC
ld a,1
ld [wMusicNextFrame],a
jp SSFP_MusicUpdateFrameEnd
; --------------------------------------------------------------------------------------------------------------------------
IF (SOUNDSYSTEM_CODE_BANK == 0)
SECTION "SoundSystem_SSFP_MUSIC_CMD_GOTOORDER",ROM0
ELSE
SECTION "SoundSystem_SSFP_MUSIC_CMD_GOTOORDER",ROMX,BANK[SOUNDSYSTEM_CODE_BANK]
ENDC
SSFP_MUSIC_CMD_GOTOORDER:
ld a,[wMusicOrderPtr]
ld c,a
ld a,[wMusicOrderPtr+1]
ld b,a
ld a,[de]
inc de
ld l,a
ld a,[de]
inc de
ld h,a
add hl,bc
ld a,h
ld [wMusicOrderPtr+1],a
ld a,l
ld [wMusicOrderPtr],a
jp SSFP_MusicUpdate
; --------------------------------------------------------------------------------------------------------------------------
IF (SOUNDSYSTEM_CODE_BANK == 0)
SECTION "SoundSystem_SSFP_MUSIC_CMD_ENDOFSONG",ROM0
ELSE
SECTION "SoundSystem_SSFP_MUSIC_CMD_ENDOFSONG",ROMX,BANK[SOUNDSYSTEM_CODE_BANK]
ENDC
SSFP_MUSIC_CMD_ENDOFSONG:
xor a
ld [wMusicPlayState],a
dec de
jp SSFP_MusicUpdateFrameEnd
; --------------------------------------------------------------------------------------------------------------------------
IF (SOUNDSYSTEM_CODE_BANK == 0)
SECTION "SoundSystem_SSFP_MUSIC_CMD_SETSPEED",ROM0
ELSE
SECTION "SoundSystem_SSFP_MUSIC_CMD_SETSPEED",ROMX,BANK[SOUNDSYSTEM_CODE_BANK]
ENDC
SSFP_MUSIC_CMD_SETSPEED:
ld a,[de]
inc de
ld [wMusicSpeed],a
jp SSFP_MusicUpdate
; --------------------------------------------------------------------------------------------------------------------------
IF (SOUNDSYSTEM_CODE_BANK == 0)
SECTION "SoundSystem_SSFP_MUSIC_CMD_ENDOFFRAME1X",ROM0
ELSE
SECTION "SoundSystem_SSFP_MUSIC_CMD_ENDOFFRAME1X",ROMX,BANK[SOUNDSYSTEM_CODE_BANK]
ENDC
SSFP_MUSIC_CMD_ENDOFFRAME1X:
ld a,[wMusicSpeed]
ld [wMusicNextFrame],a
jp SSFP_MusicUpdateFrameEnd
; --------------------------------------------------------------------------------------------------------------------------
IF (SOUNDSYSTEM_CODE_BANK == 0)
SECTION "SoundSystem_SSFP_MUSIC_CMD_ENDOFFRAME2X",ROM0
ELSE
SECTION "SoundSystem_SSFP_MUSIC_CMD_ENDOFFRAME2X",ROMX,BANK[SOUNDSYSTEM_CODE_BANK]
ENDC
SSFP_MUSIC_CMD_ENDOFFRAME2X:
ld a,[wMusicSpeed]
add a
ld [wMusicNextFrame],a
jp SSFP_MusicUpdateFrameEnd
; --------------------------------------------------------------------------------------------------------------------------
IF (SOUNDSYSTEM_CODE_BANK == 0)
SECTION "SoundSystem_SSFP_MUSIC_CMD_ENDOFFRAME3X",ROM0
ELSE
SECTION "SoundSystem_SSFP_MUSIC_CMD_ENDOFFRAME3X",ROMX,BANK[SOUNDSYSTEM_CODE_BANK]
ENDC
SSFP_MUSIC_CMD_ENDOFFRAME3X:
ld a,[wMusicSpeed]
ld c,a
add a
add c
ld [wMusicNextFrame],a
jp SSFP_MusicUpdateFrameEnd
; --------------------------------------------------------------------------------------------------------------------------
IF (SOUNDSYSTEM_CODE_BANK == 0)
SECTION "SoundSystem_SSFP_MUSIC_CMD_ENDOFFRAME4X",ROM0
ELSE
SECTION "SoundSystem_SSFP_MUSIC_CMD_ENDOFFRAME4X",ROMX,BANK[SOUNDSYSTEM_CODE_BANK]
ENDC
SSFP_MUSIC_CMD_ENDOFFRAME4X:
ld a,[wMusicSpeed]
add a
add a
ld [wMusicNextFrame],a
jp SSFP_MusicUpdateFrameEnd
; --------------------------------------------------------------------------------------------------------------------------
IF (SOUNDSYSTEM_CODE_BANK == 0)
SECTION "SoundSystem_SSFP_MUSIC_CMD_PITCHUPDOWN_ON",ROM0
ELSE
SECTION "SoundSystem_SSFP_MUSIC_CMD_PITCHUPDOWN_ON",ROMX,BANK[SOUNDSYSTEM_CODE_BANK]
ENDC
SSFP_MUSIC_CMD_PITCHUP_ON:
ld a,[de]
and $03
add LOW(wChannelMusicEffect1)
ld h,HIGH(wChannelMusicEffect1)
ld l,a
ld [hl],MUSIC_FX_PITCHUP
jr SSFP_MUSIC_CMD_PITCHUP_reuse
SSFP_MUSIC_CMD_PITCHDOWN_ON:
ld a,[de]
and $03
add LOW(wChannelMusicEffect1)
ld h,HIGH(wChannelMusicEffect1)
ld l,a
ld [hl],MUSIC_FX_PITCHDOWN
SSFP_MUSIC_CMD_PITCHUP_reuse:
sub LOW(wChannelMusicEffect1)
add a
add LOW(wChannelMusicFXParamA1)
ld c,a
ld b,HIGH(wChannelMusicFXParamA1)
ld a,[de]
swap a
and $0F
ld [bc],a ; store max
inc c
ld [bc],a ; store max
ld a,7
add c
ld c,a
ld a,[de]
srl a
srl a
and $03
inc a
ld [bc],a
inc de
jp SSFP_MusicUpdate
; --------------------------------------------------------------------------------------------------------------------------
IF (SOUNDSYSTEM_CODE_BANK == 0)
SECTION "SoundSystem_SSFP_MUSIC_CMD_TRIPLENOTE_ON",ROM0
ELSE
SECTION "SoundSystem_SSFP_MUSIC_CMD_TRIPLENOTE_ON",ROMX,BANK[SOUNDSYSTEM_CODE_BANK]
ENDC
SSFP_MUSIC_CMD_TRIPLENOTE_ON:
ld a,[de]
inc de
; note
ld l,a
ld b,HIGH(wChannelMusicFXParamA1)
ld a,[de]
and $03
add a
add LOW(wChannelMusicFXParamA1)
ld c,a
ld a,l
swap a
and $0F
ld [bc],a
inc c
ld a,l
and $0F
ld [bc],a ; store note freq
ld a,[de]
inc de
ld c,a
and $03
add LOW(wChannelMusicEffect1)
ld h,HIGH(wChannelMusicEffect1)
ld l,a
ld [hl],MUSIC_FX_TRIPLEFREQ1
jp SSFP_MusicUpdate
; --------------------------------------------------------------------------------------------------------------------------
IF (SOUNDSYSTEM_CODE_BANK == 0)
SECTION "SoundSystem_SSFP_MUSIC_CMD_EXTRA",ROM0
ELSE
SECTION "SoundSystem_SSFP_MUSIC_CMD_EXTRA",ROMX,BANK[SOUNDSYSTEM_CODE_BANK]
ENDC
SSFP_MUSIC_CMD_EXTRA:
ld a,[de]
inc de
ld c,a
and $03
jr z,SSFP_MUSIC_CMD_EXTRA_chnl1
dec a
jr z,SSFP_MUSIC_CMD_EXTRA_chnl2
dec a
jr z,SSFP_MUSIC_CMD_EXTRA_chnl3
; chnl 4
jp SSFP_MusicUpdate
SSFP_MUSIC_CMD_EXTRA_chnl1:
ld a,c
and $FC
ldh [rAUD1LEN],a
jp SSFP_MusicUpdate
SSFP_MUSIC_CMD_EXTRA_chnl2:
ld a,c
and $FC
ldh [rAUD2LEN],a
jp SSFP_MusicUpdate
SSFP_MUSIC_CMD_EXTRA_chnl3:
ld a,[wMusicSFXInstChnl3Lock]
or a
jp nz,SSFP_MusicUpdate
ld a,c
and $FC
ldh [rAUD3LEVEL],a
jp SSFP_MusicUpdate
;***************************************************************************************************************************
;* instrument command handlers
;***************************************************************************************************************************
; channel 1
IF (SOUNDSYSTEM_CODE_BANK == 0)
SECTION "SoundSystem_SSFP_Inst1Update",ROM0
ELSE
SECTION "SoundSystem_SSFP_Inst1Update",ROMX,BANK[SOUNDSYSTEM_CODE_BANK]
ENDC
SSFP_Inst1Update:
ld a,[de]
inc de
ld hl,SSFP_Inst1_JumpTable
add a
add l
ld l,a
ld a,[hl+]
ld h,[hl]
ld l,a
jp hl
; --------------------------------------------------------------------------------------------------------------------------
IF (SOUNDSYSTEM_CODE_BANK == 0)
SECTION "SoundSystem_SSFP_Inst1_CMD_FRAMEEND",ROM0
ELSE
SECTION "SoundSystem_SSFP_Inst1_CMD_FRAMEEND",ROMX,BANK[SOUNDSYSTEM_CODE_BANK]
ENDC
SSFP_Inst1_CMD_FRAMEEND:
ld a,[de]
inc de
ld [wMusicSFXInstPause1],a ; load new pause
jp SSFP_Inst1UpdateFrameEnd
; --------------------------------------------------------------------------------------------------------------------------
IF (SOUNDSYSTEM_CODE_BANK == 0)
SECTION "SoundSystem_SSFP_Inst1_CMD_START",ROM0
ELSE
SECTION "SoundSystem_SSFP_Inst1_CMD_START",ROMX,BANK[SOUNDSYSTEM_CODE_BANK]
ENDC
SSFP_Inst1_CMD_START:
ld a,[wChannelFreq1]
ldh [rAUD1LOW],a
ld a,[de]
inc de
ld hl,wChannelFreq1+1
or [hl]
ldh [rAUD1HIGH],a
jp SSFP_Inst1Update
; --------------------------------------------------------------------------------------------------------------------------
IF (SOUNDSYSTEM_CODE_BANK == 0)
SECTION "SoundSystem_SSFP_Inst1_CMD_END",ROM0
ELSE
SECTION "SoundSystem_SSFP_Inst1_CMD_END",ROMX,BANK[SOUNDSYSTEM_CODE_BANK]
ENDC
SSFP_Inst1_CMD_END:
dec de ; rewind counter
ld a,[wSoundFXLock]
bit SFXLOCKB_CHANNEL1,a
jp nz,SSFP_Inst1UpdateFrameEnd
or SFXLOCKF_1_LEFT|SFXLOCKF_1_RIGHT
ld [wSoundFXLock],a
; restore music freq
ld hl,wChannelMusicFreq1
ld bc,wChannelFreq1
ld a,[hl+]
ld [bc],a
inc c
ld a,[hl]
ld [bc],a
jp SSFP_Inst1UpdateFrameEnd ; do nothing else (counter loaded with 0 (256) frame wait)
; --------------------------------------------------------------------------------------------------------------------------
IF (SOUNDSYSTEM_CODE_BANK == 0)
SECTION "SoundSystem_SSFP_Inst1_CMD_ENVELOPE",ROM0
ELSE
SECTION "SoundSystem_SSFP_Inst1_CMD_ENVELOPE",ROMX,BANK[SOUNDSYSTEM_CODE_BANK]
ENDC
SSFP_Inst1_CMD_ENVELOPE:
ld a,[de]
inc de
ld hl,wChannelVol1
or [hl]
ldh [rAUD1ENV],a
IF (SOUNDSYSTEM_ENABLE_VUM)
swap a
and $0F
ld [wVUMeter1],a
ENDC
jp SSFP_Inst1Update
; --------------------------------------------------------------------------------------------------------------------------
IF (SOUNDSYSTEM_CODE_BANK == 0)
SECTION "SoundSystem_SSFP_Inst1_CMD_STARTFREQ",ROM0
ELSE
SECTION "SoundSystem_SSFP_Inst1_CMD_STARTFREQ",ROMX,BANK[SOUNDSYSTEM_CODE_BANK]
ENDC
SSFP_Inst1_CMD_STARTFREQ:
ld a,[de]
inc de
ldh [rAUD1LOW],a
ld a,[de]
inc de
ldh [rAUD1HIGH],a
jp SSFP_Inst1Update
; --------------------------------------------------------------------------------------------------------------------------
IF (SOUNDSYSTEM_CODE_BANK == 0)
SECTION "SoundSystem_SSFP_Inst1_CMD_ENVELOPEVOL",ROM0
ELSE
SECTION "SoundSystem_SSFP_Inst1_CMD_ENVELOPEVOL",ROMX,BANK[SOUNDSYSTEM_CODE_BANK]
ENDC
SSFP_Inst1_CMD_ENVELOPEVOL:
ld a,[de]
inc de
ldh [rAUD1ENV],a
IF (SOUNDSYSTEM_ENABLE_VUM)
swap a
and $0F
ld [wVUMeter1],a
ENDC
jp SSFP_Inst1Update
; --------------------------------------------------------------------------------------------------------------------------
IF (SOUNDSYSTEM_CODE_BANK == 0)
SECTION "SoundSystem_SSFP_Inst1_CMD_STARTENVVOLFREQ",ROM0
ELSE
SECTION "SoundSystem_SSFP_Inst1_CMD_STARTENVVOLFREQ",ROMX,BANK[SOUNDSYSTEM_CODE_BANK]
ENDC
SSFP_Inst1_CMD_STARTENVVOLFREQ:
ld a,[de]
inc de
ldh [rAUD1ENV],a
IF (SOUNDSYSTEM_ENABLE_VUM)
swap a
and $0F
ld [wVUMeter1],a
ENDC
ld a,[de]
inc de
ldh [rAUD1LOW],a
ld a,[de]
inc de
ldh [rAUD1HIGH],a
jp SSFP_Inst1Update
; --------------------------------------------------------------------------------------------------------------------------
IF (SOUNDSYSTEM_CODE_BANK == 0)
SECTION "SoundSystem_SSFP_Inst1_CMD_PANMID",ROM0
ELSE
SECTION "SoundSystem_SSFP_Inst1_CMD_PANMID",ROMX,BANK[SOUNDSYSTEM_CODE_BANK]
ENDC
SSFP_Inst1_CMD_PANMID:
ld hl,wMusicSFXPanning
ld a,AUDTERM_1_LEFT|AUDTERM_1_RIGHT
or [hl]
ld [hl],a
ldh [rAUDTERM],a
jp SSFP_Inst1Update
; --------------------------------------------------------------------------------------------------------------------------
IF (SOUNDSYSTEM_CODE_BANK == 0)
SECTION "SoundSystem_SSFP_Inst1_CMD_PANRIGHT",ROM0
ELSE
SECTION "SoundSystem_SSFP_Inst1_CMD_PANRIGHT",ROMX,BANK[SOUNDSYSTEM_CODE_BANK]
ENDC
SSFP_Inst1_CMD_PANRIGHT:
ld hl,wMusicSFXPanning
ld a,AUDTERM_1_RIGHT
or [hl]
and ~AUDTERM_1_LEFT
ld [hl],a
ldh [rAUDTERM],a
jp SSFP_Inst1Update
; --------------------------------------------------------------------------------------------------------------------------
IF (SOUNDSYSTEM_CODE_BANK == 0)
SECTION "SoundSystem_SSFP_Inst1_CMD_PANLEFT",ROM0
ELSE
SECTION "SoundSystem_SSFP_Inst1_CMD_PANLEFT",ROMX,BANK[SOUNDSYSTEM_CODE_BANK]
ENDC
SSFP_Inst1_CMD_PANLEFT:
ld hl,wMusicSFXPanning
ld a,AUDTERM_1_LEFT
or [hl]
and ~AUDTERM_1_RIGHT
ld [hl],a
ldh [rAUDTERM],a
jp SSFP_Inst1Update
; --------------------------------------------------------------------------------------------------------------------------
IF (SOUNDSYSTEM_CODE_BANK == 0)
SECTION "SoundSystem_SSFP_Inst1_CMD_PULSELEN",ROM0
ELSE
SECTION "SoundSystem_SSFP_Inst1_CMD_PULSELEN",ROMX,BANK[SOUNDSYSTEM_CODE_BANK]
ENDC
SSFP_Inst1_CMD_PULSELEN:
ld a,[de]
inc de
ldh [rAUD1LEN],a
jp SSFP_Inst1Update
; --------------------------------------------------------------------------------------------------------------------------
IF (SOUNDSYSTEM_CODE_BANK == 0)
SECTION "SoundSystem_SSFP_Inst1_CMD_SWEEP",ROM0
ELSE
SECTION "SoundSystem_SSFP_Inst1_CMD_SWEEP",ROMX,BANK[SOUNDSYSTEM_CODE_BANK]
ENDC
SSFP_Inst1_CMD_SWEEP:
ld a,[de]
inc de
ldh [rAUD1SWEEP],a
jp SSFP_Inst1Update
; ==========================================================================================================================
; channel 2
IF (SOUNDSYSTEM_CODE_BANK == 0)
SECTION "SoundSystem_SSFP_Inst2Update",ROM0
ELSE
SECTION "SoundSystem_SSFP_Inst2Update",ROMX,BANK[SOUNDSYSTEM_CODE_BANK]
ENDC
SSFP_Inst2Update:
ld a,[de]
inc de
ld hl,SSFP_Inst2_JumpTable
add a
add l
ld l,a
ld a,[hl+]
ld h,[hl]
ld l,a
jp hl
; --------------------------------------------------------------------------------------------------------------------------
IF (SOUNDSYSTEM_CODE_BANK == 0)
SECTION "SoundSystem_SSFP_Inst2_CMD_FRAMEEND",ROM0
ELSE
SECTION "SoundSystem_SSFP_Inst2_CMD_FRAMEEND",ROMX,BANK[SOUNDSYSTEM_CODE_BANK]
ENDC
SSFP_Inst2_CMD_FRAMEEND:
ld a,[de]
inc de
ld [wMusicSFXInstPause2],a ; load new pause
jp SSFP_Inst2UpdateFrameEnd
; --------------------------------------------------------------------------------------------------------------------------
IF (SOUNDSYSTEM_CODE_BANK == 0)
SECTION "SoundSystem_SSFP_Inst2_CMD_START",ROM0
ELSE
SECTION "SoundSystem_SSFP_Inst2_CMD_START",ROMX,BANK[SOUNDSYSTEM_CODE_BANK]
ENDC
SSFP_Inst2_CMD_START:
ld a,[wChannelFreq2]
ldh [rAUD2LOW],a
ld a,[de]
inc de
ld hl,wChannelFreq2+1
or [hl]
ldh [rAUD2HIGH],a
jp SSFP_Inst2Update
; --------------------------------------------------------------------------------------------------------------------------
IF (SOUNDSYSTEM_CODE_BANK == 0)
SECTION "SoundSystem_SSFP_Inst2_CMD_END",ROM0
ELSE
SECTION "SoundSystem_SSFP_Inst2_CMD_END",ROMX,BANK[SOUNDSYSTEM_CODE_BANK]
ENDC
SSFP_Inst2_CMD_END:
dec de ; rewind counter
ld a,[wSoundFXLock]
bit SFXLOCKB_CHANNEL2,a
jp nz,SSFP_Inst2UpdateFrameEnd
or SFXLOCKF_2_LEFT|SFXLOCKF_2_RIGHT
ld [wSoundFXLock],a
; restore music freq
ld hl,wChannelMusicFreq2
ld bc,wChannelFreq2
ld a,[hl+]
ld [bc],a
inc c
ld a,[hl]
ld [bc],a
jp SSFP_Inst2UpdateFrameEnd ; do nothing else (counter loaded with 0 (256) frame wait)
; --------------------------------------------------------------------------------------------------------------------------
IF (SOUNDSYSTEM_CODE_BANK == 0)
SECTION "SoundSystem_SSFP_Inst2_CMD_ENVELOPE",ROM0
ELSE
SECTION "SoundSystem_SSFP_Inst2_CMD_ENVELOPE",ROMX,BANK[SOUNDSYSTEM_CODE_BANK]
ENDC
SSFP_Inst2_CMD_ENVELOPE:
ld a,[de]
inc de
ld hl,wChannelVol2
or [hl]
ldh [rAUD2ENV],a
IF (SOUNDSYSTEM_ENABLE_VUM)
swap a
and $0F
ld [wVUMeter2],a
ENDC
jp SSFP_Inst2Update
; --------------------------------------------------------------------------------------------------------------------------
IF (SOUNDSYSTEM_CODE_BANK == 0)
SECTION "SoundSystem_SSFP_Inst2_CMD_STARTFREQ",ROM0
ELSE
SECTION "SoundSystem_SSFP_Inst2_CMD_STARTFREQ",ROMX,BANK[SOUNDSYSTEM_CODE_BANK]
ENDC
SSFP_Inst2_CMD_STARTFREQ:
ld a,[de]
inc de
ldh [rAUD2LOW],a
ld a,[de]
inc de
ldh [rAUD2HIGH],a
jp SSFP_Inst2Update
; --------------------------------------------------------------------------------------------------------------------------
IF (SOUNDSYSTEM_CODE_BANK == 0)
SECTION "SoundSystem_SSFP_Inst2_CMD_ENVELOPEVOL",ROM0
ELSE
SECTION "SoundSystem_SSFP_Inst2_CMD_ENVELOPEVOL",ROMX,BANK[SOUNDSYSTEM_CODE_BANK]
ENDC
SSFP_Inst2_CMD_ENVELOPEVOL:
ld a,[de]
inc de
ldh [rAUD2ENV],a
IF (SOUNDSYSTEM_ENABLE_VUM)
swap a
and $0F
ld [wVUMeter2],a
ENDC
jp SSFP_Inst2Update
; --------------------------------------------------------------------------------------------------------------------------
IF (SOUNDSYSTEM_CODE_BANK == 0)
SECTION "SoundSystem_SSFP_Inst2_CMD_STARTENVVOLFREQ",ROM0
ELSE
SECTION "SoundSystem_SSFP_Inst2_CMD_STARTENVVOLFREQ",ROMX,BANK[SOUNDSYSTEM_CODE_BANK]
ENDC
SSFP_Inst2_CMD_STARTENVVOLFREQ:
ld a,[de]
inc de
ldh [rAUD2ENV],a
IF (SOUNDSYSTEM_ENABLE_VUM)
swap a
and $0F
ld [wVUMeter2],a
ENDC
ld a,[de]
inc de
ldh [rAUD2LOW],a
ld a,[de]
inc de
ldh [rAUD2HIGH],a
jp SSFP_Inst2Update
; --------------------------------------------------------------------------------------------------------------------------
IF (SOUNDSYSTEM_CODE_BANK == 0)
SECTION "SoundSystem_SSFP_Inst2_CMD_PANMID",ROM0
ELSE
SECTION "SoundSystem_SSFP_Inst2_CMD_PANMID",ROMX,BANK[SOUNDSYSTEM_CODE_BANK]
ENDC
SSFP_Inst2_CMD_PANMID:
ld hl,wMusicSFXPanning
ld a,AUDTERM_2_LEFT|AUDTERM_2_RIGHT
or [hl]
ld [hl],a
ldh [rAUDTERM],a
jp SSFP_Inst2Update
; --------------------------------------------------------------------------------------------------------------------------
IF (SOUNDSYSTEM_CODE_BANK == 0)
SECTION "SoundSystem_SSFP_Inst2_CMD_PANRIGHT",ROM0
ELSE
SECTION "SoundSystem_SSFP_Inst2_CMD_PANRIGHT",ROMX,BANK[SOUNDSYSTEM_CODE_BANK]
ENDC
SSFP_Inst2_CMD_PANRIGHT:
ld hl,wMusicSFXPanning
ld a,AUDTERM_2_RIGHT
or [hl]
and ~AUDTERM_2_LEFT
ld [hl],a
ldh [rAUDTERM],a
jp SSFP_Inst2Update
; --------------------------------------------------------------------------------------------------------------------------
IF (SOUNDSYSTEM_CODE_BANK == 0)
SECTION "SoundSystem_SSFP_Inst2_CMD_PANLEFT",ROM0
ELSE
SECTION "SoundSystem_SSFP_Inst2_CMD_PANLEFT",ROMX,BANK[SOUNDSYSTEM_CODE_BANK]
ENDC
SSFP_Inst2_CMD_PANLEFT:
ld hl,wMusicSFXPanning
ld a,AUDTERM_2_LEFT
or [hl]
and ~AUDTERM_2_RIGHT
ld [hl],a
ldh [rAUDTERM],a
jp SSFP_Inst2Update
; --------------------------------------------------------------------------------------------------------------------------
IF (SOUNDSYSTEM_CODE_BANK == 0)
SECTION "SoundSystem_SSFP_Inst2_CMD_PULSELEN",ROM0
ELSE
SECTION "SoundSystem_SSFP_Inst2_CMD_PULSELEN",ROMX,BANK[SOUNDSYSTEM_CODE_BANK]
ENDC
SSFP_Inst2_CMD_PULSELEN:
ld a,[de]
inc de
ldh [rAUD2LEN],a
jp SSFP_Inst2Update
; --------------------------------------------------------------------------------------------------------------------------
IF (SOUNDSYSTEM_CODE_BANK == 0)
SECTION "SoundSystem_SSFP_Inst2_CMD_SWEEP",ROM0
ELSE
SECTION "SoundSystem_SSFP_Inst2_CMD_SWEEP",ROMX,BANK[SOUNDSYSTEM_CODE_BANK]
ENDC
SSFP_Inst2_CMD_SWEEP:
inc de ; ignore
jp SSFP_Inst2Update
; ==========================================================================================================================
; channel 3
IF (SOUNDSYSTEM_CODE_BANK == 0)
SECTION "SoundSystem_SSFP_Inst3Update",ROM0
ELSE
SECTION "SoundSystem_SSFP_Inst3Update",ROMX,BANK[SOUNDSYSTEM_CODE_BANK]
ENDC
SSFP_Inst3Update:
ld a,[de]
inc de
ld hl,SSFP_Inst3_JumpTable
add a
add l
ld l,a
ld a,[hl+]
ld h,[hl]
ld l,a
jp hl
; --------------------------------------------------------------------------------------------------------------------------
IF (SOUNDSYSTEM_CODE_BANK == 0)
SECTION "SoundSystem_SSFP_Inst3_CMD_FRAMEEND",ROM0
ELSE
SECTION "SoundSystem_SSFP_Inst3_CMD_FRAMEEND",ROMX,BANK[SOUNDSYSTEM_CODE_BANK]
ENDC
SSFP_Inst3_CMD_FRAMEEND:
ld a,[de]
inc de
ld [wMusicSFXInstPause3],a ; load new pause
jp SSFP_Inst3UpdateFrameEnd
; --------------------------------------------------------------------------------------------------------------------------
IF (SOUNDSYSTEM_CODE_BANK == 0)
SECTION "SoundSystem_SSFP_Inst3_CMD_START",ROM0
ELSE
SECTION "SoundSystem_SSFP_Inst3_CMD_START",ROMX,BANK[SOUNDSYSTEM_CODE_BANK]
ENDC
SSFP_Inst3_CMD_START:
ld a,[wChannelFreq3]
ldh [rAUD3LOW],a
ld a,AUD3ENA_ON
ldh [rAUD3ENA],a
ld a,[de]
inc de
ld hl,wChannelFreq3+1
or [hl]
ldh [rAUD3HIGH],a
jp SSFP_Inst3Update
; --------------------------------------------------------------------------------------------------------------------------
IF (SOUNDSYSTEM_CODE_BANK == 0)
SECTION "SoundSystem_SSFP_Inst3_CMD_END",ROM0
ELSE
SECTION "SoundSystem_SSFP_Inst3_CMD_END",ROMX,BANK[SOUNDSYSTEM_CODE_BANK]
ENDC
SSFP_Inst3_CMD_END:
dec de ; rewind counter
xor a
ldh [rAUD3ENA],a
IF (SOUNDSYSTEM_ENABLE_VUM)
ld [wVUMeter3],a
ENDC
ld a,[wSoundFXLock]
bit SFXLOCKB_CHANNEL3,a
jp nz,SSFP_Inst3UpdateFrameEnd
or SFXLOCKF_3_LEFT|SFXLOCKF_3_RIGHT
ld [wSoundFXLock],a
; restore music freq
ld hl,wChannelMusicFreq3
ld bc,wChannelFreq3
ld a,[hl+]
ld [bc],a
inc c
ld a,[hl]
ld [bc],a
jp SSFP_Inst3UpdateFrameEnd ; do nothing else (counter loaded with 0 (256) frame wait)
; --------------------------------------------------------------------------------------------------------------------------
IF (SOUNDSYSTEM_CODE_BANK == 0)
SECTION "SoundSystem_SSFP_Inst3_CMD_ENVELOPE",ROM0
ELSE
SECTION "SoundSystem_SSFP_Inst3_CMD_ENVELOPE",ROMX,BANK[SOUNDSYSTEM_CODE_BANK]
ENDC
SSFP_Inst3_CMD_ENVELOPE:
ld a,[de]
inc de
ld hl,wChannelVol3
or [hl]
ldh [rAUD3LEVEL],a
IF (SOUNDSYSTEM_ENABLE_VUM)
swap a
sla a
and $0C
dec a
xor $0C
ld [wVUMeter3],a
ENDC
jp SSFP_Inst3Update
; --------------------------------------------------------------------------------------------------------------------------
IF (SOUNDSYSTEM_CODE_BANK == 0)
SECTION "SoundSystem_SSFP_Inst3_CMD_STARTFREQ",ROM0
ELSE
SECTION "SoundSystem_SSFP_Inst3_CMD_STARTFREQ",ROMX,BANK[SOUNDSYSTEM_CODE_BANK]
ENDC
SSFP_Inst3_CMD_STARTFREQ:
ld a,[de]
inc de
ldh [rAUD3LOW],a
ld a,AUD3ENA_ON
ldh [rAUD3ENA],a
ld a,[de]
inc de
ldh [rAUD3HIGH],a
jp SSFP_Inst3Update
; --------------------------------------------------------------------------------------------------------------------------
IF (SOUNDSYSTEM_CODE_BANK == 0)
SECTION "SoundSystem_SSFP_Inst3_CMD_ENVELOPEVOL",ROM0
ELSE
SECTION "SoundSystem_SSFP_Inst3_CMD_ENVELOPEVOL",ROMX,BANK[SOUNDSYSTEM_CODE_BANK]
ENDC
SSFP_Inst3_CMD_ENVELOPEVOL:
ld a,[de]
inc de
ldh [rAUD3LEVEL],a
IF (SOUNDSYSTEM_ENABLE_VUM)
swap a
sla a
and $0C
dec a
xor $0C
ld [wVUMeter3],a
ENDC
jp SSFP_Inst3Update
; --------------------------------------------------------------------------------------------------------------------------
IF (SOUNDSYSTEM_CODE_BANK == 0)
SECTION "SoundSystem_SSFP_Inst3_CMD_STARTENVVOLFREQ",ROM0
ELSE
SECTION "SoundSystem_SSFP_Inst3_CMD_STARTENVVOLFREQ",ROMX,BANK[SOUNDSYSTEM_CODE_BANK]
ENDC
SSFP_Inst3_CMD_STARTENVVOLFREQ:
ld a,[de]
inc de
ldh [rAUD3LEVEL],a
IF (SOUNDSYSTEM_ENABLE_VUM)
swap a
sla a
and $0C
dec a
xor $0C
ld [wVUMeter3],a
ENDC
ld a,[de]
inc de
ldh [rAUD3LOW],a
ld a,AUD3ENA_ON
ldh [rAUD3ENA],a
ld a,[de]
inc de
ldh [rAUD3HIGH],a
jp SSFP_Inst3Update
; --------------------------------------------------------------------------------------------------------------------------
IF (SOUNDSYSTEM_CODE_BANK == 0)
SECTION "SoundSystem_SSFP_Inst3_CMD_PANMID",ROM0
ELSE
SECTION "SoundSystem_SSFP_Inst3_CMD_PANMID",ROMX,BANK[SOUNDSYSTEM_CODE_BANK]
ENDC
SSFP_Inst3_CMD_PANMID:
ld hl,wMusicSFXPanning
ld a,AUDTERM_3_LEFT|AUDTERM_3_RIGHT
or [hl]
ld [hl],a
ldh [rAUDTERM],a
jp SSFP_Inst3Update
; --------------------------------------------------------------------------------------------------------------------------
IF (SOUNDSYSTEM_CODE_BANK == 0)
SECTION "SoundSystem_SSFP_Inst3_CMD_PANRIGHT",ROM0
ELSE
SECTION "SoundSystem_SSFP_Inst3_CMD_PANRIGHT",ROMX,BANK[SOUNDSYSTEM_CODE_BANK]
ENDC
SSFP_Inst3_CMD_PANRIGHT:
ld hl,wMusicSFXPanning
ld a,AUDTERM_3_RIGHT
or [hl]
and ~AUDTERM_3_LEFT
ld [hl],a
ldh [rAUDTERM],a
jp SSFP_Inst3Update
; --------------------------------------------------------------------------------------------------------------------------
IF (SOUNDSYSTEM_CODE_BANK == 0)
SECTION "SoundSystem_SSFP_Inst3_CMD_PANLEFT",ROM0
ELSE
SECTION "SoundSystem_SSFP_Inst3_CMD_PANLEFT",ROMX,BANK[SOUNDSYSTEM_CODE_BANK]
ENDC
SSFP_Inst3_CMD_PANLEFT:
ld hl,wMusicSFXPanning
ld a,AUDTERM_3_LEFT
or [hl]
and ~AUDTERM_3_RIGHT
ld [hl],a
ldh [rAUDTERM],a
jp SSFP_Inst3Update
; --------------------------------------------------------------------------------------------------------------------------
IF (SOUNDSYSTEM_CODE_BANK == 0)
SECTION "SoundSystem_SSFP_Inst3_CMD_WAVE",ROM0
ELSE
SECTION "SoundSystem_SSFP_Inst3_CMD_WAVE",ROMX,BANK[SOUNDSYSTEM_CODE_BANK]
ENDC
SSFP_Inst3_CMD_WAVE:
ld hl,wMusicSFXInstChnl3WaveID
ld a,[de]
inc de
cp 255
jr z,.loadlong
cp [hl]
jr z,.skip
.loadlong:
ld hl,_AUD3WAVERAM
xor a
ldh [rAUD3ENA],a
REPT 16
ld a,[de]
inc de
ld [hl+],a
ENDR
jp SSFP_Inst3Update
.skip:
ld a,e
add 16
ld e,a
ld a,d
adc 0
ld d,a
jp SSFP_Inst3Update
; --------------------------------------------------------------------------------------------------------------------------
IF (SOUNDSYSTEM_CODE_BANK == 0)
SECTION "SoundSystem_SSFP_Inst3_CMD_LEN",ROM0
ELSE
SECTION "SoundSystem_SSFP_Inst3_CMD_LEN",ROMX,BANK[SOUNDSYSTEM_CODE_BANK]
ENDC
SSFP_Inst3_CMD_LEN:
ld a,[de]
inc de
ldh [rAUD3LEN],a
jp SSFP_Inst3Update
; ==========================================================================================================================
; channel 4
IF (SOUNDSYSTEM_CODE_BANK == 0)
SECTION "SoundSystem_SSFP_Inst4Update",ROM0
ELSE
SECTION "SoundSystem_SSFP_Inst4Update",ROMX,BANK[SOUNDSYSTEM_CODE_BANK]
ENDC
SSFP_Inst4Update:
ld a,[de]
inc de
ld hl,SSFP_Inst4_JumpTable
add a
add l
ld l,a
ld a,[hl+]
ld h,[hl]
ld l,a
jp hl
; --------------------------------------------------------------------------------------------------------------------------
IF (SOUNDSYSTEM_CODE_BANK == 0)
SECTION "SoundSystem_SSFP_Inst4_CMD_FRAMEEND",ROM0
ELSE
SECTION "SoundSystem_SSFP_Inst4_CMD_FRAMEEND",ROMX,BANK[SOUNDSYSTEM_CODE_BANK]
ENDC
SSFP_Inst4_CMD_FRAMEEND:
ld a,[de]
inc de
ld [wMusicSFXInstPause4],a ; load new pause
jp SSFP_Inst4UpdateFrameEnd
; --------------------------------------------------------------------------------------------------------------------------
IF (SOUNDSYSTEM_CODE_BANK == 0)
SECTION "SoundSystem_SSFP_Inst4_CMD_START",ROM0
ELSE
SECTION "SoundSystem_SSFP_Inst4_CMD_START",ROMX,BANK[SOUNDSYSTEM_CODE_BANK]
ENDC
SSFP_Inst4_CMD_START:
ld a,[de]
inc de
ldh [rAUD4GO],a
jp SSFP_Inst4Update
; --------------------------------------------------------------------------------------------------------------------------
IF (SOUNDSYSTEM_CODE_BANK == 0)
SECTION "SoundSystem_SSFP_Inst4_CMD_END",ROM0
ELSE
SECTION "SoundSystem_SSFP_Inst4_CMD_END",ROMX,BANK[SOUNDSYSTEM_CODE_BANK]
ENDC
SSFP_Inst4_CMD_END:
dec de ; rewind counter
ld a,[wSoundFXLock]
bit SFXLOCKB_CHANNEL4,a
jp nz,SSFP_Inst4UpdateFrameEnd
or SFXLOCKF_4_LEFT|SFXLOCKF_4_RIGHT
ld [wSoundFXLock],a
; restore music freq
ld hl,wChannelMusicFreq4
ld bc,wChannelFreq4
ld a,[hl+]
ld [bc],a
inc c
ld a,[hl]
ld [bc],a
jp SSFP_Inst4UpdateFrameEnd ; do nothing else (counter loaded with 0 (256) frame wait)
; --------------------------------------------------------------------------------------------------------------------------
IF (SOUNDSYSTEM_CODE_BANK == 0)
SECTION "SoundSystem_SSFP_Inst4_CMD_ENVELOPE",ROM0
ELSE
SECTION "SoundSystem_SSFP_Inst4_CMD_ENVELOPE",ROMX,BANK[SOUNDSYSTEM_CODE_BANK]
ENDC
SSFP_Inst4_CMD_ENVELOPE:
ld a,[de]
inc de
ld hl,wChannelVol4
or [hl]
ldh [rAUD4ENV],a
IF (SOUNDSYSTEM_ENABLE_VUM)
swap a
and $0F
ld [wVUMeter4],a
ENDC
jp SSFP_Inst4Update
; --------------------------------------------------------------------------------------------------------------------------
IF (SOUNDSYSTEM_CODE_BANK == 0)
SECTION "SoundSystem_SSFP_Inst4_CMD_STARTFREQ",ROM0
ELSE
SECTION "SoundSystem_SSFP_Inst4_CMD_STARTFREQ",ROMX,BANK[SOUNDSYSTEM_CODE_BANK]
ENDC
SSFP_Inst4_CMD_STARTFREQ:
ld a,[de]
inc de
ldh [rAUD4POLY],a
ld a,[de]
inc de
ldh [rAUD4GO],a
jp SSFP_Inst4Update
; --------------------------------------------------------------------------------------------------------------------------
IF (SOUNDSYSTEM_CODE_BANK == 0)
SECTION "SoundSystem_SSFP_Inst4_CMD_ENVELOPEVOL",ROM0
ELSE
SECTION "SoundSystem_SSFP_Inst4_CMD_ENVELOPEVOL",ROMX,BANK[SOUNDSYSTEM_CODE_BANK]
ENDC
SSFP_Inst4_CMD_ENVELOPEVOL:
ld a,[de]
inc de
ldh [rAUD4ENV],a
IF (SOUNDSYSTEM_ENABLE_VUM)
swap a
and $0F
ld [wVUMeter4],a
ENDC
jp SSFP_Inst4Update
; --------------------------------------------------------------------------------------------------------------------------
IF (SOUNDSYSTEM_CODE_BANK == 0)
SECTION "SoundSystem_SSFP_Inst4_CMD_STARTENVVOLFREQ",ROM0
ELSE
SECTION "SoundSystem_SSFP_Inst4_CMD_STARTENVVOLFREQ",ROMX,BANK[SOUNDSYSTEM_CODE_BANK]
ENDC
SSFP_Inst4_CMD_STARTENVVOLFREQ:
ld a,[de]
inc de
ldh [rAUD4ENV],a
IF (SOUNDSYSTEM_ENABLE_VUM)
swap a
and $0F
ld [wVUMeter4],a
ENDC
ld a,[de]
inc de
ldh [rAUD4POLY],a
ld a,[de]
inc de
ldh [rAUD4GO],a
jp SSFP_Inst4Update
; --------------------------------------------------------------------------------------------------------------------------
IF (SOUNDSYSTEM_CODE_BANK == 0)
SECTION "SoundSystem_SSFP_Inst4_CMD_PANMID",ROM0
ELSE
SECTION "SoundSystem_SSFP_Inst4_CMD_PANMID",ROMX,BANK[SOUNDSYSTEM_CODE_BANK]
ENDC
SSFP_Inst4_CMD_PANMID:
ld hl,wMusicSFXPanning
ld a,AUDTERM_4_LEFT|AUDTERM_4_RIGHT
or [hl]
ld [hl],a
ldh [rAUDTERM],a
jp SSFP_Inst4Update
; --------------------------------------------------------------------------------------------------------------------------
IF (SOUNDSYSTEM_CODE_BANK == 0)
SECTION "SoundSystem_SSFP_Inst4_CMD_PANRIGHT",ROM0
ELSE
SECTION "SoundSystem_SSFP_Inst4_CMD_PANRIGHT",ROMX,BANK[SOUNDSYSTEM_CODE_BANK]
ENDC
SSFP_Inst4_CMD_PANRIGHT:
ld hl,wMusicSFXPanning
ld a,AUDTERM_4_RIGHT
or [hl]
and AUDTERM_4_LEFT ^ $FF ; same as ~, but ~ here triggers a false warning
ld [hl],a
ldh [rAUDTERM],a
jp SSFP_Inst4Update
; --------------------------------------------------------------------------------------------------------------------------
IF (SOUNDSYSTEM_CODE_BANK == 0)
SECTION "SoundSystem_SSFP_Inst4_CMD_PANLEFT",ROM0
ELSE
SECTION "SoundSystem_SSFP_Inst4_CMD_PANLEFT",ROMX,BANK[SOUNDSYSTEM_CODE_BANK]
ENDC
SSFP_Inst4_CMD_PANLEFT:
ld hl,wMusicSFXPanning
ld a,AUDTERM_4_LEFT
or [hl]
and ~AUDTERM_4_RIGHT
ld [hl],a
ldh [rAUDTERM],a
jp SSFP_Inst4Update
; --------------------------------------------------------------------------------------------------------------------------
IF (SOUNDSYSTEM_CODE_BANK == 0)
SECTION "SoundSystem_SSFP_Inst4_CMD_POLYLOAD",ROM0
ELSE
SECTION "SoundSystem_SSFP_Inst4_CMD_POLYLOAD",ROMX,BANK[SOUNDSYSTEM_CODE_BANK]
ENDC
SSFP_Inst4_CMD_POLYLOAD:
ld a,[de]
inc de
ldh [rAUD4POLY],a
jp SSFP_Inst4Update
; --------------------------------------------------------------------------------------------------------------------------
IF (SOUNDSYSTEM_CODE_BANK == 0)
SECTION "SoundSystem_SSFP_Inst4_CMD_LEN",ROM0
ELSE
SECTION "SoundSystem_SSFP_Inst4_CMD_LEN",ROMX,BANK[SOUNDSYSTEM_CODE_BANK]
ENDC
SSFP_Inst4_CMD_LEN:
ld a,[de]
inc de
ldh [rAUD4LEN],a
jp SSFP_Inst4Update
;***************************************************************************************************************************
;* tables of fx/command handlers
;***************************************************************************************************************************
IF (SOUNDSYSTEM_CODE_BANK == 0)
SECTION "SoundSystem Music FX Table 1",ROM0,ALIGN[5]
ELSE
SECTION "SoundSystem Music FX Table 1",ROMX,BANK[SOUNDSYSTEM_CODE_BANK],ALIGN[5]
ENDC
SSFP_MusicFX_JumpTable1:
DW $0000 ; dummy
DW SSFP_MUSIC_FX1_VIB1
DW SSFP_MUSIC_FX1_VIB2
DW SSFP_MUSIC_FX1_TF1
DW SSFP_MUSIC_FX1_TF2
DW SSFP_MUSIC_FX1_TF3
DW SSFP_MUSIC_FX1_PITCHUP
DW SSFP_MUSIC_FX1_PITCHDOWN
; --------------------------------------------------------------------------------------------------------------------------
IF (SOUNDSYSTEM_CODE_BANK == 0)
SECTION "SoundSystem Music FX Table 2",ROM0,ALIGN[5]
ELSE
SECTION "SoundSystem Music FX Table 2",ROMX,BANK[SOUNDSYSTEM_CODE_BANK],ALIGN[5]
ENDC
SSFP_MusicFX_JumpTable2:
DW $0000 ; dummy
DW SSFP_MUSIC_FX2_VIB1
DW SSFP_MUSIC_FX2_VIB2
DW SSFP_MUSIC_FX2_TF1
DW SSFP_MUSIC_FX2_TF2
DW SSFP_MUSIC_FX2_TF3
DW SSFP_MUSIC_FX2_PITCHUP
DW SSFP_MUSIC_FX2_PITCHDOWN
; --------------------------------------------------------------------------------------------------------------------------
IF (SOUNDSYSTEM_CODE_BANK == 0)
SECTION "SoundSystem Music FX Table 3",ROM0,ALIGN[5]
ELSE
SECTION "SoundSystem Music FX Table 3",ROMX,BANK[SOUNDSYSTEM_CODE_BANK],ALIGN[5]
ENDC
SSFP_MusicFX_JumpTable3:
DW $0000 ; dummy
DW SSFP_MUSIC_FX3_VIB1
DW SSFP_MUSIC_FX3_VIB2
DW SSFP_MUSIC_FX3_TF1
DW SSFP_MUSIC_FX3_TF2
DW SSFP_MUSIC_FX3_TF3
DW SSFP_MUSIC_FX3_PITCHUP
DW SSFP_MUSIC_FX3_PITCHDOWN
; --------------------------------------------------------------------------------------------------------------------------
IF (SOUNDSYSTEM_CODE_BANK == 0)
SECTION "SoundSystem Music Table",ROM0,ALIGN[6]
ELSE
SECTION "SoundSystem Music Table",ROMX,BANK[SOUNDSYSTEM_CODE_BANK],ALIGN[6]
ENDC
SSFP_Music_JumpTable:
DW SSFP_MUSIC_CMD_ENDOFFRAME
DW SSFP_MUSIC_CMD_PLAYINSTNOTE
DW SSFP_MUSIC_CMD_PLAYINST
DW SSFP_MUSIC_CMD_SETVOLUME
DW SSFP_MUSIC_CMD_VIBRATO_ON
DW SSFP_MUSIC_CMD_EFFECT_OFF
DW SSFP_MUSIC_CMD_SYNCFLAG
DW SSFP_MUSIC_CMD_ENDOFPATTERN
DW SSFP_MUSIC_CMD_GOTOORDER
DW SSFP_MUSIC_CMD_ENDOFSONG
DW SSFP_MUSIC_CMD_SETSPEED
DW SSFP_MUSIC_CMD_ENDOFFRAME1X
DW SSFP_MUSIC_CMD_ENDOFFRAME2X
DW SSFP_MUSIC_CMD_ENDOFFRAME3X
DW SSFP_MUSIC_CMD_ENDOFFRAME4X
DW SSFP_MUSIC_CMD_PITCHUP_ON
DW SSFP_MUSIC_CMD_PITCHDOWN_ON
DW SSFP_MUSIC_CMD_TRIPLENOTE_ON
DW SSFP_MUSIC_CMD_EXTRA
; --------------------------------------------------------------------------------------------------------------------------
IF (SOUNDSYSTEM_CODE_BANK == 0)
SECTION "SoundSystem Inst1 Table",ROM0,ALIGN[5]
ELSE
SECTION "SoundSystem Inst1 Table",ROMX,BANK[SOUNDSYSTEM_CODE_BANK],ALIGN[5]
ENDC
SSFP_Inst1_JumpTable: ; common commands
DW SSFP_Inst1_CMD_FRAMEEND
DW SSFP_Inst1_CMD_START
DW SSFP_Inst1_CMD_END
DW SSFP_Inst1_CMD_ENVELOPE
DW SSFP_Inst1_CMD_STARTFREQ
DW SSFP_Inst1_CMD_ENVELOPEVOL
DW SSFP_Inst1_CMD_STARTENVVOLFREQ
DW SSFP_Inst1_CMD_PANMID
DW SSFP_Inst1_CMD_PANRIGHT
DW SSFP_Inst1_CMD_PANLEFT
; specific commands
DW SSFP_Inst1_CMD_PULSELEN
DW SSFP_Inst1_CMD_SWEEP
; --------------------------------------------------------------------------------------------------------------------------
IF (SOUNDSYSTEM_CODE_BANK == 0)
SECTION "SoundSystem Inst2 Table",ROM0,ALIGN[5]
ELSE
SECTION "SoundSystem Inst2 Table",ROMX,BANK[SOUNDSYSTEM_CODE_BANK],ALIGN[5]
ENDC
SSFP_Inst2_JumpTable: ; common commands
DW SSFP_Inst2_CMD_FRAMEEND
DW SSFP_Inst2_CMD_START
DW SSFP_Inst2_CMD_END
DW SSFP_Inst2_CMD_ENVELOPE
DW SSFP_Inst2_CMD_STARTFREQ
DW SSFP_Inst2_CMD_ENVELOPEVOL
DW SSFP_Inst2_CMD_STARTENVVOLFREQ
DW SSFP_Inst2_CMD_PANMID
DW SSFP_Inst2_CMD_PANRIGHT
DW SSFP_Inst2_CMD_PANLEFT
; specific commands
DW SSFP_Inst2_CMD_PULSELEN
DW SSFP_Inst2_CMD_SWEEP
; --------------------------------------------------------------------------------------------------------------------------
IF (SOUNDSYSTEM_CODE_BANK == 0)
SECTION "SoundSystem Inst3 Table",ROM0,ALIGN[5]
ELSE
SECTION "SoundSystem Inst3 Table",ROMX,BANK[SOUNDSYSTEM_CODE_BANK],ALIGN[5]
ENDC
SSFP_Inst3_JumpTable: ; common commands
DW SSFP_Inst3_CMD_FRAMEEND
DW SSFP_Inst3_CMD_START
DW SSFP_Inst3_CMD_END
DW SSFP_Inst3_CMD_ENVELOPEVOL ; prevent crash
DW SSFP_Inst3_CMD_STARTFREQ
DW SSFP_Inst3_CMD_ENVELOPEVOL
DW SSFP_Inst3_CMD_STARTENVVOLFREQ
DW SSFP_Inst3_CMD_PANMID
DW SSFP_Inst3_CMD_PANRIGHT
DW SSFP_Inst3_CMD_PANLEFT
; specific commands
DW SSFP_Inst3_CMD_WAVE
DW SSFP_Inst3_CMD_LEN
; --------------------------------------------------------------------------------------------------------------------------
IF (SOUNDSYSTEM_CODE_BANK == 0)
SECTION "SoundSystem Inst4 Table",ROM0,ALIGN[5]
ELSE
SECTION "SoundSystem Inst4 Table",ROMX,BANK[SOUNDSYSTEM_CODE_BANK],ALIGN[5]
ENDC
SSFP_Inst4_JumpTable: ; common commands
DW SSFP_Inst4_CMD_FRAMEEND
DW SSFP_Inst4_CMD_START
DW SSFP_Inst4_CMD_END
DW SSFP_Inst4_CMD_ENVELOPE
DW SSFP_Inst4_CMD_STARTFREQ
DW SSFP_Inst4_CMD_ENVELOPEVOL
DW SSFP_Inst4_CMD_STARTENVVOLFREQ
DW SSFP_Inst4_CMD_PANMID
DW SSFP_Inst4_CMD_PANRIGHT
DW SSFP_Inst4_CMD_PANLEFT
; specific commands
DW SSFP_Inst4_CMD_POLYLOAD
DW SSFP_Inst4_CMD_LEN
; --------------------------------------------------------------------------------------------------------------------------
IF (SOUNDSYSTEM_CODE_BANK == 0)
SECTION "SoundSystem Frequency Table",ROM0,ALIGN[8]
ELSE
SECTION "SoundSystem Frequency Table",ROMX,BANK[SOUNDSYSTEM_CODE_BANK],ALIGN[8]
ENDC
FrequencyTable:
; C C#/Db D D#/Eb E F F#/Gb G G#/Ab A A#/Bb B
DW $0020,$0091,$00FC,$0160,$01C0,$0219,$026E,$02BE,$030a,$0351,$0394,$03D4 ; octave 2
DW $0410,$0448,$047E,$04B0,$04E0,$050D,$0537,$055F,$0585,$05A8,$05Ca,$05EA ; octave 3
DW $0608,$0624,$063F,$0658,$0670,$0686,$069C,$06B0,$06C2,$06D4,$06E5,$06F5 ; octave 4
DW $0704,$0712,$071F,$072C,$0738,$0743,$074E,$0758,$0761,$076a,$0773,$077A ; octave 5
DW $0782,$0789,$0790,$0796,$079C,$07A2,$07A7,$07AC,$07B1,$07B5,$07B9,$07BD ; octave 6
DW $07C1,$07C5,$07C8,$07CB,$07CE,$07D1,$07D3,$07D6,$07D8,$07DB,$07DD,$07DF ; octave 7
| 24.740779 | 125 | 0.587767 | [
"MIT"
] | gb-archive/GBSoundSystem | Driver/SoundSystem.asm | 95,252 | Assembly | 1 |
; A066999: a(n) = 3^n * Sum_{i=1..n} i^3/3^i.
; Submitted by Jamie Morken(s2)
; 1,11,60,244,857,2787,8704,26624,80601,242803,729740,2190948,6575041,19727867,59186976,177565024,532699985,1598105787,4794324220,14382980660,43148951241,129446864371,388340605280,1165021829664,3495065504617,10485196531427,31455589613964,94366768863844,283100306615921,849300919874763,2547902759654080,7643708278995008,22931124837020961,68793374511102187,206380123533349436,619140370600094964,1857421111800335545,5572263335401061507,16716790006203243840,50150370018609795520,150451110055829455481
mov $6,$0
add $6,1
lpb $6
mul $1,3
mov $2,$3
add $2,3
add $4,1
mov $5,$4
pow $5,$2
add $1,$5
sub $6,1
lpe
mov $0,$1
| 39.333333 | 496 | 0.793785 | [
"Apache-2.0"
] | ckrause/loda-programs | oeis/066/A066999.asm | 708 | Assembly | 19 |
; uint16_t esx_f_write(unsigned char handle, void *src, size_t nbytes)
SECTION code_esxdos
PUBLIC _esx_f_write
EXTERN l0_esx_f_write_callee
_esx_f_write:
pop de
dec sp
pop af
pop hl
pop bc
push bc
push hl
push af
inc sp
push de
jp l0_esx_f_write_callee
| 12.458333 | 70 | 0.695652 | [
"BSD-2-Clause"
] | ByteProject/Puddle-BuildTools | FictionTools/z88dk/libsrc/_DEVELOPMENT/arch/zxn/esxdos/c/sdcc_ix/esx_f_write.asm | 299 | Assembly | 4 |
; A022105: Fibonacci sequence beginning 1, 15.
; 1,15,16,31,47,78,125,203,328,531,859,1390,2249,3639,5888,9527,15415,24942,40357,65299,105656,170955,276611,447566,724177,1171743,1895920,3067663,4963583,8031246,12994829
mov $1,1
mov $2,5
lpb $0,1
sub $0,1
add $1,$2
add $2,10
mov $3,$1
mov $1,$2
mov $2,$3
lpe
| 23 | 171 | 0.695652 | [
"Apache-2.0"
] | karttu/loda | programs/oeis/022/A022105.asm | 322 | Assembly | 19 |
; A310373: Coordination sequence Gal.6.150.5 where G.u.t.v denotes the coordination sequence for a vertex of type v in tiling number t in the Galebach list of u-uniform tilings.
; Submitted by Christian Krause
; 1,4,10,14,18,23,27,31,36,40,44,50,54,58,64,68,72,77,81,85,90,94,98,104,108,112,118,122,126,131,135,139,144,148,152,158,162,166,172,176,180,185,189,193,198,202,206,212,216,220
mov $1,$0
seq $0,312890 ; Coordination sequence Gal.6.115.5 where G.u.t.v denotes the coordination sequence for a vertex of type v in tiling number t in the Galebach list of u-uniform tilings.
add $1,1
div $1,3
add $0,$1
| 60.9 | 182 | 0.745484 | [
"Apache-2.0"
] | ckrause/loda-programs | oeis/310/A310373.asm | 609 | Assembly | 19 |
;/*!
; @file
;
; @brief BvsSavRedrawWait DOS wrapper
;
; (c) osFree Project 2021, <http://www.osFree.org>
; for licence see licence.txt in root directory, or project website
;
; This is Family API implementation for DOS, used with BIND tools
; to link required API
;
; @author Yuri Prokushev ([email protected])
;
;*/
.8086
; Helpers
INCLUDE helpers.inc
INCLUDE dos.inc
INCLUDE bseerr.inc
_TEXT SEGMENT BYTE PUBLIC 'CODE' USE16
@BVSPROLOG BVSSAVREDRAWWAIT
VIOHANDLE DW ? ;Video handle
NOTIFYTYPE DD ? ;
SAVREDRAWINDIC DW ? ;
@BVSSTART BVSSAVREDRAWWAIT
EXTERN VIOCHECKHANDLE: PROC
MOV BX,[DS:BP].ARGS.VIOHANDLE ; GET HANDLE
CALL VIOCHECKHANDLE
JNZ EXIT
XOR AX,AX ; ALL IS OK
EXIT:
@BVSEPILOG BVSSAVREDRAWWAIT
_TEXT ENDS
END
| 18.790698 | 69 | 0.685644 | [
"BSD-3-Clause"
] | osfree-project/FamilyAPI | bvs/BvsSavRedrawWait.asm | 808 | Assembly | 4 |
SECTION "Stack", WRAM0[$C080]
ds $80 - 1
wStack::
SECTION "Init", ROM0
Init:
di
cp $11
ld a, 1
jr z, .cgb
xor a
.cgb
ld [hGBC], a
xor a
ldx [rIF], [rIE]
ldx [rRP]
ldx [rSCX], [rSCY]
ldx [rSB], [rSC]
ldx [rWX], [rWY]
ldx [rBGP], [rOBP0], [rOBP1]
ldx [rTMA], [rTAC]
put [rTAC], rTAC_4096Hz
.wait
ld a, [rLY]
cp 144
jr c, .wait
xor a
ld [rLCDC], a
ld sp, wStack
fill $C000, $2000, 0
ld a, [hGBC]
and a
jr z, .cleared_wram
ld a, 7
.wram_bank
push af
ld [rSVBK], a
fill $D000, $1000, 0
pop af
dec a
cp 1
jr nc, .wram_bank
.cleared_wram
ld a, [hGBC]
push af
fill $FF80, $7F, 0
pop af
ld [hGBC], a
fill $8000, $2000, 0
fill $FE00, $A0, 0
put [rJOYP], 0
put [rSTAT], 8 ; hblank enable
put [rWY], $90
put [rWX], 7
put [rLCDC], %11100011
IF def(NormalSpeed) ; not implemented yet
ld a, [hGBC]
and a
call nz, NormalSpeed
ENDC
put [rIF], 0
put [rIE], %1111
ei
halt
call WriteDMATransferToHRAM
call Main
; if Main returns, restart the program
jp Init
| 10.893617 | 41 | 0.599609 | [
"MIT"
] | gb-archive/waveform-gb | src/code/init.asm | 1,024 | Assembly | 4 |
; A288170: a(n) = 3*a(n-1) - a(n-2) - 4*a(n-3) + 2*a(n-4) for n >= 4, where a(0) = 2, a(1) = 4, a(2) = 8, a(3) = 16, a(4) = 34, a(5) = 70 .
; 2,4,8,16,34,70,144,292,590,1186,2380,4768,9546,19102,38216,76444,152902,305818,611652,1223320,2446658,4893334,9786688,19573396,39146814,78293650,156587324,313174672,626349370,1252698766,2505397560,5010795148,10021590326,20043180682,40086361396,80172722824,160345445682,320690891398,641381782832,1282763565700,2565527131438,5131054262914,10262108525868,20524217051776,41048434103594,82096868207230,164193736414504,328387472829052,656774945658150,1313549891316346,2627099782632740,5254199565265528
mov $14,$0
mov $16,$0
add $16,1
lpb $16
clr $0,14
mov $0,$14
sub $16,1
sub $0,$16
mov $11,$0
mov $13,$0
add $13,1
lpb $13
mov $0,$11
sub $13,1
sub $0,$13
mov $7,$0
mov $9,2
lpb $9
mov $0,$7
sub $9,1
add $0,$9
sub $0,2
mov $1,6
mov $4,7
lpb $0
sub $0,1
mul $4,2
lpe
div $4,$1
mov $1,$4
mov $10,$9
lpb $10
mov $8,$1
sub $10,1
lpe
lpe
lpb $7
mov $7,0
sub $8,$1
lpe
mov $1,$8
mul $1,2
add $12,$1
lpe
add $15,$12
lpe
mov $1,$15
| 24.54902 | 497 | 0.589457 | [
"Apache-2.0"
] | jmorken/loda | programs/oeis/288/A288170.asm | 1,252 | Assembly | 19 |
End of preview. Expand
in Data Studio
README.md exists but content is empty.
- Downloads last month
- 46