home *** CD-ROM | disk | FTP | other *** search
/ YPA: Your Privacy Assured / YPA.ISO / other_goodies / music / deli211.lha / DeliTracker_II / Bonus / playsid3.lha / PlaySID3.0 / Convert.doc < prev    next >
Text File  |  1994-08-12  |  11KB  |  362 lines

  1.  
  2. **************************************************************
  3. ****** HOW TO CONVERT C64 TUNES TO AMIGA PLAYSID FORMAT ******
  4. **************************************************************
  5.  
  6. Requirements:
  7.  
  8.     * You have to know 6502 machinecode quite well.
  9.     * You have access to a C64 or a good Emulator
  10.     * You have an good machine code monitor to your C64 or Emulator
  11.  
  12.     and it will be easier if...
  13.  
  14.     * You have a 1541 diskdrive
  15.     * You have a transfer cable C64-Amiga
  16.     * You have already ripped tunes
  17.     * You know a lot about SID
  18.  
  19. Ripping:
  20.  
  21.     This is often a hard thing to do. You should locate where in
  22.     memory that the musicplayer and data is. If it is spread into
  23.     several parts, then you have to write memory transfer routines.
  24.     You should find where to call to init and start the different
  25.     tunes. You then save the music in one (this is very important) 
  26.     file. You should always try to locate as many tunes or sounds
  27.     as possible, so that nothing is forgotten. Otherwise your job
  28.     maybe will be re-done by another guy who has found more tunes.
  29.  
  30. Converting:
  31.  
  32.     This is easier. If you have already ripped tunes that consists
  33.     of more than one file, see instructions on ripping. Now you 
  34.     should rewrite the music player so that it can be thought of as
  35.     two major subroutines (sometimes this is already the case, like
  36.     Maniacs of Noise). The first subroutine will be called by PlaySID
  37.     with the accumulator set to the tunenumber (hex $00-$FF). This
  38.     should initalize all things like volume etc. The second subroutine
  39.     is the real music playing part. This will be called by PlaySID
  40.     each 1/50 or 1/60 second (set by parameters in .info). Note that
  41.     this routine routine should be ended by either RTI, RTS or a jump
  42.     to address $Exxx (this because the non-used bytes at $E000-FFFF is
  43.     filled with $40=RTI). If you use RTS you must then also check that
  44.     the stackpointer is ok (the same as when called from PlaySID).
  45.     Note that the memory transfer routines should be in the first
  46.     subroutine. Note also that PlaySID initializes all 64k of memory and
  47.     reloads the musicplayer each time you press play. Note also that
  48.     the memory control register ($01) is of nearly no use under PlaySID.
  49.     It sees all memory as ram (even $D000-$DFFF!).
  50.  
  51.     Sometimes the music uses the fourth channel, like sample channel.
  52.     This is done by changing the volume ($D418) very often. Usually
  53.     this is programmed using the NMI ($0318 or $FFFA). PlaySID uses
  54.     another metod. The SID registers are enhanced with several new
  55.     registers, see below. You have to write a routine that is a part
  56.     of the second subroutine. This routine replaces the NMI routine,
  57.     and with that follows that the NMI routine are not used anymore. For
  58.     some examples look below (although they're not NMI's but they'll
  59.     explain the way to convert). Please always write to the START reg
  60.     ($D41D) after you have set the other regs, for future revisions
  61.     of PlaySID.
  62.  
  63. Transfering:
  64.  
  65.     When you transfer the files, you don't have to remove the
  66.     2 bytes in the beginning of the file (if you let them be, you
  67.     could also use the files in some C64emulator that maybe will be
  68.     released). If you haven't got the opportunity to transfer by
  69.     yourself, you could send the files to us (the authors of PlaySID)
  70.     on a 5 1/4 disk or even cassette. If you do, the you must 
  71.     include the information about the .info parameters.
  72.  
  73. Making the Icon:
  74.  
  75.     Just copy an icon from an existing PlaySID file. For example
  76.     copy arkanoid.info to <filename>.info. Then select the icon in
  77.     workbench and select Information in the workbench menu. Now you
  78.     change the parameters to that of your file. Look at PlaySID.doc
  79.     for a complete description of the parameters. It is very much
  80.     appreciated that you also include information about author and
  81.     copyright. You could even include lines like RIPPER="xxxx" or
  82.     VERSION="xxxxx", because these lines are not seen by PLAYSID.
  83.  
  84. New Icon Tooltype Features (V2.2):
  85.  
  86.         If 0 is specified as loadaddress, the first two bytes of the file
  87.     will instead be used as loadaddress.
  88.     
  89.     If 0 is specified as initaddress, then the initaddress will be the
  90.     first C64 address loaded.
  91.  
  92.     If 0 is specified as playaddress, then the playaddress will be the
  93.     address of the interrupt initialized by the subroutine at the
  94.     initaddress. This address will be the contents of $0314/0315 or
  95.     $FFFE/FFFF depending on what value $0001 contains.
  96.  
  97.        SPEED = <speeddata> ;in hex
  98.  
  99.     speeddata contains info about playspeed. For each tune a bit
  100.     is reserved, bit 0 for tune nr 1 and so on. A 0 bit means vertical
  101.     sync (50Hz PAL or 60Hz NTSC) and a 1 bit means 60 Hz or the 
  102.     time set in $DC04/05. Default value is 0 for all bits.
  103.  
  104.  
  105. Appendix:
  106.  
  107. *********************
  108. * NEW SID REGISTERS *
  109. *********************
  110.  
  111.     ADDRESS    VALUE    FUNCTION            USAGE
  112.  
  113.     D41D    00-FC    Nr of tones-1            Galway-Noise (START)
  114.         FD    Stop Sampling            Sample (STOP)
  115.         FC    Start Sampling with 1/4        Sample (START)
  116.             volume
  117.         FE    Start Sampling with 1/2        Sample (START)
  118.             volume
  119.         FF    Start Sampling            Sample (START)
  120.             ex. 4-bit sample -> FF
  121.                 3-bit sample (one extra LSR)
  122.                 -> FE etc.
  123.             note. only write to this reg
  124.                   after setting the other
  125.                   regs to proper values.
  126.  
  127.     D41E    00-FF    ToneData address lowbyte    Galway-Noise
  128.     D41F    00-FF    ToneData address highbyte    Galway-Noise
  129.     D41E    00-FF    SampleData address low        Sample
  130.     D41F    00-FF    SampleData address high        Sample
  131.  
  132.     D43D    00-FF    Tonelength (in samples)        Galway-Noise
  133.     D43E    00-0F    Volume of Noise            Galway-Noise
  134.     D43D    00-FF    SampleData end addr. low    Sample
  135.     D43E    00-FF    SampleData end addr. high    Sample
  136.  
  137.     D43F    00-FF    Period for each value of    Galway-Noise
  138.             ToneData (in C64-cycles)
  139.         00-FE    Nr times of Repeat        Sample
  140.         FF    Continious sample        Sample
  141.  
  142.     D45D    00-FF    Period for value 0 of        Galway-Noise
  143.             ToneData (in C64-cycles)
  144.         00-FF    Period for samples lowbyte    Sample
  145.     D45E    00-FF    Period for samples highbyte    Sample
  146.             (in C64-cycles)
  147.             ex. the period is usually the 
  148.                 value of the timer on 6526
  149.                 ($DD04,05 etc.) which handles
  150.                 the NMI-irq used
  151.  
  152.     D45F    00,01    Nr of bytes to add after    Sample
  153.         02,04    Reading one nibble (4 bits)
  154.         08...    (i.e. Octave) ,usually 00
  155.             ex. xx xx xx xx ... -> 00
  156.                 x_ x_ x_ x_ ... -> 01
  157.                 x_ __ x_ __ ... -> 02 etc.
  158.  
  159.     D47D    00    Sampleorder: Lownibble        Sample
  160.             ,Highnibble (the most used)
  161.         01    Sampleorder: Highnibble        Sample
  162.             ,Lownibble
  163.             ex. (12 34 -> 1 2 3 4) -> 01
  164.                 (12 34 -> 2 1 4 3) -> 00
  165.  
  166.     D47E    00-FF    SampleData repeataddress low    Sample
  167.     D47F    00-FF    SampleData repeataddress high    Sample
  168.  
  169.  
  170. * EXAMPLES *
  171. ; *** MARTIN GALWAY *** *** NOISE ***
  172. ; 6502 Routine:
  173. ; Loop of Y=5 to 0 step -1
  174. ; Loop of X=19 to 0 step -1
  175. ; Read $B64E,Y in A
  176. ; Wait A*73 cycles
  177. ; Wait 22 cycles
  178. ; Add 7 to volume
  179. ; End Loop X
  180. ; End Loop Y
  181. ; END
  182. ;
  183. ; Replacement with:
  184. ; D43D=$19
  185. ; D41E=$4E, D41F=$B6
  186. ; D43F=$73
  187. ; D45D=$22
  188. ; D43E=$07
  189. ; D41D=$05
  190. ;
  191. ; *** MARTIN GALWAY *** *** SAMPLE ***
  192. ; 6502 Routine:
  193. ; Loop of Y=0 to 100 step 1
  194. ; Read $B64E,Y in A
  195. ; Write Lownibble of A in Volumereg
  196. ; Wait 74 cycles
  197. ; Write Highnibble of A in Volumereg
  198. ; Wait 74 cycles
  199. ; End Loop Y
  200. ; Do it one more time
  201. ; END
  202. ;
  203. ; Replacement with:
  204. ; D41E=$4E, D41F=$B6
  205. ; D43D=$4E, D43E=$B7
  206. ; D45D=$74, D45E=$00
  207. ; D45F=$00
  208. ; D47D=$00
  209. ; D43F=$01
  210. ; D47E=$4E, D47F=$B6
  211. ; D41D=$FF
  212. ;
  213. ;
  214. ; *** ORDINARY SAMPLE ***
  215. ; 6502 NMI-irq Routine:
  216. ; Checks if all is played ($FC,$FD = $FE,$FF ?)
  217. ; Loads next byte with LDA ($FC),Y  (Y = 0) ,if so required
  218. ; Shift outs the highnibble , if so required
  219. ; Stores this value in $D418
  220. ; Exits (RTI)
  221. ;
  222. ; Replacement with:
  223. ; Locate the routine which initalizes the values $FC-$FF and which starts
  224. ; the NMI-irq (Probably with LDA #$81,STA $DD0D ,LDA #$xx,STA $DD04
  225. ; LDA #$yy,STA DD05 etc.)
  226. ; Do instead this,
  227. ; D41E,1F = value of adress $FC,FD
  228. ; D43D,3E = value of adress $FE,FF
  229. ; D43F = 00 , D45F = 00
  230. ; D47D = 00 or 01
  231. ; D45D,5E = value of address $DD04,05
  232. ; D41D = FF
  233. ;
  234.  
  235. ***********************************
  236. * UNIMPLEMENTED 6502 INSTRUCTIONS *
  237. ***********************************
  238.  
  239. Complete list of the unimplemented instructions for the 6510 microprocessor.
  240. (C) 1984,1992 Hσkan Sundell
  241.  
  242. Notes: In the listing belove there are some shortcuts used, A = Accumulator
  243.        , X = Index register X , Y = Index register Y , SP = Stackpointer
  244.        , M = byte in Memory , -> = is Stored in. The flag settings are,
  245.        unless other specified, calculated in the same way as the consisting
  246.        intructions.
  247.  
  248. Code    Adress-mode    Description
  249. 02    ---        Total HALT
  250. 03    (Ind,X)        ASL,ORA
  251. 04    Zeropage    NOP
  252. 07    Zeropage    ASL,ORA
  253. 0B    Immediate    AND #$xx,ASL A with only setting flags
  254. 0C    Absolute    NOP
  255. 0F    Absolute    ASL,ORA
  256. 12    ---        Total HALT
  257. 13    (Ind),Y        ASL,ORA
  258. 14    Zeropage    NOP
  259. 17    Zeropage,X    ASL,ORA
  260. 1A    Implied        NOP
  261. 1B    Absolute,Y    ASL,ORA
  262. 1C    Absolute    NOP
  263. 1F    Absolute,X    ASL,ORA
  264.  
  265. 22    ---        Total HALT
  266. 23    (Ind,X)        ROL,AND
  267. 27    Zeropage    ROL,AND
  268. 2B    Immediate    AND #$xx,ROL A with only setting flags
  269. 2F    Absolute    ROL,AND
  270. 32    ---        Total HALT
  271. 33    (Ind),Y        ROL,AND
  272. 34    Zeropage    NOP
  273. 37    Zeropage,X    ROL,AND
  274. 3A    Implied        NOP
  275. 3B    Absolute,Y    ROL,AND
  276. 3C    Absolute    NOP
  277. 3F    Absolute,X    ROL,AND
  278.  
  279. 42    ---        Total HALT
  280. 43    (Ind,X)        LSR,EOR
  281. 44    Zeropage    NOP
  282. 47    Zeropage    LSR,EOR
  283. 4B    Immediate    AND #$xx,LSR A
  284. 4F    Absolute    LSR,EOR
  285. 52    ---        Total HALT
  286. 53    (Ind,Y)        LSR,EOR
  287. 54    Zeropage    NOP
  288. 57    Zeropage,X    LSR,EOR
  289. 5A    Implied        NOP
  290. 5B    Absolute,Y    LSR,EOR
  291. 5C    Absolute    NOP
  292. 5F    Absoulte,X    LSR,EOR
  293.  
  294. 62    ---        Total HALT
  295. 63    (Ind,X)        ROR,ADC
  296. 64    Zeropage    NOP
  297. 67    Zeropage    ROR,ADC
  298. 6B    Immediate    AND #$xx,ROR A
  299. 6F    Absoulte    ROR,ADC
  300. 72    ---        Total HALT
  301. 73    (Ind),Y        ROR,ADC
  302. 74    Zeropage    NOP
  303. 77    Zeropage,X    ROR,ADC
  304. 7A    Implied        NOP
  305. 7B    Absolute,Y    ROR,ADC
  306. 7C    Absolute    NOP
  307. 7F    Absolute,X    ROR,ADC
  308.  
  309. 80    Zeropage    NOP
  310. 82    Zeropage    NOP
  311. 83    (Ind,X)        0->M if X=0 , No flags set
  312. 87    Zeropage    A and X -> M , No flags set
  313. 8B    Immediate    M and X -> A (bits 7-1) , M0 and X0 and A0 -> A0
  314.                         , No flags set
  315. 8F    Absolute    A and X -> M , No flags set
  316. 92    ---        Total HALT
  317. 93    (Ind),Y        A and X and $21 -> M , No flags set
  318. 97    Zeropage,Y    A and X -> M , No flags set
  319. 9B    Absolute,Y    A and X and $21 -> M , A and X -> SP, No flags set
  320. 9C    Absolute,X    A and Y and $21 -> M , No flags set
  321. 9E    Absolute,Y    A and X and $21 -> M , No flags set
  322. 9F    Absolute,Y    A and X and $21 -> M , No flags set
  323.  
  324. A3    (Ind,X)        LDA,LDX
  325. A7    Zeropage    LDA,LDX
  326. AB    Immediate    LDA,LDX
  327. AF    Absolute    LDA,LDX
  328. B2    ---        Total HALT
  329. B3    (Ind),Y        LDA,LDX
  330. B7    Zeropage,Y    LDA,LDX
  331. BB    Absolute,Y    SP and M -> A,X,SP
  332. BF    Absolute,Y    LDA,LDX
  333.  
  334. C2    Zeropage    NOP
  335. C3    (Ind,X)        DEC,CMP
  336. C7    Zeropage    DEC,CMP
  337. CB    Immediate    (X and A) - M -> X
  338. CF    Absolute    DEC,CMP
  339. D2    ---        Total HALT
  340. D3    (Ind),Y        DEC,CMP
  341. D4    Zeropage    NOP
  342. D7    Zeropage,X    DEC,CMP
  343. DA    Implied        NOP
  344. DB    Absolute,Y    DEC,CMP
  345. DC    Absolute    NOP
  346. DF    Absolute,X    DEC,CMP
  347.  
  348. E2    Zeropage    NOP
  349. E3    (Ind,X)        INC,SBC
  350. E7    Zeropage    INC,SBC
  351. EB    Immedite    SBC #$xx
  352. EF    Absolute    INC,SBC
  353. F2    ---        Total HALT
  354. F3    (Ind),Y        INC,SBC
  355. F4    Zeropage    NOP
  356. F7    Zeropage,X    INC,SBC
  357. FA    Implied        NOP
  358. FB    Absolute,Y    INC,SBC
  359. FC    Absolute    NOP
  360. FF    Absolute,X    INC,SBC
  361.  
  362.