4 ms·
Nice job. The sound effects are a bit too advanced because early IBM computers shipped with pretty simple, magnetically driven dynamic speakers. On a related n
by vunderba 2mo ago
Nice job. The sound effects are a bit too advanced because early IBM computers shipped with pretty simple, magnetically driven dynamic speakers.
On a related note, I’ve actually spent the last four months working on a 100% faithful adaptation of both QBasic and QuickBasic 4.5 that runs entirely in the browser on a virtual CPU and hardware abstraction layer. It’s a love letter to everyone who learned to program on Microsoft’s BASIC interpreters in the ’80s and early ’90s.
The best compliment I’ve received so far is from friends who grew up in the same era I did: when I fullscreen the browser, a few of them assumed it was a virtual machine running the real thing.
A QBasic port of the original BASIC-based DONKEY.BAS was one of the first programs I got running in it:
https://mordenstar.com/share/qbasic-core-demos https://mordenstar.com/share/qbasic-core-demos
- HeyLaughingBoy 2mo agoAt my first job, our entire order-entry and inventory management system was written in QBASIC. I wish I had the source to try it out with this. I know someone who might, if we could figure out how to get it off a DOS 5.25" floppy!
- vunderba 2mo agoThat’s awesome. If you ever end up getting a copy of it, I’d love to stress-test QBasic-Core against it since I built in a virtual hard drive to allow File I/O (PUT for random access, PRINT to file number, etc.) I’ve got a fairly large collection of several hundred programs from the early to late ’90s that I’ve been carefully testing A/B testing against period accurate hardware and my simulator but actual professionally used QBASIC-based applications from back with the source intact are hard to come by.
- ColdStream 2mo agoThe good news is that 5.25" floppies have tended to be more resilient to time than the 3.5" discs. Turns out just having less data spread over a larger space helped them in this regard. Hardest part is usually trying to find working drives and a means of getting the data off the system.
- VorpalWay 2mo agoThe best (and most flexible) way to get data of old floppies is https://github.com/keirf/greaseweazle https://github.com/keirf/greaseweazle which reads the data at a raw magnetic level using a standard floppy drive and a custom open source circuit board which replaces the host controller. However, if you are specifically dealing with PC floppies, it is potentially overkill (but it might still be the easiest way to hook up a 5.25" floppy drive to a modern computer). 5.25" drives may also need a separate power supply in addition to the greaseweazle, for 3.5" drives the GW has enough power to power the drive directly though.
- mysterydip 2mo agoThis is fantastic! As one of those kids who spent the early 90s in QBasic, thank you!
- mosburger 2mo agoaw neat I'd love to try doing this for its predecessor GWBASIC (my first programming language on the Tandy 1000EX)
- vunderba 2mo agoYou absolutely should! I’ve already sunk hundreds of hours into building out the fidelity of QuickBASIC (everything down to emulating memory access so you can simulate realistic PEEKing and POKEing), so I don’t have the sanity points left to tackle any other variants myself, but I’d love to see a GW-BASIC version.
- chorizo 2mo agoGot grounded for “breaking” the computer by POKE’ing random numbers to 0 to 65535. In my defense, I was 11.
- vunderba 2mo agoHaha same. I definitely crashed our family's PC quite a few times as a kid by forgetting to set the segment address to &HA000 and then poking, mistakenly assuming I was hitting mode 13h VGA memory.
- 1313ed01 2mo agoSounds like pcbasic, that implements GW-BASIC in python, both with a SDL GUI and a TUI, and it contains a partial PC emulator to make it possible to peek and poke some addresses and such. Impressive project, well documented and seems stable and nothing obvious is missing. https://robhagemans.github.io/pcbasic/download.html https://robhagemans.github.io/pcbasic/download.html
- hakfoo 2mo agoWhat's weird is that they did an open-source release of GWBASIC, but it seemed to be in a worse state than the DOS 1/2/4 releases. I don't think there's a turnkey distribution out there outside of digging up your old DOS 4.01 floppies.
- d3Xt3r 2mo agoAnd for the slightly younger folks who have more memories of Visual Basic than QBasic, check out GAMBAS: https://gambaswiki.org/website/en/main.html https://gambaswiki.org/website/en/main.html
- vunderba 2mo agoLoved Visual Basic! VB3 was probably my first experience as a kid to the idea of “threading” and UI-blocking operations. Remember this? DoEvents
- d3Xt3r 2mo agoI do remember DoEvents! Sadly it's not present in GAMBAS, but there's WAIT, which is kinda the same: https://gambaswiki.org/wiki/lang/wait https://gambaswiki.org/wiki/lang/wait
- NuclearPM 2mo agoDo non-magnetically driven speakers exist?
- racingmars 2mo agoYes, electrostatic speakers are a good example. Also a lot of PC motherboards I've had over the years have had the little piezoelectric speaker. And while still magnetic, there are planar magnetic speakers which are much more like electrostatic speakers (just using a magnetic field instead of electric field) than the typical moving coil / dynamic speaker drivers that you think of.
- LeBit 2mo agoThis guy knows speakers. I have a pair of Magneplanar speakers. They always impress people.
- alana314 2mo agoNibbles!
- codebje 2mo agoYou used to be able to do surprising things with those old speakers using a timer interrupt: on an IBM XT it was possible to get 8kHz quality out of it, enough to make 4-channel MOD playback sound about as good as hearing it over a phone. But your more typical use case was to play a single tone for some significant fraction of a second.
- _jackdk_ 2mo agoThe 8088 MPH demo, for example, pushed the PC Speaker pretty far: https://www.youtube.com/watch?v=yHXx3orN35Y https://www.youtube.com/watch?v=yHXx3orN35Y
- vunderba 2mo agoNice, there’s also a great in-depth article about an album driven entirely using the primitive PC speaker. The whole COM file comes in at around 40 KB, so you can copy it onto an old machine and run it. Some of it you'd swear you're listening to a SID chip~ https://habr.com/en/articles/439192 https://habr.com/en/articles/439192 https://www.youtube.com/watch?v=tUy1MEpqbvk https://www.youtube.com/watch?v=tUy1MEpqbvk
- pjmlp 2mo agoNote for the audience that COM files were limited to 64 KB, thus not much left and naturally it was all done in Assembly.
- 2mo ago
- physicles 2mo agoAmazing. This is nostalgia heroin for me. How far does the HAL go? Screen 12 and 13, and writing directly to VRAM? WAIT for vsync? Call absolute for mouse usage?
- vunderba 2mo agoThanks! I went so far with it that I was honestly questioning my own sanity. The HAL has a virtualized CPU, and I spent more time than I’d care to admit precisely timing instructions on various period-accurate hardware (386SX, 486DX). I even tuned it to the point where programs that take advantage of it actually run faster on the 486 because of the built‑in math coprocessor. > Writing directly to VRAM? WAIT for vsync? All screen modes are supported including the ability to draw to hidden pages. It’s got a fully emulated VGA hardware layer and even a synthetic VGA beam clock, so you can do tricks like `WAIT &H3DA, 8, 8` for vertical retrace to minimize flicker. > Call absolute for mouse usage? Yup! Int 33h is fully supported, we basically use a virtual TSR driver which is pointed to by the interrupt vector table. I actually tested it with an old pixel art editor I made in the 90s! PEEK/POKE and much of the BIOS are fully simulated, so you can use more advanced QuickBasic 4.5 features like calling interrupts (including silly stuff like rebooting the computer via int 19h). There's a ton more (including a Hayes compatible modem plugged into COM1) as well. I basically dug out a stack of my old PC books from the late ’80s and early ’90s, and they’ve been my bibles for the past several months (Undocumented DOS, The Programmer’s PC Sourcebook, etc.). It’s about 99% done at this point. I’m hoping to do a Show HN in the next couple of weeks.
- khriss 2mo agoThis comment is peak HN! In depth, thoughtful comments about someone deeply passionate about technology were the reason why HN became the place on the web for hackers. Thanks for keeping the spirit alive!
- physicles 2mo agoWow, I didn’t expect this kind of reply at all. What a labor of love. Can’t wait to try it out! What made you decide to emulate things at this level instead of using a more off the shelf hardware stack?
- shakow 2mo agoHow comes the modem panel is not “shader-ized” (scanlines + distortion)?
- vunderba 2mo agoKeen eye! That's an old demo video. The modem panel now (and other panels such as the printer) are now run through the same post-processing shader pipeline as the rest of the editor when you've entered into CRT immersive mode.
- mycall 2mo agoI once heard a digitized version of "Daisy Bell" (DAISY.COM) which sings through IBM PC speaker although of poor bitrate.
- londons_explore 2mo agoIt runs fairly well in dosbox in a browser though right? Why port directly?
- vunderba 2mo agoGreat question! So DOSBox, which I absolutely love, has some limitations. For example, you don’t really get a lot of period-accurate virtual devices out of the box, whereas Qbasic-Core tries to recreate the experience of actually having a 386SX/33 MHz computer along with the accompanying peripherals - everything from a LPT-connected dot-matrix printer to a 14.4 kbps Hayes-compatible modem, all of which you can directly interface with. For me, this project is really a love letter. It’s about recreating that nostalgic experience and also making it something others can just drop in and enjoy. You don't have to install DosBox, track down a copy of QBASIC and configure it with sane defaults for speed since many BAS programs which are CPU dependent are probably going to run way too fast. You can run it anywhere you have a browser, because it runs entirely client-side. You can even share programs in other sites, since it ships with a small virtual interpreter. That means you can iframe BAS examples if you want to demonstrate how QuickBasic worked.
- dahart 2mo ago> early IBM computers shipped with pretty simple, magnetically driven dynamic speakers Yes the PC & donkey.bas were monophonic design, but the PCjr shipped with 3-channel polyphonic sound plus a noise generator. It might have been capable of doing the sounds in this port of donkey that took “some liberties”. ;) I remember some sound demos on the PC that emulated polyphonic sound by fast/audible switching between notes in a chord. Hey it seemed cool at the time. :P I just looked and couldn’t find any quickly enough but bumped into examples of even better true polyphony on the PC achieved by assembly hacking.
- vunderba 2mo ago> I remember some sound demos on the PC that emulated polyphonic sound by fast/audible switching between notes in a chord Didn't know that about the PCjr! I'll have to see if I can find some examples of the generator online. Polyphony by rapidly switching between notes in a chord was also one of the common tricks on the SID chip for the C64. Even though it has separate channels, you could use get away with a single channel to play triads by arpeggiating extremely fast between the three notes.
- arantius 2mo ago> ... fast/audible switching between notes in a chord ... https://en.wikipedia.org/wiki/Arpeggio https://en.wikipedia.org/wiki/Arpeggio Many of my favorite chiptunes use this technique.