TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Pacman in 512 bytes of x86 boot sector machine code

229 点作者 nanochess将近 6 年前

11 条评论

thrwaway4137将近 6 年前
just to put into perspective how little 512 bytes is, here is 512 ascii bytes (including 8 newlines)<p><pre><code> pacmanpacmanpacmanpacmanpacmanpacmanpacmanpacmanpacmanpacman pacmanpacmanpacmanpacmanpacmanpacmanpacmanpacmanpacmanpacman pacmanpacmanpacmanpacmanpacmanpacmanpacmanpacmanpacmanpacman pacmanpacmanpacmanpacmanpacmanpacmanpacmanpacmanpacmanpacman pacmanpacmanpacmanpacmanpacmanpacmanpacmanpacmanpacmanpacman pacmanpacmanpacmanpacmanpacmanpacmanpacmanpacmanpacmanpacman pacmanpacmanpacmanpacmanpacmanpacmanpacmanpacmanpacmanpacman pacmanpacmanpacmanpacmanpacmanpacmanpacmanpacmanpacmanpacman pacmanpacmanpacmanpacman </code></pre> that&#x27;s it. That&#x27;s 512 characters&#x2F;ascii bytes.
评论 #20387953 未加载
评论 #20388216 未加载
评论 #20387539 未加载
评论 #20388054 未加载
jchw将近 6 年前
Reflection:<p>- Machine code is very dense. Really, this is not an accident, although maybe it’s not entirely on purpose either, more just common sense at the time. In the end, there were probably many platforms using this or predecessor CPUs with very little RAM&#x2F;ROM and bytes still counted even on IBM PC.<p>- Assembly code is still very readable. The trouble is not that machine code isn’t readable, and it probably never really was. It just doesn’t offer ways to build abstraction beyond what the machine supported (like routines, sw interrupts, etc.) Only gets worse as hardware gets more complicated. Imagine avoiding VGA and instead attempting to support initializing a modern graphics card all the way through! It would probably be quite ridiculous even with documentation. This is part of what bugs me about a lot of non-x86 platforms, since that’s kind of the environment you’re dropped into in many of them.<p>- Speaking of compatibility, one must wonder how many new layers have been introduced on top of things like VGA since the original VGA.
评论 #20387708 未加载
评论 #20388367 未加载
评论 #20390758 未加载
parkertomatoes将近 6 年前
Playable link: <a href="https:&#x2F;&#x2F;parkertomatoes.github.io&#x2F;v86&#x2F;?type=mbr&amp;content=uBMAzRD8uACgjtiOwL54fb8gFC6tkbvwANHhuBg3cwO4OALooAEB34PrEHIK6JYBKd%2BD7wjr4oHHiAmB%2FqJ9ddKxBbgCAC6lq%2BL7tADNGjsWBPp09okWBPq0Ac0WtAB0As0WiOAsSHIMPAlzCLusfS7Xov75viDmrZetkzHA6CwAgDb%2F%2BYC4KA54B6Ai5rED0uDoMQG3IegbAbcu6BYBtyjoEQG3NOgMAeugdAPoFgGJ%2BDHSuUAB9%2FGI1AjEgOQHdVu1Nzht%2FxDkOK0AChDkOG0IEOQ4rcD%2BEOSE%2F3Qt9sMFdAw7FgD6sAJyDrAI6wo6BgL6sARyArABhMR1IojYhMR1HNDodfiwCOv0iRYA%2BqIC%2BqD%2B%2BYTEdQYg3HQaiNiIRP6oBbuA%2FXUDuwIAqAx0AvfbAd%2BJfPzDAELn5%2F%2F%2Ffjw8fvzw8Px%2BPP%2F%2F%2F%2F%2F%2F%2F%2F%2F%2FPH7%2F%2F%2BfnQgA8fv%2F%2F%2F%2F9%2BPDx%2B29v%2F%2F%2F%2BlAAAAGBgAAAA8fj8PDz9%2BPAAA%2Fn8CQgJC%2F39AQn5%2BAgJ%2FAsADQAJ%2FAkAC%2Fn8CQv97QAp%2BfgJA%2F38AAJiqkFCYZKA8qFABAAAIAAIAAAStl62E5JOwMFDGRP8C6Ob%2BWFBTUVdQuzB9LteTuQgAiPjQ43ICMcCA%2FxByCoA9DnUD6Rf%2BMgWq4uaBxzgBWECoB3XSX1lbWMNPVao%3D" rel="nofollow">https:&#x2F;&#x2F;parkertomatoes.github.io&#x2F;v86&#x2F;?type=mbr&amp;content=uBMAz...</a>
JoeAltmaier将近 6 年前
My older brother bought an 8086 kit in the 80&#x27;s. He could afford 128B (bytes) of RAM which cost $50. It had a front panel with switches for toggling in a program (MITS 8800) and a serial display port. So I wrote a little game in 128 bytes that took one key input and you guided a little &#x27;X&#x27; around the screen, trying to avoid the obstacles or going off the screen.
评论 #20388728 未加载
评论 #20396089 未加载
remlov将近 6 年前
Video of this in action: <a href="https:&#x2F;&#x2F;www.youtube.com&#x2F;watch?v=ALBgsXOq11o" rel="nofollow">https:&#x2F;&#x2F;www.youtube.com&#x2F;watch?v=ALBgsXOq11o</a>
评论 #20387483 未加载
moron4hire将近 6 年前
What&#x27;s incredible is that there really aren&#x27;t any special &quot;tricks&quot; here. The code is pretty easy to follow.
SmellyGeekBoy将近 6 年前
&gt; It&#x27;s compatible with 8088 (the original IBM PC). So you now have to look for a 8-bit compatible VGA card if you want to run it in original hardware ;)<p>I&#x27;d be interested in the thoughts behind this decision. CGA would have been more period correct and more compatible with the &quot;real&quot; hardware that&#x27;s out there (I say this as an IBM 5150 owner). Not wanting to criticise the author of course - this is still a very cool project and, being open source, I&#x27;m sure we&#x27;ll see new variations popping up before too long. I might even have a go myself.
评论 #20390629 未加载
nanochess将近 6 年前
Standby for my upcoming 8088 programming book ;)
ktpsns将近 6 年前
&gt; It can be run as a COM file or put into a boot sector of a floppy disk to be run.<p>Isn&#x27;t &quot;COM file&quot; something specific to DOS? How does it differ from a machine binary file, i.e. what GCC (or a linker) would spit out of the ASM code? (The makefile uses nasm, thought)
评论 #20387659 未加载
评论 #20387684 未加载
评论 #20387664 未加载
评论 #20390603 未加载
basementcat将近 6 年前
While still very impressive, this does make use of BIOS routines for VGA, I&#x2F;O and timekeeping.
评论 #20388303 未加载
评论 #20390647 未加载
sukilot将近 6 年前
HN Title is misleading. The github author correctly calls it Pillman &#x2F; yellow-thing-eats-pills-and-chased-by-ghosts . Even ignoring trademark issues; it&#x27;s not Pac-Man -- there are no power pills, no teleporter&#x2F;torus holes, no ghost house, no fruits, no score, etc.