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

Mem command for older DOS versions

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

    Mem command for older DOS versions

    I'm not sure when MEM was introduced but my DOS 3.3 doesn't have it and I've actually missed it a bit.. So I baked my own version and figured I may as well share it here
    It turned out to be 41 bytes, if anyone can see a way to make it smaller please post!

    Download below, and here is the source too.
    Code:
    ;nasm -fbin -omem.com mem.asm
    
    cpu 8086
    bits 16
    org 100h
    
        ; Try to resize our current block to 0FFxxh paragraphs
        ; This will fail and report max paragraphs available in BX
        mov     bh, 0FFh
        mov     ah, 4Ah
        int     21h
    
        ; Divide by (1024/16)
        ; On 286+ we can shr ax,6 directly and save 1 byte
        xchg    ax, bx
        mov     cl, 6
        shr     ax, cl
    
        ; Convert to string, starting with the last digit
        ; Overwrites code we don't need any more, to save space
        jmp     short skipString
    digitsGoHere:
        db 'k$'
    skipString:
    
        mov     bl, 10
        mov     di, digitsGoHere
    convertLoop:
        dec     di
        div     bl
        add     ah, '0'
        mov     [di], ah
        xor     ah, ah
        test    al, al
        jnz     short convertLoop
    
        ; Output string, we have our pointer in DI
        mov     ah, 9
        mov     dx, di
        int     21h
    
        ret
    Attached Files

    #2
    How about this one, from 20 or so years ago? Does disk drives, conventional, EMS and XMS; computes percentages.
    Attached Files

    Comment


      #3
      That works but really does more than I want... And this is the programming forum after all so where's the fun in using something existing I've typed mem at least a dozen times and keep forgetting its not there, hence the replacement.
      And if I may nitpick a bit, sstat also shows there's more memory available than there actually is because they round up instead of down.

      Comment


        #4
        snq: I'm not sure when MEM was introduced but my DOS 3.3 doesn't have it and I've actually missed it a bit.. So I baked my own version and figured I may as well share it here
        That's nice and small and could be useful so I'll keep it. Thanks!

        MEM was introduced in v4.0, however CHKDSK which works just fine was introduced in v1.0

        I know this is the Programming forum but there is no reason to miss anything in DOS, for example this directory is full of memory utilities. I would hope that most DOS users have downloaded what they want from there by now since it's no longer as troublesome as it was with 2400baud.

        Chuck(G): How about this one, from 20 or so years ago? Does disk drives, conventional, EMS and XMS; computes percentages.
        That's a nice layout but the first 5 lines scroll off the screen because of the note at the bottom so it needs to be piped or something. Also it shows one of my substitute drives (X: ) but it missed the other one (B: ). I guess it's a nuisance to accommodate lunies like me who do something like use B: with SUBST. Hey, the alphabet is short enough as it is and I'm not going to waste a perfectly good letter! Also, I'm not complaining but perhaps you'd like to know that it shows garbage for my extended memory, perhaps because I'm using JEMMEX as my memory manager.

        Code:
        Extended     �             0 �4,294,903,185    0.0% �       64,111    0.0%
        BTW: is that Sydex BBS still runnig?
        WANTED: Cardinal 2450MNP modem.

        Comment


          #5
          Slightly o/t but a few weeks ago I wondered how much memory I had on my machine (running win 2k). Being one click away from a command prompt, I typed "mem" and got this back...



          655360 bytes total conventional memory
          655360 bytes available to MS-DOS
          627056 largest executable program size

          1048576 bytes total contiguous extended memory
          0 bytes available contiguous extended memory
          941056 bytes available XMS memory
          MS-DOS resident in High Memory Area


          Looks like it hasn't been updated for a while!
          "Don't it always seem to go
          That you don't know what you’ve got ‘til it’s gone" (BANG )

          Comment


            #6
            The rounding is intentional--probably done on someone's requrest. I'd forgotten that I even wrote the thing until snq posted his thing.

            Feel free to tinker with the code--it was an advertising freebie (it may be included in some of the old McGraw-Hill utilities disks). It comes from a time when 4GB was an enormous drive, bigger than anything on the market.

            The notable thing is not the stuff that fetches the memory, but the COBOL-style numeric editing routine (note the "picture" strings early on in the program. This is a cut-down version from one that I wrote for a compiler that would do check-protect and implied ("V") decimals as well.

            I think the BBS was taken off the air in 1996, but I can't recall exactly. I still have the hard drive from it and it still boots Windows NT 4.0.

            Comment


              #7
              I did put it in my utils dirs for when I want more info It's pretty cool that except for the rounding, your program and mine give the same results for memory available, even though the methods of obtaining the number are completely different.

              Being an old demoscener I still always feel the need to optimize stuff, either for size or performance. Usually size because performance we got plenty of nowadays. Didn't really get started with the whole demoscene thing until the 16 bit era was pretty much over though, we did one 16 bit 64k intro written in pascal/asm and then moved on to pmode and later on win32.

              Comment


                #8
                So like I said, I like size optimizing.. Here's a version that is 40 bytes, and still works on 8086.
                The change is the way I get the initial pointer to the end of the string. Call/pop instead of jmp/mov. Don't know how I missed that in the first place

                Code:
                ;nasm -fbin -omem.com mem.asm
                
                cpu 8086
                bits 16
                org 100h
                
                    ; Try to resize our current block to 0FFxxh paragraphs
                    ; This will fail and report available paragraphs in BX
                    mov     bh, 0FFh
                    mov     ah, 4Ah
                    int     21h
                
                    ; Divide by (1024/16)
                    ; On 286+ we can shr ax,6 directly and save 1 byte
                    xchg    ax, bx
                    mov     cl, 6
                    shr     ax, cl
                
                    ; Convert to string, starting with the last digit
                    ; Overwrites code we don't need any more, to save space
                    call    skipString
                digitsGoHere:
                    db 'k$'
                skipString:
                    pop     di              ; DI=digitsGoHere
                
                    mov     bl, 10
                convertLoop:
                    dec     di
                    div     bl
                    add     ah, '0'
                    mov     [di], ah
                    xor     ah, ah
                    test    al, al
                    jnz     short convertLoop
                
                    ; Output string, we have our pointer in DI
                    mov     ah, 9
                    mov     dx, di
                    int     21h
                
                    ret

                Comment


                  #9
                  @snq: Did you try CHDSK? For me it reports:

                  Code:
                        655,360 total bytes memory
                        629,648 bytes free
                  @Chuck(G): Actually it's a 6GB drive and (apart from a SUBST B: ) it managed all that perfectly:
                  Code:
                   All Drives   �     6,062,340 �      318,032    5.2% �    5,744,308   94.8%
                  It was the 128MB RAM which went screwy.
                  Last edited by Ole Juul; August 10, 2010, 02:19 PM.
                  WANTED: Cardinal 2450MNP modem.

                  Comment


                    #10
                    What's the point of making something smaller than 1 sector? Takes the same amount of disk space; loads just as fast.

                    But you could save a byte by using the highest memory address in the PSP:

                    Code:
                            mov  ax,ds:[2]
                            mov  bx,ds
                            sub  ax,bx
                    Will give you the largest contiguous area in memory in ax (which is all you really care about anyway).

                    Comment


                      #11
                      Originally posted by Chuck(G) View Post
                      What's the point of making something smaller than 1 sector? Takes the same amount of disk space; loads just as fast.
                      Isn't the size of "smaller than one sector" programs still important when you put a bunch of them into one library such as with COMPAK.COM?
                      WANTED: Cardinal 2450MNP modem.

                      Comment


                        #12
                        There is no point, but the world would be pretty boring without pointless stuff.

                        Comment


                          #13
                          Originally posted by Ole Juul View Post
                          Isn't the size of "smaller than one sector" programs still important when you put a bunch of them into one library such as with COMPAK.COM?
                          Only marginally, as most people don't use libraries--and then, there's the overhead of locating and extracting the program. On the other hand, it might be nice to tuck the code for this program into COMMAND.COM as an internal program.

                          Comment


                            #14
                            Originally posted by Chuck(G) View Post
                            But you could save a byte by using the highest memory address in the PSP:

                            Code:
                                    mov  ax,ds:[2]
                                    mov  bx,ds
                                    sub  ax,bx
                            Will give you the largest contiguous area in memory in ax (which is all you really care about anyway).
                            It does give the same result, but it's 1 byte larger for me, may just be nasm though.
                            mov ax, [ds:2] is 4 bytes, the other 2 instructions are 2 bytes each, so 8 in total. The first 4 lines of my code are 7 bytes together.

                            Oh and putting this in command.com or anything like that would make it one time use only, because part of the code is overwritten with the string that is outputted

                            Comment


                              #15
                              Originally posted by nige the hippy View Post
                              Slightly o/t but a few weeks ago I wondered how much memory I had on my machine (running win 2k). Being one click away from a command prompt, I typed "mem" and got this back...

                              655360 bytes total conventional memory
                              655360 bytes available to MS-DOS
                              627056 largest executable program size

                              1048576 bytes total contiguous extended memory
                              0 bytes available contiguous extended memory
                              941056 bytes available XMS memory
                              MS-DOS resident in High Memory Area

                              Looks like it hasn't been updated for a while!
                              Unfortunately, the DOS utilities included with every NT-family version of Windows (NT, 2000, XP, etc.) and every version of OS/2 since 2.0 are stuck at the equivalent of MS-DOS 5.0, so you miss out on the many updates and enhancements that were included in DOS 6.0 and higher. (And yet, the DOS within Windows XP still includes completely archaic and obsolete programs like EDLIN.)

                              In fact, it always annoyed me that Microsoft continued to make improvements to the MS-DOS 7.x subsystem of Windows 95 and 98, but yet almost none of these new features were carried over to the command line of the supposedly far superior Windows 2000 and XP.

                              Comment

                              Working...
                              X