Dark Bit Factory & Gravity
PROGRAMMING => Other languages => ASM => Topic started by: madeyes on June 16, 2009
-
Hi,
I'm struggling to remember this from my DOS programming days, so does anyone know if in a DOS (or at least DOS VM under winXP) COM program; is it ok to make use of the unused memory in the code segment or do i have to request memory via an interrupt call to dos? I was hoping to use memory after the offset at the end of my code to the end of the segment for a buffer :) Maybe that's cheating for a 256 byte demo anyway :)
madeyes
-
My "Overhead" intro uses fs as an offset in the code segment for data :) nothin' wrong with that.
mov ax,cs
add ah,10h
mov fs,ax
;)
-
I think you get 64Kb allocated in a com program, so you can use the full cs segment for anything.
If you add something like
start_of_space: db ?
at the end of your program, you'll be able to find where this space starts.
Jim
-
yup, just use an interrupt to print the value of (*Not at*) start_of_space.
Alternatively, if you're doing this for sizecoding, you already know how large your .com will be :) so you can use the code I gave earlier but with more specific values. 256b could be "add ah,byte 1" to conserve the most memory.
(P.S. just figured the above out, thanks to Jim :) )
Oh and one more thing: .bss sections ARE ok in tinycoding ;)
-
You can only use bss segments in an exe, not a com file which needs to fit in a single 64kb segment. If you use an exe you have access to all available memory though, which might be an advantage.
Jim
-
You can only use bss segments in an exe, not a com file
Doh :)