如何在DOS中获得一个额外的段? [英] How can I get an extra segment in DOS?

查看:86
本文介绍了如何在DOS中获得一个额外的段?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想编写一个DOS程序(我的第一个程序),但是我没有经验.

I'd like to write a little DOS program (my first one) and I'm a little bit inexperienced.

对于该程序,我需要超过64 KB的(传统)内存.如何获得额外的内存?理想情况下,我想为程序增加两个64k的内存块.我可以开始将数据写入地址空间中的某个地方还是需要请求额外的内存吗?

For the program, I need more than 64 kilobytes of (conventional) memory. How can I get extra memory? Ideally, I'd like to have two extra 64k blocks of memory for the program. Can I just start to write data somewhere into the address space or do I need to request extra memory?

推荐答案

在DOS下,是的,您可以开始使用另一段内存.但是,有一个重要的警告!

Under DOS, yes, you can just start using another segment of memory. There is an important caution, however!

查看正在使用的DOS版本的内存映射.您要确保您没有选择实际上保留用于其他用途的内存区域.这是博士中的一位.多布的日记:

Have a look at a memory map for the version of DOS that you are using. You want to be sure that you aren't selecting a region of memory that is actually reserved for another purpose. Here is one from Dr. Dobb's Journal:

Address (Hex)                 Memory Usage

0000:0000                Interupt vector table
0040:0000                ROM BIOS data area
0050:0000                DOS parameter area
0070:0000                IBMBIO.COM / IO.SYS *
mmmm:mmmm                BMDOS.COM / MSDOS.SYS *
mmmm:mmmm                CONFIG.SYS - specified information
                         (device drivers and internal buffers
mmmm:mmmm                Resident COMMAND.COM
mmmm:mmmm                Master environment
mmmm:mmmm                Environment block #1
mmmm:mmmm                Application program #1
     .                        .      .                        .      .                        .
mmmm.mmmm                Environment block #n
mmmm:mmmm                Application #n
xxxx:xxxx                Transient COMMAND.COM
A000:0000                Video buffers and ROM
FFFF:000F                Top of 8086 / 88 address space

官方"内存分配机制是通过内存控制块(MCB)和DOS中断0x21,使用0x48进行分配,使用0x49释放内存.可以在此 Microsoft支持文档中找到对此的良好讨论.

The "official" memory allocation mechanism is through memory control blocks (MCB) and the DOS interrupt 0x21 using 0x48 to allocate and 0x49 to free memory. A good discussion of this can be found in this Microsoft support document.

有关中断方法的文档,请您可以在此处查看.

For documentation on the interrupt approach, you might look here.

这篇关于如何在DOS中获得一个额外的段?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆