7 ms·
MartyPC is a cross-platform emulator of early PCs written in Rust
- deleted 1mo ago[deleted]
- Dwedit 1mo agoMysteriously, backslash has been mapped to backspace for some reason.
- unixhero 1mo agoOld terminals had this shenanigans going on too. Backspace was not backspace and so on
- deleted 1mo ago[deleted]
- datakan 1mo agoI don't think Backspace as a key was standard internationally until 1994. Apple still doesn't use it, just Delete.
- Dwedit 1mo agoThis is about early IBM PCs, not apple computers. And the non-working key is the Backslash key \ , not the backspace key.
- GloriousCow 1mo agoWhat keyboard layout are you using? I can't reproduce on a US layout.
- Dwedit 1mo agoKey is Scancode 0x2B, or as a VKEY code: VK_OEM_5 (0xDC) Javascript says the key I pressed was keycode 220 (same number as 0xDC) or key "\". I had Tandy 1000 as the selected machine. When I look at the onscreen keyboard, I don't see a backslash key underneath backspace, but I do see one next to left shift. For keyboards that have the alternate backslash there, it is listed as having a scancode of 0x56 and a VKEY code of VK_OEM_102 (0xE2). (I haven't actually checked information specific to the actual Tandy keyboard)
- GloriousCow 1mo agoYeah the OSD is only the Model F and the Tandy has some difference so the OSD keyboard may not work quite right with the Tandy. I have to make all new pixel-art for a Tandy 1000 keyboard and PCjr keyboard. Fun
- Dwedit 1mo agoNot just the OSD keyboard, my real backslash key is also pressing backspace. You can't do your classic DOS commands like "cd\" without a working backspace key.
- GloriousCow 1mo agoI need to know what keyboard layout you're using. If it is not a standard US keyboard it will need a mapping
- Dwedit 1mo agoIt's a US keyboard (happens to be a laptop). I've already named the scancodes and VK codes in the parent post. Browser is Firefox. Backslash works fine if you have chosen to emulate the PC or PC XT. For PCJr, no keystroke appears at all (it does not act as backspace). For Tandy 1000, it acts as backspace. You get the same result whether you use the real backslash key or the backslash key from the on-screen keyboard.
- GloriousCow 1mo agoThanks. This should be fixed for Tandy 1000 now. On PCjr there is no backslash key, you have to type a backspace using alt + /, so I will need to define a macro that does that for you. The Tandy 1000 will need its own OSD since the tandy keyboard differs from the Model F in significant ways. You'll notice that if you type shift-backslash on the current model-F based OSD you'll get a 7 instead of the expected |. Because backslash is on numpad 7 on the Tandy. Dealing with this stuff is tons of fun
- rrr_oh_man 1mo agoThat's keyboard code [1] vs. Keyboard key [2]. [1] Physical location of a key https://w3c.github.io/uievents/#keys-codevalues https://w3c.github.io/uievents/#keys-codevalues [2] Mapping of a key https://w3c.github.io/uievents/#keys-keyvalues https://w3c.github.io/uievents/#keys-keyvalues The naming is terrible and I have to look it up every single time
- szundi 1mo agoWhy never seeing a title “written by C” or Java or js
- tenox7 1mo agoThe main feature of apps written in Rust is that they are written in Rust.
- dosisking 1mo ago"It's not a feature, it's a bug"
- fortran77 1mo agoI flag all these “written in Rust” posts.
- globalnode 1mo agoits just ppl trying to be different from their boring parents. wish i had enough karma to flag them too but i keep getting downvoted into oblivion for making fun of written in rust posts
- GloriousCow 1mo agoI am not the OP of this post, but they're just using my github description. when I first wrote it, Rust was a novel choice for an emulator, and it helped people find examples of emulators written in Rust. believe it or not I didn't tailor it for the HN meta
- pigeons 1mo ago"Hax – a minimalist, terminal-native coding agent written in C" https://news.ycombinator.com/item?id=49273175 https://news.ycombinator.com/item?id=49273175 but I see your point.
- imhoguy 1mo agoBecause nowadays "written in Rust" means "written by AI", as Java or C are not so sexy for LLMs /s
- ranger_danger 1mo agoIronically, and unfortunately, this doesn't actually emulate the FM Towns Marty (or even the regular FM Towns PC) like I assumed it would.
- handbanana_ 1mo agoThe name is a reference to the 8088 MPH scene demo, it was the first emulator to be able to run it.
- BobMcBob 1mo agoYet another avenue to play EGATREK in a browser. For that, its work it.
- EvanAnderson 1mo agoOh, holy crap. I haven't thought about EGATREK in at least 30 years. I'm going to go dig it up right now. Thanks for causing me to recall that memory!
- unixhero 1mo agoWhat's great about Egatrek?
- chvid 1mo agoAlmost usable on an iPhone.
- kuschkufan 1mo agoI used to have a phone like that.
- GloriousCow 1mo agoWhat would you say is missing or not working well?
- JMiao 1mo agoprobably in the minority but i want the screeching and grumbling hard disk sounds
- hggh 1mo agoIBMulator has HDD sounds: https://www.ibmulator.org/ https://www.ibmulator.org/
- GloriousCow 1mo agogreat emulator and nice guy too. maybe i should ask him if i can use his HDD sounds
- GloriousCow 1mo agothey're planned at some point. I need to write a utility or custom controller rig with a pico that can step the head on an MFM drive in patterns i can record, then model stepping to cylinder in the hard disk controller.
- rrr_oh_man 1mo agoDoesn't seem to support non-QWERTY keboards :(
- teiferer 1mo agoBut it's written in Rust! Who cares about non-qwerty! /s
- GloriousCow 1mo agoI've built out a full keyboard-remapping system, to support any keyboard layout. I need help building these files. Are you using DVORAK? If you are willing to help, please open a Github issue with some info about your keyboard, and I'll build support for it.
- rrr_oh_man 1mo agoThanks! Done
- creatonez 1mo agoHow did DOS era software handle this anyways? I can't imagine it would be fun to be a dvorak typist in the DOS era.
- GloriousCow 1mo agoDOS has the 'keyb' utility and 'keyboard.sys' to support different layouts, using various code pages. If you have a CGA card, you're stuck with the code page of the ROM your card came with, which in most cases was code page 437, although a few variants were made. EGA/VGA had software fonts so other code pages could be loaded.
- globalnode 1mo agothe other week i wrote a program in python, and ive been thinking of upgrading my cpp knowledge from v11, wish me luck
- hnlmorg 1mo agoEarly PCs weren’t written in Rust.
- pjmlp 1mo agoIn C neither, despite urban myths.
- hnlmorg 1mo agoIs that something people believe? I can’t say that’s a myth I’ve ever heard.
- pjmlp 1mo agoYep, before UNIX and C there were no systems programming languages, and after getting the clay tablets from UNIX and C, all civilisation was built upon them. /s At least when you spend long time around some programming circles.
- queenkjuul 1mo agoEarly PCs were made of steel which can rust
- hnlmorg 1mo agoNicely done!
- pjmlp 1mo agoAdlib support! At least someone else remembers it wasn't only Soundblaster.
- anonzzzies 1mo agoAll my friends had Soundblasters; I had a self soldered Covox. Fun times.
- abrookewood 1mo agoWhaaat?? Do tell more!
- anonzzzies 1mo agoFor not well off geeks you could just solder a bunch of resistors together and get vastly better sound than from the crappy PC speaker and there were games that supported it and I wrote some software for it (which unfortunately is gone I think). I had a lot of just having this on the pc in the house. https://github.com/necroware/silly-sound-bastard https://github.com/necroware/silly-sound-bastard
- GloriousCow 1mo agoI am very close to emulating the Covox - I emulate the Disney Sound Source, which is just a Covox with a FIFO
- sjsdaiuasgdia 1mo ago[dead]
- _flux 1mo agoBut Soundblaster came with Adlib, so surely complete support for SB should mean Adlib support as well.. ?
- pjmlp 1mo ago
- azwaterdamagere 1mo ago[flagged]
- Kudos 1mo agoNot specific to this project, but nowadays when I see "written in rust" I hear "written by Claude".
- binaryturtle 1mo ago"cross-platform" and Rust, as advertised in the current title/link label, is incompatible for sure. Can't get that to run on my older OS X machine nor my Amiga. :)
- ChickeNES 1mo agoYup, I have private forks where I've had Claude/Codex rip out Rust for that reason.
- GloriousCow 1mo agofeel free to fork MartyPC to build it for your Amiga
- GloriousCow 1mo agoWhen I started this emulator four years ago, this was the first PC emulator written in Rust so it was novel. I've heard the comments here loud and clear :) You all don't think Rust is novel anymore and I should lose that bit.
- tonyhart7 1mo ago[flagged]
- teiferer 1mo agoWhat does the "written in Rust" contribute to the title, exactly?
- rvz 1mo agoWritten in Rust™
- throwaway5727 1mo agoThis comment is itself a meta comment but here we go I guess...How is it possible that half the comments in this thread are about the title itself? It’s not even a made-up title, it’s taken straight from the project’s README...I keep seeing people complaining almost aggressively that others are touting Rust as a useful tool (which, to me personally, it certainly is). Does someone have a financial stake in opposing Rust’s development, or what?
- deleted 1mo ago[deleted]
- saiditmate 1mo ago[flagged]
- 13415 1mo agoRust's user community is toxic and unbearable. That's enough to explain the widespread resentment against it. Their fanboys are annoying. CommonLisp used to have a similar community problem.
- caspper69 1mo agoI write Rust code. I don’t mind it. But the truth is, I use very little of the language. I visit the Discord, and I see all the crazy overcomplicated shit these people are writing. If I had to try and make heads or tails of some of that shit I’d go crazy. I actually think some of it is actual trolling by Rust itself. And yes, the people are toxic. It’s like they really believe C and C++ and everyone else did literally everything wrong. And some of their justifications are seriously weak sauce. And remember, I like Rust. At least the parts I use. But it’s easily going to eclipse C++ in complexity if it continues the way it has been operating.
- Measter 1mo agoYup, definitely the Rust users who are toxic. Totally not the people going into every thread about Rust to tell everyone about how toxic Rust users are. Nope.
- gaoheyang 1mo agonice
- wiz21c 1mo agobesides the fact that it was written in rust, rust happens to be a really nice language to write emulators, you don't have to think much about threading and not much abut memory management, rust makes that easy => you can concentrate on your pixels. Moreover LLM grasp it very well so that you can get a bit more spare time for your emulator-side-project. It was very long since I wrote any sort of C++ and using rust was pretty refreshing. Second "besides": marty's PC may not have a lot of breadth in terms of supported hardware, but it gets the accuracy totally right. It's a very special kind of achievement. (I'm not a rust fanboy :-) I just appreciate the language for writing my emulator)
- benj111 1mo agoI assume it's called MartyPC because it Marty McFlies?
- GloriousCow 1mo agoIt is indeed a Marty McFly reference. The original demo I was trying to run was called 8088 MPH and is full of Back to the Future references. I was trying to Run Back To The Future, so I figured I'd call my emulator either Marty or McFly. Unfortunately I found out about the FM Towns later, so I renamed it from Marty to MartyPC so you could google "MartyPC Emulator" properly.
- benj111 1mo agoWell you can have the tagline for free.
- hncsiocp9x 1mo ago[dead]
- deleted 1mo ago[deleted]
- tensor 1mo agoOne of the amazing things about this project is that the author built physical harnesses for real early CPUs so that he could build test suites against the real hardware and ensure the emulation is 100% correct, down to every timing and quirk of the original hardware.
- aw1621107 1mo agoTo add on top this, the author wrote multiple blog posts on their setup [0, 1, 2]. The project itself is hosted at https://github.com/dbalsom/arduinoX86 https://github.com/dbalsom/arduinoX86 [0]: https://martypc.blogspot.com/2023/06/hardware-validating-emulator.html https://martypc.blogspot.com/2023/06/hardware-validating-emu... [1]: https://martypc.blogspot.com/2023/05/exploring-dma-on-ibm-pc.html https://martypc.blogspot.com/2023/05/exploring-dma-on-ibm-pc... [2]: https://martypc.blogspot.com/2023/10/bus-sniffing-ibm-5150.html https://martypc.blogspot.com/2023/10/bus-sniffing-ibm-5150.h...
- GloriousCow 1mo agoHi, thanks for checking out MartyPC. I'm the developer if there are any questions.
- indrora 1mo agoWhat's your favorite "What the FUCK were they smoking when they designed this?" moment?
- GloriousCow 1mo agoeasy - the PCjr keyboard interface. It is insane because IBM wanted a wireless keyboard. If you're not familiar with the PCjr keyboard, it has two IR transmitters (they are electrically the same, just having two gives you a better transmission path). The PCjr system has an IR receiver. Now, a normal keyboard cable is a standard two-wire serial protocol with clock and data. Being wireless, you have no clock, so you have to synchronize clocks, or have clock recovery built into the protocol. The PCjr does the former, using the 8253 timer chip. The keyboard has no way of knowing if the system has received a keystroke, so the system must receive every keystroke - they can't be stored in a fifo, they can't be resent if the CPU missed it. This rules out the possibility of using system interrupts - so when you type a key on the CPU and the IR receiver gets the start bit - the NMI line is raised, the 8253 is programmed to time the clock bursts from the IR receiver, and the CPU reads out every bit of the scancode. In software.
- GloriousCow 1mo agoThe PCjr also famously has no DMA, so things like floppy drive transfers are both extremely slow and somewhat unreliable - the IBM floppy controller is somewhat additionally weird is that they disable interrupts as well. The only way the PCjr knows what the controller is doing is by polling its status register, and there is enough ambiguity that it sets a 555 timer that will reset the FDC and start everything over if things time out. The combination of these two decisions means its inadvisable to type while your floppy drive is transferring data
- AmazingEveryDay 1mo ago
- mancerayder 1mo agoCan it integrate with a mobile keyboard if I opened it up on a phone? I'm eager to explore the directory contents quickly on the XT. :-)
- GloriousCow 1mo agoyes, swipe up to show a keyboard. this currently only supports the 5150/5160 completely as it is a Model F keyboard and the Tandy/Jr have some differences.