How to allocate 64K in ASM?
How do I allocate 64K of memory under pure assembly? I can get this 64K coding a .com file but my code must still small because of the 64K limit. So, how can I allocate 64K under a normal .exe file? I always get a message saying "...out of range". HELP!
"Simple is beautiful"
Are you using real mode or protected mode asm?
I believe you could only get a 64k chunk while in protected mode (easily).... something about page-switching and EMS/XMS.... unless you''re using the flat memory model, in which case it should just work.
I believe you could only get a 64k chunk while in protected mode (easily).... something about page-switching and EMS/XMS.... unless you''re using the flat memory model, in which case it should just work.
- The trade-off between price and quality does not exist in Japan. Rather, the idea that high quality brings on cost reduction is widely accepted.-- Tajima & Matsubara
Well if you are coding in real mode you can always use INT 21h calls like this:
Allocate memory
mov ah,48h
mov bx,paragraphs (16 byte blocks)
int 21h
cf is cleared if successful and AX is pointing to the segment allocated
On error AX is error code and BX is size of largest available block.
Free memory:
mov ah,49h
mov ES,segment to free
int 21h
cf cleared if successful
on error AX is the error code.
For more info on using the INT commands (and especially the int 21h) search for PC Interrupts by Ralf Brown on the net (should still be able to find some older versions of his online files, otherwise you could always by his black book with the same name)
regards
Errand
Allocate memory
mov ah,48h
mov bx,paragraphs (16 byte blocks)
int 21h
cf is cleared if successful and AX is pointing to the segment allocated
On error AX is error code and BX is size of largest available block.
Free memory:
mov ah,49h
mov ES,segment to free
int 21h
cf cleared if successful
on error AX is the error code.
For more info on using the INT commands (and especially the int 21h) search for PC Interrupts by Ralf Brown on the net (should still be able to find some older versions of his online files, otherwise you could always by his black book with the same name)
regards
Errand
Death is lifes way saying your fired.
I''m completly new to C and ASM. I heared about protected mode but doesn''t know what it is. I have some documentations about ASM and I tryed to use the INT 21h DOS call to allocate the needed memory but I always get in AX an error code and in BX the largest available blocks. I tryed using COMPACT mode because I know that it allows using several segments for the data but it doesn''t work.
Can anyone of you send me a simple example of how to do this? The code don''t need to do nothing, just show how to do it?
This is how I did it in .com files.
.model tiny
.code
org 100h
Start:
ret
Buffer DB 64000 DUP(?)
End Start
Can anyone of you send me a simple example of how to do this? The code don''t need to do nothing, just show how to do it?
This is how I did it in .com files.
.model tiny
.code
org 100h
Start:
ret
Buffer DB 64000 DUP(?)
End Start
"Simple is beautiful"
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement