Intel 80286 emulator for Raspberry Pico

github.com

30 points by fleeks 2 days ago


peterfirefly - 2 days ago

The code has some 386 things implemented but not protected mode 286 stuff.

Seems to be written by somebody who writes fairly neat and clean code, but hasn't discovered structs yet.

Definitely not cycle accurate. Video emulation only covers simple standard modes, not the undocumented ones, not proper hardware programming.

Does have a decent handling of (real-mode) interrupts. The AT keyboard interface (+ keyboard itself) is handled poorly on Windows/Linux -- the code for handling bytes sent to the keyboard is missing + there is no emulation of the receive queue in the keyboard controller. The code for the Raspberry Pi PICO is different: it actually bit bangs some pins to support a PS/2 interface (basically an AT interface). Still doesn't handle any buffering as far as I can see.

There is an 8K PC XT(?) BIOS included with no mention of where it comes from. The code there handles hardware interrupts. The software interrupt BIOS API is handled in C code (intcall86() in src/emulator/cpu.c).

jshaqaw - 2 days ago

My first neural net code (very very bad) was on a 286/287 back in the early 90s. 286 is kind of a forgotten chip since 386 32 bit changed the game but give a kid (ie teenage me) a 286, a 40mb hard drive, and Turbo Pascal and I felt like I could build anything!

janice1999 - 2 days ago

Anyone else instantly turned away by the LLM emoji bullet points?

This project could be the work of an enthusiastic developer with a deep understanding/love of the 80286 or LLM slop based on regurgitated code stolen from years of hard work by dedicated retro emulator developers. Unfair or not, emoji bullet points do not give confidence it's the first.

glonq - 2 days ago

The page calls 320×200×256 "Mode X" but IIRC that was actually 320×240×256 wasn't it?

mschuster91 - 2 days ago

The idea reminds me of the fact that truly old-ass Intel clones are the foundation of many a microcontroller design [1]. Searching for the 8051, the most popular family, here on HN will lead you to some very deep rabbit holes [2].

[1] https://en.wikipedia.org/wiki/Intel_MCS-51

[2] https://hn.algolia.com/?q=8051&utm_source=opensearch&utm_med...

peterfirefly - 2 days ago

The 8253 (timer) implementation seems downright weird. The timers only count when the low byte of their current counter value is read!? And they are only read when ports 0x40-0x42 are read? So there is no proper timer interrupt?!

... no, wait...

The 8253 calculates a 'timer_period' which is used in the {linux/win/pico}-main files. They read the platform time and call 'doirq(0)' to signal IRQ0 whenever the time is right. The actual counting in the emulated 8253 isn't used and has absolutely no relation to the IRQ0 signals. Quirky.

peterfirefly - 2 days ago

xrip (Ilya), if you read this -- please post a write up of your emulator(s) on vogons.org!

dmitrygr - 2 days ago

be warned: LLM slop with mucho bugs (i, immediately, see a few serious correctness issues)