Skip to content

Commit

Permalink
Merge pull request #6 from tom-seddon/wip/master
Browse files Browse the repository at this point in the history
Changes from wip/master 1206
  • Loading branch information
zoltanvb authored Dec 6, 2024
2 parents 62a6aec + 935fb71 commit c2f21e7
Show file tree
Hide file tree
Showing 46 changed files with 1,023 additions and 931 deletions.
4 changes: 0 additions & 4 deletions doc/Building-on-Unix.md
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,3 @@ warnings.
# Running the automated tests

`ninja test` will run the full set of tests.

A shorter set of tests can be run using cmake's `ctest` tool:

ctest -LE 'slow|kevin_edwards' --output-on-failure
25 changes: 15 additions & 10 deletions doc/Building-on-Windows.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,23 +34,28 @@ information and the initial build steps ensure everything is rebuilt.)

# Notes

- Because of the way cmake works, there are 40+ projects in the
solution. Even though most are never used, they're still there
- Because of the way cmake works, there are 50+ projects in the
solution. Even though most are rarely used, they're still there
cluttering the place up. You just have to put up with this

# Running the automated tests

Set the startup project to be `visual_studio_test_runner`, build, and
run. This runs the full set of tests, such as it is, and takes about 4
minutes on my laptop.
To run from the command line, run `make run_tests_vs2019
CONFIG=<<config>>`, supplying the config of interest (`Debug`,
`RelWithDebInfo` or `Final`). This will run the tests in parallel
according to PC core count.

You can exclude the slow tests with the
`visual_studio_test_runner_subset` project, which finishes in about 5
seconds.
To run in the debugger, set the Visual Studio startup project to be
`visual_studio_test_runner`, build, and run. This runs the full set of
tests, such as it is, one test at a time.

You can exclude the particularly slow tests with the
`visual_studio_test_runner_subset` project, which will finish a bit
more quickly.

If you have the child process debugging tool installed, the debugger
will attach to each test case as it is executed. This does add
overhead but makes debugging a lot easier.

Each test case has its own project in the solution, so you can also
run them independently.
Individual tests can be run by setting each one as the startup
project.
96 changes: 96 additions & 0 deletions doc/b2_notes.org
Original file line number Diff line number Diff line change
Expand Up @@ -1677,5 +1677,101 @@ xma1 xma2
| wv | raw WavPack | audio/x-wavpack | wavpack | (none) | (none) | (none) | wv |
| yuv4mpegpipe | YUV4MPEG pipe | (null) | (none) | wrapped_avframe | (none) | (none) | y4m |

* Disk seek noises

| Sample | Duration (ms) | Step rate (ms) |
|-------------------+---------------+----------------|
| 35_seek_2ms.wav | 83 | 2 |
| 35_seek_6ms.wav | 251 | 6 |
| 35_seek_12ms.wav | 300 | 12 |
| 35_seek_20ms.wav | 500 | 20 |
| 35_step_1_1.wav | 77 | 30 |
| 525_seek_2ms.wav | 60 | 2 |
| 525_seek_6ms.wav | 167 | 6 |
| 525_seek_12ms.wav | 257 | 12 |
| 525_seek_20ms.wav | 340 | 20 |
| 525_step_1_1.wav | 74 | 30 |

* beeb_lib test types

Separate EXE for each one is no fun! It'd be nice to rationalise this
somehow.

** Kevin Edwards

Parameters:

1. File containing minimized Kevin Edwards protection routine
2. Text (possibly >1 line) for pasting in at BASIC prompt

All dealt with by shared function: =TestKevinEwards=

** Standard

Parameters:

1. File to load
2. BBC Micro type

All dealt with by shared function: =RunStandardTest=

** Teletest

Parameters:

1. Teletext image file to load
2. .png file to compare it to

All dealt with by shared function: =RunStandardTest=

** dp111 6502Timing

Parameters:

1. BBC Micro type
2. .ssd file to run =6502tim= from

** Hoglet Tube test

Parameters:

1. BBC Micro type
2. File to load and address to load it to
3. Pre-test command to paste
4. Post-test command to paste
5. =*CONFIGURE NOTUBE= or =*CONFIGURE EXTUBE=

All dealt with by shared function: =TestTube=

* New Tests

** Before

Build folder = 11.3 GB

Test run times:

- Debug :: 138.637
- RelWithDebInfo :: 63.994
- Final :: 48.121

** After (1st pass)

Build folder = 2.9 GB

Test run times:

- Debug :: 66.374
- RelWithDebInfo :: 34.846
- Final :: 34.972

** After (2nd pass)

=Total Test Time= times:

- Debug :: 67.76
- RelWithDebInfo :: 32.62
- Final :: 31.47


* eof.
6 changes: 3 additions & 3 deletions experimental/test_ffmpeg/test_ffmpeg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -830,9 +830,9 @@ int main(int argc, char *argv[]) {
// Ensure denominator is max 65535. See mpegvideo_enc.c.
// frame_duration.num = 100000;
// frame_duration.den = (int)(fps * 100000.);
frame_duration.num=(int)(65535.0/fps);
frame_duration.den=65535;
frame_duration.num = (int)(65535.0 / fps);
frame_duration.den = 65535;

// the calculation can be (# jpegs)*(bytes/sec)/(bytes data),
// which could be used as the MF_MT_FRAME_RATE_FPS ratio. But
// they're only UINT32s and that doesn't leave much overhead.
Expand Down
2 changes: 1 addition & 1 deletion experimental/test_ffmpeg/test_ffmpeg.inl
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ NEND()
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////

#if LIBAVFORMAT_VERSION_MAJOR>=59
#if LIBAVFORMAT_VERSION_MAJOR >= 59
#define ENAME int
NBEGIN(AVChannelOrder)
NN(AV_CHANNEL_ORDER_UNSPEC)
Expand Down
2 changes: 1 addition & 1 deletion src/b2/BeebConfig.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -532,7 +532,7 @@ bool BeebLoadedConfig::Load(

if (dest->config.parasite_os.standard_rom ||
!dest->config.parasite_os.file_name.empty()) {
dest->parasite_os = LoadOSROM<2048>(dest->config.parasite_os, msg);
dest->parasite_os = LoadOSROM<4096>(dest->config.parasite_os, msg);
if (!dest->parasite_os) {
return false;
}
Expand Down
2 changes: 1 addition & 1 deletion src/b2/BeebConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ class BeebLoadedConfig {

std::shared_ptr<const std::array<uint8_t, 16384>> os;
std::shared_ptr<const std::vector<uint8_t>> roms[16];
std::shared_ptr<const std::array<uint8_t, 2048>> parasite_os;
std::shared_ptr<const std::array<uint8_t, 4096>> parasite_os;

static bool Load(BeebLoadedConfig *dest, const BeebConfig &src, Messages *msg);

Expand Down
13 changes: 9 additions & 4 deletions src/b2/BeebThread.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2954,8 +2954,7 @@ void BeebThread::ThreadMain(void) {
(void)what;

if (paused ||
(m_is_speed_limited.load(std::memory_order_acquire) &&
ts.next_stop_cycles.n <= ts.num_executed_cycles->n)) {
(m_is_speed_limited.load(std::memory_order_acquire) && ts.next_stop_cycles.n <= ts.num_executed_cycles->n)) {
PROFILE_SCOPE(PROFILER_COLOUR_ALICE_BLUE, "MQ Wait");
rmt_ScopedCPUSample(MessageQueueWaitForMessage, 0);
m_mq.ConsumerWaitForMessages(&messages);
Expand Down Expand Up @@ -3007,10 +3006,16 @@ void BeebThread::ThreadMain(void) {
}
}

stop_cycles = ts.next_stop_cycles;

messages.clear();

if (!ts.beeb) {
// No point carrying on with the other stuff if there's
// currently no emulated beeb.
continue;
}

stop_cycles = ts.next_stop_cycles;

uint32_t clone_impediments = ts.beeb->GetCloneImpediments();

m_clone_impediments.store(clone_impediments, std::memory_order_release);
Expand Down
3 changes: 3 additions & 0 deletions src/b2/BeebWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,7 @@ static bool InitialiseTogglePopupCommands() {
InitialiseTogglePopupCommand(BeebWindowPopupType_KeyboardDebug, "toggle_keyboard_debug", "Keyboard debug", &CreateKeyboardDebugWindow);
InitialiseTogglePopupCommand(BeebWindowPopupType_SystemDebug, "toggle_system_debug", "System debug", &CreateSystemDebugWindow);
InitialiseTogglePopupCommand(BeebWindowPopupType_MouseDebug, "toggle_mouse_debug", "Mouse debug", &CreateMouseDebugWindow);
InitialiseTogglePopupCommand(BeebWindowPopupType_WD1770Debug, "toggle_wd1770_debug", "WD1770 Debug", &CreateWD1770DebugWindow);
return true;
}

Expand Down Expand Up @@ -560,6 +561,7 @@ BeebWindow::BeebWindow(BeebWindowInitArguments init_arguments)
m_beeb_thread->SetBBCVolume(m_settings.bbc_volume);
m_beeb_thread->SetDiscVolume(m_settings.disc_volume);
m_beeb_thread->SetPowerOnTone(m_settings.power_on_tone);
m_beeb_thread->Send(std::make_shared<BeebThread::SetSpeedLimitedMessage>(m_init_arguments.limit_speed));

m_blend_amt = 1.f;
}
Expand Down Expand Up @@ -2221,6 +2223,7 @@ void BeebWindow::DoDebugMenu() {
m_cst.DoMenuItem(g_popups[BeebWindowPopupType_DigitalJoystickDebugger].command);
m_cst.DoMenuItem(g_popups[BeebWindowPopupType_KeyboardDebug].command);
m_cst.DoMenuItem(g_popups[BeebWindowPopupType_MouseDebug].command);
m_cst.DoMenuItem(g_popups[BeebWindowPopupType_WD1770Debug].command);

ImGui::Separator();

Expand Down
3 changes: 3 additions & 0 deletions src/b2/BeebWindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,9 @@ struct BeebWindowInitArguments {
// If set, try to autoboot. Only set for the first window created - the
// value comes from the --boot command line option.
bool boot = false;

// Initial setting for the speed limiting.
bool limit_speed = true;
};

//////////////////////////////////////////////////////////////////////////
Expand Down
1 change: 1 addition & 0 deletions src/b2/BeebWindow.inl
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ EPN(ImGuiDebug)
EPN(KeyboardDebug)
EPN(SystemDebug)
EPN(MouseDebug)
EPN(WD1770Debug)

// must be last
EQPN(MaxValue)
Expand Down
7 changes: 0 additions & 7 deletions src/b2/HTTPServer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,6 @@
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////

#ifdef _MSC_VER
#define strcasecmp(A, B) (_stricmp((A), (B)))
#endif

//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////

LOG_TAGGED_DEFINE(HTTPSV, "http", "HTTPSV", &log_printer_stdout_and_debugger, false);

//////////////////////////////////////////////////////////////////////////
Expand Down
3 changes: 3 additions & 0 deletions src/b2/b2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -646,6 +646,7 @@ struct Options {
bool vsync = false;
bool timer = false;
std::string config_name;
bool limit_speed = true;
#if RMT_ENABLED
bool remotery = false;
bool remotery_thread_sampler = false;
Expand Down Expand Up @@ -720,6 +721,7 @@ static bool ParseCommandLineOptions(

p.AddOption('b', "boot").SetIfPresent(&options->boot).Help("attempt to auto-boot disc");
p.AddOption('c', "config").Arg(&options->config_name).Meta("CONFIG").Help("start emulator with configuration CONFIG");
p.AddOption("no-limit-speed").ResetIfPresent(&options->limit_speed).Help("start emulator with speed limiting disabled");

p.AddOption("hz").Arg(&options->audio_hz).Meta("HZ").Help("set sound output frequency to HZ").ShowDefault();
p.AddOption("buffer").Arg(&options->audio_buffer_size).Meta("SAMPLES").Help("set audio buffer size, in samples (must be a power of two <32768: 512, 1024, 2048, etc.)").ShowDefault();
Expand Down Expand Up @@ -1397,6 +1399,7 @@ static bool main2(int argc, char *argv[], const std::shared_ptr<MessageList> &in
}

ia.boot = options.boot;
ia.limit_speed = options.limit_speed;
}

if (!BeebWindows::CreateBeebWindow(ia)) {
Expand Down
Loading

0 comments on commit c2f21e7

Please sign in to comment.