@MULTI-EDIT VERSION 7.0    C:\WATCOM\PRG\ELITE\
/MISC=1/I=1/V=1/SC=63/EV=0/CC=1
/W=2/WNM=A/A=1/WA=0/FN=C:\WATCOM\PRG\ELITE\ELITE.ASM/C=1/L=300/R=14/IL=5/WS=0/IS=1/D=0/LS=0/BI=6/BTML=1/RM=132/LT=\C\L/FLL=0/SN=43/X1=1/Y1=3/X2=80/Y2=29/ERSPLT=1/ZOOM=/OMX=0/OMY=0/X1=1/X2=80/Y1=17/Y2=33/OMX=0/OMY=0/SN=3/ZC=
/MARKS=7/L1=439/P1=13/R1=9/O1=0/L2=439/P2=13/R2=9/O2=0/L3=439/P3=13/R3=9/O3=0/L4=439/P4=13/R4=9/O4=0/L5=439/P5=13/R5=9/O5=0/L6=494/P6=48/R6=10/O6=0/L7=534/P7=12/R7=20/O7=0/L8=360/P8=1/R8=15/O8=0
/W=3/WNM=OUTPUT/A=0/WA=0/FN=C:\PROG\ME\MEERR.TMP/C=1/L=1/R=1/IL=1/WS=0/IS=0/D=1/LS=0/BI=8/BTML=1/RM=78/LT=\L /FLL=0/SN=43/X1=1/Y1=30/X2=80/Y2=33/WCS=1/CTC=64/CCC=79/CBC=79/CHC=78/CSC=79/CLC=78/CLBC=78/CEC=0/ERWN=1
/G_INT=1GVIINT_1
17
/G_INT=1DBIINT_5
3
/G_STR=BLOCK?!_0
10
/G_STR=DB#MECONFIG^C CPP H
/S=1/OR=1/X=23/Y=4/XD=0/YD=6
/G_INT=DB#CPP.PGM
1
/G_INT=CUTOFF_COL
1
/G_INT=DEFAULT_INSERT_MODE
1
/G_STR=DEF_SWITCHES
IX
/G_STR=DEF_REPL_SWITCHES
IXP
/G_STR=DEF_FS_SWITCHES
I
/G_STR=DEF_FSR_SWITCHES
I
/G_INT=BINARY_MODE
1
/G_INT=DIR_IMMEDIATE
1
/G_INT=AUTO_ARRANGE_ICONS
1
/G_INT=DEF_SCRN_STYLE
1
/G_INT=CUR_SCRN
1
/G_STR=DIR_SORT_STR
n
/G_STR=CALC_PARAMS
/X=18/Y=8/BASE=10
/G_INT=DB#ASM.PGM
1
/G_STR=DB#MECONFIG^ASM INC
/S=1/OR=1/X=23/Y=4/XD=0/YD=6
/G_INT=FOUND_COUNT
1
/G_STR=EXTENSIONS
..ASM.TMP.BAT.LST.LSR.COM.CPP.DAT.CLP.LIS
/G_STR=EDIT?!_0
1
/G_STR=FILE?!_0
1
/G_STR=FSWITCHES
I
/G_STR=FRSWITCHES
I
/G_STR=FC_CONFIG_STR
/SH=0/CC=79/IC=48/RW=30208/NKEY=30208/PKEY=33792/RKEY=5118/KEYSTR=NextDif<CtrlPGDN> PrevDif<CtrlPGUP> Report<AltShftR>
/G_INT=EXEC_ENV_MODE
1
/G_STR=FORMAT_CODE_DELIMIT
.
/G_INT=IINT_6
1
/G_STR=FILE_HISTORY1
C:\\WATCOM\\PRG\\ELITE\\RANDOM.DAT
/G_STR=FILE_HISTORY2
C:\\TELEFON
/G_STR=FILE_HISTORY3
C:\\WATCOM\\PRG\\ELITE\\ELITE.LSR
/G_STR=FILE_HISTORY4
C:\\WATCOM\\PRG\\ELITE\\CIRCLE.CLP
/G_STR=FILE_HISTORY5
C:\\WATCOM\\PRG\\ELITE\\CIRCLE.CPP
/G_STR=FILE_HISTORY6
C:\\WATCOM\\PRG\\TOAST\\FSCROLL\\TEST.CPP
/G_STR=FILE_HISTORY7
C:\\WATCOM\\PRG\\ELITE\\TEST.LST
/G_STR=FILE_HISTORY8
C:\\WATCOM\\PRG\\ELITE\\TEST.ASM
/G_STR=FILE_HISTORY9
C:\\WATCOM\\PRG\\ELITE\\ELITEBAK.ASM
/G_STR=FILE_HISTORY10
C:\\WATCOM\\PRG\\ELITE\\ELITEB3.ASM
/G_STR=FILE_HISTORY11
C:\\WATCOM\\PRG\\ELITE\\TEMP.ASM
/G_STR=FILE_HISTORY12
C:\\WATCOM\\PRG\\ELITE\\ELITE.LIS
/G_STR=FILE_HISTORY13
C:\\WATCOM\\PRG\\ELITE\\ELITE.ASM
/G_STR=FILE_HISTORY14
C:\\WATCOM\\PRG\\ELITE\\ELITE.LST
/G_STR=FILE_HISTORY15
C:\\WATCOM\\PRG\\ELITE\\MAKEFILE
/G_STR=FILE_HISTORY16
C:\\WATCOM\\PRG\\ELITE\\RANDOM.ASM
/G_STR=FILE_HISTORY
/#=16
/G_INT=MENU_RESULT
1
/G_STR=MAIN?!_0
5
/G_STR=ORGANIZE?!_0
1
/G_STR=OTHER?!_0
1
/G_STR=PRINTER_DEVICE
LPT1
/G_STR=PRINTER_TYPE
HP LASERII
/G_INT=KEYDELAY
3
/G_STR=LAST_COMPILED_WINDOW
C:\\WATCOM\\PRG\\ELITE\\ELITE.ASM
/G_STR=LAST_COMP
TURBO ASSEMBLER
/G_INT=RESTORE
3
/G_STR=SWITCHES
IX
/G_STR=SEARCH_STR
c64light
/G_STR=SEARCH_HISTORY
/#=16
/G_STR=SEARCH_HISTORY16
c64light
/G_STR=SEARCH_HISTORY15
[cs:bc_centery]
/G_STR=SEARCH_HISTORY14
[cs:bc_centery
/G_STR=SEARCH_HISTORY13
[cs:bc_centerx]
/G_STR=SEARCH_HISTORY12
bp
/G_STR=SEARCH_HISTORY11
14
/G_STR=SEARCH_HISTORY10
ax
/G_STR=SEARCH_HISTORY9
90
/G_STR=SEARCH_HISTORY8
100
/G_STR=SEARCH_HISTORY7
di
/G_STR=SEARCH_HISTORY6
circleende
/G_STR=SEARCH_HISTORY5
gs
/G_STR=SEARCH_HISTORY4
fs
/G_STR=SEARCH_HISTORY3
dx
/G_STR=SEARCH_HISTORY2
bl
/G_STR=SEARCH_HISTORY1
bx
/G_STR=SEARCH?!_0
1
/G_STR=REPLACE_HISTORY6
100
/G_STR=REPLACE_HISTORY4
110
/G_STR=REPLACE_HISTORY2
[cs:bc_centery]
/G_STR=REPLACE_HISTORY1
[cs:bc_centerx]
/G_INT=SPLIT_EDGE_MODE
1
/G_INT=SEARCH_INTR_STYLE
1
/G_STR=REPLACE_HISTORY3
pixelende
/G_STR=REPLACE_HISTORY5
90
/G_STR=SEARCH_HISTORY17
bx
/G_STR=REPLACE_HISTORY7
dx
/G_STR=REPLACE_HISTORY8
di
/G_STR=REPLACE_HISTORY9
bp
/G_STR=REPLACE_HISTORY
/#=9
/G_STR=REPL_SWITCHES
IXP
/G_STR=REPLACE_STR
bp
/G_STR=WINDOW?!_0
2
                                                                                              .
                    .
                    $ff           : jump to $ffc0 (??) the receive 
ROM routine



Q: is there another approach?

A: Yes there is. As you probably know, all important addresses of the
SPC 700 reside inside its own RAM's zeropage:

Address         / register          / usage
0000            Volume left
0001            Volume right
0002            Pitch low
0003            Pitch high          (The total 14 bits of pitch 
height)
0004            SRCN                Designates source number from 0-
255
0005            ADSR 1
0006            ADSR 2
0007            GAIN            Envelope can be freely designated by 
your code
0008            ENVX            Present val of envelope with DSP 
rewrites
0009            VALX            Present wave height val

(and so on...)

Your approach would be to move only sample data there, and/or (lots 
of) very
small chunks of data with a target address in the zeropage, and a 
starting
address of e.g. $ffc0. The small chunks would access zeropage 
addresses e.g.
for the volume etc and thus result in tones; if this is done every 
frame
you might end up with a music player quite similar to the C64 styled 
ones.


Q: So anyway, in what format exactly do I have to move data to the 
SPC?

A: I have the following source code for you, but let me explain it a 
bit
BEFORE you start to dig into it.

I've already mentioned the general "chunk" format. The loop does the 
following:


- move ram destination address to $2142/3 (akku: 16 bit)
- move either #$00 or #$01 into 2141, this depends if you have more 
than $0100
  bytes of data for the SPC;

- first time (first chunk you transmit): move constant #$cc into 2140

- loop: poke each byte that you want to be transmitted into 2140 
(word)
  the higher 7-15 bits of your accu-word contain the number of bytes 
already
  moved (e.g. 00 on the start)

- cmp $2140 with this number of bytes already moved (lower 8 bits of 
this
  number only!) and wait if its not equal.

- until the loop is over.

- for the next chunk header this is repeated, but not #$cc is moved 
into
  2140 but "nn" (lobyte of number of bytes moved) +3 or +6 if it was 
00 when
  +3 was used.

EXAMPLE:

        move #$0400 to 2142 /word access

        move #$01 to 2141
        move #$cc to 2140

        move "gg00" to 2140 where "gg" is the first real code/data 
byte for
                            the SPC

        wait till 2140 is #$00

        move hh01 to 2140 where "hh" is the second byte of code or 
data for SPC

        wait till 2140 is #$01

        move ii02 to 2140 where "ii" is the 3rd byte of data for the 
SPC....

        wait till 2140 is #$02


       lets say "ii" was the last byte. Now we add #$04 (3+carry) to 
#$02
       (#$02 being the number-1 of how many bytes we moved to the 
SPC), we
       will push it onto the stack), now :

       fetch the next header , poke target RAM address into $2142 
(word)
       poke 00 or 01 into 2141 depending of how many bytes to send,
       poke #$06 into 2140 (06 : number of bytes sent from last chunk-
1 + 3 )


I think I got this scheme pretty much right this time. Now, is PLEASE 
someone
going to donate their home-brewed SPC dis/assemblers to me? Oh pretty 
please,
I hate silent SNES's !  :)


Source code follows, reassembled from a PAN/Baseline demo "xmas wish 
92/93":
----------------------------------------------------------------------
------


; entry to the code starts here


            SEP #$30       ; x y a set to 8 bit length
            LDA #$FF       ; ff into audio0w (write)
            STA $2140
            REP #$10       ; x,y: 16 bit length
            LDX #$7FFF
l0DB5B      LDA $018000,X  ; move rom music data to ram at $7f0000
            STA $7F0000,X
            LDA $028000,X  ; move rom music data to ram at $7f0000
            STA $7F8000,X
            DEX
            BPL l0DB5B
            LDA #$80       ; screen on , probably not import@MULTI-EDIT VERSION 7.0    C:\WATCOM\PRG\ELITE\
/MISC=1/I=1/V=1/SC=64/EV=0/CC=1
/W=2/WNM=A/A=1/WA=0/FN=C:\WATCOM\PRG\ELITE\ELITE.ASM/C=1/L=300/R=14/IL=5/WS=0/IS=1/D=0/LS=0/BI=6/BTML=1/RM=132/LT=\C\L/FLL=0/SN=43/X1=1/Y1=3/X2=80/Y2=29/ERSPLT=1/ZOOM=/OMX=0/OMY=0/X1=1/X2=80/Y1=17/Y2=33/OMX=0/OMY=0/SN=3/ZC=
/MARKS=7/L1=439/P1=13/R1=9/O1=0/L2=439/P2=13/R2=9/O2=0/L3=439/P3=13/R3=9/O3=0/L4=439/P4=13/R4=9/O4=0/L5=439/P5=13/R5=9/O5=0/L6=494/P6=48/R6=10/O6=0/L7=534/P7=12/R7=20/O7=0/L8=360/P8=1/R8=15/O8=0
/W=3/WNM=OUTPUT/A=0/WA=0/FN=C:\PROG\ME\MEERR.TMP/C=1/L=1/R=1/IL=1/WS=0/IS=0/D=1/LS=0/BI=8/BTML=1/RM=78/LT=\L /FLL=0/SN=43/X1=1/Y1=30/X2=80/Y2=33/WCS=1/CTC=64/CCC=79/CBC=79/CHC=78/CSC=79/CLC=78/CLBC=78/CEC=0/ERWN=1
/G_INT=1GVIINT_1
17
/G_INT=1DBIINT_5
3
/G_STR=BLOCK?!_0
10
/G_STR=DB#MECONFIG^C CPP H
/S=1/OR=1/X=23/Y=4/XD=0/YD=6
/G_INT=DB#CPP.PGM
1
/G_INT=CUTOFF_COL
1
/G_INT=DEFAULT_INSERT_MODE
1
/G_STR=DEF_SWITCHES
IX
/G_STR=DEF_REPL_SWITCHES
IXP
/G_STR=DEF_FS_SWITCHES
I
/G_STR=DEF_FSR_SWITCHES
I
/G_INT=BINARY_MODE
1
/G_INT=DIR_IMMEDIATE
1
/G_INT=AUTO_ARRANGE_ICONS
1
/G_INT=DEF_SCRN_STYLE
1
/G_INT=CUR_SCRN
1
/G_STR=DIR_SORT_STR
n
/G_STR=CALC_PARAMS
/X=18/Y=8/BASE=10
/G_INT=DB#ASM.PGM
1
/G_STR=DB#MECONFIG^ASM INC
/S=1/OR=1/X=23/Y=4/XD=0/YD=6
/G_STR=FILE_HISTORY
/#=16
/G_STR=FILE_HISTORY16
C:\\WATCOM\\PRG\\ELITE\\STAR\\STAR.CPP
/G_STR=FILE_HISTORY15
C:\\WATCOM\\PRG\\ELITE\\RANDOM.ASM
/G_STR=FILE_HISTORY14
C:\\WATCOM\\PRG\\ELITE\\MAKEFILE
/G_STR=FILE_HISTORY13
C:\\WATCOM\\PRG\\ELITE\\ELITE.LST
/G_STR=FILE_HISTORY12
C:\\WATCOM\\PRG\\ELITE\\ELITE.ASM
/G_STR=FILE_HISTORY11
C:\\WATCOM\\PRG\\ELITE\\ELITE.LIS
/G_STR=FILE_HISTORY10
C:\\WATCOM\\PRG\\ELITE\\TEMP.ASM
/G_STR=FILE_HISTORY9
C:\\WATCOM\\PRG\\ELITE\\ELITEB3.ASM
/G_STR=FILE_HISTORY8
C:\\WATCOM\\PRG\\ELITE\\ELITEBAK.ASM
/G_STR=FILE_HISTORY7
C:\\WATCOM\\PRG\\ELITE\\TEST.ASM
/G_STR=FILE_HISTORY6
C:\\WATCOM\\PRG\\ELITE\\TEST.LST
/G_STR=FILE_HISTORY5
C:\\WATCOM\\PRG\\TOAST\\FSCROLL\\TEST.CPP
/G_STR=FILE_HISTORY4
C:\\WATCOM\\PRG\\ELITE\\CIRCLE.CPP
/G_STR=FILE_HISTORY3
C:\\WATCOM\\PRG\\ELITE\\CIRCLE.CLP
/G_STR=FILE_HISTORY2
C:\\WATCOM\\PRG\\ELITE\\ELITE.LSR
/G_STR=FILE_HISTORY1
C:\\TELEFON
/G_INT=FOUND_COUNT
1
/G_STR=EXTENSIONS
..ASM.TMP.BAT.LST.LSR.COM.CPP.DAT.CLP.LIS
/G_STR=EDIT?!_0
1
/G_STR=FILE?!_0
1
/G_STR=FSWITCHES
I
/G_STR=FRSWITCHES
I
/G_STR=FC_CONFIG_STR
/SH=0/CC=79/IC=48/RW=30208/NKEY=30208/PKEY=33792/RKEY=5118/KEYSTR=NextDif<CtrlPGDN> PrevDif<CtrlPGUP> Report<AltShftR>
/G_INT=EXEC_ENV_MODE
1
/G_STR=FORMAT_CODE_DELIMIT
.
/G_INT=IINT_6
1
/G_INT=MENU_RESULT
1
/G_STR=MAIN?!_0
5
/G_STR=ORGANIZE?!_0
1
/G_STR=OTHER?!_0
1
/G_STR=PRINTER_DEVICE
LPT1
/G_STR=PRINTER_TYPE
HP LASERII
/G_INT=KEYDELAY
3
/G_STR=LAST_COMPILED_WINDOW
C:\\WATCOM\\PRG\\ELITE\\ELITE.ASM
/G_STR=LAST_COMP
TURBO ASSEMBLER
/G_INT=RESTORE
3
/G_STR=SWITCHES
IX
/G_STR=SEARCH_STR
c64light
/G_STR=SEARCH_HISTORY
/#=16
/G_STR=SEARCH_HISTORY16
c64light
/G_STR=SEARCH_HISTORY15
[cs:bc_centery]
/G_STR=SEARCH_HISTORY14
[cs:bc_centery
/G_STR=SEARCH_HISTORY13
[cs:bc_centerx]
/G_STR=SEARCH_HISTORY12
bp
/G_STR=SEARCH_HISTORY11
14
/G_STR=SEARCH_HISTORY10
ax
/G_STR=SEARCH_HISTORY9
90
/G_STR=SEARCH_HISTORY8
100
/G_STR=SEARCH_HISTORY7
di
/G_STR=SEARCH_HISTORY6
circleende
/G_STR=SEARCH_HISTORY5
gs
/G_STR=SEARCH_HISTORY4
fs
/G_STR=SEARCH_HISTORY3
dx
/G_STR=SEARCH_HISTORY2
bl
/G_STR=SEARCH_HISTORY1
bx
/G_STR=SEARCH?!_0
1
/G_STR=REPLACE_HISTORY6
100
/G_STR=REPLACE_HISTORY4
110
/G_STR=REPLACE_HISTORY2
[cs:bc_centery]
/G_STR=REPLACE_HISTORY1
[cs:bc_centerx]
/G_INT=SPLIT_EDGE_MODE
1
/G_INT=SEARCH_INTR_STYLE
1
/G_STR=REPLACE_HISTORY3
pixelende
/G_STR=REPLACE_HISTORY5
90
/G_STR=SEARCH_HISTORY17
bx
/G_STR=REPLACE_HISTORY7
dx
/G_STR=REPLACE_HISTORY8
di
/G_STR=REPLACE_HISTORY9
bp
/G_STR=REPLACE_HISTORY
/#=9
/G_STR=REPL_SWITCHES
IXP
/G_STR=REPLACE_STR
bp
/G_STR=WINDOW?!_0
2
                                                                                  cc)
            REP #$20      ; accu = 16 bit
            LDA [$FD],Y   ; get ram data 2 bytes
            INY           ; point to next word
            INY
            TAX           ; x:=a : number of bytes to transmit
            LDA [$FD],Y   ; get ram data
            INY
            INY
            STA $2142     ; audio2w  : possibly the dest. area in the 
spc700
            SEP #$20      ; accu 8 bit
            CPX #$0100    ; set carry if first ram data was >= 0100
            lda #$00      ;
            ROL           ;
            STA $2141     ; if ram data >= 0100, poke "1" into reg 1 
otherw 0
            ADC #$7F      ; SET OVERFLOW FLAG IF X>=$0100 !!!! (nice 
trick!)
            PLA
            STA $2140     ; $cc in the first case , nn+4 on all later 
cases

l0DC32      CMP $2140    ; wait for snd chip reply
            BNE l0DC32
            BVS l0DBEC   ; if there were more than $0100 data for the 
spc's RAM
                         ; move them where they R supposed to belong 
to!
            PLP
            RTS


            PLA
            STA $2140    ; same shit, never been jumped into
l0DC3F      CMP $2140
            BNE l0DC3F
            BVS l0DBF9
            PLP
            RTS






; also lets look at 7f0000: the first few bytes at 7f0000 are:

7f0000: b7 0e 00 04 20 cd cf bd e8 00 5d af c8 f0 d0 fb 5d d5 00 01 
d5 00 02

b7 0e should be number of bytes to transmit, 0400 the destination 
inside the
spc....
at this point I really need an SPC dis/assembler.....  :(((

Okay well my first source was incompetent, sure thing. But I think I 
could
solve a lot of questions meanwhile.
