Comments (5)
Ok, I will have a look later.
from b-em.
OK, so when I looked at this the pause feature was indeed on Windows only.
It looks like it may have been introduced originally because the Windows port runs the actual emulation on one thread, i.e. that _mainthread function, and the UI and other Windows messages in another thread and needed a way to pause the emulation while the UI thread was tinkering with it, i.e. calling reset functions etc. Hooking pause up to a key was a bonus.
So in the version I have pushed to the sf/pause branch I have moved the implementation from win.c to main.c so it works on Linux too. I have also added the check for whether paused to the int50 function which is obviously called 50x a second from a timer and indicates. by incrementing fcount, that another frame should be processed so when paused it just doesn't increment it so the main loop will do whatever it does between frames, i.e. call wait(1). This should also use less CPU when paused as removing the sleep(100) when paused looks like it would busy wait.
There is a tiny bit of extra complexity in that within the context of main.c we only know if a key is down, not that it has just that moment been pressed so it necessary to track the previous state of the key to avoid acting more than once on the same keypress. I think this is preferable to having two separate implementations (and the Linux one would have to do that anyway).
from b-em.
I had a quick look at that commit. Again, looks OK, however I would say that:
- Do we really need to keep adding
extern
to the definition of variables in header files? I'd say not, as it's not needed. - file-scoped
static
variables (i.e., those not declaredstatic
inside functions) do not need to be set explicitly to0
as the compiler will do this (per the ANSI standard). - There's a tonne of whitespace changes here which are really distracting to the diff, not to mention nothing to do with adding a pause. Again, this is better addressed differently rather than just randomly always letting whitespace changes through.
from b-em.
On the question of 'extern' that is what makes what appears in the header file a declaration rather than a definition. The header file may be included in more than one module and #including a header is just included text - C has no proper concept of importing modules. So if the header file has a definition of a variable and the header file is included in multiple C modules then the variable is then defined in multiple modules. If the linker resolves that by pointing all references to one of those and removes the others then it is being helpful but it is not required to do that, it could just as well complain and not link the program.
On the question of static variables, some people use the '= 0' explicit syntax, which is harmless otherwise, to indicate that code elsewhere relies on the fact this variable starts out as zero whereas in many cases the initial value of a variable is of no consequence. Not everyone adopts that style but it isn't a broken thing to do.
On the question of the whitespace I didn't do that. It looks like at some point I turned on an option in Geany to remove trailing spaces from lines because I didn't want them for something I was writing rather than making minor changes to and it has obviously found some cases where a line consists only of spaces and a newline. If you want prepare a different version that keeps the functional changes but reverts the whitespace then be my guest but I don't propose to spend the time doing it.
from b-em.
This is now merged to master.
from b-em.
Related Issues (20)
- choosing a new folder for VDFS doesn't start at the existing one on windows. HOT 4
- NMOS and CMOS 6502 emulations fail self-modifying JSR test HOT 1
- jstest: same name as another program + executables question
- Disable auto-pause when the debugger is active? HOT 1
- VDFS: OPENUP creates a new file if it doesn't already exist HOT 4
- Integra-B: CTRL-@-BREAK is not triggering reset HOT 4
- Add support for other Z80 CoPro ROM versions? HOT 8
- Improved memory handling for 68K co-pro HOT 16
- Emulation speed wrong and Screen is a flickering mess HOT 23
- Compiler error on macOS HOT 2
- Tube ULA: 2-byte R3 transfers misbehaving HOT 9
- Core dump on startup with e624e51 HOT 3
- Change in behaviour with bit-banged sound between releases 8761065 and 608eb15 HOT 8
- Request for help with an SDL Sound Issue
- Nula issues
- segmentation fault HOT 4
- Seg fault when selecting 32016 co-pro HOT 2
- LED bar to small on 4K display
- @-symbol not mapped with logical keyboard
- libssp-0.dll missing from release
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from b-em.