ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/cebix/SIDPlayer/src/main.cpp
(Generate patch)

Comparing SIDPlayer/src/main.cpp (file contents):
Revision 1.5 by cebix, 2001-04-01T12:13:49Z vs.
Revision 1.8 by cebix, 2004-01-12T15:15:49Z

# Line 1 | Line 1
1   /*
2   *  main.cpp - SIDPlayer common routines
3   *
4 < *  SIDPlayer (C) Copyright 1996-2001 Christian Bauer
4 > *  SIDPlayer (C) Copyright 1996-2004 Christian Bauer
5   *
6   *  This program is free software; you can redistribute it and/or modify
7   *  it under the terms of the GNU General Public License as published by
# Line 46 | Line 46 | char copyright_info[64];
46   static bool psid_loaded = false;
47  
48   // Data from PSID header
49 < static uint16 init_adr;                 // C64 init routine address
50 < uint16 play_adr;                                // C64 replay routine address
51 < static uint32 speed_flags;              // Speed flags (1 bit/song)
49 > static uint16 init_adr;                         // C64 init routine address
50 > uint16 play_adr;                                        // C64 replay routine address
51 > static bool play_adr_from_irq_vec;      // Flag: dynamically update play_adr from IRQ vector ($0314/$0315 or $fffe/$ffff)
52 > static uint32 speed_flags;                      // Speed flags (1 bit/song)
53  
54  
55  
# Line 69 | Line 70 | void InitAll(int &argc, char **&argv)
70   *  Exit everything
71   */
72  
73 < void ExitAll(void)
73 > void ExitAll()
74   {
75          CPUExit();
76          SIDExit();
# Line 160 | Line 161 | bool LoadPSIDFile(const char *file)
161  
162          init_adr = read_psid_16(header, PSID_INIT);
163          play_adr = read_psid_16(header, PSID_MAIN);
164 +        play_adr_from_irq_vec = (play_adr == 0);
165  
166          speed_flags = read_psid_32(header, PSID_SPEED);
167  
# Line 202 | Line 204 | bool LoadPSIDFile(const char *file)
204          // Select default song
205          SelectSong(current_song);
206  
205        // Set replay routine address if not given in header
206        if (play_adr == 0) {    // Replay routine address is given by interrupt vector
207                if (ram[1] & 2)         // Kernal ROM switched in
208                        play_adr = (ram[0x0315] << 8) | ram[0x0314];
209                else                            // Kernal ROM switched out
210                        play_adr = (ram[0xffff] << 8) | ram[0xfffe];
211        }
212
207          // Everything OK
208          psid_loaded = true;
209          return true;
# Line 220 | Line 214 | bool LoadPSIDFile(const char *file)
214   *  PSID file loaded and ready?
215   */
216  
217 < bool IsPSIDLoaded(void)
217 > bool IsPSIDLoaded()
218   {
219          return psid_loaded;
220   }
# Line 249 | Line 243 | void SelectSong(int num)
243          // Execute init routine
244          CPUExecute(init_adr, current_song, 0, 0, 1000000);
245   }
246 +
247 +
248 + /*
249 + *  Update play_adr from IRQ vector if necessary
250 + */
251 +
252 + void UpdatePlayAdr()
253 + {
254 +        if (play_adr_from_irq_vec) {
255 +                if (ram[1] & 2)         // Kernal ROM switched in
256 +                        play_adr = (ram[0x0315] << 8) | ram[0x0314];
257 +                else                            // Kernal ROM switched out
258 +                        play_adr = (ram[0xffff] << 8) | ram[0xfffe];
259 +        }
260 + }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines