VOGONS


MartyPC

Topic actions

Reply 480 of 484, by keenmaster486

User metadata
Rank l33t
Rank
l33t
GloriousCow wrote on Yesterday, 16:11:
I will say that I love the language, I love coding in it. I feel more productive in Rust that I ever was in C. The main advanta […]
Show full quote

I will say that I love the language, I love coding in it. I feel more productive in Rust that I ever was in C. The main advantage is that I've kept up with it for three years now, unlike other projects I have attempted that usually sputter out after some months where I get frustrated or lose interest. I don't need to explain that to any programmer, we all have large directories full of half-completed projects.

That said, in terms of people being able to use my code, read it, fork it, port it, or attract collaborators, Rust has not been ideal. The 86Box project has wanted to adopt MartyPC's 8088 core emulation, but they have to laboriously translate Rust-isms with no direct equivalents in C.

If I was starting over today to make a high-performance cross platform emulator I almost certainly would choose C++. It's too late now, though, I'm kinda stuck with it unless I want to spend an entire year or more rewriting the whole thing.

I only hope that the rust ecosystem continues to grow in a healthy manner.

Makes sense. Is there a way you could turn that core emulation into a library?

GloriousCow wrote on Yesterday, 16:11:

ps: could you reply to that issue you opened?

Sorry about that! I've been very busy at work the last few days. Just responded to it.

World's foremost 486 enjoyer.

Reply 481 of 484, by VileR

User metadata
Rank l33t
Rank
l33t
jal wrote on Yesterday, 14:55:
SoftCat wrote on 2025-05-21, 10:25:

What are the maximum visible screen sizes in pixels possible on a real CGA monitor (with a pixel frequency of 14.318 MHz)?
Is it possible to increase the number of visible lines by reducing the frame rate to 50 Hz?

I don't have the details, but iirc the 5153 is pretty finicky about what frequencies it can run on, and can even break in case you drive it with the wrong ones. So I very much doubt it would accept 50Hz.

Yes, 50 Hz is way too far out of spec. If you feed a 5153 the wrong frequencies, it's much less likely to break than a 5151 is, but I still wouldn't try it because it's never going to sync anyway.

If you really want *a few* more scanlines... it's possible to increase the horizontal frequency a little, which the 5153 does accept. This shortens the duration of the scanlines, and brings them closer together vertically. That pushes vertical refresh above 60 Hz, so to bring it back down to the tolerance range, you then increase the *total* scanline count. (This also modifies the pixel aspect ratio, and also makes the picture darker for some reason, but you win some you lose some.)

I was able to do 16.57 KHz (H) / 60.93 Hz (V), which got me 222 visible lines without changing the V-SIZE control (see here for details)... That's still faster than 60 Hz, which means you can likely add even more scanlines and make it a bit slower. And of course if you do change V-SIZE you could fit even more visible lines within the frame.

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

Reply 482 of 484, by GloriousCow

User metadata
Rank Member
Rank
Member
keenmaster486 wrote on Yesterday, 17:23:

Makes sense. Is there a way you could turn that core emulation into a library?

Not easily, no. At least, not as a clean "drop-in" CPU with a C FFI. There are a bit too many internal integrations between the CPU and peripherals, maybe I could factor those out, but there's still an inversion of ownership due to Rust's ownership model and borrow checker - you might logically structure an emulator in C++ to have a Bus upon which lives a Cpu along with Memory and any peripherals. It was easier to make Rust happy by putting everything into the CPU, so the heirarchy is not what you'd expect.

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

Reply 483 of 484, by jal

User metadata
Rank Oldbie
Rank
Oldbie
GloriousCow wrote on Yesterday, 16:11:

I don't need to explain that to any programmer, we all have large directories full of half-completed projects.

I don't know what you're talking about. 😁

JAL

Reply 484 of 484, by jal

User metadata
Rank Oldbie
Rank
Oldbie
VileR wrote on Yesterday, 17:37:

(see here for details)

Thanks, that was in interesting read! Now I'm tempted to adjust the horizontal displayed for my Rick Dangerous 2 CGA rewrite (as RD2, like RD1, has a 256-pixel-wide visible area) 😁. Btw, the link to "North Star Advantage" is broken, as the content of old-computers.com seems taken down. There are some other links you could use, e.g. this one.

JAL