VOGONS


MartyPC

Topic actions

First post, by GloriousCow

User metadata
Rank Member
Rank
Member

MartyPC is a cycle accurate IBM PC/XT emulator written in Rust with an emphasis on realtime visual debugging features.

Github
https://github.com/dbalsom/martypc

Video Demo
https://www.youtube.com/watch?v=zADeLm9g0Zg

Web Demos
8088MPH: https://dbalsom.github.io/martypc/web/player. … l?title=8088mph
Area 5150: https://dbalsom.github.io/martypc/web/player. … ?title=area5150
CGACOMP: https://dbalsom.github.io/martypc/web/player. … l?title=cgacomp
FreeDos: https://dbalsom.github.io/martypc/web/player. … l?title=freedos

Current release (0.1.2)
https://github.com/dbalsom/martypc/releases/tag/0.1.2

I'm eager to hear any feedback, suggestions and bug reports people might have.

Last edited by GloriousCow on 2023-07-02, 23:35. Edited 1 time in total.

MartyPC: A cycle-accurate IBM PC/XT emulator | https://github.com/dbalsom/martypc

Reply 1 of 173, by GloriousCow

User metadata
Rank Member
Rank
Member

MartyPC Release 0.1.2 is out today and introduces some massive performance improvements and quite a few fixes.
https://github.com/dbalsom/martypc/releases/tag/0.1.2

Now that I've completed an initial optimization pass, I'm going to work on improving MartyPC's debugger and QOL features - I've already gotten some great suggestions from VileR and others.

The feedback for MartyPC has been great, I'm glad so many people have said such kind things about it. It's been a labor of love for me over the past year, and I hope to continue working on it and making it better with everyone's help.

MartyPC: A cycle-accurate IBM PC/XT emulator | https://github.com/dbalsom/martypc

Reply 2 of 173, by GloriousCow

User metadata
Rank Member
Rank
Member
mothergoose729 wrote on 2023-06-29, 23:27:

Hey Glorious Cow! I love this emulator already! I have been messing around with more accurate PC emulators lately and it's fascinating to appreciate all the nuances of these machines. Your emulator was very easy to get up and running! The ability to seamlessly toggle between RGB and composite graphics is freaking sweet, I love it!

Glad you like it!

mothergoose729 wrote on 2023-06-29, 23:27:

I know this is an initial release, so obviously there are a lot of QOL and feature improvement to make from a usability stand point. I used bios images from my PCem collection and it was hard to figure out what MartyPC needed exactly to boot. I eventually found it, but mostly just by copy and pasting tones of image files into the ROMs folder until something booted.

I've started working on better documentation. You're not the first to struggle with the ROM situation. I have an initial wiki set up, which goes into detail about the ROMs required by MartyPC: https://github.com/dbalsom/martypc/wiki/ROMs I hope to expand on this a bit as well, it was a bit more extensive but Github's outage today ate my first draft (ouch)

mothergoose729 wrote on 2023-06-29, 23:27:
I have a couple of questions about the features the emulator supports right now: […]
Show full quote

I have a couple of questions about the features the emulator supports right now:

1) Do you plan to support specific machine configurations like PCem does? (amount of memory, number of floppy drives and their size, ect)
2) Is there a true full screen mode implemented?
3) Can you load floppies from other directories?

1) A better machine configuration system is definitely needed. I originally thought 'why would anyone want less than 640k of ram?' but you're not the first to ask, and switching between different configurations is a bit tedious; although you can always have separate configuration files and specify them on the command line. I need to have something that specifies the size of a floppy drive - DOS currently formats everything as 360k. I thought I was being clever by making the drive type change depending on what image you loaded into it (which lets you read a 1.44MB disk on a XT), but this doesn't really work that well with the BIOS detecting drive type on boot and storing the size in the BDA.

2) There's no full screen mode, but it's definitely something on the to-do list. This will probably be part of a display system refactor that includes dual-window support, if I can manage it.

3) Sadly no, the floppy directory limitation is due to me not wanting to try to call the native file browser on 3 different platforms (although there are libraries that might help with this) and not wanting to make a custom file browser. It gets unmanageable when you have a lot of floppies (the menu just cuts off at the bottom of the screen), there's no subdirectory support, and so on. Listing additional floppy directories to scan in the config would be a good improvement, but the UI has to be improved to support it as well.

MartyPC: A cycle-accurate IBM PC/XT emulator | https://github.com/dbalsom/martypc

Reply 3 of 173, by Scali

User metadata
Rank l33t
Rank
l33t

This version is certainly a lot faster than the previous release.
In RGBI-mode even the old Core i7 can sustain 60 fps through most things.
Composite mode is still very heavy, giving only about 30 fps. but in theory, if the composite is moved to a shader, that should solve that problem.

It looks like it defaults to the Vulkan API if supported, and falls back to DX12 otherwise. There do not appear to be any alternatives to that, because on a system that has no DX12-support, it seems to use the Microsoft software renderer for DX12. Which sadly doesn't perform that well, so a fallback to DX11 or OpenGL may have been better on these systems. But I'm not sure if the library you use can give you these options.
Edit: Apparently you can just set an env var WGPU_BACKEND to 'dx11' or 'gl'. But for some reason it doesn't actually run in those configurations.

http://scalibq.wordpress.com/just-keeping-it- … ro-programming/

Reply 4 of 173, by GloriousCow

User metadata
Rank Member
Rank
Member
Scali wrote on 2023-07-01, 11:30:

This version is certainly a lot faster than the previous release.
In RGBI-mode even the old Core i7 can sustain 60 fps through most things.
Composite mode is still very heavy, giving only about 30 fps. but in theory, if the composite is moved to a shader, that should solve that problem.

Glad to hear things are working better. The CGA emulation on the first release was really dog slow. There are more optimizations coming. I'm thinking I can save a lot of drawing time in periods where no CGA VRAM writes or CRTC updates have occurred; I can tick the CGA as normal but just not output anything (assuming I don't clear the buffer) because in theory the frame would be unchanged. Plus I haven't even really touched the CPU, and I have several ideas there.

I'm in the process of bringing over reenigne's composite code; having considered what he said about emulating the analog behavior of the multiplexer and such, I realized there was no point in trying to re-duplicate his sampling work. We'll see if it is any faster on its own, but I'll also be using it as the base for the shader - it's one pass, vs my two-pass method, so that's an extra bonus. I just need to fix Flower Girl from being green and purple at the moment.

Scali wrote on 2023-07-01, 11:30:

It looks like it defaults to the Vulkan API if supported, and falls back to DX12 otherwise. There do not appear to be any alternatives to that, because on a system that has no DX12-support, it seems to use the Microsoft software renderer for DX12. Which sadly doesn't perform that well, so a fallback to DX11 or OpenGL may have been better on these systems. But I'm not sure if the library you use can give you these options.
Edit: Apparently you can just set an env var WGPU_BACKEND to 'dx11' or 'gl'. But for some reason it doesn't actually run in those configurations.

I'm surprised there even is a software renderer for DX12! I don't know about dx11 specifically but I know the gl backend is not supported on Windows, as it's targeting ES3. I can look into whether you can specify a backend from code, but I was hoping that it would "do the right thing" by itself...

MartyPC: A cycle-accurate IBM PC/XT emulator | https://github.com/dbalsom/martypc

Reply 5 of 173, by peterfirefly

User metadata
Rank Newbie
Rank
Newbie

config.rs has a 'raw_rom' field in the 'Machine' struct. It is never read actually used, but it means 1) the supplied martypc.toml file doesn't work and 2) one is left mightily confused by the error message. I am very new at Rust so it took a while to find out that 'raw_rom' was a bool field that was never read so the actual value didn't matter.

The Windows version is very, very slow -- but looks ok so far.
The Linux version (under WSL2 w/ Ubuntu 22.04LTS) is even slower AND it looks weird. That might be due to unusual DPI settings on my part.

My machine is a budget laptop from 2018 extended to 20GB RAM (Lenovo 14-some-letters). WSL2 uses llvmpipe (software) for its OpenGL/Vulkan implementation so of course its "GPU" is slow -- but I'm surprised the emulator needs to use the "GPU" so much that it matters even when the emulated cursor is just blinking (very slowly) while the emulated memory is being tested by the BIOS. The Windows version uses the built-in Intel HD Graphics 620.

I asked MartyPC to emulate the 5150 and I have no idea what BIOS ROM it used (it doesn't say -- and I dumped three of them into installs\roms\). After an eternity the emulated PC gave up with "131 FC00 ROM" -- perhaps because I "pressed" the turbo button?

Is there a way to skip the memory test for faster boots?

The Performance window has lots of values but I don't know what most of them mean. I can say that FPS=57, UPS a bit lower, Emulation time seems to be around 4-6ms, Render time seems to be around 10ms -- they all change so fast that I can't tell for sure. This is for the Windows version. I have played with egui's demo and it has lower render time (often around 3ms) despite seemingly doing more on the screen.

Yes, I did build with "cargo build --release".

PS: forgot to say I used git version 435c5592d23b34a024473cdccc014b508cf4bbec.

Attachments

Reply 6 of 173, by GloriousCow

User metadata
Rank Member
Rank
Member
peterfirefly wrote on 2023-07-01, 19:02:

config.rs has a 'raw_rom' field in the 'Machine' struct. It is never read actually used, but it means 1) the supplied martypc.toml file doesn't work and 2) one is left mightily confused by the error message. I am very new at Rust so it took a while to find out that 'raw_rom' was a bool field that was never read so the actual value didn't matter.

That field is only used by the web player, sorry - It should have been an Option<bool> so that it is not required to be present. But I would recommend in general that if you build from source you just drop the executable into the directory structure from a release. I don't know if i'll be keeping that 'install' directory in the source tree.

peterfirefly wrote on 2023-07-01, 19:02:

The Windows version is very, very slow -- but looks ok so far.
The Linux version (under WSL2 w/ Ubuntu 22.04LTS) is even slower AND it looks weird. That might be due to unusual DPI settings on my part.

When you say slow, do you mean moving debug windows around? or the general emulation performance? Can you take a screenshot of the Performance window?

peterfirefly wrote on 2023-07-01, 19:02:

My machine is a budget laptop from 2018 extended to 20GB RAM (Lenovo 14-some-letters). WSL2 uses llvmpipe (software) for its OpenGL/Vulkan implementation so of course its "GPU" is slow -- but I'm surprised the emulator needs to use the "GPU" so much that it matters even when the emulated cursor is just blinking (very slowly) while the emulated memory is being tested by the BIOS. The Windows version uses the built-in Intel HD Graphics 620.

What model CPU does it have?

The GPU is not used to emulate the CGA, so what you see on the emulated screen is largely irrelevant. It is used to composite the display buffer with the GUI windows - I'm a bit surprised that this has turned out to be such a challenge for a lot of PCs. I might make an SDL front end for lower-spec machines or configurations where a fast GPU isn't available.

peterfirefly wrote on 2023-07-01, 19:02:

I asked MartyPC to emulate the 5150 and I have no idea what BIOS ROM it used (it doesn't say -- and I dumped three of them into installs\roms\). After an eternity the emulated PC gave up with "131 FC00 ROM" -- perhaps because I "pressed" the turbo button?

minuszerodegrees says that 131 is the 'cassette port wrap-around (loopback) test', interesting. Does it boot with Turbo off?

I think I will add a Machine Info window that will show which ROM is in use; but in general, it will pick the newest set by release date. So if you have all three known versions of the 5150 bios in the ROMs folder it will use the October '82 BIOS.

peterfirefly wrote on 2023-07-01, 19:02:

Is there a way to skip the memory test for faster boots?

In general, I'd recommend emulating a 5160 with the 1986 BIOS unless you have a specific interest in the 5150. MartyPC will hot-patch the 1986 5160 BIOS to speed up the memory test dramatically, because I got tired of waiting ages for it to boot myself. I could do this for every BIOS version, but it's just a matter of finding the right offsets and defining the patches for each ROM.

peterfirefly wrote on 2023-07-01, 19:02:

The Performance window has lots of values but I don't know what most of them mean. I can say that FPS=57, UPS a bit lower, Emulation time seems to be around 4-6ms, Render time seems to be around 10ms -- they all change so fast that I can't tell for sure. This is for the Windows version. I have played with egui's demo and it has lower render time (often around 3ms) despite seemingly doing more on the screen.

'Render time' reported by MartyPC isn't EGUI's render time, so we can't compare the two, it's mainly comprised of three steps: converting the indexed color CGA output to RGBA, scaling it, and optionally converting it for composite monitor simulation.

Your render time is extremely high - mine is well under 1ms. So you're bumping up against 16ms frame times, which means you won't be keeping 60fps. Can you go to Display menu and uncheck 'Correct Aspect Ratio' and tell me what that drops your render time down to? 0.1.2 introduced SIMD-enabled aspect correction, and I'm wondering if you have some CPU incompatibility - if turning off aspect correction drastically improves render time that would be a smoking gun.

MartyPC: A cycle-accurate IBM PC/XT emulator | https://github.com/dbalsom/martypc

Reply 7 of 173, by peterfirefly

User metadata
Rank Newbie
Rank
Newbie

> But I would recommend in general that if you build from source you just drop the executable into the directory structure from a release. I don't know if i'll be keeping that 'install' directory in the source tree.

Ok, didn't know that.

> When you say slow, do you mean moving debug windows around? or the general emulation performance? Can you take a screenshot of the Performance window?

emulation performance.

> What model CPU does it have?

i3-7100U, running at 2.40GHz (power is plugged in and I turned all the power saving off).

>The GPU is not used to emulate the CGA, so what you see on the emulated screen is largely irrelevant. It is used to composite the display buffer with the GUI windows - I'm a bit surprised that this has turned out to be such a challenge for a lot of PCs. I might make an SDL front end for lower-spec machines or configurations where a fast GPU isn't available.

Yes, I found your shader. Isn't it just a simple image copy, possibly with a bit of filtering?

> minuszerodegrees says that 131 is the 'cassette port wrap-around (loopback) test', interesting. Does it boot with Turbo off?

Nope. Same error. I quit the emulator and started it again to be sure.

> I think I will add a Machine Info window that will show which ROM is in use; but in general, it will pick the newest set by release date. So if you have all three known versions of the 5150 bios in the ROMs folder it will use the October '82 BIOS.

I'd be happy with a println! 😀

> In general, I'd recommend emulating a 5160 with the 1986 BIOS unless you have a specific interest in the 5150. MartyPC will hot-patch the 1986 5160 BIOS to speed up the memory test dramatically, because I got tired of waiting ages for it to boot myself. I could do this for every BIOS version, but it's just a matter of finding the right offsets and defining the patches for each ROM.

I wanted to see Arena 5150 -- but I'll gladly take that speed hack!

I haven't tried the 5160 emulation yet.

> 'Render time' reported by MartyPC isn't EGUI's render time, so we can't compare the two, it's mainly comprised of three steps: converting the indexed color CGA output to RGBA, scaling it, and optionally converting it for composite monitor simulation.

Oh, I thought it was.

> Your render time is extremely high - mine is well under 1ms. So you're bumping up against 16ms frame times, which means you won't be keeping 60fps. Can you go to Display menu and uncheck 'Correct Aspect Ratio' and tell me what that drops your render time down to? 0.1.2 introduced SIMD-enabled aspect correction, and I'm wondering if you have some CPU incompatibility - if turning off aspect correction drastically improves render time that would be a smoking gun.

Doesn't seem to make a difference. I also looked at the GPU% in Task Manager. It is around 8.7% with or without "Correct Aspect Ratio" when there are no egui windows open and the CPU is running and doing memory test. I know the 620 is very slow compared to a modern, real graphics card -- but it can do 400 GFLOPS and 24 Gtexels/s. I have no idea what it spends 8.7% on!

I'll play with 5160 and hopefully figure out how to use Tracy in the next couple of days. I'll get back when I know more. So far this rust + egui + shader journey has been great fun so I definitely want to continue.

https://github.com/wolfpld/tracy

(I haven't figured out how to use Vogons' quotes yet -- sorry about that.)

Attachments

Reply 8 of 173, by GloriousCow

User metadata
Rank Member
Rank
Member
peterfirefly wrote on 2023-07-01, 20:02:

I wanted to see Arena 5150 -- but I'll gladly take that speed hack!

Good news, Area 5150 works fine on a 5160.

peterfirefly wrote on 2023-07-01, 20:02:

Doesn't seem to make a difference. I also looked at the GPU% in Task Manager. It is around 8.7% with or without "Correct Aspect Ratio" when there are no egui windows open and the CPU is running and doing memory test. I know the 620 is very slow compared to a modern, real graphics card -- but it can do 400 GFLOPS and 24 Gtexels/s. I have no idea what it spends 8.7% on!

All the stuff in 'Render time' is being run on your CPU, not your GPU. I know that sounds a little counterintuitive considering we associate 'Rendering' with the GPU. Maybe I should rename it to 'Buffer Processing' or something less confusing.

Is there a chance you could install cargo flamegraph https://github.com/flamegraph-rs/flamegraph and generate one (just for a few seconds even) ? it might help me get an idea of where the slowdown is on your system.

MartyPC: A cycle-accurate IBM PC/XT emulator | https://github.com/dbalsom/martypc

Reply 9 of 173, by peterfirefly

User metadata
Rank Newbie
Rank
Newbie

> All the stuff in 'Render time' is being run on your CPU, not your GPU. I know that sounds a little counterintuitive considering we associate 'Rendering' with the GPU. Maybe I should rename it to 'Buffer Processing' or something less confusing.

I got that. I still don't understand why it is using 8.7% of my GPU! And reducing the GPU usage would make a large difference for WSL2.

That's why I want to run Tracy on it.

> Is there a chance you could install cargo flamegraph https://github.com/flamegraph-rs/flamegraph and generate one (just for a few seconds even) ? it might help me get an idea of where the slowdown is on your system.

There is every chance! But not tonight...

Reply 10 of 173, by GloriousCow

User metadata
Rank Member
Rank
Member

I've successfully ported reenigne's composite code, and putting them side by side really shows off the deficiencies in my algorithm:

old_vs_reenigne.png
Filename
old_vs_reenigne.png
File size
125.84 KiB
Views
81070 views
File comment
Old MartyPC composite vs new (reenigne) method
File license
Public domain

With the added benefit of it being nearly 4x faster. Since it's one pass I can completely skip the composite signal conversion step the old algorithm had to use. Still want to make it a shader, but having a reasonably fast software path is a good thing.

MartyPC: A cycle-accurate IBM PC/XT emulator | https://github.com/dbalsom/martypc

Reply 11 of 173, by GloriousCow

User metadata
Rank Member
Rank
Member

With the much faster composite now in place, I've added a web demo for 8088MPH:

https://dbalsom.github.io/martypc/web/player. … l?title=8088mph

MartyPC: A cycle-accurate IBM PC/XT emulator | https://github.com/dbalsom/martypc

Reply 12 of 173, by mdrejhon

User metadata
Rank Newbie
Rank
Newbie

Really nice! How are you compiling your Rust software into JavaScript?

That's fantastic-looking composite emulation -- best I've ever seen in a Javascript emulator -- and even runs realtime 60fps. I'd ask for a fullscreen button, or a double-click to enter/exit fullscreen, but that's only a nice-to-have.

Bugs:
1 -- Second bug, it's not letting me zoom the canvas image via the common CTRL+scrollwheel (zoom webpage) -- it resists resizing. I'd like to go 200% to fill more of my screen.
2 -- There's a very minor raster glitch in the Kefrens bars in 8088MPH in the Javascript version of your emulator. Not sure if it's because of the settings chosen, or your emulator;
3 -- It seemed to skip over some sections of demo (maybe a late buffered Enter key)

UPDATE: There was a behavior where pressing Enter in the startup gradient tester didn't work, but restarting browser worked to fix item 1! But see item 3

Founder of www.blurbusters.com and www.testufo.com
- Research Portal
- Beam Racing Modern GPUs
- Lagless VSYNC for Emulators

Reply 13 of 173, by GloriousCow

User metadata
Rank Member
Rank
Member
mdrejhon wrote on 2023-07-02, 23:46:

Really nice! How are you compiling your Rust software into JavaScript?

wasm is a native target of the rust compiler, so it's pretty easy. The only things I had to change was turning the file open/read operations into web requests.

mdrejhon wrote on 2023-07-02, 23:46:

That's fantastic-looking composite emulation -- best I've ever seen in a Javascript emulator -- and even runs realtime 60fps. I'd ask for a fullscreen button, or a double-click to enter/exit fullscreen, but that's only a

Wish I could take credit, but it's reenigne's composite code now... mine was close, but the colors were a bit dull. (and a lot slower)

mdrejhon wrote on 2023-07-02, 23:46:

1 -- Second bug, it's not letting me zoom the canvas image via the common CTRL+scrollwheel (zoom webpage) -- it resists resizing. I'd like to go 200% to fill more of my screen.

I am not a web developer by any means, so forgive me if there is some jank to this page.

mdrejhon wrote on 2023-07-02, 23:46:

2 -- There's a very minor raster glitch in the Kefrens bars in 8088MPH in the Javascript version of your emulator. Not sure if it's because of the settings chosen, or your emulator;

Sometimes there's a vertical discontinuity in the background lines, is that what you mean? If not, could you screenshot it?

mdrejhon wrote on 2023-07-02, 23:46:

3 -- It seemed to skip over some sections of demo (maybe a late buffered Enter key)

I've watched this demo eight million times and didn't see any scene get skipped when i tested it, what effect was skipped?

EDIT: Okay, finally caught it skipping the Delorean effect after about a second. Not sure what that's about, but I suspect timer issues...

MartyPC: A cycle-accurate IBM PC/XT emulator | https://github.com/dbalsom/martypc

Reply 14 of 173, by mdrejhon

User metadata
Rank Newbie
Rank
Newbie

I just found out if I zoom before I refresh before Run, it works! I get 200% fine.

By default, you have:

<canvas tabindex="0" data-raw-handle="1" width="768" height="576" alt="MartyPC WASM Player" style="width: 768px; height: 576px;"></canvas>

If I zoom 200% while running, I get an unresized emulator and it still stays:

<canvas tabindex="0" data-raw-handle="1" width="768" height="576" alt="MartyPC WASM Player" style="width: 768px; height: 576px;"></canvas>

If I zoom before I refresh before Run, it works and correctly scaled:

<canvas tabindex="0" data-raw-handle="1" width="768" height="576" alt="MartyPC WASM Player" style="width: 384px; height: 288px;"></canvas>

It's clearly a confusing part of the web standard. The style of width/height is based on the logical units, so you need to divide the style's width and height by the page zoom factor (an API is available).

(It may be that the stuff inside the canvas is "fighting" against the zoom)

I don't know if you did that part of the HTML or if a compiler did it -- but just letting you know!

Founder of www.blurbusters.com and www.testufo.com
- Research Portal
- Beam Racing Modern GPUs
- Lagless VSYNC for Emulators

Reply 15 of 173, by GloriousCow

User metadata
Rank Member
Rank
Member

If you're curious about all the views, we apparently made the front page of Hackernews today... hello everyone 😀

MartyPC: A cycle-accurate IBM PC/XT emulator | https://github.com/dbalsom/martypc

Reply 16 of 173, by VileR

User metadata
Rank l33t
Rank
l33t

Excellent work on the latest release, and the improved composite emulation! Any plans to introduce early/late-type CGA composite selection, given the latter? 😉

I'm seeing an issue with v0.1.2 on my machine - this doesn't seem to happen with the web player, so I'm wondering if it's been fixed since the release or maybe something to do with my setup.
When 'composite display' is enabled, the rightmost ~96 pixels (or so) of the image are replaced with black:

screenshot003..png
Filename
screenshot003..png
File size
14.25 KiB
Views
10559 views
File license
Public domain

Compare with RGB:

Filename
screenshot004..png
File size
7.5 KiB
Downloads
No downloads
File license
Public domain

If the new composite code fixes this, disregard; just a heads up in case it might be something else.

Speaking of the web player... it appears to use nearest-neighbor scaling, which looks off with the aspect correction (since the scale factor is non-integer). I'm not sure what is needed to fix this; maybe one of the RenderingContext API settings mentioned here?

[ WEB ] - [ BLOG ] - [ TUBE ] - [ CODE ]

Reply 17 of 173, by Scali

User metadata
Rank l33t
Rank
l33t
GloriousCow wrote on 2023-07-01, 17:47:

I'm surprised there even is a software renderer for DX12! I don't know about dx11 specifically but I know the gl backend is not supported on Windows, as it's targeting ES3. I can look into whether you can specify a backend from code, but I was hoping that it would "do the right thing" by itself...

Strange that they wouldn't support GL under Windows, but oh well, DX11 should work fine.
Question is why it won't work. Even if I test on hardware that supports DX12, the DX11 mode doesn't work, the application closes immediately (not sure if there's any log anywhere of what error it may have encountered)... Could be because you might need API-specific shaders or such? Or at least, the current shader only works in Vulkan and DX12 (although I understand that Vulkan can compile DX HLSL shaders, so it may be the same shader they use).

http://scalibq.wordpress.com/just-keeping-it- … ro-programming/

Reply 18 of 173, by GloriousCow

User metadata
Rank Member
Rank
Member
VileR wrote on 2023-07-05, 06:53:

Any plans to introduce early/late-type CGA composite selection, given the latter? 😉

Of course! The new composite code will have controls for new/old style as well as phase offset, which I think is an interesting feature. Turns out there have been some programs written for composite using a modern scan-converter or LCD monitor, which don't seem to care about the missing color burst in 80 column mode. I guess period-accurate CRTs are getting rare. This ends up "working" on hardware but not displaying right under emulation. Now MartyPC can properly display such programs.

wrong_phase.png
Filename
wrong_phase.png
File size
293.06 KiB
Views
10090 views
File comment
Composite image viewer 180 degrees out of phase
File license
CC-BY-4.0
VileR wrote on 2023-07-05, 06:53:

I'm seeing an issue with v0.1.2 on my machine - this doesn't seem to happen with the web player, so I'm wondering if it's been fixed since the release or maybe something to do with my setup.

Already fixed, just a dumb mistake in the composite span calculation with the new hsync calculations... of course I noticed it a day after my release of 0.1.2...
One nice thing about the web player is it's always up to date 😀

VileR wrote on 2023-07-05, 06:53:

Speaking of the web player... it appears to use nearest-neighbor scaling, which looks off with the aspect correction (since the scale factor is non-integer).

That was a deliberate decision, I would just need to select a bilinear sampler in the shader instead. I like the 'crispness' of nearest neighbor vs bilinear personally, although the repeated scanlines are a negative. The desktop version tries to get the best of both worlds by doing linear interpretation on the Y axis but nearest-neighbor on the X axis, but I do this in software which is too slow for the web.

I can play around with it. Maybe it could be an option somehow and I could store it in a cookie (Hello GDPR cookie prompt...) to save your preferences.

Last edited by GloriousCow on 2023-07-05, 10:58. Edited 1 time in total.

MartyPC: A cycle-accurate IBM PC/XT emulator | https://github.com/dbalsom/martypc

Reply 19 of 173, by GloriousCow

User metadata
Rank Member
Rank
Member
Scali wrote on 2023-07-05, 09:35:

Strange that they wouldn't support GL under Windows, but oh well, DX11 should work fine.
Question is why it won't work. Even if I test on hardware that supports DX12, the DX11 mode doesn't work, the application closes immediately (not sure if there's any log anywhere of what error it may have encountered)... Could be because you might need API-specific shaders or such? Or at least, the current shader only works in Vulkan and DX12 (although I understand that Vulkan can compile DX HLSL shaders, so it may be the same shader they use).

I have to confess I'm a little out of my depth with this stuff - GPU programming especially is something I've only really dabbled in thus far, and only via an abstraction layer (wgpu). I couldn't tell you the difference between DX12 and DX11 other than DX12 is one higher. I'm sort of relying on the wgpu developers to be much smarter than me, hopefully. I can see if I can find time to look into it, if DX11 should work but doesn't maybe I can open an issue or at least ask around.

The next release should be coming along shortly, as it will fix one of the most commonly reported bugs, in that some shift-key codes are not working on international keyboard layouts. This was fixed upstream in the windowing library I'm using (winit) but my gui dependencies haven't updated yet (egui-winit binding) so I forked egui to manually bring the dependencies up to date. But the fix for the keyboard comes with an entirely-new keyboard system, so my egui fork has to rewrite the keyboard handling code, and I figure I'm as likely to introduce new bugs as I am to fix the old one. I figure that the maintainers will get around to this eventually, but I am impatient. It's a pretty bad bug, since you can't type a colon on an international keyboard, which makes changing drive letters impossible...

So the next release will pretty much just be keyboard fix + new composite.

MartyPC: A cycle-accurate IBM PC/XT emulator | https://github.com/dbalsom/martypc