Reputation: 231
I'm writing this file in assembly language and it reads a file which is 64,000 bytes long. I don't want to store it in RAM so I need to make it so that it reads one byte, manipulates the data, then store the next byte at the same address.
Any Ideas?
I am running on a MS-DOS boot disk on windows XP hardware (I don't know the specs) when ever I run it where I store the 64,000 I get an EMM error telling me I need to reboot.
Upvotes: 0
Views: 1116
Reputation: 62106
You can use DOS int 21h function 48h to allocate 64000 bytes of memory. It allocates memory in multiples of 16 bytes, so you pass it 64000/16=4000 in BX
.
On return from that function AX
will contain the segment of the allocated block, which you will have to load into a segment register (DS
, ES
, FS
or GS
) before accessing that block. If you load it into a segment register other than DS
, you will need to prefix the instructions accessing the block with the segment override prefix, like so:
mov [es:0], al
-- stores AL
to the very first byte of the block (the block's segment is in ES
).
When you're done using the allocated memory, you free it using function 49h.
Upvotes: 3