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

How does MOVCPM.COM work?

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

    How does MOVCPM.COM work?

    I'm getting to the point of relocating CP/M from the starting 20K spot to higher memory. I'm not sure whether or not I can squeeze the cold start loader and my monitor program all into 2k or not, but if necessary I'll use 4K.

    Anyway, I started to think about how MOVCPM.COM works. I seem to remember that either reading or being told that MOVCPM.COM has to be part of the original package with the CPM. And since I copied the OS from someone on the internet, I'm not sure whether the copy of my MOVCPM.COM will work or not.

    How does MOVCPM.COM work? To move code from one block to another block without reassembling it, would require to change the instructions that have address's with them. Some instructions in the transfer group instructions like LHLD and some of the branch group, like JMP, etc.

    So as long as these instructions are referencing addresses within the code being transferred all is OK, but what about if an instruction was addressing something external to the moved code? How does MOVCPM.COM handle that?

    Am I on the right track here or not. Thanks Mike

    #2
    Sort of. MOVCPM uses an early type of PRL format. Basically, CP/M is assembled twice; the second time is 100H bytes offset. The two binaries are compared and a bitmap constructed. A set bit implies that the high-order byte of an address is to be adjusted. Low order address bytes are not affected; hence, "Page relocatble file". Each byte in the bitmap corresponds to 8 bytes in the binary data. Simplicity itself. So everything to be moved in MOVCPM is part of the image and its relocation bitmap.
    Reach me: vcfblackhole _at_ protonmail dot com.

    Comment


      #3
      Hi Mike

      My view is you're on the right track. I would guess that if the address is outside the CPM zone it'll be left as is, but since all of it is known I'm not sure how there would be a foreign address. And it's only absolute addresses that need to be MOVed, the relative addresses are OK as is. Also addresses pointing to buffers and constant strings. I've seen the CP/M 2.2 source code and there aren't many, and note that it uses jump tables for BIOS / BDOS calls anyway, so these are known vectors.

      No doubt an expert will be along to put me right!

      But it's a transient program so you might try dissembling it with an origin of 0100h, for fun...

      Edit: Like I said. Nice one, Chuck! You beat me to it (with a better answer).

      Cheers
      JonB

      Comment


        #4
        MOVCPM.COM contains three primary sections: 1) executable code for the program, 2) an image of CP/M, and 3) a relocation bitmap. For example, the table below documents how MOVCPM.COM for Altair CP/M 2.2 is laid out. Note that CP/M for a different machine may have a different bootloader size and/or BIOS size, and therefore, a slightly different layout within the file.

        Offset in File In Memory Content
        0000h 0100h CPMOVE (code that “does” MOVCPM)
        0701h-0702h 0801h-0802h Length of “MODULE” (Bootloader + CCP + BDOS + BIOS)
        0800h-087fh
        0900h-097fh
        0900h-097fh
        0a00h-0a7fh
        Bootloader (1st 128 bytes)
        Bootloader (2nd 128 bytes)
        0980h 0a80h Start of CCP
        1180h 1280h Start of BDOS
        1f80h 2080h Start of BIOS
        2580h 2680h Start of relocation bitmap
        The "Module" portion of MOVCPM (when MOVCPM is in memory) is the CP/M image written by SYSGEN to the boot tracks of the disk. In this case, the module runs from 900h to 267Fh. This puts the CP/M image in the same location and format as the SYSGEN program expects. Again, the starting address may vary slightly (e.g., 980h - A80h) and the length will vary based on the size of the BIOS for your particular CP/M.

        The relocation bitmap has one bit corresponding to each byte in the module. If a bit is set, the corresponding byte must be updated based on where in memory CP/M is placed

        In order to work with this relocation scheme, the CP/M image must be assembled so that the CCP starts at address 0000h. This leaves the BDOS starting at address 0800h and the BIOS starting at address 1600h. The bootloader is always assembled at address zero, however, relocation of the bootloader is still required as it references addresses corresponding to the final location of CP/M in memory. This CP/M image (the one assembled with the CCP starting at address zero) is the image in the module section of the file.

        The bytes that must be relocated can be determined by assembling CP/M at two different addresses. The bytes that differ between the two object files are those bytes that must be updated for relocation. I have written a utility that runs on a PC and generates the bitmap for me. I then use a hex editor to patch the bitmap into the MOVCPM.COM file.

        Mike

        Comment


          #5
          Mike - you probably should include the serial number area. Unless this matches with the system being run or the code check is disabled, you get the annoying "SYNCHRONIZATION ERROR" and a hard halt. Most of this should be detailed in the OEM guide.
          Reach me: vcfblackhole _at_ protonmail dot com.

          Comment


            #6
            I believe that, the serial number stuff is what I had remembered from an early discussion. Thanks for the information. I'm currently blending my old monitor program with my new Cold Start loader, and then to burn it to EEPROM. But I thought I'd get a head start on the moving CPM to higher memory, by boning up on it. Thanks a bunch Mike

            Comment


              #7
              The program portion of the MOVCPM.COM file is generated by the source file "CPMOVE.ASM." This file (we have the DRI original) clearly comments the serialization code spread throughout the source. This makes it easy to eliminate serialization checks when you're spinning your own MOVCPM.COM.

              Mike

              Comment


                #8
                BTW, if you're just wanting to move your version of CP/M to higher memory, it's simpler just to rebuild CP/M from source rather than creating a MOVCPM. Especially if you're still changing BIOS code now and then.

                Mike

                Comment


                  #9
                  Or, simply do a MOVCPM on ANY CP/M system, and save the image, then patch your BIOS and loader into that image; write to disk. Unless you're going to do it a lot, there's no reason to create a custom MOVCPM.

                  In my case, we had a ROM boot loader that worked only from Intel .HEX format. So, our disk image wasn't the simple type that most OEMs used.
                  Reach me: vcfblackhole _at_ protonmail dot com.

                  Comment

                  Working...
                  X