Message board for the users of flat assembler.
> DOS > segment for uninitialized variables, MZ.
I am searching the name of the segment of uninitialized variable for the MZ format (If exists).
Or, the equivalent ELF .bss section for MZ format.
Thanks for attention.
|20 Aug 2011, 13:18||
No need for a special segment, you can place your scratch area anywhere
(preferably to a place that "belongs" to you). There is no protection
in real mode. So the options are:
- Put some "db or "rb" at program end (bad "db" causes bloat)
- Hog some memory from DOS
- Reserve some memory as "heap" at program end (preferred).
Don't specify "heap 0", instead for example "heap $0100"
gives you 4 KiB. So in your only-one segment there will be
your code, the heap/scratch area and stack ("stack $1000"
gives 4 KiB). So the stack is in a separate segment by
RTFM!!! (but not very verbose)
FYI, I personally use format binary for my MZ and PE executables.
You don't need segments at all (except your
code is > 64 KiB). Look at the (not many) examples
in MZ format.
Last edited by DOS386 on 20 Aug 2011, 14:11; edited 2 times in total
|20 Aug 2011, 13:43||
Are you talking about the FASM manual or the MZ manual? (I don't seen any "serious" document about the MZ format on the Web, just the Wiki article)
Then declaring an uninitialized variable, I shall want get its pointer (to put into a register and increase or decrease it). Is it possible with the heap method?
Does its pointer will be DS?
Last edited by emc on 23 Aug 2011, 12:14; edited 1 time in total
|20 Aug 2011, 14:07||
> get its pointer (to put
There are no pointers in FASM
... mov bx, blahvar ; Constant - fixed address - no PIC anymore ... mov ax, 0 mov [bx], ax ; Init ... inc word [bx] ... dec word [bx] ... ; rdrand eax ; Dangerous, commented out ... blahvar: rb 2 ; !!! ...
Only BX SI DI and BP are usable for memory operands.
BP defaults to SS instead of DS !!!
|20 Aug 2011, 14:22||
Ok, I am understanding (but I have problems with ntdvm sometimes).
The following line
mov [bx], ax ; Init
This line allows us to put 0 in blahvar ?
|20 Aug 2011, 18:13||
< Last Thread | Next Thread >
Copyright © 1999-2020, Tomasz Grysztar.
Powered by rwasa.