Shop OBEX P1 Docs P2 Docs Learn Events
A Propeller based 8086 emulator couldn't be that far away — Parallax Forums

A Propeller based 8086 emulator couldn't be that far away

pedwardpedward Posts: 1,642
edited 2014-01-10 21:30 in Propeller 2
http://www.ioccc.org/2013/cable3/hint.html

I'm thinking that with only 4043 bytes of C code and a BIOS, this could be the basis of workable PC emulator on the Prop 2.

The developer may have unobfuscated original source code to work from.

http://www.ioccc.org/years.html#2013

Comments

  • Heater.Heater. Posts: 21,230
    edited 2014-01-08 17:40
    Good grief. That is downright frightening. What kind of brain do you have to have to write a thing like that?!

    I guess it will compile under propgcc. How big will it be?

    Baring the fact that it uses SDL for output it should work on a P1 with external RAM.
  • TubularTubular Posts: 4,702
    edited 2014-01-08 18:07
    Just brilliant
  • Cluso99Cluso99 Posts: 18,069
    edited 2014-01-08 18:24
    Heater. wrote: »
    Good grief. That is downright frightening. What kind of brain do you have to have to write a thing like that?!

    I guess it will compile under propgcc. How big will it be?

    Baring the fact that it uses SDL for output it should work on a P1 with external RAM.
    Wow!

    Wonder what ZiCog would look like???
  • Heater.Heater. Posts: 21,230
    edited 2014-01-09 06:49
    Cluso,
    Wonder what ZiCog would look like???
    Noooo...!!!

    I managed to compile cable3. Works fine.
  • David BetzDavid Betz Posts: 14,516
    edited 2014-01-09 06:59
    Heater. wrote: »
    Cluso,

    Noooo...!!!

    I managed to compile cable3. Works fine.
    You mean you compiled it and ran it under propgcc? What external memory did you use?
  • Heater.Heater. Posts: 21,230
    edited 2014-01-09 07:12
    No not propgcc.

    We are going to need a few SDL routines to get this to compile for the Prop. As far as I can see it only uses:
    SDL_Flip()
    SDL_PumpEvents()
    SDL_SetVideoMode(720,348,32,0)
    SDL_Quit()

    Sounds doable if anyone is keen. Except we need a megabyte or two of double buffered video surface by the looks of it.
  • David BetzDavid Betz Posts: 14,516
    edited 2014-01-09 07:27
    I guess jazzed's 32MB SDRAM board would work.
  • Heater.Heater. Posts: 21,230
    edited 2014-01-09 07:38
    You might guess what comes next.

    Cable3 compiled to Javascript to run in the browser.
  • David BetzDavid Betz Posts: 14,516
    edited 2014-01-09 07:42
    Heater. wrote: »
    You might guess what comes next.

    Cable3 compiled to Javascript to run in the browser.
    Have fun with that! :-)
    But I'd like to run it using a browser running on my Spinneret. Can you do that?
  • cgraceycgracey Posts: 14,151
    edited 2014-01-09 15:31
    Does this mean we can have DOS back?
  • Bill HenningBill Henning Posts: 6,445
    edited 2014-01-09 15:33
    Odds are that a hand-tuned p2asm 8086 emulator would run at about 16-20Mhz equivalent.

    Hmm... DRDOS is freeware...
    cgracey wrote: »
    Does this mean we can have DOS back?
  • cgraceycgracey Posts: 14,151
    edited 2014-01-09 15:42
    Odds are that a hand-tuned p2asm 8086 emulator would run at about 16-20Mhz equivalent.

    Hmm... DRDOS is freeware...


    Well, that would be faster than the old Radio Shack 4.77MHz 8086 machine that we bought for $1200 that we made our early microcontroller tools on. I made our original EEPROM emulator and Signetics 87C751 (24-pin 8051) assembler and programmer for the PC on that old system. I miss the simplicity of those times. I never thought then that I'd someday work on a chip that could practically replace the whole motherboard of that machine. There were no FPGA's back then - only PALs and GALs, maybe PLDs. I guess I'll take today over yesterday.
  • localrogerlocalroger Posts: 3,451
    edited 2014-01-09 16:23
    Odds are that a hand-tuned p2asm 8086 emulator would run at about 16-20Mhz equivalent.

    When 12 MHz was typical around the days of MS-DOS 3.3 PC's were quite capable and zippy. There was a lot of finely tuned code written in the 4.77 MHz days that was seeing more clock and RAM than its creators had anticipated. I still miss the source code editor I used then, which could keep dozens of files (and different windows into the same open file) open at once, switching between views instantly. 256K RAM was still considered adequate, even luxurious, for most non-gaming non-power-user purposes. And most of that software can still be found.
  • David BetzDavid Betz Posts: 14,516
    edited 2014-01-09 16:34
    Oh no! If we can run DOS on the P2 then the list of Propeller languages will explode! Just think how many DOS-based compilers and interpreters will have to be added! :-)
  • bartgranthambartgrantham Posts: 83
    edited 2014-01-09 17:04
    pedward, the P2 is the first thing that came to my mind as well when I saw cable3 in the contest entries.
    Heater. wrote: »
    You might guess what comes next.

    Cable3 compiled to Javascript to run in the browser.

    Not sure if it's better or worse than the IOCCC entry, but this x86/PC emulator is pretty well done.
  • Heater.Heater. Posts: 21,230
    edited 2014-01-09 18:01
    Chip,
    Does this mean we can have DOS back?
    As much as I hate to admit it, I don't see why not.

    bartgrantham,

    I bet there are many ways to go with x86 emulation. I just loved the perversity of compiling obfuscated C into Javascript!
  • Bill HenningBill Henning Posts: 6,445
    edited 2014-01-09 19:01
    Seems to be written in JavaScript
    pedward, the P2 is the first thing that came to my mind as well when I saw cable3 in the contest entries.



    Not sure if it's better or worse than the IOCCC entry, but this x86/PC emulator is pretty well done.
  • kwinnkwinn Posts: 8,697
    edited 2014-01-09 19:52
    Interesting stuff, but I am wondering when there will be an emulator/compiler for the first language I wrote a program that was used commercially. Anyone know of an emulator for IBM 1401 SPS? Any documentation out there for it?
  • YanomaniYanomani Posts: 1,524
    edited 2014-01-09 21:02
    Hi kwinn

    Though I'd never touched a "living" IBM 1401, in 1985 I was involved in the design of an IBM 2821 emulator (+300 LSTTL + NxZ80s + Nx6116 + Nx2732/2764/27128 + Nxdiscrete BJT's/darlingtons/assorted passive components), to control a 1403 printer.
    Almost 200 units were assembled and sold/rent in Brazil, until 1989.

    The following link leds to a bunch of info about the 1401, I hope it can help a bit.

    http://ibm-1401.info/index.html#Major-Topics

    Yanomani


    kwinn wrote: »
    Interesting stuff, but I am wondering when there will be an emulator/compiler for the first language I wrote a program that was used commercially. Anyone know of an emulator for IBM 1401 SPS? Any documentation out there for it?
  • YanomaniYanomani Posts: 1,524
    edited 2014-01-09 21:22
    By the way....

    Does someone have any clue about a copy of the following book and/or Mr. Rick Bensene, from "The Old Calculator Web Museum"?

    http://www.oldcalculatormuseum.com/m-m1800ap.html

    Since dreaming worth by itself, and costs no more than a good night of sleep, I'd love to write my own Monroe 1800/Compucorp 400 series emulator, in order to revisit some of the first programs I've crafted, in assembly language. :nerd:

    Yanomani
  • Cluso99Cluso99 Posts: 18,069
    edited 2014-01-09 22:31
    Maybe I should dig out my Singer/ICL System Ten and System 25 emulators (i486) and rewrite for P2 ;)
  • Willy EkerslykeWilly Ekerslyke Posts: 29
    edited 2014-01-09 22:37
    Closest I can find is a PDF document at http://bitsavers.trailing-edge.com/pdf/compucorp/. It's for a Compucorp 445.
  • kwinnkwinn Posts: 8,697
    edited 2014-01-10 11:57
    Thanks for the link Yanomani, I will be looking in to it. Like you I never touched a "living" 1401 either. The hardware was a Collins 8400 with a 1402 card reader/punch, 1403 printer, and 3 tape drives. AFAIK it was one of the earliest machines to use microcode rather than hardware to control the cpu. The 1401 emulator was done in microcode so the entire main memory was available for programming.
    Yanomani wrote: »
    Hi kwinn

    Though I'd never touched a "living" IBM 1401, in 1985 I was involved in the design of an IBM 2821 emulator (+300 LSTTL + NxZ80s + Nx6116 + Nx2732/2764/27128 + Nxdiscrete BJT's/darlingtons/assorted passive components), to control a 1403 printer.
    Almost 200 units were assembled and sold/rent in Brazil, until 1989.

    The following link leds to a bunch of info about the 1401, I hope it can help a bit.

    http://ibm-1401.info/index.html#Major-Topics

    Yanomani
  • YanomaniYanomani Posts: 1,524
    edited 2014-01-10 20:36
    Willy Ekerslike

    Thanks for this link, I've already found it, some two year ago or so. Although it fully describes the "plain vanilla" Compucorp 445 operations, from a statistics aware programming perspective, it lacks any references to assembly language programming and the hardware foundations of Compucorp 400 series microcomputers, whose knowledge would be essential to enable a simulator for it to be crafted.
    Half of their instruction set space used to have a dual meaning, selectable under control of a special flag bit (GPCI - Group C Instruction), whose set/reset process was exercised thru one special flag set control instruction, present at the permanently enabled half of the instruction map.
    And there was the hut, where the whole magic begins.
    Once enabled, the third instruction set allowed a realy motivated, 19 y.o. young guy (me, for sure) to tackle every obstacle he never saw before, such as controlling a hammer chain to smash a two-colored ink tape between an (almost) never ending paper roll and a hard-crafted-character-covered, spinning metal drum, to paint "fuzzy and funny" shapes and faces, or rattle an Emerson, Lake & Palmer tune, other than showing simple mathematical equations results.
    It also allowed him to "taste" the sweetness of full speed cassete tape drive control, and its very loud head engage solenoid, adding a bit of "drums" to its music.
    Then, after mastering the whole tape write processes, allowed him to create his first records of "moog alike" cassette files, to be played elsewere, as digital music; a never ending crew amusement topic.
    Oh boy, sure there were joyous times, and a lot of encouragement and motivation involved, being allowed to learn software and hardware this way. And all this, in my spare or extra-hours time, cause I was urged to make my bread and butter, boringly programming it using mostly high-level instructions, to solve mechanical calculus equations and finite element stiffness and load matrices, at my second employer's industrial facility mechanical design department, some long ago defunct french company.
    Programming (hard/soft) has nothing to do with being a nerd or guru; it's all about being happy doing so.
    Chip, Ken and the whole Parallax team and concepts are fully right; it must be fun to learn and spark the right ideas, human nature will take care of the rest.

    Yanomani
    Closest I can find is a PDF document at http://bitsavers.trailing-edge.com/pdf/compucorp/. It's for a Compucorp 445.
  • YanomaniYanomani Posts: 1,524
    edited 2014-01-10 21:30
    kwinn

    You're always welcome. I've been lucky enough to have a chance to "tweak" an ancient IBM System/3 core memory read amplifiers power supply, as part of kind of a stress test; an early morning prerequisite, safely preparing it for some "commercial" usage.
    Kind of a bit lose/gain funny game, backed by an insulated screw driver and a huge needle display equiped analog VOM.
    Ever good for chilly days, cause "the beast" used to spread lots of heat out of its top grid, warming my hands, arms and shoulders, in the otherwise cold as hell condicioned air data processing environment.
    As for memory, my first Compucorp had a mild 2kB of Ram and a lot of 512 byte-long magnetic cards; starvation and space shrinkage are excellent advisors for novice programmers; you could ever dream big and think further, then assembly it, in very small steps.
    Pray God, and pass the ammunition (or the next card)! Don't mix them up, nor reverse their order, ever.

    Sure we are piling years as old furniture piles dust, soon we all will be allowed to defy Methuselah and his 999 paradigm. I could bet he had an unnoticed card, inside its tunic.:lol:

    Yanomani


    kwinn wrote: »
    Thanks for the link Yanomani, I will be looking in to it. Like you I never touched a "living" 1401 either. The hardware was a Collins 8400 with a 1402 card reader/punch, 1403 printer, and 3 tape drives. AFAIK it was one of the earliest machines to use microcode rather than hardware to control the cpu. The 1401 emulator was done in microcode so the entire main memory was available for programming.
Sign In or Register to comment.