Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Libretro
81-libretro
Commits
05408ce5
Commit
05408ce5
authored
Jul 21, 2015
by
Andre Leiradella
Browse files
added zon x-81 sound and option to enable 8k ram at 000
parent
a88dca94
Changes
4
Hide whitespace changes
Inline
Side-by-side
81/sound/sound.c
View file @
05408ce5
...
...
@@ -58,15 +58,19 @@ extern void MidiWriteBit(int Bit);
//int sound_vsync=0;
//int sound_ay_type=1;
// this patch is perhaps worse than the original,
// in any case for ZONX
#ifdef SNDPTCH
int
temp1
,
temp2
,
temp3
;
#endif
extern
int
frametstates
;
int
SelectAYReg
;
/* configuration */
int
sound_enabled
=
1
;
int
sound_freq
=
2205
0
;
int
sound_stereo
=
0
;
int
sound_freq
=
4410
0
;
int
sound_stereo
=
1
;
int
sound_stereo_acb
=
0
;
/* 1 for ACB stereo, else 0 */
/* sound_vsync and sound_ay are in common.c */
...
...
@@ -331,16 +335,17 @@ static void sound_ay_overlay(void)
{
case
0
:
case
1
:
case
2
:
case
3
:
case
4
:
case
5
:
r
=
reg
>>
1
;
#ifdef SNDPTCH
temp1
=
sound_ay_registers
[
reg
&~
1
];
temp2
=
sound_ay_registers
[
reg
|
1
]
&
15
;
temp3
=
8
*
(
temp1
|
temp2
)
<<
16
;
ay_tone_period
[
r
]
=
temp1
|
temp3
;
#else
//ay_tone_period[r]=(8*(sound_ay_registers[reg&~1]|
// (sound_ay_registers[reg|1]&15)<<8))<<16;
ay_tone_period
[
r
]
=
(
8
*
(
sound_ay_registers
[
reg
&~
1
]
|
(
sound_ay_registers
[
reg
|
1
]
&
15
)
<<
8
))
<<
16
;
#endif
/* important to get this right, otherwise e.g. Ghouls 'n' Ghosts
* has really scratchy, horrible-sounding vibrato.
*/
...
...
81/zx81/zx81.c
View file @
05408ce5
...
...
@@ -310,6 +310,19 @@ BYTE zx81_opcode_fetch(int Address)
// loading it into the video shift register.
if
(
z80
.
i
>=
zx81
.
maxireg
&&
zx81
.
truehires
==
HIRESWRX
&&
!
bit6
)
{
if
(
zx81
.
colour
==
COLOURCHROMA
)
{
int
c
;
// If the Chroma 81 interface is enabled, we had better fetch
// the ink and paper colour from memory too.
c
=
memory
[
Address
];
pink
=
c
&
15
;
ppaper
=
(
c
>>
4
)
&
15
;
}
data
=
zx81_readbyte
((
z80
.
i
<<
8
)
|
(
z80
.
r7
&
128
)
|
((
z80
.
r
-
1
)
&
127
));
update
=
1
;
}
...
...
@@ -358,8 +371,6 @@ BYTE zx81_opcode_fetch(int Address)
c
=
memory
[
0xc000
+
(
data2
<<
3
)
+
rowcounter
];
}
ink
=
pink
;
paper
=
ppaper
;
pink
=
c
&
15
;
ppaper
=
(
c
>>
4
)
&
15
;
}
...
...
@@ -409,12 +420,12 @@ BYTE zx81_opcode_fetch(int Address)
c
=
zx81_readbyte
((
Address
&
1023
)
+
8192
);
ink
=
c
&
15
;
paper
=
(
c
>>
4
)
&
15
;
p
ink
=
c
&
15
;
p
paper
=
(
c
>>
4
)
&
15
;
if
(
setborder
)
{
border
=
paper
;
border
=
p
paper
;
setborder
=
0
;
}
}
...
...
@@ -444,9 +455,6 @@ BYTE zx81_opcode_fetch(int Address)
if
(
zx81
.
colour
==
COLOURCHROMA
)
{
ink
=
pink
;
paper
=
ppaper
;
pink
=
ppaper
=
zx81
.
chromamode
&
15
;
}
...
...
@@ -469,10 +477,12 @@ void zx81_writeport(int Address, int Data, int *tstates)
configbyte
=
Data
;
break
;
case
0x0f
:
case
0x1f
:
if
(
zx81
.
aytype
==
AY_TYPE_ZONX
)
sound_ay_write
(
SelectAYReg
,
Data
);
break
;
case
0xcf
:
case
0xdf
:
if
(
zx81
.
aytype
==
AY_TYPE_ACE
)
sound_ay_write
(
SelectAYReg
,
Data
);
if
(
zx81
.
aytype
==
AY_TYPE_ZONX
)
SelectAYReg
=
Data
&
15
;
...
...
@@ -492,6 +502,7 @@ void zx81_writeport(int Address, int Data, int *tstates)
if
(
zx81
.
ts2050
)
d8251writeCTRL
(
Data
);
break
;
/*
case 0xc7:
d8255_write(D8255PRTA,Data);
break;
...
...
@@ -503,6 +514,7 @@ void zx81_writeport(int Address, int Data, int *tstates)
case 0xd7:
d8255_write(D8255PRTC,Data);
break;
*/
case
0xdd
:
if
(
zx81
.
aytype
==
AY_TYPE_ACE
)
SelectAYReg
=
Data
;
...
...
@@ -730,6 +742,12 @@ int zx81_do_scanline()
shift_register
<<=
1
;
shift_reg_inv
<<=
1
;
if
(
zx81
.
colour
==
COLOURCHROMA
&&
i
==
7
)
{
ink
=
pink
;
paper
=
ppaper
;
}
}
switch
(
LastInstruction
)
...
...
@@ -765,7 +783,9 @@ int zx81_do_scanline()
hsync_counter
-=
ts
;
if
(
!
(
z80
.
r
&
64
))
// check iff1 to avoid changing border color in some WRX modes
if
(
!
(
z80
.
r
&
64
)
&&
z80
.
iff1
)
int_pending
=
1
;
if
(
!
HSYNC_generator
)
sync_len
+=
ts
;
...
...
Makefile.libretro
View file @
05408ce5
...
...
@@ -256,7 +256,7 @@ endif
DEFINES
:=
-D__LIBRETRO__
$(PLATFORM_DEFINES)
DEFINES
+=
-DHAVE_CONFIG_H
DEFINES
+=
-DHAVE_CONFIG_H
-DSNDPTCH
CFLAGS
+=
$(fpic)
$(DEFINES)
CFLAGS
+=
-Wall
...
...
src/libretro.cpp
View file @
05408ce5
...
...
@@ -68,9 +68,11 @@ static state_t state;
static
const
struct
retro_variable
core_vars
[]
=
{
{
"81_fast_load"
,
"Tape Fast Load; enabled|disabled"
},
{
"81_
chroma_81"
,
"Emulate Chroma 81; disabled|enabled
"
},
{
"81_
8_16_contents"
,
"8K-16K Contents; ROM shadow|RAM
"
},
{
"81_highres"
,
"High Resolution; none|WRX"
},
{
"81_chroma_81"
,
"Emulate Chroma 81; disabled|enabled"
},
{
"81_video_presets"
,
"Video Presets; clean|tv|noisy"
},
{
"81_sound"
,
"Sound emulation; none|Zon X-81"
},
{
"81_keybovl_transp"
,
"Transparent Keyboard Overlay; enabled|disabled"
},
{
"81_key_hold_time"
,
"Time to Release Key in ms; 500|1000|100|300"
},
{
NULL
,
NULL
},
...
...
@@ -85,6 +87,13 @@ static int update_variables( void )
int
old_scaled
=
state
.
scaled
;
TZXFile
.
FlashLoad
=
coreopt
(
env_cb
,
core_vars
,
"81_fast_load"
,
NULL
)
!=
1
;
{
int
option
=
coreopt
(
env_cb
,
core_vars
,
"81_8_16_contents"
,
NULL
)
==
1
;
option
+=
option
<
0
;
reset
=
reset
||
state
.
cfg
.
EnableLowRAM
!=
option
;
state
.
cfg
.
EnableLowRAM
=
option
;
}
{
int
option
=
coreopt
(
env_cb
,
core_vars
,
"81_video_presets"
,
NULL
);
...
...
@@ -186,10 +195,18 @@ static int update_variables( void )
static
int
hires
[]
=
{
HIRESDISABLED
,
HIRESWRX
};
int
option
=
coreopt
(
env_cb
,
core_vars
,
"81_highres"
,
NULL
);
option
+=
option
<
0
;
reset
=
state
.
cfg
.
HiRes
!=
hires
[
option
];
reset
=
reset
||
state
.
cfg
.
HiRes
!=
hires
[
option
];
state
.
cfg
.
HiRes
=
hires
[
option
];
}
{
static
int
sound
[]
=
{
AY_TYPE_DISABLED
,
AY_TYPE_ZONX
};
int
option
=
coreopt
(
env_cb
,
core_vars
,
"81_sound"
,
NULL
);
option
+=
option
<
0
;
reset
=
reset
||
state
.
cfg
.
SoundCard
!=
sound
[
option
];
state
.
cfg
.
SoundCard
=
sound
[
option
];
}
state
.
transp
=
coreopt
(
env_cb
,
core_vars
,
"81_keybovl_transp"
,
NULL
)
!=
1
;
{
...
...
@@ -285,7 +302,7 @@ bool retro_load_game( const struct retro_game_info* info )
memcpy
(
state
.
data
,
info
->
data
,
state
.
size
);
state
.
devices
[
0
]
=
RETRO_DEVICE_CURSOR_JOYSTICK
;
state
.
devices
[
1
]
=
RETRO_DEVICE_
CURSOR_JOYSTICK
;
state
.
devices
[
1
]
=
RETRO_DEVICE_
SINCLAIR_KEYBOARD
;
state
.
cfg
.
machine
=
MACHINEZX81
;
state
.
cfg
.
LambdaColour
=
COLOURDISABLED
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment