Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FPS setting affects speed of the emulator #86

Open
Myron-S opened this issue Feb 1, 2021 · 7 comments
Open

FPS setting affects speed of the emulator #86

Myron-S opened this issue Feb 1, 2021 · 7 comments

Comments

@Myron-S
Copy link

Myron-S commented Feb 1, 2021

Not sure if this is a bug or by design.

Emulating: Master 128
View: Real Time
Speed is showing at 1.00 and fps is 50.
Emulator at this point is operating fine.

The issue:

I attach the Sprow ARM7TDMI 2nd processor and reset the emulator.
Speed remains at about 1.00, but fps now between 0 to 12 and fluctuating between the two and the emulated session runs so slow that when a key is pressed, can take about 1 to 3 seconds to appear.

When I lock the fps to 50, this changes speed to about 0.92 and the emulated machine becomes usable.
The above is the workaround. I think because the ARM7TDMI operated at 64MHz that locking the speed to 50 fps from real time essentially throttles the emulated co-processor?

When I remove the Co-processor fps remains at 50, but the speed of the emulated Master 128 is now at about 25 times the normal speed until I set speed back to real-time.

I'm curious why the frames per second setting is affecting the speed of the emulated machine. Is this a bug?

@chrisn
Copy link
Collaborator

chrisn commented Feb 1, 2021

I attach the Sprow ARM7TDMI 2nd processor and reset the emulator. Speed remains at about 1.00, but fps now between 0 to 12 and fluctuating between the two and the emulated session runs so slow that when a key is pressed, can take about 1 to 3 seconds to appear.

This seems strange - on my laptop I get speed 1.0 with fps between 20 and 30 and keyboard responsiveness is fine. BeebEm simply skips rendering video frames to try to keep the speed of the emulated CPU at 1.0 (relative to a real Beeb), so I'm surprised that keypresses take longer to respond.

@Myron-S
Copy link
Author

Myron-S commented Feb 1, 2021

One frame a second. Sometimes is stays at 0 frames a second for several seconds.
All I do is select the ARM7TDI co-processor.
When I change it back to no co-processor then the speed hovers closely at 1 and frames per second stay at 50.

My laptop is: Intel(R) Core(TM) i7-7700HQ CPU @ 2.80GHz, 2808 Mhz, 4 Core(s), 8 Logical Processor(s)
CPU speed sits above 2808 Mhz. Usually sits at nearer the manufacturer's ceiling of 3490 Mhz.
Windows 10 is configured to use the CPU's integrated CPU.

On my system is BeebEm skipping, at times, more then 50 frames when set to Real time so everything stops?

I tried the Master 512 co-processor and it works perfectly. GEM desktop (and that brings back memories). Just that prototype ARM co-processor.

Strange indeed.

image

preferences.cfg

*** BeebEm Preferences ***

AMXMouseAdjust=00009c89
AMXMouseEnabled=01
AMXMouseLRForMiddle=00000001
AMXMouseSize=00009c85
AVIPath=
AutoSavePrefsAll=00
AutoSavePrefsCMOS=01
AutoSavePrefsFolders=00
Basic Hardware=00
BitKeys=3031323334353637
BitmapCaptureFormat=00009d4a
BitmapCaptureResolution=00009d48
CMOSRam=0400000000c9fffe320007c11e050059a2000000000000000000000000000000000000000000000000000000000000000000
CaptureResolution=00009cfa
DDFullScreenMode=00009ca6
DXSmoothMode7Only=00
DXSmoothing=01
DisableKeysBreak=00
DisableKeysEscape=00
DisableKeysShortcut=00
DiscDriveSoundEnabled=00
DiscsFilter=00000000
DiscsPath=DiscIms
DisplayRenderer=00009d1b
EconetEnabled=01
ExponentialVolume=01
FDCDLL0=None
FDCDLL1=None
FDCDLL2=Hardware\Acorn1770.dll
FDCDLL3=None
FloppyDriveEnabled=01
FrameSkip=00009cfd
FreezeWhenInactive=00
FullScreen=00
HideCursor=00
HideMenuEnabled=00
IDEDriveEnabled=00
IP232custom=00
IP232customip=
IP232customport=00006290
IP232localhost=00
IP232mode=00
IP232raw=00
ImagePath=
KeyMapAS=00
KeyMapFunc=00
KeyMapping=00009c63
LED Information=03
MachineType=03
MaintainAspectRatio=01
Monitor=00
MotionBlur=00009cf1
MotionBlurIntensities=64584b3e3226190c
Music5000Enabled=00
Part Samples=01
PrefsVersion=2.1
PrinterEnabled=00
PrinterFile=
PrinterPort=00009c92
RTCEnabled=00
RTCY2KAdjust=01
RelaySoundEnabled=00
SCSIDriveEnabled=01
SWRAMBoard=00
SWRAMWritable=00000000010101010000000000000000
SampleRate=00009c4e
SerialPort=02
SerialPortEnabled=00
ShowFSP=01
SoundChipEnabled=01
SoundConfig::Selection=00000000
SoundEnabled=01
SoundVolume=00009c55
StatesPath=BeebState
Sticks=00000000
Tape Clock Speed=e015
TapeSoundEnabled=00
TapesPath=Tapes
Teletext Half Mode=00
TeletextAdapterEnabled=00
TeletextCustom=00
TeletextCustomIP0=127.0.0.1
TeletextCustomIP1=127.0.0.1
TeletextCustomIP2=127.0.0.1
TeletextCustomIP3=127.0.0.1
TeletextCustomPort0=00004d31
TeletextCustomPort1=00004d32
TeletextCustomPort2=00004d33
TeletextCustomPort3=00004d34
TeletextLocalhost=00
TextToSpeechEnabled=00
TextViewEnabled=00
Timing=00009c58
TouchScreenEnabled=00
TubeType=00
UnlockTape=00
UserKeyMapFile=DefaultUser.kmap
WinSize=00009d59
WinSizeX=00000320
WinSizeY=00000258
WindowPos=12020000810000004405000021030000
WriteInstructionCounts=00
WriteProtectOnLoad=01

image

image

Note the speed. When locked at 50 FPS the cursor looks like it's having a fit.

@Myron-S
Copy link
Author

Myron-S commented Feb 3, 2021

I've had a look at the code. Right now, at this level, it's over my head. I'm a systems geek and applications programmer. I'm not a stranger to assembler and machine code and cut my skills on mnemonics on paper, dry-run, covert to decimal and then poke the program into a ZX81 REM statement what was formatted to be long enough to hold the machine code program, but that was quite a while ago. This is your realm. :-)

From there I moved into this:
https://en.wikipedia.org/wiki/AIM-65

@chrisn
Copy link
Collaborator

chrisn commented Feb 3, 2021

Thanks! My laptop is Intel i7-10510 CPU at 1.8GHz, so not dissimilar performance to yours, so I'm surprised we get such different results. The speed adjustment is a part of the code that I've never really looked at before, so I'm not familiar with what it's doing. I'd guess there's a bug somewhere in there, so hopefully we can track it down. I generally only use the Real time option, so I'm not sure what the fixed FPS options mean.

@Myron-S
Copy link
Author

Myron-S commented Feb 3, 2021

Ok. Where is the code that manages Speed located? Maybe there may be a slight chance I might just see where the issue lies?

@chrisn
Copy link
Collaborator

chrisn commented Feb 3, 2021

The menu commands are handled here. If you select one of the Fixed speed options, then m_FPSTarget is set to 0 and the m_RealTimeTarget value is used. Conversely, the FPS options use m_FPSTarget and set m_RealTimeTarget to 0.

The actual speed adjustment is done here. This is called by the CRTC emulation when the emulated Beeb starts a new video frame.

@Myron-S
Copy link
Author

Myron-S commented Feb 3, 2021

Initial quick observation.

When switching to the ARM7TDMI, just on a broad observation it looks like if (Ticks <= (DWORD)(nCycles / 2000))
here mostly false on each pass than true thus mostly skipping if not the majority of the 50 available frames, all the frames are skipped. I realise that of there is logic present to make sure at least the 100's frame is displayed without fail.

Query: In this condition why is this if construct mostly false and at time always false for all 50 frames?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants