Subj : segments To : ALL From : GENE KWIECINSKI Date : Sun Dec 28 2003 01:51 am Seems like a simple problem, but might be a long description of it, *hopefully* a simple fix. (Using plain vanilla MASM.) In short, I want to use multiple segments not to *have* different segments, /per se/, ie, not to be able to have >64k of anything, either singly or combined, but to just group together sections of code/data/etc. by *function*. Everything's a tiny-model .com file. Am trying to reorganise code at the *source* level, though, so that instead of a random mix of code, constant data, and volatile data scattered throughout a .com, I want to declare each in its own segment. So rather'n having in source file 1 (eg, string ops) code, constants, data, then in source file 2 (eg, wrapper functions for DOS/BIOS calls) more code, more constants, more data, etc., I want it to assemble so that the final .com file will be code, code, code, constants, constants, constants, and data, data, data. I tried declaring code segment byte public code ends bss segment byte public bss ends data segment byte public data ends tiny group code,bss,data code segment assume cs:tiny,ds:tiny,es:tiny ... ... code ends etc. and that seems to work just fine, with one exception! I print out "messages", eg, a help screen, which is preordered as an array of strings, then table of pointers, terminated with a null pointer, eg bss segment h00 db 'line 1 of help msg',0 h01 db 'line 2 of help msg',0 h02 db 'line 3 of help msg',0 htbl dw h00,h01,h02,0 bss ends and print the message by feeding 'htbl' to a subroutine that groks this, eg, code segment lea ax,hbtl push ax call _putmsg code ends Not a problem, as 'htbl' *will* be resolved by the assembler relative to 'code'/'tiny', in this case, say, 046DH. Pointers 'h00', 'h01', and 'h02' *should* be resolved to 04xxH, but are left alone relative to segment 'bss', so that values in the list 'htbl' are in the range 00xxH (ie, counter starts at 0 at first 'bss' data), *not* 04xxH were they to be resolved relative to the 'code'/'tiny' segment/group. *If* any pointer in 'data' or 'bss' is referenced by something in the 'code' section, it's properly resolved to its real binary address as it would appear in the .com file. If left alone and only self-referenced within 'data' or 'bss', it's left as its unresolved value relative only to the beginning of the respective segment that it's declared in. Changing everything to the same segment (which defeats the whole purpose) fixes it. I know of no way to force resolution to the final value, like maybe htbl dw tiny:h00, tiny:h01, tiny:h02, 0 so that the values will *not* be 0000,0019,0032,0000, but in fact be something like 046D,0486,049F,0000. Did try defining a constant to be added to each pointer (eg, "bss - code"), but the assembler would have none of it. I *could* put dummy instructions like 'lea ax,h00', 'lea ax,h01', and 'lea ax,h02', just to "touch" those values, but again, that defeats the whole purpose. I can't believe I'm the first/only one to run up against this problem. *ANY* ideas?? --- þ SLMR 2.0 #åñjw þ For a good time, call F0F0:F0F0. * Origin: FONiX Info Systems * Berkshire UK * www.fonix.org (2:252/171) .