[HN Gopher] Intel 8080 emulator. 19th IOCCC. Best of Show
       ___________________________________________________________________
        
       Intel 8080 emulator. 19th IOCCC. Best of Show
        
       Author : hggh
       Score  : 126 points
       Date   : 2024-03-19 18:15 UTC (4 hours ago)
        
 (HTM) web link (nanochess.org)
 (TXT) w3m dump (nanochess.org)
        
       | nsxwolf wrote:
       | Is there an ELI5 for this? How could something so small possibly
       | be an 8080 emulator?
        
         | bombcar wrote:
         | The 8080 is a simple processor, the "how to program" manual is
         | only 60 pages.
         | 
         | Most of the instructions are changing registers in various
         | ways, which is pretty simple. The Appendix A has all of them:
         | https://altairclone.com/downloads/manuals/8080%20Programmers...
        
           | tromp wrote:
           | I am more amazed you can fit a (pretty large subset of)
           | Haskell compiler/runtime in about twice the size [1].
           | 
           | [1] https://www.ioccc.org/2019/lynn/hint.html
        
             | anthk wrote:
             | Well, an a complete lisp system on that size, for sure. And
             | forth environment.
        
           | none_to_remain wrote:
           | I went too far and ran into the printed hexadecimal-decimal
           | lookup table for every number from 0x0-0xFFF
        
             | dekhn wrote:
             | ah yes, I had that poster on my wall as a kid... https://tw
             | itter.com/JBrooksBSI/status/952291667041599488/pho...
        
               | bombcar wrote:
               | Now I'm having fond memories of discovering the IBM box
               | drawing characters above 128 as a kid, and doing fancy
               | text files.
        
         | belter wrote:
         | It's the Toledo family. All is possible.
         | 
         | https://news.ycombinator.com/item?id=28337064
        
           | msla wrote:
           | Given the number of lies on the company's website, I'm not
           | inclined to believe them about other things.
        
           | philomath_mn wrote:
           | Wow, that sent me down a rabbit hole -- but this line from
           | the homepage makes it sound like he is _not_ part of that
           | family?
           | 
           | > If you're looking for information about the Mexican
           | scientist Oscar Toledo Esteva, then please go to the History
           | page of the Familia Toledo organization site.
           | 
           | https://nanochess.org/index.html
        
             | emi2k01 wrote:
             | I believe they are father and son. The `Books` section on
             | the Toledo family website links to books written by Oscar
             | Toledo G.
        
         | slily wrote:
         | The 8080 instruction set opcodes have logical bit patterns, so
         | you can identify the operation and operands through bit masking
         | instead of requiring a huge LUT. Beyond that you can simplify a
         | lot by sacrificing timing accuracy.
        
           | zabzonk wrote:
           | you can also write one using a 256-byte switch, which ain't
           | so big. i wrote an 8080 emulator in fortran77 on a dec10 that
           | way, back in the 1980s. but of course size wasn't an issue.
           | it did prove to be quite portable - to vax and ibm vm/cms. we
           | used it for teaching assembler programming.
        
         | RetroTechie wrote:
         | The 8080 has ~5k transistors. There's only so much complexity
         | one can build with those.
        
       | tromp wrote:
       | Sadly, the International Obfuscated C Code Contest has not been
       | held in the past 3 years, the last one being the 27th IOCCC from
       | 2020 [1].
       | 
       | Looking forward to seeing more editions in the future, and
       | submitting another entry myself...
       | 
       | [1] https://www.ioccc.org/years.html#2020
        
         | howerj wrote:
         | I've been waiting for the competition to open up again, I think
         | I have an entry good enough. There does appear to be some
         | activity on their GitHub repo, but I have no idea when the next
         | one will be. Does anyone here have any gossip about when the
         | next one might be? Wild rumor would also suffice.
        
       | dormento wrote:
       | > I intended to make it simple to understand, it uses only four C
       | keywords.
       | 
       | Fantastic
        
       | wzdd wrote:
       | Related, 8086tiny, a 2013 IOCCC winner. About twice as much
       | source code, and if not cheating then certainly leaning heavily
       | on the rules, but very impressive as it's a full x86 emulator
       | with graphics and several peripherals.
       | 
       | Original entry: https://www.ioccc.org/years.html#2013_cable3
       | 
       | "Deobfuscated": https://github.com/adriancable/8086tiny
       | 
       | (Not mine, just a fan)
        
         | rahkiin wrote:
         | From the description, one small part of the code:
         | 
         | --64[T=1[O=32[L=(X=*Y&7)&1,o=X/2&1,l]=0,t=(c=y)&7,a=c/8&7,Y]>>6
         | ,g=~-T?y:(n)y,d=BX=y,l]
         | 
         | The difference between bf and c sometimes is small
        
       | anthk wrote:
       | BTW, CPM 2.2 doesn't run on that emulator in my machine (intel
       | Atom, Linux, 32 bit, tried with gcc 8, clang 11, and tcc 0.29.7).
       | Basic does.
        
       | simlevesque wrote:
       | It compiles on my machine but I can't run it, I always get a
       | SIGSEGV. Same thing for the chess program.
       | 
       | I ran both the original build command and the "And now it is
       | 2024" one.
        
         | skulk wrote:
         | For the 8080 emulator, you need the c_basic.bin (renamed to
         | just "C") and c_bios.bin to be in the same directory as the
         | executable, as per the article. I tried this and it dumps me
         | into a BASIC shell. So cool!
        
       | verall wrote:
       | A somewhat related ask for help -
       | 
       | I have seen a program, I think for IOCCC, where the code was
       | aligned in 4 character columns that seemed to naturally fit the
       | code, so it would have code arranged like:                 for(
       | long i=0; i<n; i++)       {int a=1, b=2, c=3, d=4;
       | 
       | for the whole program.
       | 
       | I lost it though and have been completely unable to find it,
       | despite searching very hard.
       | 
       | Has anyone seen something like this before? I would be forever
       | grateful for any pointer towards it.
        
         | omoikane wrote:
         | Was it one of these?
         | 
         | https://www.ioccc.org/years.html#1995_heathbar
         | 
         | https://www.ioccc.org/years.html#2014_endoh1
         | 
         | https://www.ioccc.org/years.html#2006_sloane
         | 
         | May be related, I have an index that lists winning entries with
         | some form of ASCII art, one of those could be what you were
         | looking for.
         | 
         | https://docs.google.com/spreadsheets/d/e/2PACX-1vRg3T5z-QN66...
        
       | xuhu wrote:
       | Is there a competition where you win by showing something both
       | compact and extraordinary but not obfuscated ? Like zlib
       | compression in 100 lines or some song recognition using FFT in X
       | lines, or a working ssh client in Y lines ?
        
         | frakt0x90 wrote:
         | Demoscene? Mostly geared towards graphics but that's one
         | example.
        
       ___________________________________________________________________
       (page generated 2024-03-19 23:00 UTC)