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

    #16
    Originally posted by Just4Fun;568336 [URL="https://hackaday.io/project/159973-z80-mbc2-4ics-homemade-z80-computer"
    Z80-MBC2[/URL]
    Wow, why haven't I noticed before? Looks great!
    With kind regards / met vriendelijke groet, Ruud Baltissen

    www.baltissen.org

    Comment


      #17
      Originally posted by sergey View Post
      RETI - Will switch to the 8080 emulation mode if the PSW it restores from the stack has MD flag set to 0.

      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.
      So if I understand correctly this code should be able to switch in to and out of 8080 emulation mode without hooking any interrupts? I've never understood why the people at NEC didn't just use a single instruction to toggle the MD bit to switch in and out of emulation mode.
      Code:
      	pushf
      	push	cs
      	push	ReturnToX86
      	pushf
      	push	cs
      	push	Go8080
      	push	bp
      	mov	bp, sp
      	or	BYTE [bp+13], 1 << 7	; Set MD bit
      	and	BYTE [bp+7], ~(1 << 7)	; Clear MD bit
      	pop	bp
      	iret				; Enter 8080 emulation mode
      Go8080:
      	; 8080 code goes here
      	retem
      ReturnToX86:
      A lot of overhead but at least no interrupts wasted.

      On a sidenote, I made macros to implement all the NEC V-specific instructions with the hope to use them to save ROM space in XUB but I have yet to find any real use for them. See this.
      Looking for a cache card for the "ICL ErgoPRO C4/66d V"

      Comment


        #18
        I think part of the reason was needing to flush the instruction queue. I recall a MicroNote that called out certain issues with the 8087 being falsely triggered by certain instruction sequences before a native-to-8080 mode switch. In any case, it doesn't really matter--8080 instructions are duplicated functionally by x86 native ones. For executing stretches of x86 code, you have the CALLN instruction.

        Some of the v20 instructions are useful, such as the bit-field operations and, if you're of the right need, the BCD string ones. The problem is that the 8086 gives you no way to trap them if it encounters them, so you'd have to duplicate whole routines in 8086 code to emulate the V20 instructions, if you used them.

        Chalk it up as a curiosity. I recall that NEC had early versions of the 8080 that didn't work quite the same way that the Intel parts did.

        Comment


          #19
          Originally posted by Krille View Post
          So if I understand correctly this code should be able to switch in to and out of 8080 emulation mode without hooking any interrupts? I've never understood why the people at NEC didn't just use a single instruction to toggle the MD bit to switch in and out of emulation mode.
          Code:
          	pushf
          	push	cs
          	push	ReturnToX86
          	pushf
          	push	cs
          	push	Go8080
          	push	bp
          	mov	bp, sp
          	or	BYTE [bp+13], 1 << 7	; Set MD bit
          	and	BYTE [bp+7], ~(1 << 7)	; Clear MD bit
          	pop	bp
          	iret				; Enter 8080 emulation mode
          Go8080:
          	; 8080 code goes here
          	retem
          ReturnToX86:
          I am wondering if there is more stuff going on behind the scenes other than MD flag change. This note particularly looks interesting (page 8-5 here):

          EMULATION NESTING
          In a native mode called by CALLN or an NMI or INT interrupt from emulation mode, emulation mode cannot be called again by a BRKEM instruction. If this nesting is attempted, MD won't work normally, and normal operation cannot be expected.


          This is kind of weird... you'd think that one can use 8080 emulation similar to vm86 in 386, and have several 8080 virtual machines running in parallel.

          Comment


            #20
            From my understanding, it's a matter of register saving--in particular, the MD register, which isn't part of the 8080 PSW.

            Personally, if I were building something from scratch, I'd use the V40 or V50 and save myself some work. The integrated peripherals are pretty much compatible with the standard PC set (well, almost--you get a 8251A-type UART, instead of the 8250).

            Comment


              #21
              This is an really interesting thread, I must admit. I always have been fascinated by that 8080 emulation mode of the V-Series chips.
              However, there's one important thing to keep in mind - While the original CP/M-80 was strictly using 8080 instructions only,
              that's not exactly true for the application software. Due to other interesting features, such as a single supply voltage (+5v) and an integrated RAM refresher,
              the i8080 did fell out of favour quite quickly due to the Z80. The Zilog 80 was much more advanced, had got hardwired functions and an extended instructions set.
              So please don't expect too much of the later software releases to run on the archaic 8080. If there's any other chip that comes even the close to the Z80,
              then it would be the i8085. It's the embedded form of the 8080, with single supply voltage support (hence the 85) and a few other enhancements.
              In one way or another, the 8080 is like the 808x of the x86 world, with Z80 beeing the 80286 and the 8085 beeing the 8018x..
              "Time, it seems, doesn't flow. For some it's fast, for some it's slow.
              In what to one race is no time at all, another race can rise and fall..." -The Minstrel

              Comment


                #22
                Embedded? The 8085 was used as the main CPU in several early microcomputer systems.

                But there was, right up until 1982 or so, plenty of 8080 software. There was still enough market share with the 8080/85 to make it profitable--at least in commercial software. I don't know about the hobbyist stuff and games--a look through the CP/MUG and other interest group archives will show that.

                The added-yet-undocumented instructions of the 8085 has been discussed here several times over the years.

                Yet almost nobody pays attention to the NSC800--basically a Z80 with an 8085 bus. I wonder why.

                Comment


                  #23
                  Thanks a lot for the tip with the NSC800, I didn't know this before!
                  By "embedded", I meant that the i8085 was quite popular for single-board computers (SBCs), on controllers on ISA/S-100 cards
                  and among engineers (microcontroller test boards). At least here in my place. Speaking of the CP/M software, I don't mean to disagree.
                  It's just that the Z80 was very popular both in literature and physical form. Various CP/M programming books and PC magazines targeted
                  for computer enthusiasts included ASM samples that did include some Z80 specific instructions here and there and therefore didn't run on plain 8080 machines anymore.
                  In most cases, that wasn't even on purpose, I think. The authors simply assumed a Z80 silently, without even spending a thought on the i8080.
                  Commercial software, of course, was originally tested on a wider selection of computers than Public Domain software tested within a circle of friends.
                  In case of emulation though, this might be no real problem, I suppose, since the few extra instructions (Z80/i8085) that the NEC V misses could be emulated.
                  "Time, it seems, doesn't flow. For some it's fast, for some it's slow.
                  In what to one race is no time at all, another race can rise and fall..." -The Minstrel

                  Comment


                    #24
                    The problem with trying to emulate unimplemented instructions in the the V series native mode is that there's no trap for illegal/unrecognized instructions. So not an option in emulation. At any rate, after the 80286, the V-series emulation could be performed faster in software.

                    22nice used to have (and may still--I can't recall) a "test" mode in software emulation where 8080 ISA is assumed until a Z80 instruction is attempted. The user is then notified that the subject program is not 8080-compliant.

                    One advantage of the 8085 was the wide range of 8080 peripheral support available. You could cobble up interface using those chips with the Z80, but the 8259 interrupt support wasn't available, nor was the 8257-type DMA. Z80 when it started, had CTC, PIO and SIO and that was pretty much it. You could build a complete 8085 system with CRT and floppy support using nothing but Intel peripheral chips. At the same time, the same 8085 could work as a 2-chip embedded controller.

                    The lack of embedded features was a real puzzler with Zilog--true, they had the Z8, but it's a different architecture. Motorola had the very successful 68xx controllers; MOS had a similar thing for the 650x, and Intel had not only the 8085, but the 8048 and 8051 chips. If you want to state that a particular vendor's CPU family was almost exclusively embedded, that would have to be the 6800 derivatives, which remained popular for many years.

                    Comment


                      #25
                      Originally posted by Krille View Post
                      On a sidenote, I made macros to implement all the NEC V-specific instructions with the hope to use them to save ROM space in XUB but I have yet to find any real use for them. See this.
                      I take that back. Yesterday I actually found a use for the ROL4 instruction. See this.
                      Looking for a cache card for the "ICL ErgoPRO C4/66d V"

                      Comment


                        #26
                        But does the use of ROL4 improve performance in a detectable way?

                        Comment


                          #27
                          I doubt it, Chuck. But that's not the point, size is what matters.
                          Looking for a cache card for the "ICL ErgoPRO C4/66d V"

                          Comment


                            #28
                            That's what she said

                            Comment


                              #29
                              Originally posted by sergey View Post
                              I am wondering if there is more stuff going on behind the scenes other than MD flag change. This note particularly looks interesting (page 8-5 here):

                              EMULATION NESTING
                              In a native mode called by CALLN or an NMI or INT interrupt from emulation mode, emulation mode cannot be called again by a BRKEM instruction. If this nesting is attempted, MD won't work normally, and normal operation cannot be expected.


                              This is kind of weird... you'd think that one can use 8080 emulation similar to vm86 in 386, and have several 8080 virtual machines running in parallel.
                              You need to use BRKEM to enter emulation mode, because the mode flag is normally "locked". Some 8086 software (including BIOS code) modifies this bit, which would cause an unintended mode switch if it were always writable. I found this out years ago when writing a simple CP/M emulator on a Tidalwave palmtop, it would hang on reboot if the emulation mode was still unlocked.

                              RETEM sets the mode flag to read-only again, which is why you can't nest 8080 -> 8086 -> 8080.
                              The reason why these instructions use interrupt vectors is likely because it made the microcode simpler.

                              As Chuck mentioned, there is no invalid opcode trap (even in native mode, despite being otherwise compatible with the 80186 instruction set!), and a lot of CP/M software uses Z80 opcodes.

                              Comment


                                #30
                                Originally posted by Chuck(G) View Post
                                That's what she said
                                Haha.. yes, but "she" usually wants it bigger, not smaller.

                                Originally posted by dreNorteR View Post
                                You need to use BRKEM to enter emulation mode, because the mode flag is normally "locked".
                                That's too bad. It would have been nice to be able to enter emulation mode without using an interrupt.
                                Looking for a cache card for the "ICL ErgoPRO C4/66d V"

                                Comment

                                Working...
                                X