Image Map Image Map
Page 1 of 3 123 LastLast
Results 1 to 10 of 26

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

  1. #1

    Question 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. #2

    Default

    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 2nd, 2017 at 10:59 AM.

  3. #3

    Default

    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.

  4. #4
    Join Date
    Dec 2013
    Location
    Hawthorne, CA
    Posts
    155

    Default

    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.

  5. #5
    Join Date
    Jan 2007
    Location
    Pacific Northwest, USA
    Posts
    25,233
    Blog Entries
    20

    Default

    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)

  6. #6

    Default

    Quote 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?

  7. #7

    Default

    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 4th, 2017 at 05:56 AM.

  8. #8

    Default

    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 4th, 2017 at 06:54 AM.

  9. #9

    Default

    Quote 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.

  10. #10

    Default

    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.

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
  •