Announcement

Collapse

Forum etiquette

Our mission ...

This forum is part of our mission to promote the preservation of vintage computers through education and outreach. (In real life we also run events and have a museum.) We encourage you to join us, participate, share your knowledge, and enjoy.

This forum has been around in this format for over 15 years. These rules and guidelines help us maintain a healthy and active community, and we moderate the forum to keep things on track. Please familiarize yourself with these rules and guidelines.


Remain civil and respectful

There are several hundred people who actively participate here. People come from all different backgrounds and will have different ways of seeing things. You will not agree with everything you read here. Back-and-forth discussions are fine but do not cross the line into rude or disrespectful behavior.

Conduct yourself as you would at any other place where people come together in person to discuss their hobby. If you wouldn't say something to somebody in person, then you probably should not be writing it here.

This should be obvious but, just in case: profanity, threats, slurs against any group (sexual, racial, gender, etc.) will not be tolerated.


Stay close to the original topic being discussed
  • If you are starting a new thread choose a reasonable sub-forum to start your thread. (If you choose incorrectly don't worry, we can fix that.)
  • If you are responding to a thread, stay on topic - the original poster was trying to achieve something. You can always start a new thread instead of potentially "hijacking" an existing thread.



Contribute something meaningful

To put things in engineering terms, we value a high signal to noise ratio. Coming here should not be a waste of time.
  • This is not a chat room. If you are taking less than 30 seconds to make a post then you are probably doing something wrong. A post should be on topic, clear, and contribute something meaningful to the discussion. If people read your posts and feel that their time as been wasted, they will stop reading your posts. Worse yet, they will stop visiting and we'll lose their experience and contributions.
  • Do not bump threads.
  • Do not "necro-post" unless you are following up to a specific person on a specific thread. And even then, that person may have moved on. Just start a new thread for your related topic.
  • Use the Private Message system for posts that are targeted at a specific person.


"PM Sent!" messages (or, how to use the Private Message system)

This forum has a private message feature that we want people to use for messages that are not of general interest to other members.

In short, if you are going to reply to a thread and that reply is targeted to a specific individual and not of interest to anybody else (either now or in the future) then send a private message instead.

Here are some obvious examples of when you should not reply to a thread and use the PM system instead:
  • "PM Sent!": Do not tell the rest of us that you sent a PM ... the forum software will tell the other person that they have a PM waiting.
  • "How much is shipping to ....": This is a very specific and directed question that is not of interest to anybody else.


Why do we have this policy? Sending a "PM Sent!" type message basically wastes everybody else's time by making them having to scroll past a post in a thread that looks to be updated, when the update is not meaningful. And the person you are sending the PM to will be notified by the forum software that they have a message waiting for them. Look up at the top near the right edge where it says 'Notifications' ... if you have a PM waiting, it will tell you there.

Copyright and other legal issues

We are here to discuss vintage computing, so discussing software, books, and other intellectual property that is on-topic is fine. We don't want people using these forums to discuss or enable copyright violations or other things that are against the law; whether you agree with the law or not is irrelevant. Do not use our resources for something that is legally or morally questionable.

Our discussions here generally fall under "fair use." Telling people how to pirate a software title is an example of something that is not allowable here.


Reporting problematic posts

If you see spam, a wildly off-topic post, or something abusive or illegal please report the thread by clicking on the "Report Post" icon. (It looks like an exclamation point in a triangle and it is available under every post.) This send a notification to all of the moderators, so somebody will see it and deal with it.

If you are unsure you may consider sending a private message to a moderator instead.


New user moderation

New users are directly moderated so that we can weed spammers out early. This means that for your first 10 posts you will have some delay before they are seen. We understand this can be disruptive to the flow of conversation and we try to keep up with our new user moderation duties to avoid undue inconvenience. Please do not make duplicate posts, extra posts to bump your post count, or ask the moderators to expedite this process; 10 moderated posts will go by quickly.

New users also have a smaller personal message inbox limit and are rate limited when sending PMs to other users.


Other suggestions
  • Use Google, books, or other definitive sources. There is a lot of information out there.
  • Don't make people guess at what you are trying to say; we are not mind readers. Be clear and concise.
  • Spelling and grammar are not rated, but they do make a post easier to read.
See more
See less

NEC V20 and CP/M

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    NEC V20 and CP/M

    Hallo,

    I own several nice CP/M machines, a Bondwell-16 and Commodore 128 and 128D. They all use a Z80 to run CP/M 3.0. I completely forgot it and was recently reminded that the NEC V20, a clone of the Intel 8088, is capable of running 8080 instructions as well. Doing some searching I found some source code that should enable me to run 8080 programs on my PC20-III in time (I hope).

    My questions:
    - Originally CP/M was meant to run on machines equipped with the 8080. Z80 equipped machines were able to run it as well of course. The Z80 being a better CPU, I can imagine that therefore people started to write programs for the Z80. If I can run CP/M 2 on my PC, how big is the chance that 3rd party software is "polluted" by Z80 code?
    - Was anyone able to run CP/M 2 on a PC with a V20?
    - Was CP/M 3 supposed to be "8080 only" as well or was it targeted to the Z80?

    Many thanks for any reply!
    With kind regards / met vriendelijke groet, Ruud Baltissen

    www.baltissen.org

    #2
    Most 3rd party apps for CP/M-80 were 8080 code. Some vendor utilities might have been written for the Z80, but those generally aren't useful anywhere but that specific machine.

    Note that the core CP/M-80 code, as well as MP/M, CP/NET, etc. was all written for the 8080 (contains no Z80 code). That includes CP/M 3. This applies to code originating from Digital Research. Note however that the BIOS, and other vendor-specific code, might be written for the Z80. That only matters if you are looking at other vendor's code.
    - Doug

    Comment


      #3
      Originally posted by durgadas311 View Post
      That includes CP/M 3.
      Aha, thank you very much for this information! I don't have CP/M 2 but do own CP/M 3 for the machines I mentioned earlier. So IMHO the things that I have to do are:
      - copy this CP/M 3 to a floppy (for the moment) or find something more ready on the internet
      - write my own CP/M BIOS
      IMHO I have to write a program that copies the needed BIOS thingies into memory, switches the V20 into 8080 mode and starts up the BIOS.

      We'll see..... (to be continued)
      With kind regards / met vriendelijke groet, Ruud Baltissen

      www.baltissen.org

      Comment


        #4
        Yeah, you got the general idea. I'm not sure how the V20 boots, but often there is a small bootstrap "sector" (or block) that gets loaded off disk. That bootstrap code then sets up hardware and loads the rest of the OS. The bootstrap code, IMHO, sounds like the right place to switch to 8080 mode - probably immediately prior to jumping to the loaded OS image.

        There are some sites where you can find pristine CP/M binary images (BDOS et al., CCP, etc.), but some of those are older, or "un-patched" versions. Read the fine print. For CP/M 3, you'll need to the *BDOS3.SPR files, and your own BNKBIOS3.SPR file, in order to build the CPM3.SYS file. That plus CCP.COM will allow you to boot. But you need GENCPM.COM in order to build CPM3.SYS. There are a lot of moving pieces to be fit together.
        - Doug

        Comment


          #5
          From memory (and this is going back some), the V20 boots into the x86 mode. Using whatever OS you are in (typically MSDOS or CP/M-86) you then run a program that sets up an 8080 environment and then ESCapes to emulation mode to run your 8080 code. Take a look at http://www.eolith.co.uk/mirrors/cpm86/86emulat.zip It contains VCPM emulator (source included) that I wrote many many years ago to emulate a CPM/80 session running under CP/M-86.
          CP/M-86 Software Repository www.cpm86.eolith.co.uk

          Comment


            #6
            Yup, x86, then the BRKEM instruction is issued to start 8080 emulation. The operand of the instruction specifies an interrupt number whose vector contains the segmentffset where emulation is to begin. Similarly, to end, a RETEM instruction is issued in 8080 code. One feature not often employed is the CALLN (call native) which issues an 8086-type interrupt call that enables x86 code (which returns using an IRET) to be mixed in with 8080 code.

            The emulation by the V-series CPUs is pretty good with only a couple of end cases causing trouble. I recall that the early versions of JRT Pascal tickled one of those by modularizing its code such that a call to a function or subroutine first loaded SP with the address of the entry point, then calling said entry point. This got mangled by the V20's BIU such that the emulation would crash. I've got a MicroNote on this somewhere, but I remember discovering the problem and calling my contact at NEC Natick with the issue--someone had reported the same problem about two days earlier.

            All in all, the V-series 8080 emulation is good, but the faster 80286 machines could outrun a V20 using software emulation--and offer Z80 emulation to boot. Hardware 8080 emulator sort of fell into the dustbin of history, but it's worth noting that the V40 and V50 chips also have 8080 emulation capability.

            Comment


              #7
              NEC V20 and NEC V30 boot and run in x86 mode, exactly as an Intel 8088/8086 would do.

              The 8080 emulation mode is enabled later on, e.g. from an MS-DOS application. That application should also provide the I/O and other services for the 8080 emulation.

              NEC V20/V30 provides several instructions to enable and facilitate the emulation:
              • From x86 mode:
                • BRKEM imm8 (0x0F 0xFF imm - Switches to 8080 mode. It behaves similarly to an INT imm8 instruction, that is it saves the return address, segment and PSW to the stack, when it loads the CS and IP from the imm8 index of the interrupt table. It also sets the MD flag (bit 15 of PSW) to 0, which enables the emulation.
                • RETI - Will switch to the 8080 emulation mode if the PSW it restores from the stack has MD flag set to 0.
                • Hardware interrupts INT/NMI and RESET will also switch V20/V30 to x86 mode.
              • From 8080 mode:
                • CALLN imm8 (0xED 0xED imm - Basically an INT imm8 version for 8080 emulation mode. It will switch the CPU to x86 mode and call the interrupt specified by imm8
                • RETEM (0xED 0xFD) - Very similar to x86's RETI, it restores CS, IP, and PSW from the stack, and since PSW stored in the stack has MD flag set to 1 (presumably previously saved by BRKEM), it will also switch to x86 mode.


              In 8080 emulation mode most of x86 registers map to the corresponding 8080 registers:
              • AL to A
              • BX to HL
              • CX to BC
              • DX to DE
              • Lower 8-bit of PSW to FLAGS
              • x86's BP to 8080 SP - This allows having separate stacks for x86 and 8080 modes.


              Note that 8080 emulation mode does not provide I/O virtualization. That is any 8080 I/O instructions will access the hardware directly. Since most of the IBM PC peripherals I/O ports are located out of 0x0 - 0xFF area (remember, 8080 has 8-bit I/O addresses), they will not be accessible from 8080 emulation mode. This probably not a big issue. CP/M applications rarely access I/O ports directly, and the I/O can be done through the 8080 BIOS, which can use CALLN to access the I/O functions through an x86 mode wrapper.

              It must be a CP/M emulation application for V20/V30 somewhere... Otherwise it would be an interesting exercise to write one. Using both x86 and 8080 assembly to program an obscure feature. Sounds like tons of fun!

              Comment


                #8
                Ever hear of 22NICE? If you can find an earlier version, it has V-series support. But then it functions not to run CP/M per se, but to provide CP/M functionality by translating the CP/M function references to calls to native x86 code routines. The idea was to make x80 applications transparently executable like x86 DOS applications. So, for instance, CP/M ED and PIP have a few interesting features not duplicated in stock MSDOS.

                I uploaded another CP/M V-series emulator here about a year or so ago. It operated much the same way.

                The V-series 8080 emulation was an interesting dead end back in the day, but software emulation is so much more flexible. I recall that the V20 emulation heyday, if one can call it that, ran from about 1986-1990. After that, XT's were toast.

                Comment


                  #9
                  HI Guys, You can still register SYDEX 22NICE. I was a bit shocked.

                  22NICE actually bulds a wrapper executable around the CPM.COM file.

                  The wrapper provides the BIOS/BDOS functions as well as the terminal emulation type.

                  Then you execute the converted file which launches in x86 mode, then flips to x80 mode and runs the code. (Pretty Cool Actually)

                  JA

                  Comment


                    #10
                    Thanks for all these info!
                    I'm starting to design an SBC board using a V20 (uPD70108HCZ, the "full static CMOS" version) for both CP/M 80 and CP/M 86, trying to use the same approach of my previous Z80 board, the Z80-MBC2, using a cheap Atmega MCU as EEPROM and universal I/O emulator.
                    I'm at the early beginning stage, so I've a lot to study...

                    Comment


                      #11
                      First for all sho replied: thank you very much!

                      Originally posted by Chuck(G) View Post
                      Ever hear of 22NICE? If you can find an earlier version, it has V-series support.
                      Interesting. Looking for 22NICE on the internet to see if there is more to find, I ran into an old thread that mentions an expansion card that offers 8080/Z80 support. I did some Google of course but nothing found. Another challenge would be to build one my self.
                      With kind regards / met vriendelijke groet, Ruud Baltissen

                      www.baltissen.org

                      Comment


                        #12
                        Originally posted by Ruud View Post
                        First for all sho replied: thank you very much!


                        Interesting. Looking for 22NICE on the internet to see if there is more to find, I ran into an old thread that mentions an expansion card that offers 8080/Z80 support. I did some Google of course but nothing found. Another challenge would be to build one my self.
                        See here: https://www.li-pro.net/cpm-emu-dos-22disk-22nice.phtml

                        Comment


                          #13
                          Originally posted by Ruud View Post
                          First for all sho replied: thank you very much!


                          Interesting. Looking for 22NICE on the internet to see if there is more to find, I ran into an old thread that mentions an expansion card that offers 8080/Z80 support. I did some Google of course but nothing found. Another challenge would be to build one my self.
                          Do a search for Xedex Baby Blue. You will find a number of articles explaining how it works and also why it failed. $600 for the card and $100 per disk to be converted from the CP/M original format to the Baby Blue on IBM PC format made it easy to justify buying new IBM PC versions of software instead. A major auction site lists one as being available from Hungary at a price of almost $200 plus all the RAM looks to have been stripped from it.

                          I thought I once saw a DIY Z80 ISA card but I can't find a link right now.

                          Comment


                            #14
                            If I dig into my old product index from PC Tech Journal, there were several such cards. I can make a list if anyone's interested.

                            Got a call from a fellow a couple of months back who's still running some CP/M application on his Win10 x64 system using 22Nice (he installed VDos). I'll confess to using it occasionally on my Ubuntu AMD64 machine.

                            Comment


                              #15
                              Somewhere I have a Blue Lightnin' card but no software for it.

                              Comment

                              Working...
                              X