Image Map Image Map
Results 1 to 7 of 7

Thread: 8008 pure JavaScript emulator

  1. #1
    Join Date
    Jun 2012
    Location
    UK - Worcester
    Posts
    1,975

    Default 8008 pure JavaScript emulator

    I managed to find a day or so to at least 'break the back' of a new 8008 JavaScript emulator.

    Most of it is running, but I have some bugs to shake out and I would like to add an I/O port simulator.

    It is running MONITOR-8 from the MIL MOD-8 computer system.

    I will post it to my google drive when I am happy and post a link on this thread to it for comments.

    Dave

  2. #2
    Join Date
    Jun 2012
    Location
    UK - Worcester
    Posts
    1,975

    Default

    Ok,

    I have updated a 'buggy' version of the emulator to my google drive at: https://drive.google.com/drive/folde...qT?usp=sharing.

    I have it running under an old version of Safari on an iMac.

    Known issues are:

    ^A doesn't yet work. On the 'fix' list.
    RUBOUT doesn't yet work. On the 'fix' list.
    There is a problem with CR/LF. On the 'fix' list.

    There is no EPROM programmer support. Not on the fix list (yet)...

    The emulator doesn't fully work with MONITOR 8 - so there is a debugging activity to do... I will leave the code for a while and then have another look at it. I have just found a stupidity within the last few minutes...

    Something seems 'a bit random' as well. I can't quite put my finger on it yet though... Once I can define the problem - I can look for it!

    Instruction timing is not yet correct. This will be a long term goal...

    Download all of the files from my google drive (one HTML file and three PNG files) to the same directory and run the HTML file. You will need to put your CAPS LOCK on (MONITOR 8 only likes upper case characters). Click the [RUN] button when you are ready.

    LOC works - but doesn't take the correct octal number you provide as a parameter.
    DLP works.
    DPO and DBF seem to work (but don't start at the specified location and seem to continue forever)...

    Some of the assembly mnemonics work - most don't. HLT, ADI, NDI etc. (most of the immediate instructions) work. Well, they are accepted by MONITOR 8 and increment the pointer by the correct amount ... Other mnemonics (for example NOP, LBA etc.) don't work. I suspect I am close... Possibly a FLAG issue? I did update the CARRY flag as part of the IMMEDIATE instructions. This was contrary to the documentation I found on the web - but seemed more logical to me after reading the 8008 User Manual.

    Here is the manual. Section 'C' details the MONITOR 8 program: http://deramp.com/downloads/mfe_arch...al/mf8008a.pdf

    Here is the online table of instructions I was referring to: http://pastraiser.com/cpu/i8008/i8008_opcodes.html

    Anyhow - enjoy the alpha version and let me know what you think. All constructive comments welcome!

    Regards,

    Dave
    Last edited by daver2; May 12th, 2018 at 05:54 AM.

  3. #3

    Default

    Interesting that you targeted MONITOR-8. I used that in an ESP8266 based emulator that is on Hackaday. Monitor-8 is a pretty amazing piece of code, with all that it does in less than 2k. If you are interested I also have (slightly modified) source/object versions of SCELBAL, Galaxy, and Star Shoot in the source. I used a slightly buggy assembler so I had to hard-code some opcodes as DB's. I still can't SWEAR that my emulator is "perfect" because I've never seen a comprehensive 8008 tester. I had to guess what would happen on wraparound situations.

    After debugging MY emulators, I can give you a hint: it's ALWAYS the flags and rotates. Especially if things seem random. BTW I don't update any flag on an immediate instruction.

    Considering that my esp8266 project was incredibly cheap and simple to build (a lower-end ESP8266, a regulator, and an RS-232 converter, it might be $6.00 of parts), I don't think that anyone else actually built one. Actually, you can just get a USB-based ESP8266 evaluation board for $10 with USB and an additional power input and that should run.

  4. #4
    Join Date
    Jun 2012
    Location
    UK - Worcester
    Posts
    1,975

    Default

    Had a chance to go through my code a bit more thoroughly over the weekend.

    Things are not as 'random' as I thought. MONITOR 8 doesn't work correctly (mainly in the area of the LOC/DLP commands to start with).

    If I perform the same actions from starting the emulator - I get the same results. This indicates it is 'programatic' rather than random.

    I have checked my instructions with the paper documentation I have. I have made a few changes (where I think there may be errors) - but, of course, that is my opinion!

    I am going to try four approaches to debugging:

    1. Put the flag setting back to the documenation I have and try again (!)
    2. Try MONITOR 8 in Mike's emulator to see if it runs correctly there.
    3. See if I can identify other sources of 8008 documentation.
    4. Introduce additional debug code into my emulator.

    If anyone could have a look through the code I have posted and make any suggestions I would be most grateful.

    Cheers,

    Dave

  5. #5
    Join Date
    Jun 2012
    Location
    UK - Worcester
    Posts
    1,975

    Default

    So, this is what I have found so far:

    The nice 8008 instruction table at http://pastraiser.com/cpu/i8008/i8008_opcodes.html is not quite the same as the instruction set defined in http://www.8008chron.com/Intel_MSC-8_April_1975.pdf.

    For example, the ADI d8 instruction in the 'pretty table' is defined as modifying the S, Z and P flags - but not the C flag. In the Intel documentation, all of the 'immediate' mathematical and logical instructions affect the carry (C) flag.

    I have also noted that the Intel documentation states that the carry (C) flag is reset to zero for the AND, OR and XOR instructions. I believe this is implicit in the instruction rather than explicit (any logical operation on two 8-bit quantities should not result in a carry being generated, so the carry flag should always be reset by definition).

    So far my emulated instructions seem to hold up to scruitany...

    Dave

  6. #6
    Join Date
    Jun 2012
    Location
    UK - Worcester
    Posts
    1,975

    Default

    I think I have found the culprit - myself!

    I was using an internal function to return an address (the concatenation of H and L) - but using it occasionally to also refer to the data at that address...

    I think I have found and fixed all of the instances of the incorrect use.

    Dave

  7. #7
    Join Date
    Jun 2012
    Location
    UK - Worcester
    Posts
    1,975

    Default

    I found a bug in MONITOR-8 (a transcription error from the original printed source). So I have fixed that and uploaded the latest version (as of Sunday 27th May 2018) to my drive at https://drive.google.com/open?id=1du...kyWL9zdsLNgIqT.

    I have a few more things to do yet:

    1. Sort the keyboard emulation out a bit better (control and shift keys don't work properly yet).

    2. Add an emulation of a Paper Tape Reader and Punch. That's what the two black rectangles will be shortly... My plan is to support drag and drop so you can drop a file onto the Paper Tape Reader and that will be 'loaded' for subsequent use by MONITOR-8.

    3. A general tidy up and test of all MONITOR-8 commands.

    4. I might add the EPROM programmer as a last addition. I will permit the virtual EPROM to be 'programmed' from MONITOR-8. The resultant EPROM should then appear in the memory map (as per a real MOD-8) and you will be able to drag and drop the resultant 256 bytes of EPROM to a host file.

    I may make a MOD-8 comparable SCELBAL available?

    Suggestions for any further development?

    Dave

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •