I have two pieces of code in two separate source files using WASM, assuming at least MASM 3.0 (or so) compatibility. I think the code speaks for itself what I'm trying to do (just for amusement for now, really):
First source file bios_start.asm:
Second source file org_jmp.asm:
Based on a book I have based on MASM 5.0 or so (and this should be MASM 3.0 compatible- so the Watcom Assembler should work), the COMMON combine type should make all segments be overlaid on each other relative to a common address.
Of course, because NOTHING in MASM syntax EVER works as advertised (MASM's lack of consistent documentation and features not working as intuitively expected is the reason I believe 8088 is so difficult, not the assembly language itself), instead of the segments being overlaid on each other, the segments of code are laid out one after another in memory, so bios_start is at 0xe000 and org_jmp is at 0x1dff3... the second segment is relative to the first, when both should be relative to a single address (0xe000) and overwritten if necessary.
Interestingly enough, attempting the following:
Causes WASM to not trigger an error, but also generate no source file at all... it would be nice to simply have the org directive update all labels' offsets without generating 0xe000 bytes of zero-fill.
I'm really not sure what I'm doing wrong... all I want is my first source file to be placed at offset 0xe000 and the second to be place at 0xfff0 in a single source file. If it's possible, I also want all labels to have an offset of 0xe000 added to it to reduce the file size to 8192 bytes.
The order of files into the linker, if it matters, is the same as how I labelled the source files. My linker options correctly generate a raw binary output:
First source file bios_start.asm:
Code:
public bios_org
biosseg segment byte common 'bios_start'
org 0xe000
bios_org:
inc ax
inc ax ;Dummy instructions
inc ax
biosseg ends
end
Second source file org_jmp.asm:
Code:
extrn bios_org:near
biosseg segment byte common 'org_jmp'
org 0xfff0
DB 0EAH ; HARD CODE JUMP
DW bios_org ; OFFSET
DW 0F000H ; SEGMENT
db '07/21/13'
db 0x0ff
db 0x00
db 0x00 ;Checksum
biosseg ends
end
Based on a book I have based on MASM 5.0 or so (and this should be MASM 3.0 compatible- so the Watcom Assembler should work), the COMMON combine type should make all segments be overlaid on each other relative to a common address.
Of course, because NOTHING in MASM syntax EVER works as advertised (MASM's lack of consistent documentation and features not working as intuitively expected is the reason I believe 8088 is so difficult, not the assembly language itself), instead of the segments being overlaid on each other, the segments of code are laid out one after another in memory, so bios_start is at 0xe000 and org_jmp is at 0x1dff3... the second segment is relative to the first, when both should be relative to a single address (0xe000) and overwritten if necessary.
Interestingly enough, attempting the following:
Code:
org 0xe000
public bios_org
biosseg segment byte common 'bios_start'
bios_org:
inc ax
inc ax
inc ax
biosseg ends
end
Causes WASM to not trigger an error, but also generate no source file at all... it would be nice to simply have the org directive update all labels' offsets without generating 0xe000 bytes of zero-fill.
I'm really not sure what I'm doing wrong... all I want is my first source file to be placed at offset 0xe000 and the second to be place at 0xfff0 in a single source file. If it's possible, I also want all labels to have an offset of 0xe000 added to it to reduce the file size to 8192 bytes.
The order of files into the linker, if it matters, is the same as how I labelled the source files. My linker options correctly generate a raw binary output:
Code:
wlink FILE {bios_start.obj org_jmp.obj} FORMAT RAW BIN NAME bios.bin OPTION NODEFAULTLIBS, START=bios_org, MAP=bios, STACK=0