An 8086 PC emulator in 4043 bytes
ioccc.org
An 8086 PC emulator in 4043 bytes
1–10 of 39 posts
Re: An 8086 PC emulator in 4043 bytes
#2Or after running through preprocessing (not a huge help I found, sadly): https://gist.github.com/peterc/8259713
Re: An 8086 PC emulator in 4043 bytes
#3Re: An 8086 PC emulator in 4043 bytes
#4The source itself: http://ioccc.org/2013/cable3/cable3.c Or after running through preprocessing (not a huge help I found, sadly): https://gist.github.com/peterc/8259713
Re: An 8086 PC emulator in 4043 bytes
#5Then I saw AutoCAD, Flight Simulator, and Windows.
Mind = blown.
Re: An 8086 PC emulator in 4043 bytes
#6The source itself: http://ioccc.org/2013/cable3/cable3.c Or after running through preprocessing (not a huge help I found, sadly): https://gist.github.com/peterc/8259713
Did you do this by hand? Line 38 looks weird: main(BX,nE)char nE; {
Re: An 8086 PC emulator in 4043 bytes
#7Earlier quoted context omitted.
Did you do this by hand? Line 38 looks weird: main(BX,nE)char nE; {
That's an old-school C function declaration. Note that the function return type are parameter types are implicitly int. nE is then explicitly declared to be a char pointer pointer.
Re: An 8086 PC emulator in 4043 bytes
#8The source itself: http://ioccc.org/2013/cable3/cable3.c Or after running through preprocessing (not a huge help I found, sadly): https://gist.github.com/peterc/8259713
Did you do this by hand? Line 38 looks weird: main(BX,nE)char nE; {
Re: An 8086 PC emulator in 4043 bytes
#9Re: An 8086 PC emulator in 4043 bytes
#10"CPU supports the full 8086/186 instruction set. Due to the complexities of the 8086’s arbitrary-length instruction decoding and flags, 8086 instructions are first converted to a simpler intermediate format before being executed. This conversion, along with instruction lengths and how each instruction modifies the flags, is assisted by some lookup tables which form part of the BIOS binary."
With that in mind, the BIOS is _hand-written_ and about 12kB (gzips to <4kB), so that's also a fantastic achievement. All-in-all, this is a wonderful entry.