Skip to content

Commit

Permalink
Minor changes
Browse files Browse the repository at this point in the history
* added distinct soft reset and hard reset
* fixed tape play/stop in the menu
* fixed warnings
* added Cia source files to Code::Blocks project file
  • Loading branch information
calmopyrin committed Jul 13, 2018
1 parent d6aa707 commit a764a35
Show file tree
Hide file tree
Showing 7 changed files with 32 additions and 23 deletions.
2 changes: 2 additions & 0 deletions YapeSDL.VS14.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,8 @@
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<EnablePREfast>false</EnablePREfast>
<Optimization>Full</Optimization>
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
</ClCompile>
<Link>
<AdditionalDependencies>SDL2main.lib;SDL2.lib;legacy_stdio_definitions.lib;%(AdditionalDependencies)</AdditionalDependencies>
Expand Down
2 changes: 2 additions & 0 deletions YapeSDL.cbp
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@
<Unit filename="1541mem.cpp" />
<Unit filename="1541mem.h" />
<Unit filename="1541rom.h" />
<Unit filename="Cia.cpp" />
<Unit filename="Cia.h" />
<Unit filename="FdcGcr.cpp" />
<Unit filename="FdcGcr.h" />
<Unit filename="SaveState.cpp" />
Expand Down
16 changes: 8 additions & 8 deletions diskfs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -102,18 +102,18 @@ unsigned char CIECFSDrive::OpenFile(int channel, char *filename)
FindFirstFile(plainname);
} else {

switch (filetype) {
switch (filetype) {
case FTYPE_PRG:
strcpy( extension, ".prg"); // Add .prg extension
strcpy(extension, ".prg"); // Add .prg extension
break;
/*case FTYPE_SEQ:
strcpy( extension, ".seq"); // Add .seq extension
break;*/
/*case FTYPE_SEQ:
strcpy( extension, ".seq"); // Add .seq extension
break;*/
default:
strcpy( extension, ".prg");
strcpy(extension, ".prg");
}
strcat(plainname, extension); /* Add extension */
}
strcat( plainname, extension); /* Add extension */
}
//fprintf(stderr,"Searching for: %s\n", plainname);

switch (filemode) {
Expand Down
6 changes: 6 additions & 0 deletions interface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -501,6 +501,12 @@ bool UI::handle_menu_command( struct element_t *element)
case UI_TAPE_REWIND:
ted8360->tap->rewind();
break;
case UI_TAPE_STOP:
ted8360->tap->pressTapeButton(ted8360->GetClockCount(), 0);
break;
case UI_TAPE_PLAY:
ted8360->tap->pressTapeButton(ted8360->GetClockCount(), 1);
break;
case UI_FILE_LOAD_PRG:
show_file_list( &file_menu, UI_PRG_ITEM );
return false;
Expand Down
14 changes: 7 additions & 7 deletions main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
and/or modify it under certain conditions. For more information,
read 'Copying'.
(c) 2000, 2001, 2004, 2005, 2007, 2015 Attila Grósz
(c) 2000, 2001, 2004, 2005, 2007, 2015-2018 Attila Grósz
(c) 2005 VENESZ Roland
*/

Expand Down Expand Up @@ -268,11 +268,6 @@ bool start_file(const char *szFile, bool autostart = true)
{
char *pFileExt = (char *) strrchr(szFile, '.');

// to work around a few buggy defenders...
if (!ted8360->getEmulationLevel())
while (ted8360->beamy != 240)
ted8360->ted_process(0);

if (pFileExt) {
char *fileext = pFileExt;
if (!strcmp(fileext,".d64") || !strcmp(fileext,".D64")) {
Expand Down Expand Up @@ -317,6 +312,10 @@ bool autostart_file(const char *szFile, bool autostart)
// do some frames
unsigned int frames = ted8360->getAutostartDelay();
machineDoSomeFrames(frames);
// to work around a few buggy defenders...
if (!ted8360->getEmulationLevel())
while (ted8360->getVerticalCount() != 160)
ted8360->ted_process(0);
// and then try to load the parameter as file
return start_file(szFile, autostart);
}
Expand Down Expand Up @@ -844,7 +843,7 @@ inline static void poll_events(void)
break;
case SDLK_r:
ted8360->Reset(false);
machineReset(false);
machineReset((event.key.keysym.mod & (KMOD_LSHIFT | KMOD_RSHIFT)) != 0);
printf("Resetting...\n");
PopupMsg(" RESET ");
break;
Expand Down Expand Up @@ -901,6 +900,7 @@ inline static void poll_events(void)
{
unsigned int buttonPressed = ted8360->tap->IsButtonPressed();
ted8360->tap->pressTapeButton(ted8360->GetClockCount(), !buttonPressed);
PopupMsg(" %s TAPE... ", buttonPressed ? "STOPPING" : "PLAYING");
}
break;

Expand Down
7 changes: 3 additions & 4 deletions tape.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
and/or modify it under certain conditions. For more information,
read 'Copying'.
(c) 2000, 2001, 2005 Attila Grósz
(c) 2000, 2001, 2005, 2016-2018 Attila Grósz
*/

#include "tape.h"
Expand Down Expand Up @@ -35,7 +35,7 @@ enum {

static unsigned char mtap_header_default[]={
'C','1','6','-','T','A','P','E','-','R','A','W',
0x02, // version -> 1 - whole wave 2 - wholeWave
0x02, // version -> 1 - "whole wave" 2 - "half wave"
0x02, // 0 - C64, 1 - VIC20, 2 - C16/+4
0x00, // Video standard ( 0= PAL, 1 =NTSC, 2 = NTSC2
0x00, // empty
Expand All @@ -48,7 +48,7 @@ const char tapeFormatStr[][32] = {
"MTAP1", "MTAP2", "PCM WAV 8-bit", "PCM WAV 16-bit", "Unknown"
};

TAP::TAP() : tapeSoFar(0), tapeFileSize(0), tapeBuffer(NULL), lastCycle(0), edge(0), buttonPressed(0)
TAP::TAP() : tapeFileSize(0), tapeBuffer(NULL), lastCycle(0), edge(0), buttonPressed(0), tapeSoFar(0)
{
buttonPressed = motorOn = false;
}
Expand Down Expand Up @@ -193,7 +193,6 @@ inline void TAP::readWavData(unsigned int elapsed)
int sample = tapeBuffer[tapeSoFar++];

if (tapeFormat == TAPE_FORMAT_PCM16) {
short in = short(sample | (tapeBuffer[tapeSoFar++] << 8));
sample += tapeBuffer[tapeSoFar++] << 8;
int change = short(sample) - prevSample;
if (sample > 0 && change > 0) {
Expand Down
8 changes: 4 additions & 4 deletions tedmem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ enum {
TRFSHDELAY = 1 << 11
};

TED::TED() : sidCard(0), SaveState(), clockDivisor(10), crsrphase(0)
TED::TED() : SaveState(), sidCard(0), crsrphase(0), clockDivisor(10)
{
unsigned int i;

Expand Down Expand Up @@ -154,14 +154,14 @@ TED::TED() : sidCard(0), SaveState(), clockDivisor(10), crsrphase(0)
BadLine = 0;
CycleCounter = 0;
retraceScanLine = RETRACESCANLINEMAX;

tedSoundInit(sampleRate);
if (enableSidCard(true, 0)) {
//sidCard->setModel(SID8580DB);
}
}

void TED::flipRamMask(void *none)
void TED::flipRamMask(void *none)
{
if (RAMMask == 0xFFFF) RAMMask = 0x3FFF;
else if (RAMMask == 0x7FFF) RAMMask = 0xFFFF;
Expand Down Expand Up @@ -272,7 +272,7 @@ void TED::loadromfromfile(int nr, const char fname[512], unsigned int offset)
case 1: if (!strncmp(fname, "3PLUS1LOW",9))
memcpy(rom[1] + offset, plus4lo, ROMSIZE);
else if (!strncmp(fname, "3PLUS1HIGH", 10))
memcpy(rom[1] + offset, plus4hi, ROMSIZE);
memcpy(rom[1] + offset, plus4hi, ROMSIZE);
else
memset(rom[1] + offset, 0, ROMSIZE);
break;
Expand Down

0 comments on commit a764a35

Please sign in to comment.