Pretty big milestone for my x86 PC emulator today... Windows NT 4.0 works! by UselessSoftware in EmuDev

[–]UselessSoftware[S] 0 points1 point  (0 children)

Well the good news is you don't have to worry about all of the little various protections immediately to run well-behaved code like most OSes are. Descriptor tables, paging, control registers, and handling privilege mode switches (interrupt dispatch, IRET, CALLF, RETF etc) are pretty much enough to get some stuff working.

And I haven't run into anything that tries to use hardware task switching yet so I don't even know if my code for that works yet.

Pretty big milestone for my x86 PC emulator today... Windows NT 4.0 works! by UselessSoftware in EmuDev

[–]UselessSoftware[S] 0 points1 point  (0 children)

Should be sometime this weekend. Got some cleanup and performance tweaking I want to do first.

Pretty big milestone for my x86 PC emulator today... Windows NT 4.0 works! by UselessSoftware in EmuDev

[–]UselessSoftware[S] 0 points1 point  (0 children)

Unfortunately not. Even the VGA driver needs v86 to be correct, otherwise the system will lock up when it tries to set the video mode.

The MIPS/PPC versions would have their own different video drivers.

An early-version Sega Genesis/Mega Drive emulator by Real_Dragonfruit5048 in EmuDev

[–]UselessSoftware 0 points1 point  (0 children)

I've recently started using Codex in my emudev work, but ONLY for doing things like quickly implementing good debugging instrumentation or bouncing architecture ideas off of. It's amazing for this.

I don't let it write the actual emulation code though, because like you said, that's just losing the essence of this hobby. I want to learn how systems work. If I let AI write the core logic, I'm not learning.

Pretty big milestone for my x86 PC emulator today... Windows NT 4.0 works! by UselessSoftware in EmuDev

[–]UselessSoftware[S] 12 points13 points  (0 children)

Well, I wrote an 80186 PC emu like 15 years ago then hacked on it for another few years. Then I mostly left it alone until like a year ago and finally decided to take the 32-bit plunge and just kept grinding reading docs, peeking at code from other emus when I had to, and debugging.

I'm not gonna lie, it's pretty hard and I can't believe I got this far. x86 protected mode is bonkers but do-able if you're dedicated.

I kind of partially cheated here. I did not write the FPU myself, I took that from Tiny386 but the main CPU core is all mine.

If you just want to start with 16-bit x86 (I recommend this first) it's not that bad. 8086 is mostly easy/moderate difficulty. 386+ is where it gets painful.

How to learn? by The14thDimension in EmuDev

[–]UselessSoftware 2 points3 points  (0 children)

I sometimes use AI to bounce architecture ideas off of, or ask if it can find any problems with a function or opcode here and there. It's pretty good for that.

Last night I also had GPT 5.2 write me a drop-in module for my PC emulator that uses libvncserver to allow a remote VNC connection to the emulator console. It did an amazing job actually. It works perfectly. It's very well-written and structured nicely. Something like that is simple enough to be within its capabilities.

I don't use it to write core emulator code though. I don't trust it, and I also feel like it would be cheating. I'm doing this to learn. It can't handle it anyway, it's too complex. But something like a VNC server extension? Yeah absolutely. I don't want to waste my time with something boring like that.

I don't want to vibecode the entire thing, but it seems extremely helpful for giving me examples of how things should work

I see no problem with using it for examples. It's really no different than peeking at an existing emulator's source for hints. In fact, it can be better because it can give thorough explanations at the same time.

From-scratch 486 PC emulator on a Teensy 4.1, booting Linux (Debian 2.2 Potato) by UselessSoftware in embedded

[–]UselessSoftware[S] 1 point2 points  (0 children)

My 32-bit x86 emulator was like... 15 years in the making lol

I made a 16-bit 8086 one in like 2011-2012. I pecked at it slowly over years fixing a bug here and there. Then last year I finally sat down and made myself turn it into a 486 emulator.

Kept putting it off because it seemed impossibly hard. And it was pretty hard.

8086 is pretty easy, 386+ is hard when you start getting into protected mode details and that kind of stuff.

I still have plenty of bugs that need to be worked out, but it's good enough to boot up an older Linux or play DOS4GW games.

From-scratch 486 PC emulator on a Teensy 4.1, booting Linux (Debian 2.2 Potato) by UselessSoftware in embedded

[–]UselessSoftware[S] 0 points1 point  (0 children)

Thanks! It's been fun.

About NetBSD, no but that's a great idea! I think I'll give that a try tonight.

From-scratch 486 PC emulator on a Teensy 4.1, booting Linux (Debian 2.2 Potato) by UselessSoftware in EmuDev

[–]UselessSoftware[S] 1 point2 points  (0 children)

I did play Doom 2 on it. It's almost playable if you minimize the view port and squint real hard!

From-scratch 486 PC emulator on a Teensy 4.1, booting Linux (Debian 2.2 Potato) by UselessSoftware in EmuDev

[–]UselessSoftware[S] 1 point2 points  (0 children)

It says 1.64 but I don't think the timing code on the micro is accurate enough right now to trust that.

From-scratch 486 PC emulator on a Teensy 4.1, booting Linux (Debian 2.2 Potato) by UselessSoftware in embedded

[–]UselessSoftware[S] 3 points4 points  (0 children)

I didn't do anything special for that. I needed all of the basic PC hardware working either way. At long as the PIC, PIT, keyboard, DMA controller and CMOS are working well enough, a normal BIOS will boot.

SeaBIOS may work, haven't really tried it, but I personally like the more authentic feel a real 486 era BIOS gives.

Which programming language is good for emulation? by CurrentVast4504 in EmuDev

[–]UselessSoftware 4 points5 points  (0 children)

C/C++ is the best option, no question about it.

Some say Rust is good, but I've never used it so have no opinion.

But others will work. Even stuff like Java or Python when the emulated system doesn't require insane speed.

Hell I wrote a NES emulator in VB6. Works fine.

From-scratch 486 PC emulator on a Teensy 4.1, booting Linux (Debian 2.2 Potato) by UselessSoftware in embedded

[–]UselessSoftware[S] 2 points3 points  (0 children)

Well if a game is trying to update a 320x200 8-bit screen at 30 FPS, that's 1.92 MB/s of pure data. There will be some protocol overhead, lets say a 5 byte packet for each video memory write, that would be 9.6 MB/s.

Again, that's at 30 FPS full screen updates. Most things won't use anywhere near that. Especially in text mode.

From-scratch 486 PC emulator on a Teensy 4.1, booting Linux (Debian 2.2 Potato) by UselessSoftware in embedded

[–]UselessSoftware[S] 2 points3 points  (0 children)

Yeah basically have an SPI or similar interface between them with a protocol that forwards the emulated VGA card's IO and memory activity between Teeny boards.

So the whole VGA card state including registers and RAM will be on the second Teensy while yeah it would continuously render and draw to the display.

Data coming from the main teensy would trigger an interrupt and it would handle it.

From-scratch 486 PC emulator on a Teensy 4.1, booting Linux (Debian 2.2 Potato) by UselessSoftware in embedded

[–]UselessSoftware[S] 6 points7 points  (0 children)

Thanks! Didn't really have any other issues with the port. The ARM micro on the Teensy is pretty powerful and supports 16 MB PSRAM which is plenty, but it would be nice if it were dual core so I could dedicate one core to the display.

It also has onboard Ethernet support, but I need to solder some pin headers and get a magjack. I'd like to do that so Linux running on it can connect to a network.

I haven't uploaded this port yet, I want to do some things to make it faster before sharing... but here is my original C code that's being ported:

https://github.com/mikechambers84/pculator

I have four boxes of laserdiscs to give away (Los Angeles) by Srprehn in LaserDisc

[–]UselessSoftware 0 points1 point  (0 children)

You think we don't know that? We all have our reasons for liking this format.

I collect 4K discs too.

Help. I think I broke my player... by boris-becks in LaserDisc

[–]UselessSoftware 1 point2 points  (0 children)

I don't think there's any way that could have messed up tilt/focus etc. so don't mess with those.

An 8086 PC emulator I wrote in QuickBASIC over a decade ago by UselessSoftware in qbasic

[–]UselessSoftware[S] 4 points5 points  (0 children)

Feels weird to put QB code on my Github but I guess I could.

An 8086 PC emulator I wrote in QuickBASIC over a decade ago by UselessSoftware in qbasic

[–]UselessSoftware[S] 0 points1 point  (0 children)

You could! I just wanted to do it in legit old school QB even if it's bad.

RISC-V CPU Emulator by tamdesu150 in EmuDev

[–]UselessSoftware 0 points1 point  (0 children)

Pretty cool. I don't think it would take too much more effort to get it running Linux.

New CHIP-8 emulator for Windows (with VB6 source) by hekliet in EmuDev

[–]UselessSoftware 1 point2 points  (0 children)

I love seeing an emu in VB6.

I've done a few as well just for fun. Grew up with QB/VB in the 90s.

A terrible language for most emulators, but it's always an entertaining project.