Building an x86 ancestor : an attempt.

Discussion in 'Lounge' started by The_YongGrand, May 31, 2015.

  1. The_YongGrand

    The_YongGrand Just Started

    Here goes my (vain) attempt to build an entire 8088 (an x86 ancestor) computer out of breadboards, wires, and more wires!

    The first picture is the breadboarded system. Top is the Intel 8088 clone (NEC V20) because it can operate at lower voltages and a 50% duty cycle clocking, which I can get it from other microcontrollers. The middle has the latches to hold the address, and the buffers to control the data in/outs. On the right is the extra circuitries for selecting which RAM/ROM to access. (address decoders)

    The bottom is the SRAM (Static RAM) which is only at 512kilobytes. Trust me, it's a lot back then. I have not connected the EEPROM (Electrically Erasable Programmable ROM) yet - this is the part where the BIOS firmware is stored inside. [After all, this is what this website is all about!]

    The other picture is the EEPROM programmer I whipped out because I'm too lazy to buy them from Ebay. As the name goes, it programs the firmware inside.

    The challenging part is to write the BIOS firmware using assembler, and to carefully connect this EEPROM back into the circuit after programming. As there is no "graphics card" or anything, I have to manually program the interrupts (INT 10H here) to send the output to a small character LCD. Once it's done I can do a memory test and maybe add more stuff to it.

    It may take many weekends since I can only work on that for these time! :faint: :haha:
     

    Attached Files:

  2. Adrian Wong

    Adrian Wong Da Boss Staff Member

    Wow.. Really low-level stuff! #RESPECT! :thumb: :thumb:
     
  3. atwl77

    atwl77 Just Started

    512? Should have put in 640... otherwise not enough for playing Double Dragon X-D
     
  4. Chai

    Chai Administrator Staff Member

    Lol, space+p for kicking. I remember bashing the keyboard.
     
  5. The_YongGrand

    The_YongGrand Just Started

    On other note, here's a guide where I learn how to whip this circuit out:

    homebrew8088

    With some knowledge of Digital ELectronics back, I did it okay enough. :)
     
  6. The_YongGrand

    The_YongGrand Just Started

    I bumped into a problem when I have to write the firmware - the assemblers are very limited and there are not much guides on "composing" BIOS in an embedded environment. Plus, bringing in the EEPROM in and out the breadboard would break the pins, so it isn't too feasible.

    Luckily I have an FPGA board where I can directly connected the processor to it and the FPGA is responsible for all the address decoding which saves a lot of time and space, and I don't have to connect the individual chips one-by-one.

    Another alternative will be using Raspberry Pi with a full emulator - at the least I would just need to test the BIOS code by simply loading it. :)
     
  7. Adrian Wong

    Adrian Wong Da Boss Staff Member

    You bought the Raspberry Pi too?
     
  8. The_YongGrand

    The_YongGrand Just Started

    Oh man, I have two of them! I have the A+ (small and slim version) and the latest 2.

    The RPi-2 is already being used for a media player for my new cheap Samsung 40-inch LED. Put the "Kodi Media Player" image there too! :)

    Apart from all that, this thing is everywhere now, and sometimes it's so cheap, you can make all sorts of things on it. I'm also planning to build a mini-arcade for myself using that as well. :thumb:

    Hint: Buy the Pis from Element14!
     
  9. Adrian Wong

    Adrian Wong Da Boss Staff Member

    You are so 1337! :thumb: :thumb:
     
  10. The_YongGrand

    The_YongGrand Just Started

    Nah, I'm not that uber-leet! You can get the Pis to play with too, and the Arduino. Get yourself a small box of electronic components and learn programming and also some electronics. :)
     
  11. The_YongGrand

    The_YongGrand Just Started

    After the trouble of breadboarding the entire thing, I have to put that aside and use an emulator - lucky me I have access to very fast microcontrollers like STM32. Plus, some of their "training boards" have SDRAM inside, so memory isn't an issue there.

    Of course, I have found an 8086 emulator code by Mike Chambers - and I have to strip this code to a bare minimum before I port this to the microcontroller.

    After messing around with what works and what doesn't, I manage to compile the (modified) little assembly code sample by homebrew8088, and at last, the system jumps to the desired starting point (0x0300 in the sample code just for the testing). In the picture you can see the address changes after stepping instruction by instruction. Of course it remains at 0300:0000 because the sample program code I have is waiting there.

    And yes, the emulator copies the contents of the BIOS into the RAM first, hence the "ROM BIOS shadowing".

    The system, starts at the address FFFF:0000 during bootup. From that, it jumps to another address which deals with the main body of the BIOS program and all the other important things. :whistle:

    If I'm not mistaken, all the PCs have to start at the minimum 16-bit mode during the bootup. :whistle:
     

    Attached Files:

    Last edited: Jul 4, 2015
  12. Adrian Wong

    Adrian Wong Da Boss Staff Member

    I think that's only if they are using the BIOS. They should be able to skip that if they are using the new UEFI, right?
     
  13. The_YongGrand

    The_YongGrand Just Started

    Yeah. I read that when it enters the new UEFI, they can switch back between the 16 and 32-bit mode.

    However, all I focus now is the very basic of the x86 system - learn to write a BIOS like what these people did during the 90s. I wouldn't focus on the Video BIOS first - they might be a different entity.

    The newer UEFI BIOSes are by Coreboot, and they can be written in C. Some of the motherboards can be flashed into a custom firmware, but the user must need a "Bus Pirate" (a flexible handy programmer/probe kit) to reprogram the Flash BIOS inside. Luckily these are not parallel EEPROM, they are either SPI/I2C, so these can be programmed in situ. :thumb:
     
  14. Adrian Wong

    Adrian Wong Da Boss Staff Member

    You should write a guide on what you are doing. :mrgreen:

    BTW, don't forget to update me on the list for Galileo! :D
     
  15. The_YongGrand

    The_YongGrand Just Started

    Yeah, I will try my best. I'm not experienced in any x86 programming and I'm just learning how to do all that. :)

    Btw, is it okay if I can consult my colleague about the project suggestion for Galileo? He has worked on it and may give us some simple ideas. :)
     
  16. trodas

    trodas Newbie

    Amaizing stuff. However I doubt, that w/o blocking capacitors this will work reliably. Time to add even more components, I'm affraid :D

    And yep, writting own bios become necessary :) Good luck with that :) Please let us know, how it will go... :beer:
     
  17. The_YongGrand

    The_YongGrand Just Started

    After a year, I managed to come back and dust off this thing, but first, I have used an emulator on PC to test-run the BIOS ROM first. The Fake86 emulator (by Mike Chambers) is ported into a 32-bit microcontroller and I've been trying to call the int 10h interrupt, and it succeeded.

    However, I'm not writing any video BIOS and all the int 10h (screen output) interrupts and its routines are re-routed to the external I/O ports so that the external video driver (which I again, built it myself) displays the stuff. :)

    However, I need many stripboards and many wires of different colors to rebuild the 8088 system since it's messy on the breadboard. I will come back with those and make a permenant solution. :)
     

Share This Page