1 |
|
/* |
2 |
|
* C64.cpp - Put the pieces together |
3 |
|
* |
4 |
< |
* Frodo (C) 1994-1997,2002-2003 Christian Bauer |
4 |
> |
* Frodo (C) 1994-1997,2002-2005 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 |
50 |
|
|
51 |
|
C64::C64() |
52 |
|
{ |
53 |
– |
int i,j; |
53 |
|
uint8 *p; |
54 |
|
|
55 |
|
// The thread is not yet running |
64 |
|
TheDisplay = new C64Display(this); |
65 |
|
|
66 |
|
// Allocate RAM/ROM memory |
67 |
< |
RAM = new uint8[0x10000]; |
68 |
< |
Basic = new uint8[0x2000]; |
69 |
< |
Kernal = new uint8[0x2000]; |
70 |
< |
Char = new uint8[0x1000]; |
71 |
< |
Color = new uint8[0x0400]; |
72 |
< |
RAM1541 = new uint8[0x0800]; |
73 |
< |
ROM1541 = new uint8[0x4000]; |
67 |
> |
RAM = new uint8[C64_RAM_SIZE]; |
68 |
> |
Basic = new uint8[BASIC_ROM_SIZE]; |
69 |
> |
Kernal = new uint8[KERNAL_ROM_SIZE]; |
70 |
> |
Char = new uint8[CHAR_ROM_SIZE]; |
71 |
> |
Color = new uint8[COLOR_RAM_SIZE]; |
72 |
> |
RAM1541 = new uint8[DRIVE_RAM_SIZE]; |
73 |
> |
ROM1541 = new uint8[DRIVE_ROM_SIZE]; |
74 |
|
|
75 |
|
// Create the chips |
76 |
|
TheCPU = new MOS6510(this, RAM, Basic, Kernal, Char, Color); |
86 |
|
TheREU = TheCPU->TheREU = new REU(TheCPU); |
87 |
|
|
88 |
|
// Initialize RAM with powerup pattern |
89 |
< |
for (i=0, p=RAM; i<512; i++) { |
90 |
< |
for (j=0; j<64; j++) |
89 |
> |
p = RAM; |
90 |
> |
for (unsigned i=0; i<512; i++) { |
91 |
> |
for (unsigned j=0; j<64; j++) |
92 |
|
*p++ = 0; |
93 |
< |
for (j=0; j<64; j++) |
93 |
> |
for (unsigned j=0; j<64; j++) |
94 |
|
*p++ = 0xff; |
95 |
|
} |
96 |
|
|
97 |
|
// Initialize color RAM with random values |
98 |
< |
for (i=0, p=Color; i<1024; i++) |
98 |
> |
p = Color; |
99 |
> |
for (unsigned i=0; i<COLOR_RAM_SIZE; i++) |
100 |
|
*p++ = rand() & 0x0f; |
101 |
|
|
102 |
|
// Clear 1541 RAM |
103 |
< |
memset(RAM1541, 0, 0x800); |
103 |
> |
memset(RAM1541, 0, DRIVE_RAM_SIZE); |
104 |
|
|
105 |
|
// Open joystick drivers if required |
106 |
< |
open_close_joysticks(false, false, ThePrefs.Joystick1On, ThePrefs.Joystick2On); |
106 |
> |
open_close_joysticks(0, 0, ThePrefs.Joystick1Port, ThePrefs.Joystick2Port); |
107 |
|
joykey = 0xff; |
108 |
|
|
109 |
|
#ifdef FRODO_SC |
121 |
|
|
122 |
|
C64::~C64() |
123 |
|
{ |
124 |
< |
open_close_joysticks(ThePrefs.Joystick1On, ThePrefs.Joystick2On, false, false); |
124 |
> |
open_close_joysticks(ThePrefs.Joystick1Port, ThePrefs.Joystick2Port, 0, 0); |
125 |
|
|
126 |
|
delete TheJob1541; |
127 |
|
delete TheREU; |
179 |
|
|
180 |
|
void C64::NewPrefs(Prefs *prefs) |
181 |
|
{ |
182 |
< |
open_close_joysticks(ThePrefs.Joystick1On, ThePrefs.Joystick2On, prefs->Joystick1On, prefs->Joystick2On); |
182 |
> |
open_close_joysticks(ThePrefs.Joystick1Port, ThePrefs.Joystick2Port, prefs->Joystick1Port, prefs->Joystick2Port); |
183 |
|
PatchKernal(prefs->FastReset, prefs->Emul1541Proc); |
184 |
|
|
185 |
|
TheDisplay->NewPrefs(prefs); |
713 |
|
#endif |
714 |
|
|
715 |
|
#ifdef __unix |
716 |
< |
#include "C64_x.h" |
716 |
> |
# if defined(QTOPIA) or defined(MAEMO) |
717 |
> |
# include "C64_Embedded.h" |
718 |
> |
# else |
719 |
> |
# include "C64_x.h" |
720 |
> |
# endif |
721 |
|
#endif |
722 |
|
|
723 |
|
#ifdef __mac__ |