Announcement

Collapse

Forum Rules and 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.


Rule 1: 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.


Rule 2: 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.



Rule 3: 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.


Rule 4: "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.

Rule 5: 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

Installing CP/M 3 (Plus?) on a home-built Z80 computer

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

    Installing CP/M 3 (Plus?) on a home-built Z80 computer

    Hi everyone,

    I've got a Z80-based computer that I've built with 256KB of memory (made up of 128KB RAM and 128KB ROM), divided into 16 x 16KB banks that I can map in any combination to the 4 pages accessible by the Z80's 16-bit address bus. It currently runs CP/M 2.2.

    As the MMU was a recent addition, I thought my next step should be to get CP/M 3 up and running as it supports banked memory. The plan is to fix the upper 16KB page and allow CP/M to swap the lower 48KB as one block, giving it Bank 0 and Bank 1 (the minimum requirement for CP/M 3.)

    My knowledge of CP/M (and assembly - although not programming in general) is extremely limited and I'm learning as I go. From what I can gather from the documents, I need to write a new CPMLDR.COM file with a modified CBIOS in it to allow CP/M 3 to interface with the hardware in my computer (the CompactFlash drive specifically) so it can load CP/M 3 on boot. Makes sense. Then I need to write a more fleshed-out CBIOS for CP/M 3 itself and build a CPM3.COM file for CPMLDR to load into memory and execute. Also makes sense.

    However, I'd appreciate a little guidance on how to complete these tasks if possible. I have CP/M 2.2 with a working CBIOS already. I've read in the CP/M 3 System Guide that you can convert the CBIOS from 2.2 to 3. This would obviously make sense as I'll likely be building the CPMLDR and CPM 3 .COM files in CP/M 2.2, and there's no point re-inventing the wheel.

    Initially I had a look online to find examples of LDRBIOS assembly files but all I can find relating to the LDRBIOS I need to build CPMLDR are written in 8080. Yes, I know the Z80 can understand 8080 opcodes but I can't (I'm still learning Z80 opcodes!)

    The guide talks about extra jump points, which I've added, to the BIOS jump table - I'm about to start working my way through the functions and making sure they do what CP/M 3 expects (though I'm looking initially to create a non-banked version of CP/M 3 first.) But the LDRBIOS.ASM comments talk about 'boot' being null, then elsewhere that it should get its start value from @mxtpa and...

    Anyone done this before and can remember what they did? I just need a few pointers really as I don't know enough about the subject to confidently make the edits I need to.

    I've attached a zip file with the two .ASM files - CPM3_CBIOS64.ASM is the full CBIOS for CP/M 3 that I'm building based off of the CP/M 2.2 CBIOS, LDRBIOS.ASM is an example BIOS for CPMLDR (stripped down) that I'm trying to convert to work with my system and get CPM 3 running.

    Any help would be greatly appreciated!

    File Attachment: BIOS.zip

    #2
    I haven't looked at your BIOS yet, but I do have CP/M 3 for the Z89/Z90 computers online at https://github.com/durgadas311/MmsCpm3 which might help. This example is a bit extreme, as the BIOS supports many different disk and hardware options, through linkable modules. The main BIOS (mbios3.asm) is tailored for the H89 platform, but might be a possible starting point. There's also a wiki there, where I try to describe more details. If you think it's useful, let me know and I can help you adapt it. Or at least explain parts of it. In this case, the loader is created by linking in a BIOS disk module and a bootstrap module for the specific disk to boot from.

    I should note that all of that code uses "Intel mnemonics extended for the Z80", so you will have that hurdle to understand and/or utilize it. There is a Z80.LIB macro library for RMAC, though.
    Last edited by durgadas311; December 2, 2017, 10:59 AM.
    - Doug

    Comment


      #3
      Thanks durgadas311, any examples are a great help to me as I find it much easier learning from a working example than from a sequence of instructions that often miss important steps out because of assumptions about the reader's prior knowledge.

      I'm going to have some time hopefully tomorrow to take a good look at the BIOS. It makes most sense to me to use the CP/M 2.2 BIOS and 'upgrade' it to work with CP/M 3 - then I'll pare it down to the minimum required for CPMLDR and get that built too.

      Comment


        #4
        John Monahan has some write-ups on bringing up CPM/3 his S100Computers website:

        Floppy - http://www.s100computers.com/Softwar...20Software.htm
        IDE/CF card - http://www.s100computers.com/Softwar...20Software.htm

        Note that John's IDE write-up uses a 'holes' version of the LBA translation routine out of simplicity, which does not work with cpmtools, if you scroll down to the 'A New Simplified CF-CARD CPM3 Image.' there is information on the LBA translation routines needed to avoid the holes.

        Comment


          #5
          I've never verified this, but I've long suspected that if one writes a BIOS/XIOS for MP/M II, then the job's pretty much done for CP/M 3. Truth or delusion? (i.e., I've done for former, but not the latter)
          Reach me: vcfblackhole _at_ protonmail dot com.

          Comment


            #6
            Originally posted by MarsMan2020 View Post
            John Monahan has some write-ups on bringing up CPM/3 his S100Computers website:

            Floppy - http://www.s100computers.com/Softwar...20Software.htm
            IDE/CF card - http://www.s100computers.com/Softwar...20Software.htm

            Note that John's IDE write-up uses a 'holes' version of the LBA translation routine out of simplicity, which does not work with cpmtools, if you scroll down to the 'A New Simplified CF-CARD CPM3 Image.' there is information on the LBA translation routines needed to avoid the holes.
            Wow that's a really detailed resource - thanks for that, MarsMan2020.

            I've already got CPM 2.2 running on my system - so the BIOS is set up to work with the CompactFlash card and I'm hoping it won't take much to convert it for use with CPM 3. Now I know that CPM 3 has a few changes to the drive tables compared to 2.2, but aside from those and the jump table modifications (and coding the associated extra functions where necessary), I don't think there's much more I need to do to get a working CPM3 BIOS?

            Comment


              #7
              Okay, I've had a go at LDRBIOS.ASM and converted it to Z80 opcodes, with a couple of tweaks (a DJNZ and LDIR where the 8080 version had loops).

              From what I can gather from the comments in the file, I don't need to do anything else as this BIOS will run alongside my CP/M 2.2 CBIOS and uses the functions in that to access the CompactFlash and other machine-specific IO features?

              Anyone care to take a look at the file and give it a quick sanity check for me? If it's okay, I guess I just need to compile a CPMLDR.COM file using this assembly to run at 0100H and I'll be able to run it in CP/M 2.2? Do I need to compile a new CPM3.SYS with a full CBIOS first before I can run CP/M 3 from CP/M 2.2?

              File attachment: LDRBIOS.zip

              EDIT: Update as I've tried to create CPMLDR.COM with LINK and got the following error/s:

              Code:
              A>LINK CPMLDR[L100]=CPMLDR,LDRBIOS
              LINK 1.31
              
              UNDEFINED SYMBOLS:
              
              @CIVEC  @COVEC  @AOVEC  @LOVEC  @BNKBF  @CRDMA  @CRDSK  @FX
              @RESEL  @VINFO  @USRCD  @ERMDE  @DATE   @HOUR   @MIN    @SEC
              @MXTPA
              
              ABSOLUTE     0000
              CODE SIZE    0AC7 (0100-0BC6)
              DATA SIZE    0000
              COMMON SIZE  0000
              USE FACTOR     22
              
              A>
              I've obviously misunderstood the symbols in LDRBIOS.ASM - these need to be explicitly set in the assembly file?
              Last edited by nockieboy; December 4, 2017, 05:56 AM.

              Comment


                #8
                If CPMLDR.COM is truly stand-alone (does not depend on the CP/M 2.2 used to start it) then you should be OK. This image is often placed on boot tracks of a disk so that you can boot directly into CP/M 3. For my Kaypro version, I used a modified CP/M 2.2 boot disk (to avoid critical memory areas) and then made that CCP "auto execute" the CPMLDR command (by patching the command buffer in the CCP). For test purposes, you can usually just invoke CPMLDR from CP/M 2.2 CCP, provided there are no memory conflicts (i.e. CPMLDR.COM is stand-alone). The first instruction in CPMLDR.COM should probably be a DI, or at least before the LDRBIOS cold boot entry is called.
                Last edited by durgadas311; December 4, 2017, 06:54 AM.
                - Doug

                Comment


                  #9
                  Originally posted by durgadas311 View Post
                  The first instruction in CPMLDR.COM should probably be a DI, or at least before the LDRBIOS cold boot entry is called.
                  Ah, thanks. I'll add that in. Is there anywhere I can look up EXTRN assembly directives so I can work out what I need to do to fix them in my LDRBIOS source? They're throwing 'undefined symbol' errors when I try to link/compile CPMLDR with my BIOS, as shown in my previous post.

                  Comment


                    #10
                    Your undefined symbols look like SCB. Since the loader is not exactly CP/M 3, I'm not sure what those resolve to. Perhaps the loader is pre-initializing the SCB for CP/M 3. I'll have to check the loader submit files, but there probably needs to be another module to link with it. Maybe see if there is a submit file on my github repository that might lend a clue. Probably looking for an SCB.ASM or SCB.REL.
                    - Doug

                    Comment


                      #11
                      There should be an SCB.MAC or SCB.ASM.

                      Comment


                        #12
                        Sorry, what's an SCB? Will SCB.MAC/ASM be a generic file, or another hardware specific one?

                        EDIT: Ah - System Control Block? Found a reference to SCB.Z80 online.. Just need to find one now. Not in front of a computer at the moment. How would I include that with the LINK command I was using to build the CPMLDR.COM file?
                        Last edited by nockieboy; December 4, 2017, 10:53 AM.

                        Comment


                          #13
                          I would suggest reading the CP/M 3 system manual, and perhaps programmers manual, for more about SCB. Also, there may be different versions of SCB.ASM out there. I'm not sure that the one used for the BIOS is the same as what is needed for the LOADER. There is some good information in the DRI manual about bringing up CP/M 3. The SCB used for the BIOS has a "dummy" base address for the SCB, which GENCPM (or some other component) recognizes and translates into a real address. I'm not sure what the LOADER needs SCB for, so not sure what sort of base address it needs.

                          Basically, though, the SCB is a block of memory, mostly maintained by the BDOS, that exports various bits of information. In some cases, external entities like the BIOS and CCP may alter information in the SCB or pre-init values during boot.
                          Last edited by durgadas311; December 4, 2017, 11:41 AM.
                          - Doug

                          Comment


                            #14
                            Odd, I posted a reply and it seems to have disappeared.

                            There's a copy here:

                            http://v1050.classiccmp.org/src/index.html#SCB.ASM

                            It's part of the standard distribution.

                            I can't find the SUB file I used to build CPMLDR for my system so I can't say if I linked SCB.REL or not.

                            I'm still trying to recover my build environment.

                            Comment


                              #15
                              Originally posted by Alphasite View Post
                              Odd, I posted a reply and it seems to have disappeared.

                              There's a copy here:

                              http://v1050.classiccmp.org/src/index.html#SCB.ASM

                              It's part of the standard distribution.

                              I can't find the SUB file I used to build CPMLDR for my system so I can't say if I linked SCB.REL or not.

                              I'm still trying to recover my build environment.
                              Ah, thanks Alphasite - that's a handy resource. I managed to find an SCB.Z80 - funnily enough - in the CP/M 3 distribution files I have, as you've mentioned. As far as linking it with LDRBIOS.ASM to create CPMLDR.COM, I've taken a shortcut and just copied the contents into LDRBIOS.ASM as it's just a group of equates. I've managed to successfully build a CPMLDR.COM file as a result but, no surprise, it crashes the emulator when I run it. I've got to go through the equates and make sure they're matching up to the correct addresses for the SCB in my computer and try it out on that, but I just feel there's probably a million other things I need to be matching up as well that could cause it all to fall over.

                              Comment

                              Working...
                              X